From e4afa2a04173d90d5e88ef0d1cd575d2a827534d Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Mon, 22 Oct 2018 11:53:30 +0200 Subject: [PATCH] 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! --- Kernel/Syscall.cpp | 4 ++-- Kernel/Syscall.h | 1 + Kernel/Userspace.cpp | 5 +++++ Kernel/Userspace.h | 1 + Kernel/_fs_contents | Bin 1024000 -> 1024000 bytes Kernel/_test.cpp | 3 +++ 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 index e477e526b93abf23e44644000936533dc3e3e541..2d8bec64f7da6a25617d04665c6c982e653725ce 100644 GIT binary patch delta 630 zcmZoTVApWKZi5aBXX~7^(cN>-Mssd9WpQR?EZfM~&a{c6LxQ<=&e_e~3YGl)UpN>T zDzi^Scg{Hr!p*`4?ZO6(?ZO63?ZO7k?ZO5u?ZO7E?ZO6Z+l39-c|QoZurh#w37FJi z5MvOXYhC@&Z4ltjW;Rck?4d(MPyo2(+!F++q-Is2g_*sS) zrxq0#Bqpbt7L=AGXSgOaq~@f>r{P2#vw9IokM_e_4I>k9O9zJj0_Bn3=9lx zPC53`Pb9P6h@B z2as|G28I{R3=E*q5@vwVAfJH3r3PvOR2hRP(Z<* zm>3v-OcuPM%=&|wfuW~eSA(NnSA(-%SA(lvSA)A?1_1^J1|bFp27U$x1{MYe1`Y-WhJ?v$uO~A;nk;xjnYDwNfuW%Np$13$Lk-UM hhZh>kA8PQlKh)rDf2hH?{hopen("/_hello.o"); + auto testExecutable = vfs->open("/_test.o"); ASSERT(testExecutable); auto testExecutableData = testExecutable->readEntireFile(); ASSERT(testExecutableData);