From: John Hodge Date: Mon, 16 May 2011 12:51:20 +0000 (+0800) Subject: AcessNative - Fixes mostly, still not yet complete X-Git-Tag: rel0.10~107 X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=b391a1b79e12096b561e68a48eb096dcb77fca47;p=tpg%2Facess2.git AcessNative - Fixes mostly, still not yet complete --- diff --git a/AcessNative/acesskernel_src/Makefile b/AcessNative/acesskernel_src/Makefile index 1c92b476..ed79684b 100644 --- a/AcessNative/acesskernel_src/Makefile +++ b/AcessNative/acesskernel_src/Makefile @@ -38,7 +38,7 @@ endif all: $(BIN) clean: - $(RM) $(BIN) $(OBJ) + $(RM) $(BIN) $(OBJ) $(DEPFILES) $(BIN): $(OBJ) @echo [LINK] -o $@ @@ -48,3 +48,5 @@ $(BIN): $(OBJ) @echo [CC] -o $@ @$(CC) -c $< -o $@ $(CFLAGS) $(CPPFLAGS) @$(CC) -M $(CPPFLAGS) -MT $@ -o $*.d.$(PLATFORM) $< + +-include $(DEPFILES) diff --git a/AcessNative/acesskernel_src/server.c b/AcessNative/acesskernel_src/server.c index 725a326b..0cede83c 100644 --- a/AcessNative/acesskernel_src/server.c +++ b/AcessNative/acesskernel_src/server.c @@ -118,6 +118,7 @@ int Server_WorkerThread(void *ClientPtr) tRequestHeader errorHeader; int retSize = 0; int sentSize; + int cur_client_id = 0; #if USE_TCP #else @@ -127,6 +128,11 @@ int Server_WorkerThread(void *ClientPtr) while( Client->CurrentRequest == NULL ) SDL_CondWait(Client->WaitFlag, Client->Mutex); + if(Client->ClientID != cur_client_id) { + Threads_SetThread( Client->ClientID ); + cur_client_id = Client->ClientID; + } + Log_Debug("AcessSrv", "Worker %i takes %p", Client->ClientID, Client->CurrentRequest); @@ -245,9 +251,11 @@ int SyscallServer(void) tRequestHeader *req = (void*)data; struct sockaddr_in addr; uint clientSize = sizeof(addr); - int length = recvfrom(gSocket, data, BUFSIZ, 0, (struct sockaddr*)&addr, &clientSize); + int length; tClient *client; + length = recvfrom(gSocket, data, BUFSIZ, 0, (struct sockaddr*)&addr, &clientSize); + if( length == -1 ) { perror("SyscallServer - recv"); break; diff --git a/AcessNative/ld-acess_src/Makefile b/AcessNative/ld-acess_src/Makefile index f7543fd0..eb84ad89 100644 --- a/AcessNative/ld-acess_src/Makefile +++ b/AcessNative/ld-acess_src/Makefile @@ -27,7 +27,7 @@ DEPFILES := $(DEPFILES:%.o.$(PLATFORM)=%.d.$(PLATFORM)) all: $(BIN) clean: - $(RM) $(BIN) $(OBJ) + $(RM) $(BIN) $(OBJ) $(DEPFILES) $(BIN): link.ld.$(PLATFORM) $(OBJ) # $(LD) -g -o $@ $(OBJ) -T link.ld.$(PLATFORM) @@ -43,3 +43,5 @@ link.ld.lin: @echo Making Linker Script ($@) @$(LD) --verbose | awk '{ if( substr($$0,0,5) == "====="){ bPrint = !bPrint; } else { if(bPrint){ print $$0;} } }' | sed 's/\b0x0[08][0-9]*\b/0x00100000/g' > $@ +-include $(DEPFILES) + diff --git a/AcessNative/ld-acess_src/binary.c b/AcessNative/ld-acess_src/binary.c index d3dee99a..6439fb96 100644 --- a/AcessNative/ld-acess_src/binary.c +++ b/AcessNative/ld-acess_src/binary.c @@ -239,7 +239,7 @@ int Binary_GetSymbol(const char *SymbolName, uintptr_t *Value) } } - // TODO: Search list of loaded binaries + // Search list of loaded binaries for(bin = gLoadedBinaries; bin; bin = bin->Next) { if( !bin->Ready ) continue; diff --git a/AcessNative/ld-acess_src/elf.c b/AcessNative/ld-acess_src/elf.c index c01d24d4..daea0443 100644 --- a/AcessNative/ld-acess_src/elf.c +++ b/AcessNative/ld-acess_src/elf.c @@ -2,7 +2,7 @@ * Acess v0.1 * ELF Executable Loader Code */ -#define DEBUG 1 +#define DEBUG 0 #include #include #include @@ -108,8 +108,8 @@ void *Elf_Load(int FD) continue; if( phtab[i].VAddr < base ) base = phtab[i].VAddr; - if( phtab[i].VAddr > max ) - max = phtab[i].VAddr; + if( phtab[i].VAddr + phtab[i].MemSize > max ) + max = phtab[i].VAddr + phtab[i].MemSize; } LOG("base = %08x, max = %08x\n", base, max); @@ -492,6 +492,8 @@ int Elf_GetSymbol(void *Base, char *Name, uintptr_t *ret) pBuckets = PTR(hdr->misc.HashTable); symtab = PTR(hdr->misc.SymTable); +// LOG("Base = %p : pBuckets = %p, symtab = %p\n", Base, pBuckets, symtab); + if(!pBuckets || !symtab) return 0; diff --git a/AcessNative/ld-acess_src/syscalls.c b/AcessNative/ld-acess_src/syscalls.c index 58824351..5fbecbd2 100644 --- a/AcessNative/ld-acess_src/syscalls.c +++ b/AcessNative/ld-acess_src/syscalls.c @@ -318,7 +318,7 @@ size_t acess_read(int FD, size_t Bytes, void *Dest) { size_t acess_write(int FD, size_t Bytes, void *Src) { if(FD & NATIVE_FILE_MASK) return fwrite( Src, Bytes, 1, gaSyscall_LocalFPs[FD & (NATIVE_FILE_MASK-1)] ); - DEBUG("write(0x%x, 0x%x, %p(\"%.*s\"))", FD, Bytes, Src, Bytes, (char*)Src); + DEBUG("write(0x%x, 0x%x, %p\"%.*s\")", FD, Bytes, Src, Bytes, (char*)Src); return _Syscall(SYS_WRITE, ">i >i >d", FD, Bytes, Bytes, Src); } @@ -372,6 +372,7 @@ int acess__SysMount(const char *Device, const char *Directory, const char *Type, // --- Error Handler int acess__SysSetFaultHandler(int (*Handler)(int)) { + printf("TODO: Set fault handler (asked to set to %p)\n", Handler); return 0; }