diff options
author | Andreas Baumann <mail@andreasbaumann.cc> | 2017-05-12 11:47:56 +0200 |
---|---|---|
committer | Andreas Baumann <mail@andreasbaumann.cc> | 2017-05-12 11:47:56 +0200 |
commit | 3adae629e98f9fd256349b291e89e6f63c5e469e (patch) | |
tree | c22c099c0f6acd732242b96a7844cb072f091416 /src | |
parent | cdd32146693561ed5b025e6c8a866370402ce380 (diff) | |
download | abaos-3adae629e98f9fd256349b291e89e6f63c5e469e.tar.gz abaos-3adae629e98f9fd256349b291e89e6f63c5e469e.tar.bz2 |
sorted out the character constant mess: we have a flat model (with GDT)
starting from 0x8000, but the first 2k are stage 2 of the boot loader,
so out kernel entry is 0x8400. We have to tell ld that and use 0x8400
instead of 0x8000, otherwise all string constants point to Nirvana!
Diffstat (limited to 'src')
-rw-r--r-- | src/Makefile | 2 | ||||
-rw-r--r-- | src/bochs.config | 3 | ||||
-rw-r--r-- | src/boot.asm | 2 | ||||
-rw-r--r-- | src/kernel.c | 40 |
4 files changed, 23 insertions, 24 deletions
diff --git a/src/Makefile b/src/Makefile index 45db0f7..e0dfedb 100644 --- a/src/Makefile +++ b/src/Makefile @@ -19,7 +19,7 @@ boot.bin: boot.asm gdt.asm stage1_functions.asm stage2_functions.asm switch_mode nasm boot.asm -f bin -o boot.bin kernel.bin: kernel.o vga.o port.o port_asm.o string.o stdlib.o - $(LD) -o kernel.bin -n -Ttext 0x8000 --oformat binary \ + $(LD) -o kernel.bin -N -n -Ttext 0x8400 --oformat binary \ kernel.o vga.o port.o port_asm.o string.o stdlib.o magic.bin: magic.asm diff --git a/src/bochs.config b/src/bochs.config index 333b12a..653df69 100644 --- a/src/bochs.config +++ b/src/bochs.config @@ -4,7 +4,8 @@ config_interface: textconfig display_library: x memory: host=32, guest=32 romimage: file="/usr/share/bochs/BIOS-bochs-latest", address=0x0, options=none -vgaromimage: file="/usr/share/bochs/VGABIOS-lgpl-latest" +#vgaromimage: file="/usr/share/bochs/VGABIOS-lgpl-latest" +vgaromimage: file="/usr/share/bochs/VGABIOS-lgpl-latest-cirrus" boot: floppy floppy_bootsig_check: disabled=0 # no floppya diff --git a/src/boot.asm b/src/boot.asm index 045b135..377ec66 100644 --- a/src/boot.asm +++ b/src/boot.asm @@ -107,8 +107,6 @@ BEGIN_PROTECTED_MODE: ; check sanity of kernel by searching for MAGIC string at a given ; position call check_magic - mov edx, eax - call pm_print_hex cmp ax, 1 jnz HALT_OS diff --git a/src/kernel.c b/src/kernel.c index 0f09819..8232a12 100644 --- a/src/kernel.c +++ b/src/kernel.c @@ -9,13 +9,12 @@ void entry( void ) vga_set_color( &vga, VGA_COLOR_LIGHT_GREY ); vga_set_background_color( &vga, VGA_COLOR_BLACK ); - - volatile char msg[] = "ABAOS 0.0.1 STARTING"; - vga_put_string( &vga, (const char *)msg ); + + vga_put_string( &vga, "ABAOS 0.0.1 STARTING" ); // clang 4.0.0 needs volatile otherwise it takes a random value // from the register in the second vga_put_char_at below??! - volatile char bar[] = "\\|/-"; + const char bar[] = "\\|/-"; int y_pos = vga_get_cursor_y( &vga ); int x_pos = vga_get_cursor_x( &vga ); int i = 0; @@ -32,22 +31,23 @@ void entry( void ) vga_put_newline( &vga ); vga_put_hex( &vga, 4711 ); + vga_put_newline( &vga ); - //~ vga_set_color( &vga, VGA_COLOR_WHITE ); - //~ vga_set_background_color( &vga, VGA_COLOR_RED ); - //~ vga_clear_screen( &vga ); + vga_set_color( &vga, VGA_COLOR_WHITE ); + vga_set_background_color( &vga, VGA_COLOR_RED ); + vga_clear_screen( &vga ); - //~ for( int i = 0; i < 50; i++ ) { - //~ for( int j = 0; j < i; j++ ) { - //~ vga_put_char( &vga, '-' ); - //~ } - //~ vga_put_char( &vga, '>' ); - //~ vga_put_string( &vga, (const char *)msg ); - //~ vga_put_newline( &vga ); - //~ } - //~ for( int j = 0; j < 50; j++ ) { - //~ vga_put_char( &vga, '-' ); - //~ } - //~ vga_put_char( &vga, '>' ); - //~ vga_put_string( &vga, (const char *)msg ); + for( int i = 0; i < 50; i++ ) { + for( int j = 0; j < i; j++ ) { + vga_put_char( &vga, '-' ); + } + vga_put_char( &vga, '>' ); + vga_put_string( &vga, (const char *)"TEST TEST TEST" ); + vga_put_newline( &vga ); + } + for( int j = 0; j < 50; j++ ) { + vga_put_char( &vga, '-' ); + } + vga_put_char( &vga, '>' ); + vga_put_string( &vga, (const char *)"TEST TEST TEST" ); } |