mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 21:08:12 +00:00
Start working on memory-mapped files.
First of all, change sys$mmap to take a struct SC_mmap_params since our sycsall calling convention can't handle more than 3 arguments. This exposed a bug in Syscall::invoke() needing to use clobber lists. It was a bit confusing to debug. :^)
This commit is contained in:
parent
41a751c90c
commit
fdbd9f1e27
14 changed files with 82 additions and 26 deletions
|
@ -82,33 +82,42 @@ inline constexpr const char* toString(Function function)
|
|||
return "Unknown";
|
||||
}
|
||||
|
||||
struct SC_mmap_params {
|
||||
uint32_t addr;
|
||||
uint32_t size;
|
||||
int32_t prot;
|
||||
int32_t flags;
|
||||
int32_t fd;
|
||||
uint32_t offset; // FIXME: 64-bit off_t?
|
||||
};
|
||||
|
||||
void initialize();
|
||||
|
||||
inline dword invoke(dword function)
|
||||
{
|
||||
dword result;
|
||||
asm volatile("int $0x80":"=a"(result):"a"(function));
|
||||
asm volatile("int $0x80":"=a"(result):"a"(function):"memory");
|
||||
return result;
|
||||
}
|
||||
|
||||
inline dword invoke(dword function, dword arg1)
|
||||
{
|
||||
dword result;
|
||||
asm volatile("int $0x80":"=a"(result):"a"(function),"d"(arg1));
|
||||
asm volatile("int $0x80":"=a"(result):"a"(function),"d"(arg1):"memory");
|
||||
return result;
|
||||
}
|
||||
|
||||
inline dword invoke(dword function, dword arg1, dword arg2)
|
||||
{
|
||||
dword result;
|
||||
asm volatile("int $0x80":"=a"(result):"a"(function),"d"(arg1),"c"(arg2));
|
||||
asm volatile("int $0x80":"=a"(result):"a"(function),"d"(arg1),"c"(arg2):"memory");
|
||||
return result;
|
||||
}
|
||||
|
||||
inline dword invoke(dword function, dword arg1, dword arg2, dword arg3)
|
||||
{
|
||||
dword result;
|
||||
asm volatile("int $0x80":"=a"(result):"a"(function),"d"(arg1),"c"(arg2),"b"(arg3));
|
||||
asm volatile("int $0x80":"=a"(result):"a"(function),"d"(arg1),"c"(arg2),"b"(arg3):"memory");
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue