forked from PoliEcho-holding-org/kern
Added temporary Puts() syscall to print a string. I use it in calc to print a message
This commit is contained in:
@@ -2,6 +2,7 @@
|
|||||||
#define SYSCALL_H
|
#define SYSCALL_H
|
||||||
|
|
||||||
#include <interrupt/pit.h>
|
#include <interrupt/pit.h>
|
||||||
|
#include <screen/text.h>
|
||||||
|
|
||||||
// System call count
|
// System call count
|
||||||
#define MAX_SYSCALLS 2
|
#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
|
// System call table
|
||||||
void* syscalls[MAX_SYSCALLS] = {
|
void* syscalls[MAX_SYSCALLS] = {
|
||||||
sys_sleep,
|
sys_sleep,
|
||||||
|
sys_puts,
|
||||||
};
|
};
|
||||||
|
|
||||||
// int 0x80 - Syscall interrupt, handled by this function
|
// int 0x80 - Syscall interrupt, handled by this function
|
||||||
|
|||||||
@@ -2,6 +2,14 @@
|
|||||||
|
|
||||||
__attribute__ ((section ("entry")))
|
__attribute__ ((section ("entry")))
|
||||||
void main() {
|
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
|
sleep(4500); // Wait 4.5 seconds
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|||||||
+2
-2
@@ -6,11 +6,11 @@
|
|||||||
#include <interrupt/syscall.h>
|
#include <interrupt/syscall.h>
|
||||||
#include <interrupt/pic.h>
|
#include <interrupt/pic.h>
|
||||||
#include <ports/io.h>
|
#include <ports/io.h>
|
||||||
#include <c/string.h>
|
#include <string.h>
|
||||||
#include <screen/graphics.h>
|
#include <screen/graphics.h>
|
||||||
#include <keyboard/keyboard.h>
|
#include <keyboard/keyboard.h>
|
||||||
#include <interrupt/pit.h>
|
#include <interrupt/pit.h>
|
||||||
#include <c/time.h>
|
#include <time.h>
|
||||||
|
|
||||||
#define PROMPT "#> "
|
#define PROMPT "#> "
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user