summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--DevTools/UserspaceEmulator/Emulator.cpp31
-rw-r--r--DevTools/UserspaceEmulator/Emulator.h3
2 files changed, 34 insertions, 0 deletions
diff --git a/DevTools/UserspaceEmulator/Emulator.cpp b/DevTools/UserspaceEmulator/Emulator.cpp
index 508a0bdc76..8306ba00b5 100644
--- a/DevTools/UserspaceEmulator/Emulator.cpp
+++ b/DevTools/UserspaceEmulator/Emulator.cpp
@@ -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.
diff --git a/DevTools/UserspaceEmulator/Emulator.h b/DevTools/UserspaceEmulator/Emulator.h
index 912005c623..236b709999 100644
--- a/DevTools/UserspaceEmulator/Emulator.h
+++ b/DevTools/UserspaceEmulator/Emulator.h
@@ -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);