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 STACKED_LOCKS 0
14 #define LOCK_DISABLE_INTS 1
16 //#define INT_MAX 0x7FFFFFFF
17 //#define UINT_MAX 0xFFFFFFFF
20 typedef signed char Sint8;
21 typedef unsigned char Uint8;
22 typedef signed short Sint16;
23 typedef unsigned short Uint16;
24 typedef signed int Sint32;
25 typedef unsigned int Uint32;
27 typedef signed long int Sint64;
28 typedef unsigned long int Uint64;
30 typedef signed long long int Sint64;
31 typedef unsigned long long int Uint64;
36 typedef Uint64 tPAddr;
37 typedef Uint64 tVAddr;
39 typedef Uint64 size_t;
42 #define __ASM__ __asm__ __volatile__
48 #define HALT() __asm__ __volatile__ ("sti;\n\thlt")
50 * \brief Fire a magic breakpoint (bochs)
52 #define MAGIC_BREAK() __asm__ __volatile__ ("xchg %bx, %bx")
54 // Systemcall Registers
55 // TODO: Fix this structure
56 typedef struct sSyscallRegs
65 Uint Resvd1[2]; // Kernel RSP, RBP
70 Uint Resvd2[6]; // R10 - R15
71 Uint Resvd3[5]; // IntNum, ErrCode, RIP, CS, RFLAGS
73 Uint Resvd4[5]; // Int, Err, rip, CS, ...
74 Uint StackPointer; // RSP
79 * \brief Short Spinlock structure
81 struct sShortSpinlock {
82 #if STACKED_LOCKS == 2
83 volatile void *Lock; //!< Lock value
85 volatile int Lock; //!< Lock value
89 int IF; //!< Interrupt state on call to SHORTLOCK
97 extern int IS_LOCKED(struct sShortSpinlock *Lock);
98 extern int CPU_HAS_LOCK(struct sShortSpinlock *Lock);
99 extern void SHORTLOCK(struct sShortSpinlock *Lock);
100 extern void SHORTREL(struct sShortSpinlock *Lock);