mirror of
https://github.com/RGBCube/serenity
synced 2025-06-01 09:38:10 +00:00
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:
parent
3a3c57357c
commit
e4afa2a041
7 changed files with 13 additions and 3 deletions
|
@ -51,8 +51,8 @@ DWORD handle(DWORD function, DWORD arg1, DWORD arg2, DWORD arg3)
|
||||||
case Syscall::Yield:
|
case Syscall::Yield:
|
||||||
yield();
|
yield();
|
||||||
break;
|
break;
|
||||||
case 0x1235: // putch
|
case Syscall::PutCharacter:
|
||||||
kprintf( "%c", arg1 & 0xFF );
|
kprintf("%c", arg1 & 0xff);
|
||||||
break;
|
break;
|
||||||
case Syscall::Sleep:
|
case Syscall::Sleep:
|
||||||
//kprintf("syscall: sleep(%d)\n", arg1);
|
//kprintf("syscall: sleep(%d)\n", arg1);
|
||||||
|
|
|
@ -10,6 +10,7 @@ namespace Syscall {
|
||||||
enum Function {
|
enum Function {
|
||||||
Sleep = 0x1982,
|
Sleep = 0x1982,
|
||||||
Yield = 0x1983,
|
Yield = 0x1983,
|
||||||
|
PutCharacter = 1984,
|
||||||
PosixOpen = 0x1985,
|
PosixOpen = 0x1985,
|
||||||
PosixClose = 0x1986,
|
PosixClose = 0x1986,
|
||||||
PosixRead = 0x1987,
|
PosixRead = 0x1987,
|
||||||
|
|
|
@ -52,4 +52,9 @@ void yield()
|
||||||
DO_SYSCALL_A0(Syscall::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();
|
uid_t getuid();
|
||||||
void sleep(DWORD ticks);
|
void sleep(DWORD ticks);
|
||||||
void yield();
|
void yield();
|
||||||
|
void putch(char);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Binary file not shown.
|
@ -8,5 +8,8 @@ extern "C" int elf_entry()
|
||||||
char buf[2048];
|
char buf[2048];
|
||||||
int nread = read(fd, buf, sizeof(buf));
|
int nread = read(fd, buf, sizeof(buf));
|
||||||
buf[nread] = '\0';
|
buf[nread] = '\0';
|
||||||
|
for (int i = 0; i < nread; ++i) {
|
||||||
|
putch(buf[i]);
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -170,7 +170,7 @@ static void init_stage2()
|
||||||
|
|
||||||
#ifdef TEST_ELF_LOADER
|
#ifdef TEST_ELF_LOADER
|
||||||
{
|
{
|
||||||
auto testExecutable = vfs->open("/_hello.o");
|
auto testExecutable = vfs->open("/_test.o");
|
||||||
ASSERT(testExecutable);
|
ASSERT(testExecutable);
|
||||||
auto testExecutableData = testExecutable->readEntireFile();
|
auto testExecutableData = testExecutable->readEntireFile();
|
||||||
ASSERT(testExecutableData);
|
ASSERT(testExecutableData);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue