AcessNative - Fixing little bugs
authorJohn Hodge <[email protected]>
Wed, 9 May 2012 04:33:22 +0000 (12:33 +0800)
committerJohn Hodge <[email protected]>
Wed, 9 May 2012 04:33:22 +0000 (12:33 +0800)
AcessNative/acesskernel_src/nativefs.c
AcessNative/acesskernel_src/syscalls.c
AcessNative/ld-acess_src/binary.c
AcessNative/ld-acess_src/exports.c
AcessNative/ld-acess_src/memory.c
AcessNative/syscalls.h

index 864a24b..4f1b377 100644 (file)
@@ -79,6 +79,7 @@ tVFS_Node *NativeFS_Mount(const char *Device, const char **Arguments)
        ret->ImplInt = strlen(ret->Data);\r
        ret->ImplPtr = info;\r
        ret->Inode = (Uint64)dp;\r
+       ret->Flags = VFS_FFLAG_DIRECTORY;\r
 \r
        ret->Type = &gNativeFS_DirNodeType;     \r
        \r
index fa473b2..58dc801 100644 (file)
@@ -7,6 +7,7 @@
 #define DEBUG  1
 #include <acess.h>
 #include <threads.h>
+#include <events.h>
 #include "../syscalls.h"
 
 // === IMPORTS ===
@@ -199,6 +200,10 @@ SYSCALL2(Syscall_GetMessage, "dd", Uint *, void *,
        return Proc_GetMessage(a0, a1);
 );
 
+SYSCALL1(Syscall_WaitEvent, "i", int,
+       return Threads_WaitEvents(a0);
+);
+
 const tSyscallHandler  caSyscalls[] = {
        Syscall_Null,
        Syscall_Exit,
@@ -231,7 +236,8 @@ const tSyscallHandler       caSyscalls[] = {
 
        Syscall_SendMessage,
        Syscall_GetMessage,
-       Syscall_select
+       Syscall_select,
+       Syscall_WaitEvent
 };
 const int      ciNumSyscalls = sizeof(caSyscalls)/sizeof(caSyscalls[0]);
 /**
index fa2af0c..6235431 100644 (file)
@@ -253,6 +253,7 @@ int Binary_GetSymbol(const char *SymbolName, uintptr_t *Value, size_t *Size)
 
        //printf("Binary_GetSymbol: RETURN 0, not found\n");
        printf("--- ERROR: Unable to find symbol '%s'\n", SymbolName);
-       
+
+       exit( -1 );
        return 0;
 }
index c236b52..406e55f 100644 (file)
@@ -263,10 +263,19 @@ int acess_SysSendMessage(int DestTID, int Length, void *Data)
 
 int acess_SysGetMessage(int *SourceTID, void *Data)
 {
-       return _Syscall(SYS_GETMSG, "<d <d",
+//     static __thread int lastlen = 1024;
+       int lastlen;
+
+       lastlen = _Syscall(SYS_GETMSG, "<d <d",
                SourceTID ? sizeof(int) : 0, SourceTID,
-               Data ? 4096 : 0, Data
+               Data ? 1024 : 0, Data
                );
+       return lastlen;
+}
+
+int acess__SysWaitEvent(int Mask)
+{
+       return _Syscall(SYS_WAITEVENT, ">i", Mask);
 }
 
 // --- Logging
@@ -327,7 +336,8 @@ const tSym  caBuiltinSymbols[] = {
        
        DEFSYM(_SysAllocate),
        DEFSYM(_SysDebug),
-       DEFSYM(_SysSetFaultHandler)
+       DEFSYM(_SysSetFaultHandler),
+       DEFSYM(_SysWaitEvent)
 };
 
 const int      ciNumBuiltinSymbols = sizeof(caBuiltinSymbols)/sizeof(caBuiltinSymbols[0]);
index 872cb2c..f1147c2 100644 (file)
@@ -27,14 +27,14 @@ int AllocateMemory(uintptr_t VirtAddr, size_t ByteCount)
                return -1;
        }
        #else
-       printf("AllocateMemory: mmap(%p, %lx, ...)\n", (void*)base, ByteCount);
+//     printf("AllocateMemory: mmap(%p, 0x%lx, ...)\n", (void*)base, ByteCount);
        tmp = mmap((void*)base, size, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0);
        if( tmp == MAP_FAILED ) {
                printf("ERROR: Unable to allocate memory\n");
                perror("AllocateMemory");
                return -1;
        }
-       printf("AllocateMemory: RETURN 0\n");
+//     printf("AllocateMemory: RETURN 0\n");
        #endif
        return 0;
 }
index 3c7bd85..d1a0bdc 100644 (file)
@@ -64,6 +64,7 @@ enum eSyscalls {
        SYS_SENDMSG,
        SYS_GETMSG,
        SYS_SELECT,
+       SYS_WAITEVENT,
        
        N_SYSCALLS
 };
@@ -103,7 +104,8 @@ static const char * casSYSCALL_NAMES[] = {
        "SYS_AN_FORK",
        "SYS_SENDMSG",
        "SYS_GETMSG",
-       "SYS_SELECT"
+       "SYS_SELECT",
+       "SYS_WAITEVENT"
 };
 #endif
 

UCC git Repository :: git.ucc.asn.au