-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);
- return _Syscall(SYS_WRITE, ">i >i >d", FD, Bytes, Bytes, Src);
-}
-
-int acess_seek(int FD, int64_t Ofs, int Dir) {
- if(FD & NATIVE_FILE_MASK) {
- switch(Dir) {
- case ACESS_SEEK_SET: Dir = SEEK_SET; break;
- default:
- case ACESS_SEEK_CUR: Dir = SEEK_CUR; break;
- case ACESS_SEEK_END: Dir = SEEK_END; break;
- }
- return fseek( gaSyscall_LocalFPs[FD & (NATIVE_FILE_MASK-1)], Ofs, Dir );
- }
- DEBUG("seek(0x%x, 0x%llx, %i)", FD, Ofs, Dir);
- return _Syscall(SYS_SEEK, ">i >I >i", FD, Ofs, Dir);
-}
-
-uint64_t acess_tell(int FD) {
- if(FD & NATIVE_FILE_MASK)
- return ftell( gaSyscall_LocalFPs[FD & (NATIVE_FILE_MASK-1)] );
- return _Syscall(SYS_TELL, ">i", FD);
-}
-
-int acess_ioctl(int fd, int id, void *data) {
- // NOTE: 1024 byte size is a hack
- return _Syscall(SYS_IOCTL, ">i >i ?d", fd, id, 1024, data);
-}
-int acess_finfo(int fd, t_sysFInfo *info, int maxacls) {
- return _Syscall(SYS_FINFO, ">i <d >i",
- fd,
- sizeof(t_sysFInfo)+maxacls*sizeof(t_sysACL), info,
- maxacls);
-}
-
-int acess_readdir(int fd, char *dest) {
- return _Syscall(SYS_READDIR, ">i <d", fd, 256, dest);
-}
-
-int acess__SysOpenChild(int fd, char *name, int flags) {
- return _Syscall(SYS_OPENCHILD, ">i >s >i", fd, name, flags);
-}
-
-int acess__SysGetACL(int fd, t_sysACL *dest) {
- return _Syscall(SYS_GETACL, "<i >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_MOUNT, ">s >s >s >s", Device, Directory, Type, Options);
-}
-
-
-// --- Error Handler
-int acess__SysSetFaultHandler(int (*Handler)(int)) {
- printf("TODO: Set fault handler (asked to set to %p)\n", Handler);
- return 0;
-}
-
-// --- Memory Management ---
-uint64_t acess__SysAllocate(uint vaddr)