|
Revision 2057, 1.9 KB
(checked in by mwhitworth, 3 years ago)
|
|
Add SYS_SAVE_BASE, fix condition in SysGetCall.
|
| Line | |
|---|
| 1 | |
|---|
| 2 | |
|---|
| 3 | |
|---|
| 4 | |
|---|
| 5 | |
|---|
| 6 | |
|---|
| 7 | |
|---|
| 8 | |
|---|
| 9 | |
|---|
| 10 | |
|---|
| 11 | |
|---|
| 12 | |
|---|
| 13 | |
|---|
| 14 | |
|---|
| 15 | |
|---|
| 16 | |
|---|
| 17 | |
|---|
| 18 | |
|---|
| 19 | #ifndef SYS_H |
|---|
| 20 | #define SYS_H |
|---|
| 21 | |
|---|
| 22 | #include <typedefs.h> |
|---|
| 23 | #include <types.h> |
|---|
| 24 | |
|---|
| 25 | struct SysCall |
|---|
| 26 | { |
|---|
| 27 | DWORD addr; |
|---|
| 28 | DWORD numBytes; |
|---|
| 29 | }; |
|---|
| 30 | |
|---|
| 31 | |
|---|
| 32 | |
|---|
| 33 | #define SYS_FS_BASE 0 |
|---|
| 34 | #define SYS_MMAP_BASE 25 |
|---|
| 35 | #define SYS_SHMEM_BASE 29 |
|---|
| 36 | #define SYS_THREAD_BASE 33 |
|---|
| 37 | #define SYS_LOAD_BASE 38 |
|---|
| 38 | #define SYS_PROCESS_BASE 39 |
|---|
| 39 | |
|---|
| 40 | #define SYS_SCHED_BASE 42 |
|---|
| 41 | #define SYS_TIME_BASE 43 |
|---|
| 42 | #define NET_SYS_BASE 44 |
|---|
| 43 | #define SYS_MODULE_BASE 53 |
|---|
| 44 | #define SYS_CONFIG_BASE 55 |
|---|
| 45 | #define SYS_SHUTDOWN_BASE 57 |
|---|
| 46 | #define SYS_IO_BASE 58 |
|---|
| 47 | |
|---|
| 48 | #define SYS_TLS_BASE 59 |
|---|
| 49 | #define SYS_SAVE_BASE 60 |
|---|
| 50 | #define SYSCALL_MAX 61 |
|---|
| 51 | |
|---|
| 52 | #define SysEntry(addr, bytes) { (DWORD)addr, bytes } |
|---|
| 53 | #define SysEntryEnd() SysEntry(0, 0) |
|---|
| 54 | |
|---|
| 55 | void SysRegisterCall(int index, struct SysCall* call); |
|---|
| 56 | void SysRegisterRange(int index, struct SysCall* calls); |
|---|
| 57 | |
|---|
| 58 | extern struct SysCall sysCallTable[SYSCALL_MAX]; |
|---|
| 59 | |
|---|
| 60 | __attribute__((fastcall)) |
|---|
| 61 | static inline addr_t SysGetCall(DWORD index, DWORD argBytes) |
|---|
| 62 | { |
|---|
| 63 | if (index >= SYSCALL_MAX) |
|---|
| 64 | return 0; |
|---|
| 65 | |
|---|
| 66 | |
|---|
| 67 | |
|---|
| 68 | |
|---|
| 69 | |
|---|
| 70 | if (sysCallTable[index].numBytes < argBytes) |
|---|
| 71 | return 0; |
|---|
| 72 | |
|---|
| 73 | return sysCallTable[index].addr; |
|---|
| 74 | } |
|---|
| 75 | |
|---|
| 76 | #endif |
|---|