1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 01:27:34 +00:00

Kernel+LibC: Add a dbgputch() syscall and use it for userspace dbgprintf().

The "stddbg" stream was a cute idea but we never ended up using it in
practice, so let's simplify this and implement userspace dbgprintf() on top
of a simple dbgputch() syscall instead.

This makes debugging LibC startup a little bit easier. :^)
This commit is contained in:
Andreas Kling 2019-07-21 19:45:31 +02:00
parent be7dcca1a6
commit 3fce2fb205
6 changed files with 18 additions and 15 deletions

View file

@ -2716,3 +2716,9 @@ int Process::sys$dump_backtrace()
dump_backtrace();
return 0;
}
int Process::sys$dbgputch(u8 ch)
{
IO::out8(0xe9, ch);
return 0;
}

View file

@ -104,6 +104,7 @@ public:
void die();
void finalize();
int sys$dbgputch(u8);
int sys$dump_backtrace();
int sys$gettid();
int sys$donate(int tid);

View file

@ -70,6 +70,8 @@ static u32 handle(RegisterDump& regs, u32 function, u32 arg1, u32 arg2, u32 arg3
case Syscall::SC_putch:
Console::the().put_char(arg1 & 0xff);
break;
case Syscall::SC_dbgputch:
return current->process().sys$dbgputch((u8)arg1);
case Syscall::SC_sleep:
return current->process().sys$sleep((unsigned)arg1);
case Syscall::SC_usleep:

View file

@ -116,7 +116,8 @@ struct timeval;
__ENUMERATE_SYSCALL(fchown) \
__ENUMERATE_SYSCALL(halt) \
__ENUMERATE_SYSCALL(reboot) \
__ENUMERATE_SYSCALL(dump_backtrace)
__ENUMERATE_SYSCALL(dump_backtrace) \
__ENUMERATE_SYSCALL(dbgputch)
namespace Syscall {