more fixes 💻

This commit is contained in:
ThatLinuxFan 2024-01-26 17:50:01 -06:00
parent 3ad196040e
commit 498b6dd8d3
15 changed files with 35 additions and 41 deletions

1
.gitignore vendored
View file

@ -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-as
gems-kernel.git/opt/cross/bin/i386-elf-ar gems-kernel.git/opt/cross/bin/i386-elf-ar
gems-kernel.git/opt/cross/bin/i386-elf-addr2line 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

6
gems-kernel.git/build.sh Normal file → Executable file
View file

@ -7,12 +7,12 @@ mkdir builds/iso
mkdir builds/iso/boot mkdir builds/iso/boot
mkdir builds/iso/boot/grub mkdir builds/iso/boot/grub
echo "Building bootloader" 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" 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" echo "Building OS"
set disassembly-flavor intel 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 "Creating GRUB config"
echo "set default=0" > builds/iso/boot/grub/grub.cfg echo "set default=0" > builds/iso/boot/grub/grub.cfg
echo "set timeout=60" >> builds/iso/boot/grub/grub.cfg echo "set timeout=60" >> builds/iso/boot/grub/grub.cfg

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -0,0 +1,6 @@
set default=0
set timeout=60
menuentry "GEMS" {
multiboot /gems.elf
boot
}

Binary file not shown.

0
gems-kernel.git/create-iso.sh Normal file → Executable file
View file

View file

@ -0,0 +1 @@
liblto_plugin.so.0.0.0

View file

@ -0,0 +1 @@
liblto_plugin.so.0.0.0

View file

@ -0,0 +1 @@
liblto_plugin.so.0.0.0

View file

@ -0,0 +1 @@
liblto_plugin.so.0.0.0

View file

@ -1,38 +1,16 @@
/* Deprecated */
/* New one is start.s */
SECTION .multiboot SECTION .multiboot
ALIGN 4 ALIGN 4
extern kern
mboot: 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 ax, 9ch
mov ss, ax ;cannot be written directly mov ss, ax ;cannot be written directly
mov sp, 4094d mov sp, 4094d
mov ax, 7c0h mov ax, 7c0h
mov ds, ax ;cannot be written directly mov ds, ax ;cannot be written directly
MODULEALIGN equ 1<<0 call kern
MEMINFO equ 1<<1 quit:
loader:
call _start
call exit ;crash, forgot to add
exit:
hlt hlt
jmp exit jmp quit
jmp $
times 510-($-$$) db 0 times 510-($-$$) db 0
dw 0xAA55 dw 0xAA55
call loader ;darn i forgot to add this. probably whats causing the boot loop.

View file

@ -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 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. 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); outport(0x60,0xed);
kbd_ack(); kbd_ack();
outport(0x60,ledstatus); outport(0x60,ledstatus);

View file

@ -51,6 +51,10 @@ typedef struct multiboot_info {
typedef mboot_memmap_t mmap_entry_t; typedef mboot_memmap_t mmap_entry_t;
typedef multiboot_info mmap_addr_length; typedef multiboot_info mmap_addr_length;
void exit() {
panic("MISC CRASH");
}
void os() { void os() {
rloadstring("welcomescreen"); rloadstring("welcomescreen");
rloadstring("helpscreen"); rloadstring("helpscreen");
@ -85,6 +89,7 @@ void kern() {
panic("KERNEL-LEVEL CRASH"); panic("KERNEL-LEVEL CRASH");
} }
} }
int kernel_main(struct multiboot_info* mbd, unsigned int magic) { int kernel_main(struct multiboot_info* mbd, unsigned int magic) {
mmap_entry_t* entry = mbd->mmap_addr; mmap_entry_t* entry = mbd->mmap_addr;
while(entry < mbd->mmap_addr + mbd->mmap_length) { while(entry < mbd->mmap_addr + mbd->mmap_length) {