2020-08-02 14:37:23 -05:00
|
|
|
#include <rpc.h>
|
|
|
|
#include <sys/syscalls.h>
|
|
|
|
|
|
|
|
#define QUAUX(X) #X
|
|
|
|
#define QU(X) QUAUX(X)
|
|
|
|
|
|
|
|
|
|
|
|
void* rpc_call(pid_t pid,char* name,void* buf,size_t size) {
|
|
|
|
void* retbuf;
|
|
|
|
asm volatile(" \
|
|
|
|
mov $" QU(SYSCALL_CALL_RPC) ", %%eax; \
|
|
|
|
int $80; \
|
|
|
|
":"=D"(retbuf):"b"(pid),"c"(name),"d"(buf),"S"(size));
|
|
|
|
return retbuf;
|
|
|
|
}
|
|
|
|
|
|
|
|
void rpc_register_func(char* name,rpc_func code) {
|
|
|
|
asm volatile(" \
|
|
|
|
mov $" QU(SYSCALL_REGISTER_RPC) ", %%eax; \
|
|
|
|
int $80; \
|
|
|
|
"::"b"(name),"c"(code));
|
|
|
|
}
|
|
|
|
|
|
|
|
void rpc_deallocate_buf(void* buf,size_t size) {
|
|
|
|
asm volatile(" \
|
|
|
|
mov $" QU(SYSCALL_DEALLOCTATE_RPC_RET) ", %%eax; \
|
|
|
|
int $80; \
|
|
|
|
"::"b"(buf),"c"(size));
|
|
|
|
}
|
|
|
|
|
|
|
|
void rpc_return(void* buf,size_t size) {
|
|
|
|
asm volatile(" \
|
|
|
|
mov $" QU(SYSCALL_RPC_RET) ", %%eax; \
|
|
|
|
int $80; \
|
|
|
|
"::"b"(buf),"c"(size));
|
|
|
|
}
|
|
|
|
|
|
|
|
void rpc_mark_as_init() {
|
|
|
|
asm volatile(" \
|
|
|
|
mov $" QU(SYSCALL_RPC_MARK_AS_INIT) ", %%eax; \
|
|
|
|
int $80; \
|
|
|
|
"::);
|
|
|
|
}
|
2020-08-23 08:31:19 -05:00
|
|
|
char rpc_is_init(pid_t pid) {
|
|
|
|
char is_init;
|
|
|
|
asm volatile(" \
|
|
|
|
mov $" QU(SYSCALL_RPC_IS_INIT) ", %%eax; \
|
|
|
|
int $80; \
|
|
|
|
":"=c"(is_init):"b"(pid));
|
|
|
|
return is_init;
|
|
|
|
}
|