diff options
author | Benji Dial <Benji3.141@gmail.com> | 2019-12-25 13:53:18 -0500 |
---|---|---|
committer | Benji Dial <Benji3.141@gmail.com> | 2019-12-25 13:53:18 -0500 |
commit | 2c542b87ff3dc2eacc036dc296a81f8fc215e6d9 (patch) | |
tree | 0dc1f733b33c45121b806343f7d00bbda03aced8 | |
parent | 2b7b69e1ffd00aefa60d73a5af3bacc1c803a930 (diff) | |
download | portland-os-2c542b87ff3dc2eacc036dc296a81f8fc215e6d9.tar.gz |
some more, tag part doesn't work
-rw-r--r-- | makefile | 4 | ||||
-rw-r--r-- | src/kernel/link.ld | 3 | ||||
-rw-r--r-- | src/kernel/main.c | 12 | ||||
-rw-r--r-- | src/kernel/stub.asm | 14 | ||||
-rw-r--r-- | src/kernel/vga.c | 2 |
5 files changed, 22 insertions, 13 deletions
@@ -11,7 +11,9 @@ kernel: obj out gcc -c src/kernel/mem.c -o obj/kmem.o -ffreestanding -nostdlib -m32 gcc -c src/kernel/proc.c -o obj/kproc.o -ffreestanding -nostdlib -m32 gcc -c src/kernel/vga.c -o obj/kvga.o -ffreestanding -nostdlib -m32 - ld obj/k*.o -o out/kernel.elf -T src/kernel/link.ld -s --orphan-handling=discard -m elf_i386 + ld obj/kstub.o obj/kfiles.o obj/kmain.o obj/kmem.o obj/kproc.o obj/kvga.o \ + -o out/kernel.elf -T src/kernel/link.ld -s --orphan-handling=discard -melf_i386 + clean: rm -r obj out diff --git a/src/kernel/link.ld b/src/kernel/link.ld index 7d160f2..d0b7f46 100644 --- a/src/kernel/link.ld +++ b/src/kernel/link.ld @@ -1,8 +1,9 @@ +ENTRY(_start) SECTIONS { . = 0x01000000; .mb_header : ALIGN(8) { *(.mb_header) } .text : ALIGN(512) { *(.text) } .rodata : ALIGN(512) { *(.rodata) } .data : ALIGN(512) { *(.data) } - .bss : ALIGN(512) { *(.bss) } + .bss : ALIGN(512) { *(.bss) } }
\ No newline at end of file diff --git a/src/kernel/main.c b/src/kernel/main.c index 29c0a4d..75edeec 100644 --- a/src/kernel/main.c +++ b/src/kernel/main.c @@ -79,12 +79,17 @@ bool have_boot_device = false; bool have_mmap = false; enum error_codes { - NO_BOOT_DEVICE = 0, - NO_MMAP = 1, - INSUFF_MEMORY = 2 + NO_BOOT_DEVICE = 000000000000, + NO_MMAP = 000000000001, + INSUFF_MEMORY = 000000000002 }; uint32_t main(void) { + for (uint32_t *i = (uint32_t *)VGA_BUFFER; i < (uint32_t *)0x000b8fa0; ++i) + *i = 0x70207020; + + put_sz("Starting...\n"); + uint32_t info_size = *(uint32_t *)info_pointer; struct tag_start *tag_pointer = (struct tag_start *)(info_pointer + 2); @@ -196,7 +201,6 @@ uint32_t main(void) { if (!((proc_table = allocate_block(sizeof(struct proc_info) * 65536, KERNEL)) && (file_table = allocate_block(sizeof(struct file_info) * 65536, KERNEL)))) return INSUFF_MEMORY; - ; put_sz("Welcome to Portland version 0.0.9!\n"); while (1) diff --git a/src/kernel/stub.asm b/src/kernel/stub.asm index 2c097d3..84e4523 100644 --- a/src/kernel/stub.asm +++ b/src/kernel/stub.asm @@ -34,13 +34,14 @@ mb_end: section .text bits 32 +global _start _start: mov dword [info_pointer], ebx mov esp, stack call main mov edx, eax - mov eax, 0x20f0_20f0 + mov eax, 0x4720_4720 mov ebx, 0x000b_8000 mov ecx, 0x000b_8fa0 clear_screen_loop: @@ -49,11 +50,12 @@ clear_screen_loop: test ebx, ecx jne clear_screen_loop - mov dword [0x000b_8000], 0xf072_f045 - mov dword [0x000b_8004], 0xf06f_f072 - mov dword [0x000b_8008], 0xf020_f072 + mov dword [0x000b_8000], 0x4772_4745 + mov dword [0x000b_8004], 0x476f_4772 + mov dword [0x000b_8008], 0x4720_4772 - mov ebx, 0x000b_8022 + mov ebx, 0x000b_8020 + mov ecx, 0x000b_800a error_number_loop: mov al, dl and al, 0x07 @@ -61,7 +63,7 @@ error_number_loop: mov byte [ebx], al sub ebx, 2 shr edx, 3 - test ebx, 0x000b_800a + test ebx, ecx jne error_number_loop cli diff --git a/src/kernel/vga.c b/src/kernel/vga.c index e3e2516..96a691f 100644 --- a/src/kernel/vga.c +++ b/src/kernel/vga.c @@ -21,7 +21,7 @@ OF THIS SOFTWARE. #include <stdbool.h> uint16_t cursor_pos = 0; -uint8_t color = 0xf0; +uint8_t color = 0x70; #define cols 80 #define rows 25 |