mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 09:28:11 +00:00

- Turn Keyboard into a CharacterDevice (85,1) at /dev/keyboard. - Implement MM::unmapRegionsForTask() and MM::unmapRegion() - Save SS correctly on interrupt. - Add a simple Spawn syscall for launching another process. - Move a bunch of IO syscall debug output behind DEBUG_IO. - Have ASSERT do a "cli" immediately when failing. This makes the output look proper every time. - Implement a bunch of syscalls in LibC. - Add a simple shell ("sh"). All it can do now is read a line of text from /dev/keyboard and then try launching the specified executable by calling spawn(). There are definitely bugs in here, but we're moving on forward.
39 lines
650 B
C++
39 lines
650 B
C++
#include "unistd.h"
|
|
#include "string.h"
|
|
#include <Kernel/Syscall.h>
|
|
|
|
extern "C" {
|
|
|
|
uid_t getuid()
|
|
{
|
|
return Syscall::invoke(Syscall::PosixGetuid);
|
|
}
|
|
|
|
uid_t getgid()
|
|
{
|
|
return Syscall::invoke(Syscall::PosixGetgid);
|
|
}
|
|
|
|
uid_t getpid()
|
|
{
|
|
return Syscall::invoke(Syscall::PosixGetpid);
|
|
}
|
|
|
|
int open(const char* path)
|
|
{
|
|
size_t length = strlen(path);
|
|
return Syscall::invoke(Syscall::PosixOpen, (dword)path, (dword)length);
|
|
}
|
|
|
|
ssize_t read(int fd, void* buf, size_t count)
|
|
{
|
|
return Syscall::invoke(Syscall::PosixRead, (dword)fd, (dword)buf, (dword)count);
|
|
}
|
|
|
|
int close(int fd)
|
|
{
|
|
return Syscall::invoke(Syscall::PosixClose, fd);
|
|
}
|
|
|
|
}
|
|
|