X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=AcessNative%2Facesskernel_src%2Fsyscalls.c;h=58dc80171cf245a83ab481ca6b6fe5dd9a51f287;hb=45c91b880402af13c4b8f934c53780d7cba24aac;hp=4d85e8c6b38cd2fc9c3b927e2ddc2ac804c4221b;hpb=6bcb63ea0505129d32b249772b554b0848bb5612;p=tpg%2Facess2.git diff --git a/AcessNative/acesskernel_src/syscalls.c b/AcessNative/acesskernel_src/syscalls.c index 4d85e8c6..58dc8017 100644 --- a/AcessNative/acesskernel_src/syscalls.c +++ b/AcessNative/acesskernel_src/syscalls.c @@ -7,6 +7,7 @@ #define DEBUG 1 #include #include +#include #include "../syscalls.h" // === IMPORTS === @@ -177,13 +178,32 @@ SYSCALL1(Syscall_SetGID, "i", int, return Threads_SetGID(a0); ); -SYSCALL1(Syscall_Fork, "d", int *, +SYSCALL0(Syscall_GetTID, return Threads_GetTID()); +SYSCALL0(Syscall_GetPID, return Threads_GetPID()); +SYSCALL0(Syscall_GetUID, return Threads_GetUID()); +SYSCALL0(Syscall_GetGID, return Threads_GetGID()); + +SYSCALL1(Syscall_AN_Fork, "d", int *, if(Sizes[0] < sizeof(int)) return -1; *a0 = Threads_Fork(); return *a0; ); +SYSCALL2(Syscall_SendMessage, "id", int, void *, + return Proc_SendMessage(a0, Sizes[1], a1); +); + +SYSCALL2(Syscall_GetMessage, "dd", Uint *, void *, + if( Sizes[0] < sizeof(*a0) ) + return -1; + return Proc_GetMessage(a0, a1); +); + +SYSCALL1(Syscall_WaitEvent, "i", int, + return Threads_WaitEvents(a0); +); + const tSyscallHandler caSyscalls[] = { Syscall_Null, Syscall_Exit, @@ -206,12 +226,18 @@ const tSyscallHandler caSyscalls[] = { Syscall_SetUID, Syscall_SetGID, + Syscall_GetTID, + Syscall_GetPID, + Syscall_GetUID, + Syscall_GetGID, + Syscall_Sleep, - Syscall_Fork, + Syscall_AN_Fork, - NULL, - NULL, - Syscall_select + Syscall_SendMessage, + Syscall_GetMessage, + Syscall_select, + Syscall_WaitEvent }; const int ciNumSyscalls = sizeof(caSyscalls)/sizeof(caSyscalls[0]); /** @@ -272,7 +298,7 @@ tRequestHeader *SyscallRecieve(tRequestHeader *Request, int *ReturnLength) } formatString[i] = '\0'; - LOG("Request %i(%s) '%s'", Request->CallID, casSYSCALL_NAMES[Request->CallID], formatString); + //LOG("Request %i(%s) '%s'", Request->CallID, casSYSCALL_NAMES[Request->CallID], formatString); { char argListData[argListLen]; @@ -286,19 +312,19 @@ tRequestHeader *SyscallRecieve(tRequestHeader *Request, int *ReturnLength) case ARG_TYPE_VOID: break; case ARG_TYPE_INT32: - LOG("%i INT32: 0x%x", i, *(Uint32*)inData); + //LOG("%i INT32: 0x%x", i, *(Uint32*)inData); *(Uint32*)&argListData[argListLen] = *(Uint32*)inData; argListLen += sizeof(Uint32); inData += sizeof(Uint32); break; case ARG_TYPE_INT64: - LOG("%i INT64: 0x%llx", i, *(Uint64*)inData); + //LOG("%i INT64: 0x%llx", i, *(Uint64*)inData); *(Uint64*)&argListData[argListLen] = *(Uint64*)inData; argListLen += sizeof(Uint64); inData += sizeof(Uint64); break; case ARG_TYPE_STRING: - LOG("%i STR: '%s'", i, (char*)inData); + //LOG("%i STR: '%s'", i, (char*)inData); *(char**)&argListData[argListLen] = (char*)inData; argListLen += sizeof(void*); inData += Request->Params[i].Length; @@ -319,16 +345,16 @@ tRequestHeader *SyscallRecieve(tRequestHeader *Request, int *ReturnLength) { // Allocate and zero the buffer returnData[i] = calloc(1, Request->Params[i].Length); - LOG("%i ZDAT: %i %p", i, - Request->Params[i].Length, returnData[i]); + //LOG("%i ZDAT: %i %p", i, + // Request->Params[i].Length, returnData[i]); *(void**)&argListData[argListLen] = returnData[i]; argListLen += sizeof(void*); } else { returnData[i] = (void*)inData; - LOG("%i DATA: %i %p", i, - Request->Params[i].Length, returnData[i]); + //LOG("%i DATA: %i %p", i, + // Request->Params[i].Length, returnData[i]); *(void**)&argListData[argListLen] = (void*)inData; argListLen += sizeof(void*); inData += Request->Params[i].Length; @@ -367,7 +393,7 @@ tRequestHeader *SyscallRecieve(tRequestHeader *Request, int *ReturnLength) ret->Params[retValueCount].Flags = 0; ret->Params[retValueCount].Length = Request->Params[i].Length; - LOG("Syscalls", "Ret %i: Type %i, Len %i", + LOG("Ret %i: Type %i, Len %i", i, Request->Params[i].Type, Request->Params[i].Length); memcpy(inData, returnData[i], Request->Params[i].Length);