Эх сурвалжийг харах

bugfix: 解决在docker中以O1优化时导致page fault的问题

fslongjin 2 жил өмнө
parent
commit
fdd5d3cf66

+ 1 - 0
kernel/lib/libUI/textui-render.c

@@ -16,6 +16,7 @@
 
 
 extern struct scm_ui_framework_t textui_framework;
 extern struct scm_ui_framework_t textui_framework;
 
 
+extern unsigned char font_ascii[256][16]; //导出ascii字体的bitmap(8*16大小) ps:位于font.h中
 static void __textui_render_chromatic(uint16_t actual_line, uint16_t index, struct textui_char_chromatic_t *character);
 static void __textui_render_chromatic(uint16_t actual_line, uint16_t index, struct textui_char_chromatic_t *character);
 
 
 /**
 /**

+ 8 - 5
kernel/main.c

@@ -37,12 +37,10 @@
 
 
 #include <driver/interrupt/apic/apic_timer.h>
 #include <driver/interrupt/apic/apic_timer.h>
 
 
-unsigned int *FR_address = (unsigned int *)0xb8000; //帧缓存区的地址
 ul bsp_idt_size, bsp_gdt_size;
 ul bsp_idt_size, bsp_gdt_size;
 
 
-// struct Global_Memory_Descriptor memory_management_struct = {{0}, 0};
-void test_slab();
-
+#pragma GCC push_options
+#pragma GCC optimize("O0")
 struct gdtr gdtp;
 struct gdtr gdtp;
 struct idtr idtp;
 struct idtr idtp;
 void reload_gdt()
 void reload_gdt()
@@ -148,6 +146,7 @@ void system_initialize()
     // ps2_mouse_init();
     // ps2_mouse_init();
     // ata_init();
     // ata_init();
     pci_init();
     pci_init();
+    io_mfence();
     ahci_init();
     ahci_init();
 
 
     // test_slab();
     // test_slab();
@@ -174,6 +173,9 @@ void system_initialize()
     apic_timer_init();
     apic_timer_init();
     io_mfence();
     io_mfence();
 
 
+    // 这里不能删除,否则在O1会报错
+    // while (1)
+    //     pause();
 }
 }
 
 
 //操作系统内核从这里开始执行
 //操作系统内核从这里开始执行
@@ -202,7 +204,7 @@ void Start_Kernel(void)
     io_mfence();
     io_mfence();
 
 
     while (1)
     while (1)
-        hlt();
+        pause();
 }
 }
 
 
 void ignore_int()
 void ignore_int()
@@ -211,3 +213,4 @@ void ignore_int()
     while (1)
     while (1)
         ;
         ;
 }
 }
+#pragma GCC pop_options