2 * Acess2 x86-64 Architecure Module
3 * - By John Hodge (thePowersGang)
9 //#define KERNEL_BASE 0xFFFF8000##00000000
10 #define KERNEL_BASE 0xFFFFFFFF##80000000
13 //#define INT_MAX 0x7FFFFFFF
14 //#define UINT_MAX 0xFFFFFFFF
17 typedef signed char Sint8;
18 typedef unsigned char Uint8;
19 typedef signed short Sint16;
20 typedef unsigned short Uint16;
21 typedef signed int Sint32;
22 typedef unsigned int Uint32;
24 typedef signed long int Sint64;
25 typedef unsigned long int Uint64;
27 typedef signed long long int Sint64;
28 typedef unsigned long long int Uint64;
33 typedef Uint64 tPAddr;
34 typedef Uint64 tVAddr;
36 typedef Uint64 size_t;
38 typedef volatile int tSpinlock;
39 #define IS_LOCKED(lockptr) (!!(*(tSpinlock*)lockptr))
40 #define _LOCK(lockptr,action) do {int v=1;\
42 __asm__ __volatile__("lock xchgl %0, (%2)":"=r"(v):"r"(1),"r"(lockptr));\
45 #define TIGHTLOCK(lockptr) _LOCK(lockptr, __asm__ __volatile__ ("hlt"));
46 #define LOCK(lockptr) _LOCK(lockptr, Threads_Yield());
47 #define RELEASE(lockptr) __asm__ __volatile__("lock andl $0, (%0)"::"r"(lockptr));
48 #define HALT() __asm__ __volatile__ ("hlt")
50 // Systemcall Registers
51 // TODO: Fix this structure
52 typedef struct sSyscallRegs
61 Uint Resvd1[2]; // Kernel RSP, RBP
66 Uint Resvd2[6]; // R10 - R15
67 Uint Resvd3[5]; // IntNum, ErrCode, RIP, CS, RFLAGS
69 Uint Resvd4[5]; // Int, Err, rip, CS, ...
70 Uint StackPointer; // RSP