diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/boot.s | 25 | ||||
| -rw-r--r-- | src/kernel.c | 10 |
2 files changed, 27 insertions, 8 deletions
@@ -2,17 +2,33 @@ This software is licensed under the ARPL. See LICENSE for details. */ /* Multiboot header dark magic, do not touch */ -.set ALIGN, 1<<0 -.set MEMINFO, 1<<1 -.set FLAGS, ALIGN | MEMINFO -.set MAGIC, 0x1BADB002 +.set ALIGN, 1<<0 +.set MEMINFO, 1<<1 +.set VIDMODE, 1<<2 +.set FLAGS, ALIGN | MEMINFO | VIDMODE +.set MAGIC, 0x1BADB002 .set CHECKSUM, -(MAGIC + FLAGS) +/* ask grub for framebuffer + if this breaks the OS i might crash out */ +.set WIDTH, 1024 +.set HEIGHT, 768 +.set DEPTH, 32 + .section .multiboot .align 4 .long MAGIC .long FLAGS .long CHECKSUM +.long 0 /* header_addr (unused) */ +.long 0 /* load_addr (unused) */ +.long 0 /* load_end_addr (unused) */ +.long 0 /* bss_end_addr (unused) */ +.long 0 /* entry_addr (unused) */ +.long 0 /* mode_type: 0 = linear framebuffer */ +.long WIDTH /* width */ +.long HEIGHT /* height */ +.long DEPTH /* depth */ /* Multiboot does not define the esp/stack, create the stack ourselves */ .section bss @@ -43,6 +59,7 @@ _start: ABI says we need 16-byte alignment here, we aligned that before and pushed a multiple of 16 bits (zero) so we fine but i will realign for good measure anyway */ .align 16 + push %ebx call kernel_main /* if nothing left then just infinite loop */ diff --git a/src/kernel.c b/src/kernel.c index ae50def..9697a83 100644 --- a/src/kernel.c +++ b/src/kernel.c @@ -5,14 +5,14 @@ This software is licensed under the ARPL. See LICENSE for details. */ #include <stddef.h> #include <stdint.h> -/* Check if the compiler thinks you are targeting the wrong operating system. */ +/* check if compiler thinks we are targeting incorrect OS. */ #if defined(__linux__) -#error "you are not using a cross-compiler, this is bad. use an elf cross-compiler for ix86 targets, for example, i686-elf-gcc" +#error "you are not using a cross-compiler, this is bad. use an elf cross-compiler for ix86 targets, for example, i386-elf-gcc" #endif -/* This operating system will only work for the 32-bit ix86 targets. */ +/* OS only works on 32bit ix86 */ #if !defined(__i386__) -#error "this operating system needs to be compiled with a ix86-elf compiler" +#error "this operating system is only supported on ix86 targets. use an elf cross-compiler for ix86 targets, for example, i386-elf-gcc" #endif /* Hardware text mode color constants. */ @@ -123,6 +123,8 @@ void kernel_main(void) terminal_writestring("loading FrenchToastOS...\n"); terminal_writestring("developed by Arslaan Pathan"); + /* if there is nothing else to do, halt, or the computer commit die */ + /* our boot.s code does this already, but better to be safe than f**ked */ while (1) { __asm__ __volatile__ ("hlt"); } |
