AcessNative - ld-acess - Woking on ELF loading
[tpg/acess2.git] / AcessNative / ld-acess.so_src / syscalls.c
1 /*
2  */
3 //#include <acess/sys.h>
4 #include <stdio.h>
5 #include <stdlib.h>
6 #include <stdint.h>
7 #include <stdarg.h>
8
9 // === IMPORTS ===
10 /**
11  * \param ArgTypes
12  *
13  * Whitespace is ignored
14  * >i:  Input Integer
15  * >I:  Input Long Integer (64-bits)
16  * >s:  Input String
17  * >d:  Input Buffer (Preceded by valid size)
18  * <I:  Output long integer
19  * <d:  Output Buffer (Preceded by valid size)
20  */
21 int _Syscall(const char *ArgTypes, ...)
22 {
23         // int  outBufSize = 0;
24         va_list args;
25         
26         va_start(args, ArgTypes);
27         va_end(args);
28         return 0;
29 }
30
31 int open(const char *Path, int Flags) {
32         return _Syscall(">s >i", Path, Flags);
33 }
34
35 void close(int FD) {
36         _Syscall(">i", FD);
37 }
38
39 size_t read(int FD, size_t Bytes, void *Dest) {
40         return _Syscall(">i >i <d", FD, Bytes, Bytes, Dest);
41 }
42
43 size_t write(int FD, size_t Bytes, void *Src) {
44         return _Syscall(">i >i >d", FD, Bytes, Bytes, Src);
45 }
46
47 uint64_t tell(int FD) {
48         uint64_t        ret;
49         _Syscall("<I >i", &ret, FD);
50         return ret;
51 }
52
53 int seek(int FD, uint64_t Ofs, int Dir) {
54         return _Syscall(">i >I >i", FD, Ofs, Dir);
55 }
56

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