2 * Acess2 x86-64 Architecure Module
3 * - By John Hodge (thePowersGang)
9 //#define KERNEL_BASE 0xFFFF8000##00000000
10 #define KERNEL_BASE 0xFFFFFFFF##80000000
14 typedef signed char Sint8;
15 typedef unsigned char Uint8;
16 typedef signed short Sint16;
17 typedef unsigned short Uint16;
18 typedef signed int Sint32;
19 typedef unsigned int Uint32;
21 typedef signed long int Sint64;
22 typedef unsigned long int Uint64;
24 typedef signed long long int Sint64;
25 typedef unsigned long long int Uint64;
30 typedef Uint64 tPAddr;
31 typedef Uint64 tVAddr;
33 typedef Uint64 size_t;
35 typedef volatile int tSpinlock;
36 #define IS_LOCKED(lockptr) (!!(*(tSpinlock*)lockptr))
37 #define LOCK(lockptr) do {int v=1;\
39 __asm__ __volatile__("lock xchgl %0, (%2)":"=r"(v):"r"(1),"r"(lockptr));\
41 #define RELEASE(lockptr) __asm__ __volatile__("lock andl $0, (%0)"::"r"(lockptr));
42 #define HALT() __asm__ __volatile__ ("hlt")
44 // Systemcall Registers
45 // TODO: Fix this structure
46 typedef struct sSyscallRegs
55 Uint Resvd1[2]; // Kernel RSP, RBP
60 Uint Resvd2[6]; // R10 - R15
61 Uint Resvd3[5]; // IntNum, ErrCode, RIP, CS, RFLAGS
63 Uint Resvd4[5]; // Int, Err, rip, CS, ...
64 Uint StackPointer; // RSP