From: John Hodge Date: Mon, 24 Oct 2011 01:17:41 +0000 (+0800) Subject: AcessNative - Now can use the `dir` CLIShell builtin X-Git-Tag: rel0.14~203 X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=a4d8188f730bcc25cd4a6f4799ac7d65eb707cf2;p=tpg%2Facess2.git AcessNative - Now can use the `dir` CLIShell builtin --- diff --git a/AcessNative/acesskernel_src/Makefile.BuildNum b/AcessNative/acesskernel_src/Makefile.BuildNum index 72d5c7bf..c5576010 100644 --- a/AcessNative/acesskernel_src/Makefile.BuildNum +++ b/AcessNative/acesskernel_src/Makefile.BuildNum @@ -1 +1 @@ -BUILD_NUM = 16 +BUILD_NUM = 29 diff --git a/AcessNative/acesskernel_src/include/arch.h b/AcessNative/acesskernel_src/include/arch.h index 849eba82..fdd23a82 100644 --- a/AcessNative/acesskernel_src/include/arch.h +++ b/AcessNative/acesskernel_src/include/arch.h @@ -28,11 +28,6 @@ typedef intptr_t tPAddr; typedef int BOOL; -//typedef uint32_t tTID; -//typedef uint32_t tPID; -//typedef uint32_t tUID; -//typedef uint32_t tGID; - struct sShortSpinlock { int IsValid; diff --git a/AcessNative/acesskernel_src/main.c b/AcessNative/acesskernel_src/main.c index 9f0daa45..bc4083cf 100644 --- a/AcessNative/acesskernel_src/main.c +++ b/AcessNative/acesskernel_src/main.c @@ -25,7 +25,7 @@ extern const char gsGitHash[]; extern int giBuildNumber; // === GLOBALS === -const char *gsAcessDir = "../Usermode/Output/i386"; +const char *gsAcessDir = "../Usermode/Output/x86"; // === CODE === int main(int argc, char *argv[]) @@ -55,7 +55,8 @@ int main(int argc, char *argv[]) }; VT_Install(args); } - + + VFS_MkDir("/Acess"); VFS_Mount(gsAcessDir, "/Acess", "nativefs", ""); Debug_SetKTerminal("/Devices/VTerm/8"); diff --git a/AcessNative/acesskernel_src/nativefs.c b/AcessNative/acesskernel_src/nativefs.c index 6d6e2fed..9de8ae2d 100644 --- a/AcessNative/acesskernel_src/nativefs.c +++ b/AcessNative/acesskernel_src/nativefs.c @@ -53,7 +53,10 @@ tVFS_Node *NativeFS_Mount(const char *Device, const char **Arguments) DIR *dp; dp = opendir(Device); - if(!dp) return NULL; + if(!dp) { + Log_Warning("NativeFS", "ERRO: Unable to open device root '%s'", Device); + return NULL; + } // Check if directory exists // Parse flags from arguments @@ -144,6 +147,7 @@ tVFS_Node *NativeFS_FindDir(tVFS_Node *Node, const char *Name) char *NativeFS_ReadDir(tVFS_Node *Node, int Position) { // Keep track of the current directory position + // TODO: Implement NativeFS_ReadDir return NULL; } diff --git a/AcessNative/acesskernel_src/server.c b/AcessNative/acesskernel_src/server.c index 80d7c256..953722c0 100644 --- a/AcessNative/acesskernel_src/server.c +++ b/AcessNative/acesskernel_src/server.c @@ -136,11 +136,12 @@ int Server_WorkerThread(void *ClientPtr) cur_client_id = Client->ClientID; } - Log_Debug("AcessSrv", "Worker %i takes %p", - Client->ClientID, Client->CurrentRequest); - // Get the response retHeader = SyscallRecieve(Client->CurrentRequest, &retSize); + + Log_Debug("AcessSrv", "Client %i request %i", + Client->ClientID, Client->CurrentRequest->CallID); + if( !retHeader ) { // Return an error to the client diff --git a/AcessNative/acesskernel_src/syscalls.c b/AcessNative/acesskernel_src/syscalls.c index 70e09f19..84eb416f 100644 --- a/AcessNative/acesskernel_src/syscalls.c +++ b/AcessNative/acesskernel_src/syscalls.c @@ -4,6 +4,7 @@ * * Syscall Distribution */ +#define DEBUG 1 #include #include #include "../syscalls.h" @@ -23,6 +24,7 @@ typedef int (*tSyscallHandler)(Uint *Errno, const char *Format, void *Args, int a2 = *(_t2*)Args;Args+=sizeof(_t2);\ a3 = *(_t3*)Args;Args+=sizeof(_t3);\ a4 = *(_t4*)Args;Args+=sizeof(_t4);\ + LOG("SYSCALL5 '%s' %p %p %p %p %p", Fmt, (intptr_t)a0,(intptr_t)a1,(intptr_t)a2,(intptr_t)a3,(intptr_t)a4);\ _call\ } #define SYSCALL4(_name, _fmtstr, _t0, _t1, _t2, _t3, _call) int _name(Uint*Errno,const char*Fmt,void*Args,int*Sizes){\ @@ -32,6 +34,7 @@ typedef int (*tSyscallHandler)(Uint *Errno, const char *Format, void *Args, int a1 = *(_t1*)Args;Args+=sizeof(_t1);\ a2 = *(_t2*)Args;Args+=sizeof(_t2);\ a3 = *(_t3*)Args;Args+=sizeof(_t3);\ + LOG("SYSCALL4 '%s' %p %p %p %p", Fmt, (intptr_t)a0,(intptr_t)a1,(intptr_t)a2,(intptr_t)a3);\ _call\ } @@ -41,6 +44,7 @@ typedef int (*tSyscallHandler)(Uint *Errno, const char *Format, void *Args, int a0 = *(_t0*)Args;Args+=sizeof(_t0);\ a1 = *(_t1*)Args;Args+=sizeof(_t1);\ a2 = *(_t2*)Args;Args+=sizeof(_t2);\ + LOG("SYSCALL3 '%s' %p %p %p", Fmt, (intptr_t)a0,(intptr_t)a1,(intptr_t)a2);\ _call\ } @@ -49,6 +53,7 @@ typedef int (*tSyscallHandler)(Uint *Errno, const char *Format, void *Args, int if(strcmp(Fmt,_fmtstr)!=0)return 0;\ a0 = *(_t0*)Args;Args+=sizeof(_t0);\ a1 = *(_t1*)Args;Args+=sizeof(_t1);\ + LOG("SYSCALL2 '%s' %p %p", Fmt, (intptr_t)a0,(intptr_t)a1);\ _call;\ } @@ -56,11 +61,13 @@ typedef int (*tSyscallHandler)(Uint *Errno, const char *Format, void *Args, int _t0 a0;\ if(strcmp(Fmt,_fmtstr)!=0)return 0;\ a0 = *(_t0*)Args;Args+=sizeof(_t0);\ + LOG("SYSCALL1 '%s' %p", Fmt,(intptr_t)a0);\ _call;\ } #define SYSCALL0(_name, _call) int _name(Uint*Errno,const char*Fmt, void*Args,int*Sizes){\ if(strcmp(Fmt,"")!=0)return 0;\ + LOG("SYSCALL0");\ _call;\ } @@ -104,8 +111,12 @@ SYSCALL3(Syscall_IOCtl, "iid", int, int, void *, return VFS_IOCtl(a0, a1, a2); ); SYSCALL3(Syscall_FInfo, "idi", int, void *, int, - if( Sizes[1] < sizeof(tFInfo)+a2*sizeof(tVFS_ACL)) + if( Sizes[1] < sizeof(tFInfo)+a2*sizeof(tVFS_ACL)) { + LOG("offsetof(size) = %i", offsetof(tFInfo, size)); + LOG("Bad size %i < %i", Sizes[1], sizeof(tFInfo)+a2*sizeof(tVFS_ACL)); + *Errno = -EINVAL; return -1; + } return VFS_FInfo(a0, a1, a2); ); SYSCALL2(Syscall_ReadDir, "id", int, char *, @@ -263,19 +274,19 @@ tRequestHeader *SyscallRecieve(tRequestHeader *Request, int *ReturnLength) case ARG_TYPE_VOID: break; case ARG_TYPE_INT32: - LOG("Syscalls", "%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("Syscalls", "%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("Syscalls", "%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; @@ -296,7 +307,7 @@ tRequestHeader *SyscallRecieve(tRequestHeader *Request, int *ReturnLength) { // Allocate and zero the buffer returnData[i] = calloc(1, Request->Params[i].Length); - LOG("Syscalls", "%i ZDAT: %i %p", i, + LOG("%i ZDAT: %i %p", i, Request->Params[i].Length, returnData[i]); *(void**)&argListData[argListLen] = returnData[i]; argListLen += sizeof(void*); @@ -304,7 +315,7 @@ tRequestHeader *SyscallRecieve(tRequestHeader *Request, int *ReturnLength) else { returnData[i] = (void*)inData; - LOG("Syscalls", "%i DATA: %i %p", i, + LOG("%i DATA: %i %p", i, Request->Params[i].Length, returnData[i]); *(void**)&argListData[argListLen] = (void*)inData; argListLen += sizeof(void*); diff --git a/AcessNative/ld-acess_src/exports.c b/AcessNative/ld-acess_src/exports.c index 533c25b3..0c1a671b 100644 --- a/AcessNative/ld-acess_src/exports.c +++ b/AcessNative/ld-acess_src/exports.c @@ -93,10 +93,13 @@ int acess_ioctl(int fd, int id, void *data) { return _Syscall(SYS_IOCTL, ">i >i ?d", fd, id, 1024, data); } int acess_finfo(int fd, t_sysFInfo *info, int maxacls) { + DEBUG("offsetof(size, t_sysFInfo) = %i", offsetof(t_sysFInfo, size)); + DEBUG("finfo(%i, %p, %i)", fd, info, maxacls); return _Syscall(SYS_FINFO, ">i i", fd, sizeof(t_sysFInfo)+maxacls*sizeof(t_sysACL), info, - maxacls); + maxacls + ); } int acess_readdir(int fd, char *dest) { @@ -120,7 +123,7 @@ int acess__SysOpenChild(int fd, char *name, int flags) { } int acess__SysGetACL(int fd, t_sysACL *dest) { - return _Syscall(SYS_GETACL, "i i