chore: start work on new 'mm'
This commit is contained in:
parent
75aac14a44
commit
1cd839c63a
21 changed files with 435 additions and 31 deletions
2
Makefile
2
Makefile
|
@ -1,5 +1,7 @@
|
||||||
.EXPORT_ALL_VARIABLES:
|
.EXPORT_ALL_VARIABLES:
|
||||||
|
|
||||||
|
MAKEFLAGS += --no-print-directory
|
||||||
|
|
||||||
TOPDIR := $(dir $(realpath $(lastword $(MAKEFILE_LIST))))
|
TOPDIR := $(dir $(realpath $(lastword $(MAKEFILE_LIST))))
|
||||||
SYSROOTDIR := $(TOPDIR)/sysroot
|
SYSROOTDIR := $(TOPDIR)/sysroot
|
||||||
TOOLSDIR := $(TOPDIR)/tools
|
TOOLSDIR := $(TOPDIR)/tools
|
||||||
|
|
|
@ -12,7 +12,7 @@ Section: Legacy
|
||||||
> +------------+ +-------------+ +--------------+
|
> +------------+ +-------------+ +--------------+
|
||||||
>
|
>
|
||||||
|
|
||||||
About: Memory Map
|
About: Real Mode Memory Map
|
||||||
|
|
||||||
>
|
>
|
||||||
> 0x100000 +-----------------------+
|
> 0x100000 +-----------------------+
|
||||||
|
|
|
@ -214,6 +214,9 @@ szMsgErrorNotFound db "ERROR: kernel not found", 0
|
||||||
; =========================================================================
|
; =========================================================================
|
||||||
; protected mode code
|
; protected mode code
|
||||||
; =========================================================================
|
; =========================================================================
|
||||||
|
|
||||||
|
;; subroutine: multiboot
|
||||||
|
;; This subroutine handle multiboot structures and convert them to <BootInfo>
|
||||||
multiboot:
|
multiboot:
|
||||||
; https://www.gnu.org/software/grub/manual/multiboot/multiboot.html#Machine-state
|
; https://www.gnu.org/software/grub/manual/multiboot/multiboot.html#Machine-state
|
||||||
|
|
||||||
|
@ -223,7 +226,8 @@ multiboot:
|
||||||
|
|
||||||
; get kernel from module
|
; get kernel from module
|
||||||
|
|
||||||
|
;; subroutine: common32
|
||||||
|
;; This subroutine move kernel to 0x100000 and setup temporary pagging then jump to kernel code.
|
||||||
common32:
|
common32:
|
||||||
mov [0xB8000], dword 0x07690748
|
mov [0xB8000], dword 0x07690748
|
||||||
|
|
||||||
|
@ -242,15 +246,31 @@ common32:
|
||||||
or edx, (PTE_P or PTE_W)
|
or edx, (PTE_P or PTE_W)
|
||||||
mov [edi], edx
|
mov [edi], edx
|
||||||
add edi, 4
|
add edi, 4
|
||||||
add esi, 4096
|
add esi, PAGE_SIZE
|
||||||
inc ecx
|
inc ecx
|
||||||
cmp ecx, 1024
|
cmp ecx, 1024
|
||||||
jb @b
|
jb @b
|
||||||
|
|
||||||
|
; map 4mb right after kernel (for now we assume there is enough memory)
|
||||||
|
mov edi, boot_kernel_paging_table
|
||||||
|
xor ecx, ecx
|
||||||
|
@@:
|
||||||
|
mov edx, esi
|
||||||
|
or edx, (PTE_P or PTE_W)
|
||||||
|
mov [edi], edx
|
||||||
|
add edi, 4
|
||||||
|
add esi, PAGE_SIZE
|
||||||
|
inc ecx
|
||||||
|
cmp ecx, 1024
|
||||||
|
jb @b
|
||||||
|
|
||||||
|
; add entries to page directory
|
||||||
mov dword [boot_page_directory], boot_0_page_table + (PDE_P or PDE_W) ; present and writable
|
mov dword [boot_page_directory], boot_0_page_table + (PDE_P or PDE_W) ; present and writable
|
||||||
|
|
||||||
mov dword [boot_page_directory + (768 * 4)], boot_0_page_table + (PDE_P or PDE_W)
|
mov dword [boot_page_directory + (768 * 4)], boot_0_page_table + (PDE_P or PDE_W)
|
||||||
|
|
||||||
|
mov dword [boot_page_directory + (769 * 4)], boot_kernel_paging_table + (PDE_P or PDE_W)
|
||||||
|
|
||||||
mov eax, boot_page_directory
|
mov eax, boot_page_directory
|
||||||
mov cr3, eax
|
mov cr3, eax
|
||||||
|
|
||||||
|
@ -278,7 +298,12 @@ inode_cache rb sizeof.Inode
|
||||||
boot_page_directory:
|
boot_page_directory:
|
||||||
rb 4096
|
rb 4096
|
||||||
|
|
||||||
|
; we asume kernel is less than 4mb
|
||||||
boot_0_page_table:
|
boot_0_page_table:
|
||||||
rb 4096
|
rb 4096
|
||||||
|
|
||||||
|
; We map 4mb after kernel for future kernel page table/directory
|
||||||
|
boot_kernel_paging_table:
|
||||||
|
rb 4096
|
||||||
|
|
||||||
_end:
|
_end:
|
||||||
|
|
90
docs/config/Comments.txt
Normal file
90
docs/config/Comments.txt
Normal file
|
@ -0,0 +1,90 @@
|
||||||
|
Format: 2.3
|
||||||
|
|
||||||
|
# This is the Natural Docs comments file for this project. If you change
|
||||||
|
# anything here, it will apply to THIS PROJECT ONLY. You can edit the version
|
||||||
|
# in Natural Docs' Config folder to make the changes apply to all projects,
|
||||||
|
# but it's recommended that you edit this version instead.
|
||||||
|
|
||||||
|
|
||||||
|
# Ignored Keywords
|
||||||
|
# ------------------------------------------------------------------------
|
||||||
|
|
||||||
|
# If you'd like to prevent keywords from being recognized by Natural Docs,
|
||||||
|
# you can do it like this:
|
||||||
|
#
|
||||||
|
# Ignore Keywords:
|
||||||
|
# [keyword]
|
||||||
|
# [keyword]
|
||||||
|
# ...
|
||||||
|
|
||||||
|
|
||||||
|
# Comment Types
|
||||||
|
# ------------------------------------------------------------------------
|
||||||
|
# The syntax reference is after the definitions.
|
||||||
|
|
||||||
|
Alter Comment Type: Macro
|
||||||
|
|
||||||
|
Keywords:
|
||||||
|
equ
|
||||||
|
|
||||||
|
|
||||||
|
# Each Natural Docs comment has a corresponding type which determine its
|
||||||
|
# behavior. You can define your own here or override the settings of the
|
||||||
|
# existing ones.
|
||||||
|
#
|
||||||
|
# Comment Type: [name]
|
||||||
|
# Alter Comment Type: [name]
|
||||||
|
# Creates a new comment type or changes an existing one.
|
||||||
|
#
|
||||||
|
# Display Name: [name]
|
||||||
|
# Plural Display Name: [name]
|
||||||
|
# The singular and plural name of the comment type as it should appear in
|
||||||
|
# the output.
|
||||||
|
#
|
||||||
|
# Simple Identifier: [name]
|
||||||
|
# The name of the comment type using only the letters A to Z. No spaces,
|
||||||
|
# numbers, symbols, or Unicode allowed. Defaults to the comment type name
|
||||||
|
# minus any unacceptable characters. This is used to generate things like
|
||||||
|
# CSS class names.
|
||||||
|
#
|
||||||
|
# Scope: [normal|start|end|always global]
|
||||||
|
# How the comment affects scope. Defaults to normal.
|
||||||
|
# normal - The comment stays within the current scope.
|
||||||
|
# start - The comment starts a new scope for all the comments
|
||||||
|
# beneath it, like class comments.
|
||||||
|
# end - The comment resets the scope back to global for all the
|
||||||
|
# comments beneath it, like section comments.
|
||||||
|
# always global - The comment is defined as a global symbol, but does not
|
||||||
|
# change the scope for any other comments.
|
||||||
|
#
|
||||||
|
# Flags: [flag], [flag], ...
|
||||||
|
# A combination of settings that apply to the comment type.
|
||||||
|
# Code, File, or Documentation
|
||||||
|
# Whether it's used to describe a code element, a file, or is a
|
||||||
|
# standalone documentation comment. Defaults to Code.
|
||||||
|
# Variable Type
|
||||||
|
# Whether it describes a code element that can be used as a variable's
|
||||||
|
# type.
|
||||||
|
# Class Hierarchy or Database Hierarchy
|
||||||
|
# Whether it describes a code element that should be included in the
|
||||||
|
# class or database hierarchy. Requires Scope: Start.
|
||||||
|
# Enum
|
||||||
|
# Whether it describes an enum.
|
||||||
|
#
|
||||||
|
# Keywords:
|
||||||
|
# [keyword]
|
||||||
|
# [keyword], [plural keyword]
|
||||||
|
# ...
|
||||||
|
# A list of the comment type's keywords. Each line after the heading is
|
||||||
|
# the keyword and optionally its plural form for list comments. You can
|
||||||
|
# reuse existing keywords to change their definition. When using
|
||||||
|
# "Alter Comment Type", these keywords are added to the existing ones
|
||||||
|
# rather than replacing them.
|
||||||
|
#
|
||||||
|
# [Language] Keywords:
|
||||||
|
# [keyword]
|
||||||
|
# [keyword], [plural keyword]
|
||||||
|
# ...
|
||||||
|
# A list of keywords that only apply to the comment type when using a
|
||||||
|
# specific programming language. Each line after the heading is the
|
||||||
|
# keyword and optionally its plural form for list comments.
|
|
@ -20,7 +20,7 @@ Timestamp: Updated yyyy/mm/dd
|
||||||
# These are indexes you deleted, so Natural Docs will not add them again
|
# These are indexes you deleted, so Natural Docs will not add them again
|
||||||
# unless you remove them from this line.
|
# unless you remove them from this line.
|
||||||
|
|
||||||
Don't Index: Variables, Macros, Classes
|
Don't Index: Macros, Classes, Variables
|
||||||
|
|
||||||
|
|
||||||
# --------------------------------------------------------------------------
|
# --------------------------------------------------------------------------
|
||||||
|
@ -139,8 +139,11 @@ Group: Kernel {
|
||||||
|
|
||||||
Group: Memory Manager {
|
Group: Memory Manager {
|
||||||
|
|
||||||
File: mm.inc (kernel/mm/mm.inc)
|
File: bootstrap.inc (kernel/mm/bootstrap.inc)
|
||||||
File: pmm.inc (kernel/mm/pmm.inc)
|
File: Introduction (kernel/mm/intro.txt)
|
||||||
|
File: mm.inc (kernel/mm/mm.old.inc)
|
||||||
|
File: pmm.inc (kernel/mm/pmm.old.inc)
|
||||||
|
File: PMMFreeRange (kernel/mm/pmm.new.inc)
|
||||||
} # Group: Memory Manager
|
} # Group: Memory Manager
|
||||||
|
|
||||||
File: lock.inc (kernel/lock.inc)
|
File: lock.inc (kernel/lock.inc)
|
||||||
|
|
215
docs/config/Project.txt
Normal file
215
docs/config/Project.txt
Normal file
|
@ -0,0 +1,215 @@
|
||||||
|
Format: 2.3
|
||||||
|
|
||||||
|
# This is the main file you use to configure Natural Docs for your project.
|
||||||
|
|
||||||
|
|
||||||
|
# Project Information
|
||||||
|
# ------------------------------------------------------------------------
|
||||||
|
|
||||||
|
Title: StupidOS
|
||||||
|
Subtitle: 32-bit Operating System written in x86 assembly.
|
||||||
|
|
||||||
|
Copyright: Copyright © 2024 d0p1
|
||||||
|
|
||||||
|
Timestamp: Updated yyyy/mm/dd
|
||||||
|
# m - Single digit month, when possible. January is "1".
|
||||||
|
# mm - Always double digit month. January is "01".
|
||||||
|
# mon - Short month word. January is "Jan".
|
||||||
|
# month - Long month word. January is "January".
|
||||||
|
# d - Single digit day, when possible. 1 is "1".
|
||||||
|
# dd - Always double digit day. 1 is "01".
|
||||||
|
# day - Day with text extension. 1 is "1st".
|
||||||
|
# yy - Double digit year. 2022 is "22".
|
||||||
|
# yyyy - Four digit year. 2022 is "2022".
|
||||||
|
# year - Four digit year. 2022 is "2022".
|
||||||
|
|
||||||
|
|
||||||
|
# This is where you put general information about your project. None of these
|
||||||
|
# settings are required, though Title is recommended.
|
||||||
|
#
|
||||||
|
# Title: [text]
|
||||||
|
# The name of your project. (R) and (TM) will be converted to their
|
||||||
|
# respective symbols.
|
||||||
|
#
|
||||||
|
# Subtitle: [text]
|
||||||
|
# A subtitle for your project, if desired.
|
||||||
|
#
|
||||||
|
# Copyright: [text]
|
||||||
|
# The copyright notice for your project. (C) will be converted to the
|
||||||
|
# copyright symbol.
|
||||||
|
#
|
||||||
|
# Timestamp: [text]
|
||||||
|
# Text explaining when the documentation was generated, such as "Last
|
||||||
|
# Updated Month Day Year", if you want that to be included. The following
|
||||||
|
# substitutions are performed:
|
||||||
|
#
|
||||||
|
# m - Single digit month, when possible. January is "1".
|
||||||
|
# mm - Always double digit month. January is "01".
|
||||||
|
# mon - Short month word. January is "Jan".
|
||||||
|
# month - Long month word. January is "January".
|
||||||
|
# d - Single digit day, when possible. 1 is "1".
|
||||||
|
# dd - Always double digit day. 1 is "01".
|
||||||
|
# day - Day with text extension. 1 is "1st".
|
||||||
|
# yy - Double digit year. 2022 is "22".
|
||||||
|
# yyyy - Four digit year. 2022 is "2022".
|
||||||
|
# year - Four digit year. 2022 is "2022".
|
||||||
|
#
|
||||||
|
# Style: [style]
|
||||||
|
# A custom style to apply to the generated documentation. See
|
||||||
|
# https://naturaldocs.org/reference/styles for more information.
|
||||||
|
#
|
||||||
|
# Home Page: [file]
|
||||||
|
# A custom home page for the generated documentation. It could be a
|
||||||
|
# documented file in one of the source folders or a HTML file in any
|
||||||
|
# location.
|
||||||
|
#
|
||||||
|
# Encoding: [name or code page number]
|
||||||
|
# Encoding: [name or code page number] *.[extension]
|
||||||
|
# The character encoding source files use if it is something other than
|
||||||
|
# Unicode. It can be specified as a name such as "iso-8859-1" or a code
|
||||||
|
# page number such as "28591". You can see the list of encodings your
|
||||||
|
# system supports by running Natural Docs with the --list-encodings command
|
||||||
|
# line option.
|
||||||
|
#
|
||||||
|
# Natural Docs defaults to Unicode which will handle all forms of UTF-8,
|
||||||
|
# UTF-16, and UTF-32. You can set a new default for all files or you can
|
||||||
|
# limit it to an extension such as "*.txt". You can use multiple Encoding
|
||||||
|
# lines to cover all the extensions that need them.
|
||||||
|
#
|
||||||
|
# You can also set encodings for specific folders by adding Encoding lines
|
||||||
|
# in Source Folder sections.
|
||||||
|
|
||||||
|
|
||||||
|
# Source Code
|
||||||
|
# ------------------------------------------------------------------------
|
||||||
|
|
||||||
|
Source Folder: ..\..
|
||||||
|
Name: StupidOS
|
||||||
|
|
||||||
|
|
||||||
|
# This is where you tell Natural Docs which folders it should scan for source
|
||||||
|
# files. If you add any on the command line this section is ignored except
|
||||||
|
# for the properties of the ones from the command line.
|
||||||
|
#
|
||||||
|
# Source Folder: [folder]
|
||||||
|
# Specifies a folder which will be searched for source files. The path is
|
||||||
|
# relative to the project configuration folder, which lets this file remain
|
||||||
|
# portable across computers and not cause problems in version control
|
||||||
|
# systems. You can enter an absolute path and it will be converted
|
||||||
|
# automatically.
|
||||||
|
#
|
||||||
|
# Additional properties can be added after each source folder:
|
||||||
|
#
|
||||||
|
# Name: [name]
|
||||||
|
# How this source folder will appear in the menu if you have more than
|
||||||
|
# one.
|
||||||
|
#
|
||||||
|
# Encoding: [name or code page number]
|
||||||
|
# Encoding: [name or code page number] *.[extension]
|
||||||
|
# Encoding: [name or code page number] [folder]
|
||||||
|
# Encoding: [name or code page number] [folder]\*.[extension]
|
||||||
|
# The character encoding source files use if it's something other than
|
||||||
|
# Unicode. It can be specified as a name such as "iso-8859-1" or a code
|
||||||
|
# page number such as "28591". You can see the list of encodings your
|
||||||
|
# system supports by running Natural Docs with the --list-encodings
|
||||||
|
# command line option.
|
||||||
|
#
|
||||||
|
# Natural Docs defaults to Unicode which will handle all forms of UTF-8,
|
||||||
|
# UTF-16, and UTF-32. You can set a new default for all files in this
|
||||||
|
# folder, limit it to an extension such as "*.txt", limit it to a
|
||||||
|
# subfolder, or limit it to extensions in a subfolder. You can use
|
||||||
|
# multiple Encoding lines to cover all the subfolders and extensions
|
||||||
|
# that need them.
|
||||||
|
|
||||||
|
|
||||||
|
# Source Filtering
|
||||||
|
# ------------------------------------------------------------------------
|
||||||
|
|
||||||
|
Ignore Source Folder: ..\..\sysroot
|
||||||
|
|
||||||
|
|
||||||
|
# If there are any subfolders in the source code that you would like Natural
|
||||||
|
# Docs to ignore they can be added here. If you use any of these options on
|
||||||
|
# the command line this section is ignored.
|
||||||
|
#
|
||||||
|
# Ignore Source Folder: [folder]
|
||||||
|
# Tells Natural Docs to skip this folder when scanning files.
|
||||||
|
#
|
||||||
|
# Ignore Source Folder Pattern: [pattern]
|
||||||
|
# Tells Natural Docs to skip all folder names which match this pattern when
|
||||||
|
# scanning files. ? matches a single character, * matches zero or more
|
||||||
|
# characters. It applies to the entire folder name, so "cli" will not
|
||||||
|
# match "client", although "cli*" will.
|
||||||
|
#
|
||||||
|
# The data folders of common version control systems (.git, .svn, .cvs, .hg)
|
||||||
|
# are ignored automatically. You don't have to add them here.
|
||||||
|
|
||||||
|
|
||||||
|
# Images
|
||||||
|
# ------------------------------------------------------------------------
|
||||||
|
|
||||||
|
Image Folder: ..\img
|
||||||
|
|
||||||
|
|
||||||
|
# This is where you tell Natural Docs which folders it should look for images
|
||||||
|
# in. When you put something like (see diagram.jpg) in a comment Natural Docs
|
||||||
|
# will look for it relative to the source file it appears in plus any folders
|
||||||
|
# added here. If you add any on the command line this section is ignored.
|
||||||
|
#
|
||||||
|
# Image Folder: [folder]
|
||||||
|
# Specifies a folder which will be searched for image files. The path is
|
||||||
|
# relative to the project configuration folder, which lets this file remain
|
||||||
|
# portable across computers and not cause problems in version control
|
||||||
|
# systems. You can enter absolute paths and they will be converted
|
||||||
|
# automatically.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Generated Documentation
|
||||||
|
# ------------------------------------------------------------------------
|
||||||
|
|
||||||
|
HTML Output Folder: ..\html
|
||||||
|
|
||||||
|
|
||||||
|
# This is where you tell Natural Docs what kind of documentation you want
|
||||||
|
# built and where it should be put. If you use any of these options on the
|
||||||
|
# command line this section is ignored except for the properties of the ones
|
||||||
|
# from the command line.
|
||||||
|
#
|
||||||
|
# HTML Output Folder: [folder]
|
||||||
|
# Generates HTML documentation in the specified folder. The path is
|
||||||
|
# relative to the project configuration folder, which lets this file remain
|
||||||
|
# portable across computers and not cause problems in version control
|
||||||
|
# systems. You can enter an absolute path and it will be converted
|
||||||
|
# automatically.
|
||||||
|
#
|
||||||
|
# Additional properties can be added after each output folder:
|
||||||
|
#
|
||||||
|
# Title: [text]
|
||||||
|
# Subtitle: [text]
|
||||||
|
# Copyright: [text]
|
||||||
|
# Timestamp: [text]
|
||||||
|
# Style: [style]
|
||||||
|
# Home Page: [file]
|
||||||
|
# These properties can be overridden for just this output folder, which
|
||||||
|
# allows you to have multiple output folders with different styles or
|
||||||
|
# titles. See the Project Information section for descriptions of them.
|
||||||
|
|
||||||
|
|
||||||
|
# Global Settings
|
||||||
|
# ------------------------------------------------------------------------
|
||||||
|
|
||||||
|
# Other settings that apply to your entire project. Settings specified on the
|
||||||
|
# command line override the settings here.
|
||||||
|
#
|
||||||
|
# Tab Width: [width]
|
||||||
|
# The number of spaces tabs should be expanded to.
|
||||||
|
#
|
||||||
|
# Documented Only: [yes|no]
|
||||||
|
# Whether only documented code elements should appear in the output.
|
||||||
|
# Defaults to no.
|
||||||
|
#
|
||||||
|
# Auto Group: [yes|no]
|
||||||
|
# Whether groups should automatically apply to you code. Defaults to yes.
|
||||||
|
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 307 KiB After Width: | Height: | Size: 135 KiB |
Binary file not shown.
Before Width: | Height: | Size: 4.3 KiB After Width: | Height: | Size: 4.2 KiB |
Binary file not shown.
Before Width: | Height: | Size: 29 KiB After Width: | Height: | Size: 28 KiB |
|
@ -15,8 +15,8 @@ KERNEL = vmstupid.sys
|
||||||
SRCS = kernel.asm \
|
SRCS = kernel.asm \
|
||||||
const.inc \
|
const.inc \
|
||||||
klog.inc \
|
klog.inc \
|
||||||
mm/mm.inc \
|
mm/mm.old.inc \
|
||||||
mm/pmm.inc \
|
mm/pmm.old.inc \
|
||||||
lock.inc \
|
lock.inc \
|
||||||
gdt.inc \
|
gdt.inc \
|
||||||
isr.inc \
|
isr.inc \
|
||||||
|
|
|
@ -117,7 +117,7 @@ kmain:
|
||||||
include 'klog.inc'
|
include 'klog.inc'
|
||||||
include 'dev/console.inc'
|
include 'dev/console.inc'
|
||||||
include 'dev/dev.inc'
|
include 'dev/dev.inc'
|
||||||
include 'mm/mm.inc'
|
include 'mm/mm.old.inc'
|
||||||
include 'lock.inc'
|
include 'lock.inc'
|
||||||
include 'gdt.inc'
|
include 'gdt.inc'
|
||||||
include 'syscall.inc'
|
include 'syscall.inc'
|
||||||
|
|
7
kernel/mm/bootstrap.inc
Normal file
7
kernel/mm/bootstrap.inc
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
;; File: bootstrap.inc
|
||||||
|
;; Bootstrap whole PMM and MM
|
||||||
|
|
||||||
|
;; Function: mm_bootstrap
|
||||||
|
;; Setup recursive page dir at 0xFFFFF000 and temporary identity map first 3GB
|
||||||
|
mm_bootstrap:
|
||||||
|
ret
|
2
kernel/mm/intro.txt
Normal file
2
kernel/mm/intro.txt
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
File: Introduction
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
;; > 0x00000000 +---------------+
|
;; > 0x00000000 +---------------+
|
||||||
;;
|
;;
|
||||||
|
|
||||||
include "pmm.inc"
|
include "pmm.old.inc"
|
||||||
include "../sys/mmu.inc"
|
include "../sys/mmu.inc"
|
||||||
|
|
||||||
;; Macro: KV2P
|
;; Macro: KV2P
|
7
kernel/mm/pmm.new.inc
Normal file
7
kernel/mm/pmm.new.inc
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
;; Struc: PMMFreeRange
|
||||||
|
struc PMMFreeRange {
|
||||||
|
.size dd ?
|
||||||
|
.next dd ?
|
||||||
|
}
|
||||||
|
|
||||||
|
pPMMFreeListHead dd 0
|
|
@ -68,3 +68,6 @@ PTE_A = 0x020
|
||||||
PTE_D = 0x040
|
PTE_D = 0x040
|
||||||
PTE_PAT = 0x080
|
PTE_PAT = 0x080
|
||||||
PTE_G = 0x100
|
PTE_G = 0x100
|
||||||
|
|
||||||
|
;; PAGE_SIZE: Page size (4Kib)
|
||||||
|
PAGE_SIZE = 4096
|
||||||
|
|
|
@ -4,16 +4,26 @@
|
||||||
;; - <https://www.cs.fsu.edu/~awang/courses/cop5611_s2024/vnode.pdf>
|
;; - <https://www.cs.fsu.edu/~awang/courses/cop5611_s2024/vnode.pdf>
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
;; Struc: VFS
|
||||||
|
;;
|
||||||
|
;; .name - Filesystem name
|
||||||
|
;; .next - pointer to next VFS
|
||||||
|
;; .ops - pointer to VFS function
|
||||||
struc VFS {
|
struc VFS {
|
||||||
.name dd ?
|
.name dd ?
|
||||||
.next dd ?
|
.next dd ?
|
||||||
.op dd ?
|
.ops_ptr dd ?
|
||||||
}
|
}
|
||||||
DEFN VFS
|
DEFN VFS
|
||||||
|
|
||||||
|
;; Struc: Mount
|
||||||
|
;;
|
||||||
|
;; .next - address of next mount
|
||||||
|
;; .ops_ptr - address of mount ops
|
||||||
|
;; .vnodes -
|
||||||
struc Mount {
|
struc Mount {
|
||||||
.next dd ?
|
.next dd ?
|
||||||
.op dd ?
|
.ops_ptr dd ?
|
||||||
.vnodes dd ?
|
.vnodes dd ?
|
||||||
.flag dd ?
|
.flag dd ?
|
||||||
.bsize dd ?
|
.bsize dd ?
|
||||||
|
@ -30,6 +40,9 @@ struc VFSOps {
|
||||||
.vget dd ?
|
.vget dd ?
|
||||||
}
|
}
|
||||||
|
|
||||||
|
macro VNODE_TYPE name,value {
|
||||||
|
VNODE_TYPE_#name equ value
|
||||||
|
}
|
||||||
;; Constants: vnode types
|
;; Constants: vnode types
|
||||||
;;
|
;;
|
||||||
;; VNODE_TYPE_NON - XXX
|
;; VNODE_TYPE_NON - XXX
|
||||||
|
@ -40,14 +53,14 @@ struc VFSOps {
|
||||||
;; VNODE_TYPE_LNK - XXX
|
;; VNODE_TYPE_LNK - XXX
|
||||||
;; VNODE_TYPE_SOCK - XXX
|
;; VNODE_TYPE_SOCK - XXX
|
||||||
;; VNODE_TYPE_BAD - XXX
|
;; VNODE_TYPE_BAD - XXX
|
||||||
VNODE_TYPE_NON = 0x0
|
VNODE_TYPE NON, 0x0
|
||||||
VNODE_TYPE_REG = 0x1
|
VNODE_TYPE REG, 0x1
|
||||||
VNODE_TYPE_DIR = 0x2
|
VNODE_TYPE DIR, 0x2
|
||||||
VNODE_TYPE_BLK = 0x3
|
VNODE_TYPE BLK, 0x3
|
||||||
VNODE_TYPE_CHR = 0x4
|
VNODE_TYPE CHR, 0x4
|
||||||
VNODE_TYPE_LNK = 0x5
|
VNODE_TYPE LNK, 0x5
|
||||||
VNODE_TYPE_SOCK = 0x6
|
VNODE_TYPE SOCK, 0x6
|
||||||
VNODE_TYPE_BAD = 0x7
|
VNODE_TYPE BAD, 0x7
|
||||||
|
|
||||||
;; Struc: VNode
|
;; Struc: VNode
|
||||||
struc VNode {
|
struc VNode {
|
||||||
|
|
32
releasetools/efiimage.sh
Normal file
32
releasetools/efiimage.sh
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
: "${IMG=stupidos_efi.img}"
|
||||||
|
: "${EFI_PART_SIZE=1000000}" # 1Mb
|
||||||
|
|
||||||
|
if [ ! -f Makefile ]
|
||||||
|
then
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
. ./releasetools/image.defaults
|
||||||
|
. ./releasetools/image.functions
|
||||||
|
|
||||||
|
DESTDIR=${BUILDDIR}/hd
|
||||||
|
export DESTDIR
|
||||||
|
|
||||||
|
if [ -f "${IMG}" ]
|
||||||
|
then
|
||||||
|
rm -f "${IMG}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
mkdir -p "${BUILDDIR}" "${OBJ}"
|
||||||
|
|
||||||
|
mkdir -p "${DESTDIR}/boot"
|
||||||
|
|
||||||
|
create_stpdboot_ini "${DESTDIR}/boot"
|
||||||
|
|
||||||
|
make
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "Disk image at $(pwd)/${IMG}"
|
|
@ -1,7 +1,7 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
: "${IMG=disk.img}"
|
: "${IMG=stupidos_hd.img}"
|
||||||
|
|
||||||
if [ ! -f Makefile ]
|
if [ ! -f Makefile ]
|
||||||
then
|
then
|
||||||
|
|
|
@ -35,6 +35,7 @@ get_grub()
|
||||||
|
|
||||||
create_efi_image()
|
create_efi_image()
|
||||||
{
|
{
|
||||||
|
|
||||||
echo
|
echo
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,9 +47,13 @@ create_stpdboot_ini()
|
||||||
stupid_ini="$(cat <<EOF
|
stupid_ini="$(cat <<EOF
|
||||||
CMDLINE=consdev=com0
|
CMDLINE=consdev=com0
|
||||||
MODULE=dummy.mod
|
MODULE=dummy.mod
|
||||||
MODULE=dummy2.mod
|
|
||||||
EOF
|
EOF
|
||||||
)"
|
)"
|
||||||
|
|
||||||
echo "$stupid_ini" > "${target}/stupid.ini"
|
echo "$stupid_ini" > "${target}/stupid.ini"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
create_hd_image()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue