git.ucc.asn.au
/
tpg
/
acess2.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
fbdee45
)
AcessNative - Debugging and implementing, getting there now
author
John Hodge
<
[email protected]
>
Sat, 2 Jul 2011 04:36:09 +0000
(12:36 +0800)
committer
John Hodge
<
[email protected]
>
Sat, 2 Jul 2011 04:36:09 +0000
(12:36 +0800)
AcessNative/acesskernel_src/Makefile
patch
|
blob
|
history
AcessNative/acesskernel_src/main.c
patch
|
blob
|
history
AcessNative/acesskernel_src/server.c
patch
|
blob
|
history
AcessNative/acesskernel_src/syscalls.c
patch
|
blob
|
history
AcessNative/acesskernel_src/ui_sdl.c
patch
|
blob
|
history
AcessNative/acesskernel_src/video.c
patch
|
blob
|
history
AcessNative/ld-acess_src/common.h
patch
|
blob
|
history
AcessNative/ld-acess_src/main.c
patch
|
blob
|
history
AcessNative/ld-acess_src/request.c
patch
|
blob
|
history
AcessNative/ld-acess_src/syscalls.c
patch
|
blob
|
history
AcessNative/syscalls.h
patch
|
blob
|
history
diff --git
a/AcessNative/acesskernel_src/Makefile
b/AcessNative/acesskernel_src/Makefile
index
ed79684
..
74f8920
100644
(file)
--- a/
AcessNative/acesskernel_src/Makefile
+++ b/
AcessNative/acesskernel_src/Makefile
@@
-13,12
+13,15
@@
KERNEL_OBJ += vfs/nodecache.o vfs/mount.o vfs/memfile.o vfs/select.o
KERNEL_OBJ += vfs/fs/root.o vfs/fs/devfs.o
\r
KERNEL_OBJ += drv/vterm.o drv/fifo.o drv/proc.o
\r
\r
KERNEL_OBJ += vfs/fs/root.o vfs/fs/devfs.o
\r
KERNEL_OBJ += drv/vterm.o drv/fifo.o drv/proc.o
\r
\r
-OBJ := main.o helpers.o threads.o server.o syscalls.o
\r
+N_OBJ := main.o
\r
+
\r
+OBJ := helpers.o threads.o server.o syscalls.o
\r
OBJ += video.o keyboard.o mouse.o nativefs.o vfs_handle.o ui_sdl.o
\r
OBJ += $(addprefix $(KERNEL_SRC),$(KERNEL_OBJ))
\r
\r
OBJ := $(addsuffix .$(PLATFORM),$(OBJ))
\r
OBJ += video.o keyboard.o mouse.o nativefs.o vfs_handle.o ui_sdl.o
\r
OBJ += $(addprefix $(KERNEL_SRC),$(KERNEL_OBJ))
\r
\r
OBJ := $(addsuffix .$(PLATFORM),$(OBJ))
\r
-DEPFILES = $(filter %.o.$(PLATFORM),$(OBJ))
\r
+N_OBJ := $(addsuffix .$(PLATFORM),$(N_OBJ))
\r
+DEPFILES = $(filter %.o.$(PLATFORM),$(OBJ) $(N_OBJ))
\r
DEPFILES := $(DEPFILES:%.o.$(PLATFORM)=%.d.$(PLATFORM))
\r
\r
CPPFLAGS += -I include/ -I $(KERNEL_SRC)include/
\r
DEPFILES := $(DEPFILES:%.o.$(PLATFORM)=%.d.$(PLATFORM))
\r
\r
CPPFLAGS += -I include/ -I $(KERNEL_SRC)include/
\r
@@
-38,15
+41,20
@@
endif
all: $(BIN)
\r
\r
clean:
\r
all: $(BIN)
\r
\r
clean:
\r
- $(RM) $(BIN) $(OBJ) $(DEPFILES)
\r
+ $(RM) $(BIN) $(OBJ) $(
N_OBJ) $(
DEPFILES)
\r
\r
\r
-$(BIN): $(OBJ)
\r
+$(BIN): $(OBJ)
$(N_OBJ)
\r
@echo [LINK] -o $@
\r
@echo [LINK] -o $@
\r
- @$(CC) $(LDFLAGS) -o $@ $(OBJ)
\r
+ @$(CC) $(LDFLAGS) -o $@ $(
N_OBJ) $(
OBJ)
\r
\r
\r
-%.o.$(PLATFORM): %.c
\r
+
$(OBJ):
%.o.$(PLATFORM): %.c
\r
@echo [CC] -o $@
\r
@$(CC) -c $< -o $@ $(CFLAGS) $(CPPFLAGS)
\r
@$(CC) -M $(CPPFLAGS) -MT $@ -o $*.d.$(PLATFORM) $<
\r
\r
@echo [CC] -o $@
\r
@$(CC) -c $< -o $@ $(CFLAGS) $(CPPFLAGS)
\r
@$(CC) -M $(CPPFLAGS) -MT $@ -o $*.d.$(PLATFORM) $<
\r
\r
+$(N_OBJ): %.o.$(PLATFORM): %.c
\r
+ @echo [CC] -o $@
\r
+ @$(CC) -c $< -o $@ $(CFLAGS)
\r
+ @$(CC) -M -MT $@ -o $*.d.$(PLATFORM) $<
\r
+
\r
-include $(DEPFILES)
\r
-include $(DEPFILES)
\r
diff --git
a/AcessNative/acesskernel_src/main.c
b/AcessNative/acesskernel_src/main.c
index
363fea1
..
3f72413
100644
(file)
--- a/
AcessNative/acesskernel_src/main.c
+++ b/
AcessNative/acesskernel_src/main.c
@@
-6,6
+6,7
@@
*/
#include <stdio.h>
#include <stdlib.h>
*/
#include <stdio.h>
#include <stdlib.h>
+#include <signal.h>
// === IMPORTS ===
extern int UI_Initialise(int Width, int Height);
// === IMPORTS ===
extern int UI_Initialise(int Width, int Height);
@@
-23,7
+24,10
@@
const char *gsAcessDir = "../Usermode/Output/i386";
int main(int argc, char *argv[])
{
// Parse command line settings
int main(int argc, char *argv[])
{
// Parse command line settings
-
+
+ // - Ignore SIGUSR1 (used to wake threads)
+ signal(SIGUSR1, SIG_IGN);
+
// Start UI subsystem
UI_Initialise(800, 480);
// Start UI subsystem
UI_Initialise(800, 480);
diff --git
a/AcessNative/acesskernel_src/server.c
b/AcessNative/acesskernel_src/server.c
index
0cede83
..
264f412
100644
(file)
--- a/
AcessNative/acesskernel_src/server.c
+++ b/
AcessNative/acesskernel_src/server.c
@@
-267,7
+267,8
@@
int SyscallServer(void)
ntohl(addr.sin_addr.s_addr), ntohs(addr.sin_port));
client = Server_GetClient(req->ClientID);
ntohl(addr.sin_addr.s_addr), ntohs(addr.sin_port));
client = Server_GetClient(req->ClientID);
- if( req->ClientID == 0 )
+ // NOTE: Hack - Should check if all zero
+ if( req->ClientID == 0 || client->ClientAddr.sin_port == 0 )
{
memcpy(&client->ClientAddr, &addr, sizeof(addr));
}
{
memcpy(&client->ClientAddr, &addr, sizeof(addr));
}
diff --git
a/AcessNative/acesskernel_src/syscalls.c
b/AcessNative/acesskernel_src/syscalls.c
index
ec87416
..
b41e354
100644
(file)
--- a/
AcessNative/acesskernel_src/syscalls.c
+++ b/
AcessNative/acesskernel_src/syscalls.c
@@
-15,6
+15,16
@@
extern int Threads_Fork(void); // AcessNative only function
typedef int (*tSyscallHandler)(Uint *Errno, const char *Format, void *Args, int *Sizes);
// === MACROS ===
typedef int (*tSyscallHandler)(Uint *Errno, const char *Format, void *Args, int *Sizes);
// === MACROS ===
+#define SYSCALL5(_name, _fmtstr, _t0, _t1, _t2, _t3, _t4, _call) int _name(Uint*Errno,const char*Fmt,void*Args,int*Sizes){\
+ _t0 a0;_t1 a1;_t2 a2;_t3 a3;_t4 a4;\
+ if(strcmp(Fmt,_fmtstr)!=0)return 0;\
+ a0 = *(_t0*)Args;Args+=sizeof(_t0);\
+ a1 = *(_t1*)Args;Args+=sizeof(_t1);\
+ a2 = *(_t2*)Args;Args+=sizeof(_t2);\
+ a3 = *(_t3*)Args;Args+=sizeof(_t3);\
+ a4 = *(_t4*)Args;Args+=sizeof(_t4);\
+ _call\
+}
#define SYSCALL4(_name, _fmtstr, _t0, _t1, _t2, _t3, _call) int _name(Uint*Errno,const char*Fmt,void*Args,int*Sizes){\
_t0 a0;_t1 a1;_t2 a2;_t3 a3;\
if(strcmp(Fmt,_fmtstr)!=0)return 0;\
#define SYSCALL4(_name, _fmtstr, _t0, _t1, _t2, _t3, _call) int _name(Uint*Errno,const char*Fmt,void*Args,int*Sizes){\
_t0 a0;_t1 a1;_t2 a2;_t3 a3;\
if(strcmp(Fmt,_fmtstr)!=0)return 0;\
@@
-103,6
+113,9
@@
SYSCALL2(Syscall_ReadDir, "id", int, char *,
return -1;
return VFS_ReadDir(a0, a1);
);
return -1;
return VFS_ReadDir(a0, a1);
);
+SYSCALL5(Syscall_select, "idddd", int, fd_set *, fd_set *, fd_set *, time_t *,
+ return VFS_Select(a0, a1, a2, a3, a4, 0);
+);
SYSCALL3(Syscall_OpenChild, "isi", int, const char *, int,
return VFS_OpenChild(NULL, a0, a1, a2|VFS_OPENFLAG_USER);
);
SYSCALL3(Syscall_OpenChild, "isi", int, const char *, int,
return VFS_OpenChild(NULL, a0, a1, a2|VFS_OPENFLAG_USER);
);
@@
-141,8
+154,11
@@
SYSCALL1(Syscall_SetGID, "i", int,
return Threads_SetGID(Errno, a0);
);
return Threads_SetGID(Errno, a0);
);
-SYSCALL0(Syscall_Fork,
- return Threads_Fork();
+SYSCALL1(Syscall_Fork, "d", int *,
+ if(Sizes[0] < sizeof(int))
+ return -1;
+ *a0 = Threads_Fork();
+ return *a0;
);
const tSyscallHandler caSyscalls[] = {
);
const tSyscallHandler caSyscalls[] = {
@@
-168,7
+184,11
@@
const tSyscallHandler caSyscalls[] = {
Syscall_SetGID,
Syscall_Sleep,
Syscall_SetGID,
Syscall_Sleep,
- Syscall_Fork
+ Syscall_Fork,
+
+ NULL,
+ NULL,
+ Syscall_select
};
const int ciNumSyscalls = sizeof(caSyscalls)/sizeof(caSyscalls[0]);
/**
};
const int ciNumSyscalls = sizeof(caSyscalls)/sizeof(caSyscalls[0]);
/**
diff --git
a/AcessNative/acesskernel_src/ui_sdl.c
b/AcessNative/acesskernel_src/ui_sdl.c
index
3f3cb13
..
2e56a64
100644
(file)
--- a/
AcessNative/acesskernel_src/ui_sdl.c
+++ b/
AcessNative/acesskernel_src/ui_sdl.c
@@
-57,6
+57,10
@@
Uint32 UI_GetAcessKeyFromSDL(SDLKey Sym, Uint16 Unicode)
// Fast return
if( gUI_Keymap[shiftState][Sym] )
return gUI_Keymap[shiftState][Sym];
// Fast return
if( gUI_Keymap[shiftState][Sym] )
return gUI_Keymap[shiftState][Sym];
+
+ // Enter key on acess returns \n, but SDL returns \r
+ if( Sym == SDLK_RETURN )
+ Unicode = '\n';
// How nice of you, a unicode value
if( Unicode )
// How nice of you, a unicode value
if( Unicode )
@@
-85,6
+89,7
@@
Uint32 UI_GetAcessKeyFromSDL(SDLKey Sym, Uint16 Unicode)
case SDLK_F10: ret = KEY_F10; break;
case SDLK_F11: ret = KEY_F11; break;
case SDLK_F12: ret = KEY_F12; break;
case SDLK_F10: ret = KEY_F10; break;
case SDLK_F11: ret = KEY_F11; break;
case SDLK_F12: ret = KEY_F12; break;
+ case SDLK_RETURN: ret = '\n'; break;
default:
printf("Unhandled key code %i\n", Sym);
break;
default:
printf("Unhandled key code %i\n", Sym);
break;
diff --git
a/AcessNative/acesskernel_src/video.c
b/AcessNative/acesskernel_src/video.c
index
f3903fb
..
2c38533
100644
(file)
--- a/
AcessNative/acesskernel_src/video.c
+++ b/
AcessNative/acesskernel_src/video.c
@@
-264,16
+264,14
@@
int Video_IOCtl(tVFS_Node *Node, int ID, void *Data)
#if 0
case VIDEO_IOCTL_SETCURSOR: // Set cursor position
#if !BLINKING_CURSOR
#if 0
case VIDEO_IOCTL_SETCURSOR: // Set cursor position
#if !BLINKING_CURSOR
- if(giV
esa
CursorX > 0)
- V
esa
_FlipCursor(Node);
+ if(giV
ideo_
CursorX > 0)
+ V
ideo
_FlipCursor(Node);
#endif
#endif
- giVesaCursorX = ((tVideo_IOCtl_Pos*)Data)->x;
- giVesaCursorY = ((tVideo_IOCtl_Pos*)Data)->y;
- //Log_Debug("VESA", "Cursor position (%i,%i)", giVesaCursorX, giVesaCursorY);
- if(
- giVesaCursorX < 0 || giVesaCursorY < 0
- || giVesaCursorX >= gpVesaCurMode->width/giVT_CharWidth
- || giVesaCursorY >= gpVesaCurMode->height/giVT_CharHeight)
+ giVideo_CursorX = ((tVideo_IOCtl_Pos*)Data)->x;
+ giVideo_CursorY = ((tVideo_IOCtl_Pos*)Data)->y;
+ if( giVideo_CursorX < 0 || giVesaCursorY < 0
+ || giVideo_CursorX >= gpVesaCurMode->width/giVT_CharWidth
+ || giVideo_CursorY >= gpVesaCurMode->height/giVT_CharHeight)
{
#if BLINKING_CURSOR
if(giVesaCursorTimer != -1) {
{
#if BLINKING_CURSOR
if(giVesaCursorTimer != -1) {
diff --git
a/AcessNative/ld-acess_src/common.h
b/AcessNative/ld-acess_src/common.h
index
b544a45
..
05c288b
100644
(file)
--- a/
AcessNative/ld-acess_src/common.h
+++ b/
AcessNative/ld-acess_src/common.h
@@
-17,6
+17,7
@@
extern uintptr_t FindFreeRange(size_t ByteCount, int MaxBits);
extern void Warning(const char *Format, ...);
extern void Notice(const char *Format, ...);
extern void Warning(const char *Format, ...);
extern void Notice(const char *Format, ...);
+extern void Debug(const char *Format, ...);
#define ACESS_SEEK_CUR 0
#define ACESS_SEEK_SET 1
#define ACESS_SEEK_CUR 0
#define ACESS_SEEK_SET 1
diff --git
a/AcessNative/ld-acess_src/main.c
b/AcessNative/ld-acess_src/main.c
index
8363ce6
..
598055f
100644
(file)
--- a/
AcessNative/ld-acess_src/main.c
+++ b/
AcessNative/ld-acess_src/main.c
@@
-6,6
+6,9
@@
#include <stdarg.h>
#include <string.h>
#include <stdarg.h>
#include <string.h>
+// === IMPORTS ===
+extern int giSyscall_ClientID;
+
// === PROTOTYPES ===
void CallUser(void *Entry, int argc, char *argv[], char **envp) __attribute__((noreturn));
// === PROTOTYPES ===
void CallUser(void *Entry, int argc, char *argv[], char **envp) __attribute__((noreturn));
@@
-19,12
+22,12
@@
int main(int argc, char *argv[], char **envp)
int (*appMain)(int, char *[], char **);
void *base;
int (*appMain)(int, char *[], char **);
void *base;
-
int syscall_handle = -1;
+
//
int syscall_handle = -1;
for( i = 1; i < argc; i ++ )
{
if(strcmp(argv[i], "--key") == 0) {
for( i = 1; i < argc; i ++ )
{
if(strcmp(argv[i], "--key") == 0) {
-
syscall_handle
= atoi(argv[++i]);
+
giSyscall_ClientID
= atoi(argv[++i]);
continue ;
}
continue ;
}
@@
-61,19
+64,19
@@
int main(int argc, char *argv[], char **envp)
appArgc = argc - i;
appArgv = &argv[i];
appArgc = argc - i;
appArgv = &argv[i];
-
printf("Exectutable Path: '%s'\n", appPath);
-
printf("Executable argc = %i\n", appArgc);
+
//
printf("Exectutable Path: '%s'\n", appPath);
+
//
printf("Executable argc = %i\n", appArgc);
base = Binary_Load(appPath, (uintptr_t*)&appMain);
base = Binary_Load(appPath, (uintptr_t*)&appMain);
- printf("
base = %p\n"
, base);
+ printf("
[DEBUG %i] base = %p\n", giSyscall_ClientID
, base);
if( !base ) return 127;
printf("==============================\n");
if( !base ) return 127;
printf("==============================\n");
- printf("
%i %p "
, appArgc, appArgv);
+ printf("
[DEBUG %i] %i %p ", giSyscall_ClientID
, appArgc, appArgv);
for(i = 0; i < appArgc; i ++)
printf("\"%s\" ", appArgv[i]);
printf("\n");
for(i = 0; i < appArgc; i ++)
printf("\"%s\" ", appArgv[i]);
printf("\n");
- printf("
appMain = %p\n"
, appMain);
+ printf("
[DEBUG %i] appMain = %p\n", giSyscall_ClientID
, appMain);
#if 0
__asm__ __volatile__ (
"push %0;\n\t"
#if 0
__asm__ __volatile__ (
"push %0;\n\t"
@@
-102,7
+105,7
@@
void CallUser(void *Entry, int argc, char *argv[], char **envp)
void Warning(const char *Format, ...)
{
va_list args;
void Warning(const char *Format, ...)
{
va_list args;
- printf("
Warning: "
);
+ printf("
[WARN %i] ", giSyscall_ClientID
);
va_start(args, Format);
vprintf(Format, args);
va_end(args);
va_start(args, Format);
vprintf(Format, args);
va_end(args);
@@
-112,7
+115,17
@@
void Warning(const char *Format, ...)
void Notice(const char *Format, ...)
{
va_list args;
void Notice(const char *Format, ...)
{
va_list args;
- printf("Notice: ");
+ printf("[NOTICE %i] ", giSyscall_ClientID);
+ va_start(args, Format);
+ vprintf(Format, args);
+ va_end(args);
+ printf("\n");
+}
+
+void Debug(const char *Format, ...)
+{
+ va_list args;
+ printf("[DEBUG %i] ", giSyscall_ClientID);
va_start(args, Format);
vprintf(Format, args);
va_end(args);
va_start(args, Format);
vprintf(Format, args);
va_end(args);
diff --git
a/AcessNative/ld-acess_src/request.c
b/AcessNative/ld-acess_src/request.c
index
8655377
..
b8a3239
100644
(file)
--- a/
AcessNative/ld-acess_src/request.c
+++ b/
AcessNative/ld-acess_src/request.c
@@
-89,7
+89,8
@@
int _InitSyscalls()
#if USE_TCP
if( connect(gSocket, (struct sockaddr *)&gSyscall_ServerAddr, sizeof(struct sockaddr_in)) < 0 )
{
#if USE_TCP
if( connect(gSocket, (struct sockaddr *)&gSyscall_ServerAddr, sizeof(struct sockaddr_in)) < 0 )
{
- fprintf(stderr, "Cannot connect to server (localhost:%i)\n", SERVER_PORT);
+ fprintf(stderr, "[ERROR -] Cannot connect to server (localhost:%i)\n", SERVER_PORT);
+ fprintf(stderr, "[ERROR -] ", giSyscall_ClientID);
perror("_InitSyscalls");
#if __WIN32__
closesocket(gSocket);
perror("_InitSyscalls");
#if __WIN32__
closesocket(gSocket);
@@
-119,6
+120,7
@@
int _InitSyscalls()
#if !USE_TCP
// Ask server for a client ID
#if !USE_TCP
// Ask server for a client ID
+ if( !giSyscall_ClientID )
{
tRequestHeader req;
int len;
{
tRequestHeader req;
int len;
@@
-210,6
+212,7
@@
void SendData(void *Data, int Length)
#endif
if( len != Length ) {
#endif
if( len != Length ) {
+ fprintf(stderr, "[ERROR %i] ", giSyscall_ClientID);
perror("SendData");
exit(-1);
}
perror("SendData");
exit(-1);
}
@@
-236,12
+239,13
@@
int ReadData(void *Dest, int MaxLength, int Timeout)
ret = select(gSocket+1, &fds, NULL, NULL, timeoutPtr);
if( ret == -1 ) {
ret = select(gSocket+1, &fds, NULL, NULL, timeoutPtr);
if( ret == -1 ) {
+ fprintf(stderr, "[ERROR %i] ", giSyscall_ClientID);
perror("ReadData - select");
exit(-1);
}
if( !ret ) {
perror("ReadData - select");
exit(-1);
}
if( !ret ) {
- printf("
Timeout reading from socket\n"
);
+ printf("
[ERROR %i] Timeout reading from socket\n", giSyscall_ClientID
);
return 0; // Timeout
}
return 0; // Timeout
}
@@
-252,6
+256,7
@@
int ReadData(void *Dest, int MaxLength, int Timeout)
#endif
if( ret < 0 ) {
#endif
if( ret < 0 ) {
+ fprintf(stderr, "[ERROR %i] ", giSyscall_ClientID);
perror("ReadData");
exit(-1);
}
perror("ReadData");
exit(-1);
}
diff --git
a/AcessNative/ld-acess_src/syscalls.c
b/AcessNative/ld-acess_src/syscalls.c
index
e3c78df
..
5460956
100644
(file)
--- a/
AcessNative/ld-acess_src/syscalls.c
+++ b/
AcessNative/ld-acess_src/syscalls.c
@@
-12,7
+12,7
@@
#include "request.h"
#include "../syscalls.h"
#include "request.h"
#include "../syscalls.h"
-#define DEBUG(
x...) printf(
x)
+#define DEBUG(
str, x...) Debug(str,
x)
#define NATIVE_FILE_MASK 0x40000000
#define MAX_FPS 16
#define NATIVE_FILE_MASK 0x40000000
#define MAX_FPS 16
@@
-59,7
+59,7
@@
const char *ReadEntry(tRequestValue *Dest, void *DataDest, void **PtrDest, const
case 'i':
if( direction != 1 ) {
case 'i':
if( direction != 1 ) {
-
fprintf(stderr, "ReadEntry: Recieving an integer is not defined\n
");
+
Warning("ReadEntry: Recieving an integer is not defined
");
return NULL;
}
return NULL;
}
@@
-271,7
+271,7
@@
uint64_t _Syscall(int SyscallID, const char *ArgTypes, ...)
free( req );
free( retPtrs );
free( req );
free( retPtrs );
- DEBUG(": %llx
\n
", retValue);
+ DEBUG(": %llx", retValue);
return retValue;
}
return retValue;
}
@@
-349,6
+349,7
@@
uint64_t acess_tell(int FD) {
int acess_ioctl(int fd, int id, void *data) {
// NOTE: 1024 byte size is a hack
int acess_ioctl(int fd, int id, void *data) {
// NOTE: 1024 byte size is a hack
+ DEBUG("ioctl(%i, %i, %p)", fd, id, data);
return _Syscall(SYS_IOCTL, ">i >i ?d", fd, id, 1024, data);
}
int acess_finfo(int fd, t_sysFInfo *info, int maxacls) {
return _Syscall(SYS_IOCTL, ">i >i ?d", fd, id, 1024, data);
}
int acess_finfo(int fd, t_sysFInfo *info, int maxacls) {
@@
-359,9
+360,21
@@
int acess_finfo(int fd, t_sysFInfo *info, int maxacls) {
}
int acess_readdir(int fd, char *dest) {
}
int acess_readdir(int fd, char *dest) {
+ DEBUG("readdir(%i, %p)", fd, dest);
return _Syscall(SYS_READDIR, ">i <d", fd, 256, dest);
}
return _Syscall(SYS_READDIR, ">i <d", fd, 256, dest);
}
+int acess_select(int nfds, fd_set *read, fd_set *write, fd_set *error, time_t *timeout)
+{
+ DEBUG("select(%i, %p, %p, %p, %p)", nfds, read, write, error, timeout);
+ return _Syscall(SYS_SELECT, ">i ?d ?d ?d >d", nfds,
+ read ? (nfds+7)/8 : 0, read,
+ write ? (nfds+7)/8 : 0, write,
+ error ? (nfds+7)/8 : 0, error,
+ sizeof(*timeout), timeout
+ );
+}
+
int acess__SysOpenChild(int fd, char *name, int flags) {
return _Syscall(SYS_OPENCHILD, ">i >s >i", fd, name, flags);
}
int acess__SysOpenChild(int fd, char *name, int flags) {
return _Syscall(SYS_OPENCHILD, ">i >s >i", fd, name, flags);
}
@@
-408,7
+421,7
@@
int acess_clone(int flags, void *stack)
return 0;
}
return 0;
}
- //
TODO:
Return the acess TID instead
+ // Return the acess TID instead
return kernel_tid;
}
else
return kernel_tid;
}
else
@@
-422,11
+435,11
@@
int acess_execve(char *path, char **argv, char **envp)
{
int i, argc;
{
int i, argc;
-
printf("acess_execve: (path='%s', argv=%p, envp=%p)\n
", path, argv, envp);
+
DEBUG("acess_execve: (path='%s', argv=%p, envp=%p)
", path, argv, envp);
// Get argument count
for( argc = 0; argv[argc]; argc ++ ) ;
// Get argument count
for( argc = 0; argv[argc]; argc ++ ) ;
-
printf(" acess_execve: argc = %i\n
", argc);
+
DEBUG(" acess_execve: argc = %i
", argc);
char *new_argv[5+argc+1];
char key[11];
char *new_argv[5+argc+1];
char key[11];
@@
-470,6
+483,19
@@
int acess_setgid(int ID)
return _Syscall(SYS_SETGID, ">i", ID);
}
return _Syscall(SYS_SETGID, ">i", ID);
}
+int acess_SysSendMessage(int DestTID, int Length, void *Data)
+{
+ return _Syscall(SYS_SENDMSG, ">i >d", DestTID, Length, Data);
+}
+
+int acess_SysGetMessage(int *SourceTID, void *Data)
+{
+ return _Syscall(SYS_GETMSG, "<d <d",
+ SourceTID ? sizeof(int) : 0, SourceTID,
+ Data ? 4096 : 0, Data
+ );
+}
+
// --- Logging
void acess__SysDebug(const char *Format, ...)
{
// --- Logging
void acess__SysDebug(const char *Format, ...)
{
@@
-477,7
+503,7
@@
void acess__SysDebug(const char *Format, ...)
va_start(args, Format);
va_start(args, Format);
- printf("[_SysDebug
] "
);
+ printf("[_SysDebug
%i]", giSyscall_ClientID
);
vprintf(Format, args);
printf("\n");
vprintf(Format, args);
printf("\n");
@@
-486,6
+512,7
@@
void acess__SysDebug(const char *Format, ...)
void acess__exit(int Status)
{
void acess__exit(int Status)
{
+ DEBUG("_exit(%i)", Status);
_Syscall(SYS_EXIT, ">i", Status);
exit(Status);
}
_Syscall(SYS_EXIT, ">i", Status);
exit(Status);
}
@@
-507,6
+534,7
@@
const tSym caBuiltinSymbols[] = {
DEFSYM(ioctl),
DEFSYM(finfo),
DEFSYM(readdir),
DEFSYM(ioctl),
DEFSYM(finfo),
DEFSYM(readdir),
+ DEFSYM(select),
DEFSYM(_SysOpenChild),
DEFSYM(_SysGetACL),
DEFSYM(_SysMount),
DEFSYM(_SysOpenChild),
DEFSYM(_SysGetACL),
DEFSYM(_SysMount),
@@
-518,6
+546,9
@@
const tSym caBuiltinSymbols[] = {
DEFSYM(waittid),
DEFSYM(setuid),
DEFSYM(setgid),
DEFSYM(waittid),
DEFSYM(setuid),
DEFSYM(setgid),
+
+ DEFSYM(SysSendMessage),
+ DEFSYM(SysGetMessage),
DEFSYM(_SysAllocate),
DEFSYM(_SysDebug),
DEFSYM(_SysAllocate),
DEFSYM(_SysDebug),
diff --git
a/AcessNative/syscalls.h
b/AcessNative/syscalls.h
index
b75a93d
..
078944d
100644
(file)
--- a/
AcessNative/syscalls.h
+++ b/
AcessNative/syscalls.h
@@
-56,6
+56,9
@@
enum eSyscalls {
// IPC
SYS_SLEEP,
SYS_FORK,
// IPC
SYS_SLEEP,
SYS_FORK,
+ SYS_SENDMSG,
+ SYS_GETMSG,
+ SYS_SELECT,
N_SYSCALLS
};
N_SYSCALLS
};
UCC
git Repository :: git.ucc.asn.au