Tweak _test.o to use the putch() syscall.

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!
This commit is contained in:
Andreas Kling 2018-10-22 11:53:30 +02:00
parent 3a3c57357c
commit e4afa2a041
7 changed files with 13 additions and 3 deletions

View file

@ -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);
break;
case Syscall::Sleep:
//kprintf("syscall: sleep(%d)\n", arg1);

View file

@ -10,6 +10,7 @@ namespace Syscall {
enum Function {
Sleep = 0x1982,
Yield = 0x1983,
PutCharacter = 1984,
PosixOpen = 0x1985,
PosixClose = 0x1986,
PosixRead = 0x1987,

View file

@ -52,4 +52,9 @@ void yield()
DO_SYSCALL_A0(Syscall::Yield);
}
void putch(char ch)
{
DO_SYSCALL_A1(Syscall::PutCharacter, ch);
}
}

View file

@ -12,5 +12,6 @@ int kill(pid_t pid, int sig);
uid_t getuid();
void sleep(DWORD ticks);
void yield();
void putch(char);
}

Binary file not shown.

View file

@ -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;
}

View file

@ -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);