It's still running in kernel space. Once I make it possible for ELFLoader to set up a ring 3 task, we'll really be cooking!
@@ -51,8 +51,8 @@ DWORD handle(DWORD function, DWORD arg1, DWORD arg2, DWORD arg3)
case Syscall::Yield:
yield();
break;
- case 0x1235: // putch
- kprintf( "%c", arg1 & 0xFF );
+ case Syscall::PutCharacter:
+ kprintf("%c", arg1 & 0xff);
case Syscall::Sleep:
//kprintf("syscall: sleep(%d)\n", arg1);
@@ -10,6 +10,7 @@ namespace Syscall {
enum Function {
Sleep = 0x1982,
Yield = 0x1983,
+ PutCharacter = 1984,
PosixOpen = 0x1985,
PosixClose = 0x1986,
PosixRead = 0x1987,
@@ -52,4 +52,9 @@ void yield()
DO_SYSCALL_A0(Syscall::Yield);
}
+void putch(char ch)
+{
+ DO_SYSCALL_A1(Syscall::PutCharacter, ch);
+}
+
@@ -12,5 +12,6 @@ int kill(pid_t pid, int sig);
uid_t getuid();
void sleep(DWORD ticks);
void yield();
+void putch(char);
@@ -8,5 +8,8 @@ extern "C" int elf_entry()
char buf[2048];
int nread = read(fd, buf, sizeof(buf));
buf[nread] = '\0';
+ for (int i = 0; i < nread; ++i) {
+ putch(buf[i]);
+ }
return 0;
@@ -170,7 +170,7 @@ static void init_stage2()
#ifdef TEST_ELF_LOADER
{
- auto testExecutable = vfs->open("/_hello.o");
+ auto testExecutable = vfs->open("/_test.o");
ASSERT(testExecutable);
auto testExecutableData = testExecutable->readEntireFile();
ASSERT(testExecutableData);