mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-24 18:24:45 -05:00
UserspaceEmulator: Add symlink, rename, set_coredump_metadata syscalls
This commit is contained in:
parent
569d6d47fe
commit
46c7f52896
Notes:
sideshowbarker
2024-07-18 21:17:20 +09:00
Author: https://github.com/bcoles Commit: https://github.com/SerenityOS/serenity/commit/46c7f52896e Pull-request: https://github.com/SerenityOS/serenity/pull/5820
2 changed files with 57 additions and 0 deletions
|
@ -125,6 +125,9 @@ private:
|
|||
int virt$mkdir(FlatPtr path, size_t path_length, mode_t mode);
|
||||
int virt$rmdir(FlatPtr path, size_t path_length);
|
||||
int virt$unlink(FlatPtr path, size_t path_length);
|
||||
int virt$symlink(FlatPtr address);
|
||||
int virt$rename(FlatPtr address);
|
||||
int virt$set_coredump_metadata(FlatPtr address);
|
||||
int virt$get_process_name(FlatPtr buffer, int size);
|
||||
int virt$set_process_name(FlatPtr buffer, int size);
|
||||
int virt$set_mmap_name(FlatPtr);
|
||||
|
|
|
@ -138,6 +138,12 @@ u32 Emulator::virt_syscall(u32 function, u32 arg1, u32 arg2, u32 arg3)
|
|||
return virt$rmdir(arg1, arg2);
|
||||
case SC_unlink:
|
||||
return virt$unlink(arg1, arg2);
|
||||
case SC_symlink:
|
||||
return virt$symlink(arg1);
|
||||
case SC_rename:
|
||||
return virt$rename(arg1);
|
||||
case SC_set_coredump_metadata:
|
||||
return virt$set_coredump_metadata(arg1);
|
||||
case SC_write:
|
||||
return virt$write(arg1, arg2, arg3);
|
||||
case SC_read:
|
||||
|
@ -320,6 +326,54 @@ int Emulator::virt$unlink(FlatPtr path, size_t path_length)
|
|||
return syscall(SC_unlink, buffer.data(), buffer.size());
|
||||
}
|
||||
|
||||
int Emulator::virt$symlink(FlatPtr params_addr)
|
||||
{
|
||||
Syscall::SC_symlink_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);
|
||||
params.target.characters = (const char*)target.data();
|
||||
params.target.length = target.size();
|
||||
|
||||
auto link = mmu().copy_buffer_from_vm((FlatPtr)params.linkpath.characters, params.linkpath.length);
|
||||
params.linkpath.characters = (const char*)link.data();
|
||||
params.linkpath.length = link.size();
|
||||
|
||||
return syscall(SC_symlink, ¶ms);
|
||||
}
|
||||
|
||||
int Emulator::virt$rename(FlatPtr params_addr)
|
||||
{
|
||||
Syscall::SC_rename_params params;
|
||||
mmu().copy_from_vm(¶ms, params_addr, sizeof(params));
|
||||
|
||||
auto new_path = mmu().copy_buffer_from_vm((FlatPtr)params.new_path.characters, params.new_path.length);
|
||||
params.new_path.characters = (const char*)new_path.data();
|
||||
params.new_path.length = new_path.size();
|
||||
|
||||
auto old_path = mmu().copy_buffer_from_vm((FlatPtr)params.old_path.characters, params.old_path.length);
|
||||
params.old_path.characters = (const char*)old_path.data();
|
||||
params.old_path.length = old_path.size();
|
||||
|
||||
return syscall(SC_rename, ¶ms);
|
||||
}
|
||||
|
||||
int Emulator::virt$set_coredump_metadata(FlatPtr params_addr)
|
||||
{
|
||||
Syscall::SC_set_coredump_metadata_params params;
|
||||
mmu().copy_from_vm(¶ms, params_addr, sizeof(params));
|
||||
|
||||
auto key = mmu().copy_buffer_from_vm((FlatPtr)params.key.characters, params.key.length);
|
||||
params.key.characters = (const char*)key.data();
|
||||
params.key.length = key.size();
|
||||
|
||||
auto value = mmu().copy_buffer_from_vm((FlatPtr)params.value.characters, params.value.length);
|
||||
params.value.characters = (const char*)value.data();
|
||||
params.value.length = value.size();
|
||||
|
||||
return syscall(SC_set_coredump_metadata, ¶ms);
|
||||
}
|
||||
|
||||
int Emulator::virt$dbgputstr(FlatPtr characters, int length)
|
||||
{
|
||||
auto buffer = mmu().copy_buffer_from_vm(characters, length);
|
||||
|
|
Loading…
Add table
Reference in a new issue