2 * Acess2 x86-64 Architecure Module
3 * - By John Hodge (thePowersGang)
9 #define KERNEL_BASE 0xFFFFFFFF##80000000
11 #define PAGE_SIZE 0x1000
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
73 Uint StackPointer; // RSP
78 * \brief Short Spinlock structure
80 struct sShortSpinlock {
81 #if STACKED_LOCKS == 2
82 volatile void *Lock; //!< Lock value
84 volatile int Lock; //!< Lock value
88 int IF; //!< Interrupt state on call to SHORTLOCK
96 extern int IS_LOCKED(struct sShortSpinlock *Lock);
97 extern int CPU_HAS_LOCK(struct sShortSpinlock *Lock);
98 extern void SHORTLOCK(struct sShortSpinlock *Lock);
99 extern void SHORTREL(struct sShortSpinlock *Lock);
101 extern void Debug_PutCharDebug(char ch);
102 extern void Debug_PutStringDebug(const char *Str);