added IPC syscalls

This commit is contained in:
user
2026-02-24 16:35:11 +01:00
parent 349155a556
commit 18d21a5f70
9 changed files with 171 additions and 3 deletions

View File

@@ -5,7 +5,7 @@ namespace Syscall {
/*! \brief Syscall IDs
* \note the syscall number must correspond to the values in the syscall stub!
*/
enum class ID : size_t {
enum class ID : size_t {
TEST = 0,
WRITE = 1,
READ = 2,
@@ -18,7 +18,11 @@ enum class ID : size_t {
SYS_EXIT = 9,
SYS_KILL = 10,
MAP = 11,
UNMAP = 12
UNMAP = 12,
SEND = 13,
RECEIVE = 14,
REPLY = 15,
// FORK = 16
};
} // namespace Syscall
@@ -81,3 +85,15 @@ extern "C" ssize_t sys_safe_call(Syscall::ID id, size_t p1, size_t p2,
[[gnu::always_inline]] static inline int unmap(void* start, size_t size) {
return sys_call(Syscall::ID::UNMAP, (size_t) start, size,0,0,0);
}
[[gnu::always_inline]] static inline bool send(int pid, const void* sbuffer, size_t ssize, void* rbuffer, size_t rsize) {
return sys_call(Syscall::ID::SEND, pid, (size_t)sbuffer, ssize, (size_t)rbuffer, rsize);
}
[[gnu::always_inline]] static inline int receive(void* buffer, size_t size) {
return sys_call(Syscall::ID::RECEIVE, (size_t)buffer, size,0,0,0);
}
[[gnu::always_inline]] static inline bool reply(const void* buffer, size_t size) {
return sys_call(Syscall::ID::REPLY, (size_t)buffer, size,0,0,0);
}