From 432abe67d09811486b3db2ac58bb324437aa69b9 Mon Sep 17 00:00:00 2001 From: Andreas Baumann Date: Wed, 24 May 2017 11:23:53 +0200 Subject: managed to get it running on real hardware, there are issues with A20 method keyboard (hangs), serial console (qemu doesn't really emulate all aspect of a serial, a real serial blocks on waiting most likely) --- src/kernel.c | 10 +++++----- src/stage2_a20.asm | 20 ++++++++++++++++++-- 2 files changed, 23 insertions(+), 7 deletions(-) diff --git a/src/kernel.c b/src/kernel.c index fa9761a..c943087 100644 --- a/src/kernel.c +++ b/src/kernel.c @@ -10,8 +10,8 @@ void entry( void ) { - serial_t serial; - serial_init( &serial ); +// serial_t serial; +// serial_init( &serial ); vga_t vga; vga_init( &vga ); @@ -21,7 +21,7 @@ void entry( void ) console_t console; console_init( &console ); console_add_vga_output( &console, &vga ); - console_add_serial_output( &console, &serial ); +// console_add_serial_output( &console, &serial ); // initialize the early console of the kernel stdio_set_console( &console ); @@ -45,7 +45,7 @@ void entry( void ) if( i % 1000 == 1 ) { vga_put_char_at( &vga, x_pos, y_pos, '.' ); x_pos++; - serial_put_char( &serial, '.' ); +// serial_put_char( &serial, '.' ); //~ int y = 0; //~ int x = 12 / y; //~ printf( "Hex number is 0x%X and string is '%s'\n", x, "abaos" ); @@ -56,7 +56,7 @@ void entry( void ) } } vga_put_char_at( &vga, x_pos, y_pos, '.' ); - serial_put_char( &serial, '.' ); +// serial_put_char( &serial, '.' ); console_put_newline( &console ); diff --git a/src/stage2_a20.asm b/src/stage2_a20.asm index 630c67a..2110621 100644 --- a/src/stage2_a20.asm +++ b/src/stage2_a20.asm @@ -32,9 +32,13 @@ check_A20_enabled: pop ax mov byte [es:di], al + mov al, '0' + call print_char mov ax, 0 ; wrapped around (last cmp) je .exit + mov al, '1' + call print_char mov ax, 1 ; not wrapped around .exit: @@ -43,16 +47,17 @@ check_A20_enabled: pop es pop ds popf - + ret check_and_enable_A20: call check_A20_enabled cmp ax, 1 je A20_ENABLED - ret A20_ENABLE_VIA_BIOS: + mov al, 'X' + call print_char mov ax, 0x2401 int 0x15 @@ -61,6 +66,8 @@ A20_ENABLE_VIA_BIOS: je A20_ENABLED A20_ENABLE_KBD_PORT: + mov al, 'X' + call print_char mov al, 0xdd out 0x64, al @@ -68,8 +75,13 @@ A20_ENABLE_KBD_PORT: cmp ax, 1 je A20_ENABLED + jmp A20_FAST_SPECIAL_PORT + A20_ENABLE_KBD_OUT: + mov al, 'X' + call print_char + cli call .wait_input @@ -122,6 +134,10 @@ A20_ENABLE_KBD_OUT: je A20_ENABLED A20_FAST_SPECIAL_PORT: + + mov al, 'X' + call print_char + in al, 0x92 or al, 2 out 0x92, al -- cgit v1.2.3-54-g00ecf