diff options
author | AnotherTest <ali.mpfard@gmail.com> | 2020-10-24 11:19:25 +0330 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-10-25 10:13:03 +0100 |
commit | aee0df19c18cbdc91173c944d285b7f03d703ef5 (patch) | |
tree | 527ad1e50a782b39c8caa813b6a0bbd65befe278 /DevTools/UserspaceEmulator/Emulator.cpp | |
parent | 9afe9069a9febfcae9c9d8cb9d592e45fff654ec (diff) | |
download | serenity-aee0df19c18cbdc91173c944d285b7f03d703ef5.zip |
UserspaceEmulator: Add support for emulating SC_mount
Diffstat (limited to 'DevTools/UserspaceEmulator/Emulator.cpp')
-rw-r--r-- | DevTools/UserspaceEmulator/Emulator.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/DevTools/UserspaceEmulator/Emulator.cpp b/DevTools/UserspaceEmulator/Emulator.cpp index 0430367e37..fe7d1afb72 100644 --- a/DevTools/UserspaceEmulator/Emulator.cpp +++ b/DevTools/UserspaceEmulator/Emulator.cpp @@ -286,6 +286,8 @@ u32 Emulator::virt_syscall(u32 function, u32 arg1, u32 arg2, u32 arg3) return virt$shbuf_set_volatile(arg1, arg2); case SC_mmap: return virt$mmap(arg1); + case SC_mount: + return virt$mount(arg1); case SC_munmap: return virt$munmap(arg1, arg2); case SC_gettid: @@ -819,6 +821,20 @@ u32 Emulator::virt$mmap(u32 params_addr) return final_address; } +u32 Emulator::virt$mount(u32 params_addr) +{ + Syscall::SC_mount_params params; + mmu().copy_from_vm(¶ms, params_addr, sizeof(params)); + auto target = mmu().copy_buffer_from_vm((FlatPtr)params.target.characters, params.target.length); + auto fs_path = mmu().copy_buffer_from_vm((FlatPtr)params.fs_type.characters, params.fs_type.length); + params.fs_type.characters = (char*)fs_path.data(); + params.fs_type.length = fs_path.size(); + params.target.characters = (char*)target.data(); + params.target.length = target.size(); + + return syscall(SC_mount, ¶ms); +} + u32 Emulator::virt$gettid() { return gettid(); |