Slighly changed everything :)

- Makefile changes
- Linker script updates
- Made it comply with C17
- Removed entry.asm (finally)
This commit is contained in:
2024-05-24 18:25:26 +02:00
parent f879ca122f
commit 8245187356
9 changed files with 22 additions and 42 deletions
+3 -2
View File
@@ -1,8 +1,9 @@
#include <stdio.h>
#include <stdlib.h>
__attribute__ ((section("entry")))
void main() {
char msg[8] = { 'H','e','l','l','o','!','\n',0 };
print(msg);
print("Hello, World!\n");
return;
}
+1 -1
View File
@@ -1,6 +1,6 @@
ENTRY("main");
SECTIONS {
.text : {
*(entry);
*(.text*);
}
.data : {
-22
View File
@@ -1,22 +0,0 @@
[bits 32]
[global _start]
[global driveNum]
[extern main]
;; Calls the main function in 'main.c'
_start:
pop ax
mov [driveNum], al
call main
; Exit QEMU
mov ax, 0x2000
mov dx, 0x0604
out dx, ax
jmp $ ;; If we used cli, hlt we wouldn't have interrupts :/
driveNum: db 0
+7 -1
View File
@@ -17,6 +17,7 @@
#include <memory/virtual.h>
#include <memory/addresses.h>
#include <memory/malloc.h>
#include <stdlib.h>
#define PROMPT "#> "
@@ -26,6 +27,7 @@ char* filetable = (char*)FILETABLE_LOC; // Pretty sure we don't have to care abo
void printFiletable(char* ft);
void printPhysicalMemmap();
__attribute__ ((section("entry")))
void main() {
// Interrupt setup
setupIdt();
@@ -248,7 +250,7 @@ void main() {
diskRead(0, 1, (char*)buf);
if (buf[510] == 0x55 && buf[511] == 0xaa) {
print("[ DONE ]\n");
} else {
} else {
print("[ FAIL ]\n");
}
print("Write Test ......... ");
@@ -260,6 +262,10 @@ void main() {
} else {
print("[ FAIL ]\n");
}
print("Malloc Test ........ ");
void* buffer = malloc(100);
free(buffer);
print("[ DONE ]\n");
print("\nTests Finished!\n");
} else {
+1
View File
@@ -1,5 +1,6 @@
SECTIONS {
.text 0x50000 : {
*(entry);
*(.text*);
}
.data : {
-3
View File
@@ -324,9 +324,6 @@ protected_start:
rep movsd
; Perform The far jump
mov al, [driveNum]
push ax
jmp CODE_SEG:KERNEL_LOC
;; Data