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 2 // 0: No, 1: Per-CPU, 2: Per-Thread
14 #define LOCK_DISABLE_INTS 0
16 #define INVLPTR ((void*)0x0FFFFFFFFFFFFFFFULL)
18 //#define INT_MAX 0x7FFFFFFF
19 //#define UINT_MAX 0xFFFFFFFF
22 typedef signed char Sint8;
23 typedef unsigned char Uint8;
24 typedef signed short Sint16;
25 typedef unsigned short Uint16;
26 typedef signed int Sint32;
27 typedef unsigned int Uint32;
29 typedef signed long int Sint64;
30 typedef unsigned long int Uint64;
32 typedef signed long long int Sint64;
33 typedef unsigned long long int Uint64;
38 typedef Uint64 tPAddr;
39 typedef Uint64 tVAddr;
41 typedef Uint64 size_t;
44 #define __ASM__ __asm__ __volatile__
50 #define HALT() __asm__ __volatile__ ("sti;\n\thlt")
52 * \brief Fire a magic breakpoint (bochs)
54 #define MAGIC_BREAK() __asm__ __volatile__ ("xchg %bx, %bx")
56 // Systemcall Registers
57 // TODO: Fix this structure
58 typedef struct sSyscallRegs
67 Uint Resvd1[2]; // Kernel RSP, RBP
72 Uint Resvd2[6]; // R10 - R15
73 Uint Resvd3[5]; // IntNum, ErrCode, RIP, CS, RFLAGS
75 Uint Resvd4[5]; // Int, Err, rip, CS, ...
76 Uint StackPointer; // RSP
81 * \brief Short Spinlock structure
83 struct sShortSpinlock {
84 #if STACKED_LOCKS == 2
85 volatile void *Lock; //!< Lock value
87 volatile int Lock; //!< Lock value
91 int IF; //!< Interrupt state on call to SHORTLOCK
99 extern int IS_LOCKED(struct sShortSpinlock *Lock);
100 extern int CPU_HAS_LOCK(struct sShortSpinlock *Lock);
101 extern void SHORTLOCK(struct sShortSpinlock *Lock);
102 extern void SHORTREL(struct sShortSpinlock *Lock);
104 extern void Debug_PutCharDebug(char ch);
105 extern void Debug_PutStringDebug(const char *Str);