File tree Expand file tree Collapse file tree 3 files changed +17
-4
lines changed
Expand file tree Collapse file tree 3 files changed +17
-4
lines changed Original file line number Diff line number Diff line change 99// and kernel's pid is 0.
1010#define PID_KERNEL 0
1111
12+ /*
13+ * Bug:
14+ * Bootloader stage 2 is not able to load kernel if
15+ * memory address need 20 address lines (0x10000) in
16+ * our case.
17+ * It works as intended in QEMU but not in others.
18+ * Mitigation:
19+ * - Forcing MEMORY_KERNEL_LOCATION to be represented
20+ * by 16 address lines. For ex 0xF000.
21+ * Resolution:
22+ * - I'm not sure.
23+ */
1224#define MEMORY_APPBASE_LOCATION 0x10000
1325
14- #define memmgr_app_abs_location (pid ) (MEMORY_APPBASE_LOCATION + (pid)*MEMORY_APP_SIZE)
26+ #define memmgr_app_abs_location (pid ) ((pid==0)?0x0F000:( MEMORY_APPBASE_LOCATION + (pid)*MEMORY_APP_SIZE) )
1527#define memmgr_app_size (pid ) (MEMORY_APP_SIZE)
1628
17- #define MEMORY_KERNEL_LOCATION memmgr_app_abs_location(PID_KERNEL)
18- #define MEMORY_KERNEL_SIZE memmgr_app_size(PID_KERNEL)
29+ #define MEMORY_KERNEL_LOCATION ( memmgr_app_abs_location(PID_KERNEL) )
30+ #define MEMORY_KERNEL_SIZE ( memmgr_app_size(PID_KERNEL) )
Original file line number Diff line number Diff line change 1717 CLI
1818 MOV ax , 0x0000
1919 MOV es , ax ; es := 0
20+ mov sp , 0x7FF0
2021
2122 set_blinking 0
2223 clear_screen C_WHITE , C_BLACK
Original file line number Diff line number Diff line change @@ -83,10 +83,10 @@ void entry_stage() {
8383 set_color_fg (C_WHITE );
8484
8585 print_log ("" );
86+ enable_a20 ();
8687 load_static_library ();
8788 load_kernel ();
8889
89- enable_a20 ();
9090 populate_gdt_table (& gdtr , gdt_table , GDT_TABLE_SIZE , 0 );
9191
9292 // Enter_protected_mode never returns.
You can’t perform that action at this time.
0 commit comments