diff --git a/include/interrupt/syscall.h b/include/interrupt/syscall.h index 693fe77..19c9584 100644 --- a/include/interrupt/syscall.h +++ b/include/interrupt/syscall.h @@ -2,6 +2,7 @@ #define SYSCALL_H #include +#include // System call count #define MAX_SYSCALLS 2 @@ -17,9 +18,19 @@ void sys_sleep() { } } +// TODO: Use a Write() syscall and write to stdout +// Args: ebx - string pointer +void sys_puts() { + char* s; + __asm__ volatile ("movl %%ebx, %0" : "=r"(s)); + + print(s); +} + // System call table void* syscalls[MAX_SYSCALLS] = { sys_sleep, + sys_puts, }; // int 0x80 - Syscall interrupt, handled by this function diff --git a/src/calc.c b/src/calc.c index e2fbae0..d970ac3 100644 --- a/src/calc.c +++ b/src/calc.c @@ -2,6 +2,14 @@ __attribute__ ((section ("entry"))) void main() { + *(char*)(0x2000) = 'H'; + *(char*)(0x2001) = 'e'; + *(char*)(0x2002) = 'l'; + *(char*)(0x2003) = 'l'; + *(char*)(0x2004) = 'o'; + *(char*)(0x2005) = '!'; + *(char*)(0x2006) = '\0'; + __asm__ volatile ("int $0x80" : : "a"(1), "b"(0x2000)); sleep(4500); // Wait 4.5 seconds return; diff --git a/src/kernel.c b/src/kernel.c index ca1280d..5e68cb1 100644 --- a/src/kernel.c +++ b/src/kernel.c @@ -6,11 +6,11 @@ #include #include #include -#include +#include #include #include #include -#include +#include #define PROMPT "#> "