mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-21 20:15:17 +00:00
UserspaceEmulator: Add some more syscalls :^)
Here's set_process_icon(), gettimeofday() and clock_gettime().
This commit is contained in:
parent
feebe3f42e
commit
c8b496162d
Notes:
sideshowbarker
2024-07-19 04:47:47 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/c8b496162db
2 changed files with 34 additions and 0 deletions
|
@ -278,9 +278,15 @@ u32 Emulator::virt_syscall(u32 function, u32 arg1, u32 arg2, u32 arg3)
|
|||
return virt$kill(arg1, arg2);
|
||||
case SC_set_mmap_name:
|
||||
return virt$set_mmap_name(arg1);
|
||||
case SC_set_process_icon:
|
||||
return virt$set_process_icon(arg1);
|
||||
case SC_exit:
|
||||
virt$exit((int)arg1);
|
||||
return 0;
|
||||
case SC_gettimeofday:
|
||||
return virt$gettimeofday(arg1);
|
||||
case SC_clock_gettime:
|
||||
return virt$clock_gettime(arg1, arg2);
|
||||
default:
|
||||
warn() << "Unimplemented syscall: " << Syscall::to_string((Syscall::Function)function);
|
||||
dump_backtrace();
|
||||
|
@ -418,6 +424,31 @@ int Emulator::virt$kill(pid_t pid, int signal)
|
|||
return syscall(SC_kill, pid, signal);
|
||||
}
|
||||
|
||||
int Emulator::virt$set_process_icon(int shbuf_id)
|
||||
{
|
||||
return syscall(SC_set_process_icon, shbuf_id);
|
||||
}
|
||||
|
||||
int Emulator::virt$gettimeofday(FlatPtr timeval)
|
||||
{
|
||||
struct timeval host_timeval;
|
||||
int rc = syscall(SC_gettimeofday, &host_timeval);
|
||||
if (rc < 0)
|
||||
return rc;
|
||||
mmu().copy_to_vm(timeval, &host_timeval, sizeof(host_timeval));
|
||||
return rc;
|
||||
}
|
||||
|
||||
int Emulator::virt$clock_gettime(int clockid, FlatPtr timespec)
|
||||
{
|
||||
struct timespec host_timespec;
|
||||
int rc = syscall(SC_clock_gettime, clockid, &host_timespec);
|
||||
if (rc < 0)
|
||||
return rc;
|
||||
mmu().copy_to_vm(timespec, &host_timespec, sizeof(host_timespec));
|
||||
return rc;
|
||||
}
|
||||
|
||||
int Emulator::virt$set_mmap_name(FlatPtr)
|
||||
{
|
||||
// FIXME: Implement.
|
||||
|
|
|
@ -83,6 +83,9 @@ private:
|
|||
int virt$unlink(FlatPtr path, size_t path_length);
|
||||
int virt$get_process_name(FlatPtr buffer, int size);
|
||||
int virt$set_mmap_name(FlatPtr);
|
||||
int virt$set_process_icon(int);
|
||||
int virt$gettimeofday(FlatPtr);
|
||||
int virt$clock_gettime(int, FlatPtr);
|
||||
int virt$dbgputstr(FlatPtr characters, int length);
|
||||
int virt$dbgputch(char);
|
||||
int virt$fchmod(int, mode_t);
|
||||
|
|
Loading…
Add table
Reference in a new issue