diff --git a/.gitignore b/.gitignore index 77e472242..c4e8ab47d 100644 --- a/.gitignore +++ b/.gitignore @@ -1170,3 +1170,4 @@ gems-kernel.git/opt/cross/bin/i386-elf-c++ gems-kernel.git/opt/cross/bin/i386-elf-as gems-kernel.git/opt/cross/bin/i386-elf-ar gems-kernel.git/opt/cross/bin/i386-elf-addr2line +gems-kernel.git/Cross-Dev_Toolchain.i386&i686.x86_64.GCC_7_1_0.tar.gz diff --git a/gems-kernel.git/build.sh b/gems-kernel.git/build.sh old mode 100644 new mode 100755 index 74e7208bf..0f064bf99 --- a/gems-kernel.git/build.sh +++ b/gems-kernel.git/build.sh @@ -7,12 +7,12 @@ mkdir builds/iso mkdir builds/iso/boot mkdir builds/iso/boot/grub echo "Building bootloader" -opt/cross/bin/i686-elf-gcc -std=gnu99 -ffreestanding -g -c start.s -o builds/blocks/bl.o +nasm -f elf32 source/bootloader.asm -o builds/blocks/bl.o echo "Building basic keyboard support" -nasm -f elf32 detect-kbinput.asm -o builds/blocks/detectkeys.o +nasm -f elf32 source/detect-kbinput.asm -o builds/blocks/detectkeys.o echo "Building OS" set disassembly-flavor intel -opt/cross/bin/i686-elf-gcc builds/blocks/bl.o builds/blocks/detectkeys.o os.c -w -g -ffreestanding -m32 -o builds/iso/gems.elf -I"/usr/include" -I"THIRDPARTY/lwext4-master/include/" -nostdlib +opt/cross/bin/i686-elf-gcc builds/blocks/bl.o -ffreestanding -nostdlib builds/blocks/detectkeys.o source/os.c -w -g -m32 -o builds/iso/gems.elf -I"/usr/include" -I"source/THIRDPARTY/lwext4-master/include/" -I"source/THIRDPARTY/linux-old/include/linux" -I"source/THIRDPARTY/linux-old/include/asm" echo "Creating GRUB config" echo "set default=0" > builds/iso/boot/grub/grub.cfg echo "set timeout=60" >> builds/iso/boot/grub/grub.cfg diff --git a/gems-kernel.git/builds/blocks/bl.o b/gems-kernel.git/builds/blocks/bl.o new file mode 100644 index 000000000..f2b54a1ef Binary files /dev/null and b/gems-kernel.git/builds/blocks/bl.o differ diff --git a/gems-kernel.git/builds/blocks/detectkeys.o b/gems-kernel.git/builds/blocks/detectkeys.o new file mode 100644 index 000000000..1f3e303b2 Binary files /dev/null and b/gems-kernel.git/builds/blocks/detectkeys.o differ diff --git a/gems-kernel.git/builds/gems.iso b/gems-kernel.git/builds/gems.iso new file mode 100644 index 000000000..fbfa4d00d Binary files /dev/null and b/gems-kernel.git/builds/gems.iso differ diff --git a/gems-kernel.git/builds/iso/boot/grub/grub.cfg b/gems-kernel.git/builds/iso/boot/grub/grub.cfg new file mode 100644 index 000000000..699ff9def --- /dev/null +++ b/gems-kernel.git/builds/iso/boot/grub/grub.cfg @@ -0,0 +1,6 @@ +set default=0 +set timeout=60 +menuentry "GEMS" { + multiboot /gems.elf + boot +} diff --git a/gems-kernel.git/builds/iso/gems.elf b/gems-kernel.git/builds/iso/gems.elf new file mode 100755 index 000000000..9714a3448 Binary files /dev/null and b/gems-kernel.git/builds/iso/gems.elf differ diff --git a/gems-kernel.git/create-iso.sh b/gems-kernel.git/create-iso.sh old mode 100644 new mode 100755 diff --git a/gems-kernel.git/opt/cross/libexec/gcc/i386-elf/7.1.0/liblto_plugin.so b/gems-kernel.git/opt/cross/libexec/gcc/i386-elf/7.1.0/liblto_plugin.so new file mode 120000 index 000000000..f25ba8898 --- /dev/null +++ b/gems-kernel.git/opt/cross/libexec/gcc/i386-elf/7.1.0/liblto_plugin.so @@ -0,0 +1 @@ +liblto_plugin.so.0.0.0 \ No newline at end of file diff --git a/gems-kernel.git/opt/cross/libexec/gcc/i386-elf/7.1.0/liblto_plugin.so.0 b/gems-kernel.git/opt/cross/libexec/gcc/i386-elf/7.1.0/liblto_plugin.so.0 new file mode 120000 index 000000000..f25ba8898 --- /dev/null +++ b/gems-kernel.git/opt/cross/libexec/gcc/i386-elf/7.1.0/liblto_plugin.so.0 @@ -0,0 +1 @@ +liblto_plugin.so.0.0.0 \ No newline at end of file diff --git a/gems-kernel.git/opt/cross/libexec/gcc/i686-elf/7.1.0/liblto_plugin.so b/gems-kernel.git/opt/cross/libexec/gcc/i686-elf/7.1.0/liblto_plugin.so new file mode 120000 index 000000000..f25ba8898 --- /dev/null +++ b/gems-kernel.git/opt/cross/libexec/gcc/i686-elf/7.1.0/liblto_plugin.so @@ -0,0 +1 @@ +liblto_plugin.so.0.0.0 \ No newline at end of file diff --git a/gems-kernel.git/opt/cross/libexec/gcc/i686-elf/7.1.0/liblto_plugin.so.0 b/gems-kernel.git/opt/cross/libexec/gcc/i686-elf/7.1.0/liblto_plugin.so.0 new file mode 120000 index 000000000..f25ba8898 --- /dev/null +++ b/gems-kernel.git/opt/cross/libexec/gcc/i686-elf/7.1.0/liblto_plugin.so.0 @@ -0,0 +1 @@ +liblto_plugin.so.0.0.0 \ No newline at end of file diff --git a/gems-kernel.git/source/bootloader.asm b/gems-kernel.git/source/bootloader.asm index 4cae58cf9..3a85769c8 100644 --- a/gems-kernel.git/source/bootloader.asm +++ b/gems-kernel.git/source/bootloader.asm @@ -1,38 +1,16 @@ -/* Deprecated */ -/* New one is start.s */ SECTION .multiboot ALIGN 4 +extern kern mboot: - MULTIBOOT_PAGE_ALIGN equ 1<<0 - MULTIBOOT_MEMORY_INFO equ 1<<1 - MULTIBOOT_AOUT_KLUDGE equ 1<<16 - MULTIBOOT_HEADER_MAGIC equ 0x1BADB002 - MULTIBOOT_HEADER_FLAGS equ MULTIBOOT_PAGE_ALIGN | MULTIBOOT_MEMORY_INFO | MULTIBOOT_AOUT_KLUDGE - MULTIBOOT_CHECKSUM equ -(MULTIBOOT_HEADER_MAGIC + MULTIBOOT_HEADER_FLAGS) - EXTERN code, bss, end - - dd MULTIBOOT_HEADER_MAGIC - dd MULTIBOOT_HEADER_FLAGS - dd MULTIBOOT_CHECKSUM - -global exit -extern _start -mov ax, 9ch -mov ss, ax ;cannot be written directly -mov sp, 4094d -mov ax, 7c0h -mov ds, ax ;cannot be written directly -MODULEALIGN equ 1<<0 -MEMINFO equ 1<<1 - - -loader: - call _start - call exit ;crash, forgot to add - -exit: - hlt - jmp exit -times 510-($-$$) db 0 -dw 0xAA55 -call loader ;darn i forgot to add this. probably whats causing the boot loop. + mov ax, 9ch + mov ss, ax ;cannot be written directly + mov sp, 4094d + mov ax, 7c0h + mov ds, ax ;cannot be written directly + call kern +quit: + hlt + jmp quit + jmp $ + times 510-($-$$) db 0 + dw 0xAA55 \ No newline at end of file diff --git a/gems-kernel.git/source/kbd.h b/gems-kernel.git/source/kbd.h index 81f487451..10b9701f7 100644 --- a/gems-kernel.git/source/kbd.h +++ b/gems-kernel.git/source/kbd.h @@ -1,8 +1,8 @@ -unsigned char inport(wchar_t keyid, wchar_t state) { +unsigned char inport(char keyid, char state) { return inportb(keyid); //super hacky way to inport } -unsigned char outport(wchar_t scancode, wchar_t state) { +unsigned char outport(char scancode, char state) { return (outport(scancode, state)); //hacky way to set key state. } @@ -12,7 +12,7 @@ void kbd_ack(void){ } -void kbd_led_handling(wchar_t ledstatus){; +void kbd_led_handling(char ledstatus){; outport(0x60,0xed); kbd_ack(); outport(0x60,ledstatus); diff --git a/gems-kernel.git/source/os.c b/gems-kernel.git/source/os.c index 4853a128e..7fc2736f0 100644 --- a/gems-kernel.git/source/os.c +++ b/gems-kernel.git/source/os.c @@ -51,6 +51,10 @@ typedef struct multiboot_info { typedef mboot_memmap_t mmap_entry_t; typedef multiboot_info mmap_addr_length; +void exit() { + panic("MISC CRASH"); +} + void os() { rloadstring("welcomescreen"); rloadstring("helpscreen"); @@ -85,6 +89,7 @@ void kern() { panic("KERNEL-LEVEL CRASH"); } } + int kernel_main(struct multiboot_info* mbd, unsigned int magic) { mmap_entry_t* entry = mbd->mmap_addr; while(entry < mbd->mmap_addr + mbd->mmap_length) {