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