Mon, 27 Mar 2023 18:41:59 +0200
2 files changed,
18 insertions(+),
1 deletions(-)
M
src/kernel/graphics.s
→
src/kernel/graphics.s
@@ -1,4 +1,5 @@
.section .text.realmode +.global realmode_int10h realmode_int10h: push %ebp mov %esp, %ebp@@ -9,6 +10,9 @@ push %ds
push %es push %fs push %ss + + mov %cr3, %eax + push %eax mov %esp, %eax mov %eax, %esi@@ -24,9 +28,13 @@
push %esi push %edi + # disable paging + xor %eax, %eax + mov %eax, %cr3 + # switch to realmode temporarily mov %cr0, %eax - and $0xFFFFFFFE, %eax + and $0x3FFFFFFC, %eax mov %eax, %cr0 # perform long jump to set code segment@@ -45,6 +53,9 @@ pop %eax
mov %eax, %esp # restore original segments and registers + pop %eax + mov %eax, %cr3 + pop %ss pop %fs pop %es
M
src/kernel/main.c
→
src/kernel/main.c
@@ -26,6 +26,8 @@ #else
#define PRINT_DBG(...) {} #endif +extern void realmode_int10h(uint32_t mode); + int os_init(void) { core_init(); printk("Core functions initialized.\n");@@ -65,6 +67,10 @@
printk("Initializing root file system..."); FAT_init(); printk("done."); + + printk("Testing realmode graphics switch..."); + realmode_int10h(0x0D); + printk("done.\n");*/ printk("Initialization finished.\n--------------\n");