File tree Expand file tree Collapse file tree 4 files changed +11
-12
lines changed
Expand file tree Collapse file tree 4 files changed +11
-12
lines changed Original file line number Diff line number Diff line change 44// and kernel's pid is 0.
55#define PID_KERNEL 0
66
7- #define MEMORY_KERNEL_LOCATION 0x10000
8- #define MEMORY_KERNEL_SIZE 0x0FFFF
7+ #define MEMORY_APPBASE_LOCATION 0x10000
8+ #define MEMORY_APP_SIZE 0x20000
99
10- #define MEMORY_APPBASE_LOCATION 0x20000
11- #define MEMORY_APP_SIZE 0x0FFFF
12-
13- // pid starts from 1
14- #define memmgr_app_abs_location (pid ) ((pid)!=0?(MEMORY_APPBASE_LOCATION+((pid)-1)*MEMORY_APP_SIZE):MEMORY_KERNEL_LOCATION)
10+ #define memmgr_app_abs_location (pid ) (MEMORY_APPBASE_LOCATION + (pid)*MEMORY_APP_SIZE)
1511#define memmgr_app_size (pid ) (MEMORY_APP_SIZE)
12+
13+ #define MEMORY_KERNEL_LOCATION memmgr_app_abs_location(PID_KERNEL)
14+ #define MEMORY_KERNEL_SIZE memmgr_app_size(PID_KERNEL)
Original file line number Diff line number Diff line change @@ -121,13 +121,13 @@ int process_create() {
121121 // Application Code Segment Selector
122122 populate_gdt_entry (
123123 & gdt_table [idt_cs_entry ],
124- memory_location , memory_location + 0xFFFF ,
124+ memory_location , memory_location + memory_size - 1 ,
125125 0b0100 , // 32-bit protected mode
126126 0x9a );
127127 // Application Data Segment Selector
128128 populate_gdt_entry (
129129 & gdt_table [idt_ds_entry ],
130- memory_location , memory_location + 0xFFFF ,
130+ memory_location , memory_location + memory_size - 1 ,
131131 0b0100 , // 32-bit protected mode
132132 0x92 );
133133 create_infant_process_irq0_stack (process -> ss );
Original file line number Diff line number Diff line change @@ -38,13 +38,13 @@ void populate_gdt_table(
3838 // Kernel Code Segment Selector
3939 populate_gdt_entry (
4040 & gdt_table [1 ],
41- MEMORY_KERNEL_LOCATION , MEMORY_KERNEL_LOCATION + MEMORY_KERNEL_SIZE ,
41+ MEMORY_KERNEL_LOCATION , MEMORY_KERNEL_LOCATION + MEMORY_KERNEL_SIZE - 1 ,
4242 0b0100 , // 32-bit protected mode
4343 0x9a );
4444 // Kernel Data Segment Selector
4545 populate_gdt_entry (
4646 & gdt_table [2 ],
47- MEMORY_KERNEL_LOCATION , MEMORY_KERNEL_LOCATION + MEMORY_KERNEL_SIZE ,
47+ MEMORY_KERNEL_LOCATION , MEMORY_KERNEL_LOCATION + MEMORY_KERNEL_SIZE - 1 ,
4848 0b0100 , // 32-bit protected mode
4949 0x92 );
5050 // Absolute Code Segment Selector
Original file line number Diff line number Diff line change 1212
1313test_screen_content $LINENO " Bootloader: Stage 2"
1414test_screen_content $LINENO " Static library loaded at 0x00007E00: ` build_8hexbyte real_mode/static_library` "
15- test_screen_content $LINENO " Kernel loaded at 0x0000C000 : ` build_8hexbyte kernel/core` "
15+ test_screen_content $LINENO " Kernel loaded at 0x[0-9A-Fa-f]\+ : ` build_8hexbyte kernel/core` "
1616test_screen_content $LINENO " Loading GDT Table and entering protected mode"
1717
1818wait ${QEMU_PID:? }
You can’t perform that action at this time.
0 commit comments