extern void exit(int) __attribute__ ((noreturn));
extern int printf(const char *, ...);
extern int fprintf(FILE *,const char *, ...);
extern void exit(int) __attribute__ ((noreturn));
extern int printf(const char *, ...);
extern int fprintf(FILE *,const char *, ...);
extern void Debug(const char *Format, ...);
extern int AllocateMemory(uintptr_t VirtAddr, size_t ByteCount);
// === CONSTANTS ===
#define NATIVE_FILE_MASK 0x40000000
extern void Debug(const char *Format, ...);
extern int AllocateMemory(uintptr_t VirtAddr, size_t ByteCount);
// === CONSTANTS ===
#define NATIVE_FILE_MASK 0x40000000
size_t acess_read(int FD, void *Dest, size_t Bytes) {
if(FD & NATIVE_FILE_MASK)
return native_read(FD & (NATIVE_FILE_MASK-1), Dest, Bytes);
size_t acess_read(int FD, void *Dest, size_t Bytes) {
if(FD & NATIVE_FILE_MASK)
return native_read(FD & (NATIVE_FILE_MASK-1), Dest, Bytes);
- DEBUG("read(0x%x, 0x%x, *%p)", FD, Bytes, Dest);
+// if( FD > 2 )
+ DEBUG("read(0x%x, 0x%x, *%p)", FD, Bytes, Dest);
return _Syscall(SYS_READ, ">i >i <d", FD, Bytes, Bytes, Dest);
}
size_t acess_write(int FD, const void *Src, size_t Bytes) {
if(FD & NATIVE_FILE_MASK)
return native_write(FD & (NATIVE_FILE_MASK-1), Src, Bytes);
return _Syscall(SYS_READ, ">i >i <d", FD, Bytes, Bytes, Dest);
}
size_t acess_write(int FD, const void *Src, size_t Bytes) {
if(FD & NATIVE_FILE_MASK)
return native_write(FD & (NATIVE_FILE_MASK-1), Src, Bytes);
- DEBUG("write(0x%x, 0x%x, %p\"%.*s\")", FD, Bytes, Src, Bytes, (char*)Src);
+// if( FD > 2 )
+ 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);
}
return _Syscall(SYS_WRITE, ">i >i >d", FD, Bytes, Bytes, Src);
}
uint64_t acess_tell(int FD) {
if(FD & NATIVE_FILE_MASK)
return native_tell( FD & (NATIVE_FILE_MASK-1) );
uint64_t acess_tell(int FD) {
if(FD & NATIVE_FILE_MASK)
return native_tell( FD & (NATIVE_FILE_MASK-1) );
return _Syscall(SYS_TELL, ">i", FD);
}
int acess_ioctl(int fd, int id, void *data) {
int len;
return _Syscall(SYS_TELL, ">i", FD);
}
int acess_ioctl(int fd, int id, void *data) {
int len;
DEBUG("ioctl(%i, %i, %p)", fd, id, data);
DEBUG("ioctl(%i, %i, %p)", fd, id, data);
-int acess_readdir(int fd, char *dest) {
- DEBUG("readdir(%i, %p)", fd, dest);
+int acess_SysReadDir(int fd, char *dest) {
+ DEBUG("SysReadDir(%i, %p)", fd, dest);
return _Syscall(SYS_READDIR, ">i <d", fd, 256, dest);
}
return _Syscall(SYS_READDIR, ">i <d", fd, 256, dest);
}
return _Syscall(SYS_OPENCHILD, ">i >s >i", fd, name, flags);
}
int acess__SysGetACL(int fd, t_sysACL *dest) {
return _Syscall(SYS_OPENCHILD, ">i >s >i", fd, name, flags);
}
int acess__SysGetACL(int fd, t_sysACL *dest) {
return _Syscall(SYS_GETACL, ">i <d", fd, sizeof(t_sysACL), dest);
}
int acess__SysMount(const char *Device, const char *Directory, const char *Type, const char *Options) {
return _Syscall(SYS_GETACL, ">i <d", fd, sizeof(t_sysACL), dest);
}
int acess__SysMount(const char *Device, const char *Directory, const char *Type, const char *Options) {
+ DEBUG("%s('%s', '%s', '%s', '%s')", __func__, Device, Directory, Type, Options);
return _Syscall(SYS_MOUNT, ">s >s >s >s", Device, Directory, Type, Options);
}
return _Syscall(SYS_MOUNT, ">s >s >s >s", Device, Directory, Type, Options);
}
// --- Process Management ---
int acess_clone(int flags, void *stack)
{
// --- Process Management ---
int acess_clone(int flags, void *stack)
{
newID = _Syscall(SYS_AN_FORK, "<d", sizeof(int), &kernel_tid);
ret = fork();
newID = _Syscall(SYS_AN_FORK, "<d", sizeof(int), &kernel_tid);
ret = fork();
for( argc = 0; argv[argc]; argc ++ ) ;
DEBUG(" acess_execve: argc = %i", argc);
for( argc = 0; argv[argc]; argc ++ ) ;
DEBUG(" acess_execve: argc = %i", argc);
return _Syscall(SYS_WAITTID, ">i <d", TID, sizeof(int), &ExitStatus);
}
return _Syscall(SYS_WAITTID, ">i <d", TID, sizeof(int), &ExitStatus);
}
return _Syscall(SYS_SENDMSG, ">i >d", DestTID, Length, Data);
}
return _Syscall(SYS_SENDMSG, ">i >d", DestTID, Length, Data);
}
-// static __thread int lastlen = 1024;
- int lastlen;
-
- lastlen = _Syscall(SYS_GETMSG, "<d <d",
- SourceTID ? sizeof(int) : 0, SourceTID,
- Data ? 1024 : 0, Data
+ DEBUG("%s(%p, %p)", __func__, SourceTID, Data);
+ return _Syscall(SYS_GETMSG, "<d <d",
+ SourceTID ? sizeof(uint32_t) : 0, SourceTID,
+ BufLen, Data