UserspaceEmulator: Add support for SC_abort syscall

This commit is contained in:
Brendan Coles 2021-03-21 16:02:50 +00:00 committed by Andreas Kling
parent d2b7500c65
commit 7191098356
Notes: sideshowbarker 2024-07-18 21:10:45 +09:00
2 changed files with 12 additions and 0 deletions

View file

@ -163,6 +163,7 @@ private:
int virt$connect(int sockfd, FlatPtr address, socklen_t address_size);
int virt$shutdown(int sockfd, int how);
void virt$sync();
void virt$abort();
void virt$exit(int);
ssize_t virt$getrandom(FlatPtr buffer, size_t buffer_size, unsigned int flags);
int virt$chdir(FlatPtr, size_t);

View file

@ -219,6 +219,9 @@ u32 Emulator::virt_syscall(u32 function, u32 arg1, u32 arg2, u32 arg3)
case SC_sync:
virt$sync();
return 0;
case SC_abort:
virt$abort();
return 0;
case SC_exit:
virt$exit((int)arg1);
return 0;
@ -1027,6 +1030,14 @@ void Emulator::virt$sync()
syscall(SC_sync);
}
void Emulator::virt$abort()
{
reportln("\n=={}== \033[33;1mSyscall: abort\033[0m, shutting down!", getpid());
m_exit_status = 127;
m_shutdown = true;
dump_backtrace();
}
void Emulator::virt$exit(int status)
{
reportln("\n=={}== \033[33;1mSyscall: exit({})\033[0m, shutting down!", getpid(), status);