diff options
author | Andreas Kling <awesomekling@gmail.com> | 2018-10-22 11:53:30 +0200 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2018-10-22 11:53:59 +0200 |
commit | e4afa2a04173d90d5e88ef0d1cd575d2a827534d (patch) | |
tree | 2989720107c1e57025eb00a05fbbba13ccad1dbc /Kernel | |
parent | 3a3c57357c95629dc89c1045c7dbe3b0c1c6c778 (diff) | |
download | serenity-e4afa2a04173d90d5e88ef0d1cd575d2a827534d.zip |
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!
Diffstat (limited to 'Kernel')
-rw-r--r-- | Kernel/Syscall.cpp | 4 | ||||
-rw-r--r-- | Kernel/Syscall.h | 1 | ||||
-rw-r--r-- | Kernel/Userspace.cpp | 5 | ||||
-rw-r--r-- | Kernel/Userspace.h | 1 | ||||
-rw-r--r-- | Kernel/_fs_contents | bin | 1024000 -> 1024000 bytes | |||
-rw-r--r-- | Kernel/_test.cpp | 3 | ||||
-rw-r--r-- | Kernel/init.cpp | 2 |
7 files changed, 13 insertions, 3 deletions
diff --git a/Kernel/Syscall.cpp b/Kernel/Syscall.cpp index bbebaecdf8..63bea39db3 100644 --- a/Kernel/Syscall.cpp +++ b/Kernel/Syscall.cpp @@ -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); diff --git a/Kernel/Syscall.h b/Kernel/Syscall.h index 3e624a83a7..2188edd7bb 100644 --- a/Kernel/Syscall.h +++ b/Kernel/Syscall.h @@ -10,6 +10,7 @@ namespace Syscall { enum Function { Sleep = 0x1982, Yield = 0x1983, + PutCharacter = 1984, PosixOpen = 0x1985, PosixClose = 0x1986, PosixRead = 0x1987, diff --git a/Kernel/Userspace.cpp b/Kernel/Userspace.cpp index 944a6224ab..44587c38ae 100644 --- a/Kernel/Userspace.cpp +++ b/Kernel/Userspace.cpp @@ -52,4 +52,9 @@ void yield() DO_SYSCALL_A0(Syscall::Yield); } +void putch(char ch) +{ + DO_SYSCALL_A1(Syscall::PutCharacter, ch); +} + } diff --git a/Kernel/Userspace.h b/Kernel/Userspace.h index 1a8f0a1857..03ac13ea1f 100644 --- a/Kernel/Userspace.h +++ b/Kernel/Userspace.h @@ -12,5 +12,6 @@ int kill(pid_t pid, int sig); uid_t getuid(); void sleep(DWORD ticks); void yield(); +void putch(char); } diff --git a/Kernel/_fs_contents b/Kernel/_fs_contents Binary files differindex e477e526b9..2d8bec64f7 100644 --- a/Kernel/_fs_contents +++ b/Kernel/_fs_contents diff --git a/Kernel/_test.cpp b/Kernel/_test.cpp index 467b29db62..6958b23288 100644 --- a/Kernel/_test.cpp +++ b/Kernel/_test.cpp @@ -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; } diff --git a/Kernel/init.cpp b/Kernel/init.cpp index fd0c8d7510..fb0ca20b98 100644 --- a/Kernel/init.cpp +++ b/Kernel/init.cpp @@ -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); |