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 unsigned int size_t;
32 typedef Uint64 size_t;
34 typedef volatile int tSpinlock;
35 #define IS_LOCKED(lockptr) (!!(*(tSpinlock*)lockptr))
36 #define LOCK(lockptr) do {int v=1;\
38 __asm__ __volatile__("lock xchgl %%eax, (%%rdi)":"=a"(v):"a"(1),"D"(lockptr));\
40 #define RELEASE(lockptr) __asm__ __volatile__("lock andl $0, (%%rdi)"::"D"(lockptr));
41 #define HALT() __asm__ __volatile__ ("hlt")
43 // Systemcall Registers
44 // TODO: Fix this structure
45 typedef struct sSyscallRegs
47 Uint Arg4, Arg5; // RDI, RSI
49 Uint Resvd2[1]; // Kernel RSP
56 Uint RetHi; // High 64 bits of ret
63 Uint Resvd3[5]; // Int, Err, rip, CS, ...
64 Uint StackPointer; // RSP