summaryrefslogtreecommitdiff
path: root/DevTools
diff options
context:
space:
mode:
authorAnotherTest <ali.mpfard@gmail.com>2020-10-24 11:19:25 +0330
committerAndreas Kling <kling@serenityos.org>2020-10-25 10:13:03 +0100
commitaee0df19c18cbdc91173c944d285b7f03d703ef5 (patch)
tree527ad1e50a782b39c8caa813b6a0bbd65befe278 /DevTools
parent9afe9069a9febfcae9c9d8cb9d592e45fff654ec (diff)
downloadserenity-aee0df19c18cbdc91173c944d285b7f03d703ef5.zip
UserspaceEmulator: Add support for emulating SC_mount
Diffstat (limited to 'DevTools')
-rw-r--r--DevTools/UserspaceEmulator/Emulator.cpp16
-rw-r--r--DevTools/UserspaceEmulator/Emulator.h1
2 files changed, 17 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(&params, 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, &params);
+}
+
u32 Emulator::virt$gettid()
{
return gettid();
diff --git a/DevTools/UserspaceEmulator/Emulator.h b/DevTools/UserspaceEmulator/Emulator.h
index 1b55ebd3c6..0dcb1016f8 100644
--- a/DevTools/UserspaceEmulator/Emulator.h
+++ b/DevTools/UserspaceEmulator/Emulator.h
@@ -94,6 +94,7 @@ private:
int virt$shbuf_seal(int shbuf_id);
int virt$shbuf_set_volatile(int shbuf_id, bool);
u32 virt$mmap(u32);
+ u32 virt$mount(u32);
u32 virt$munmap(FlatPtr address, u32 size);
u32 virt$gettid();
u32 virt$getpid();