2 * Acess2 x86-64 Architecure Module
3 * - By John Hodge (thePowersGang)
9 #define USER_MAX 0x00007FFF##FFFFF000
10 #define KERNEL_BASE 0xFFFFFFFF##80000000
12 #define PAGE_SIZE 0x1000
18 #define STACKED_LOCKS 2 // 0: No, 1: Per-CPU, 2: Per-Thread
19 #define LOCK_DISABLE_INTS 0
21 #define INVLPTR ((void*)0x0FFFFFFFFFFFFFFFULL)
23 //#define INT_MAX 0x7FFFFFFF
24 //#define UINT_MAX 0xFFFFFFFF
27 typedef signed char Sint8;
28 typedef unsigned char Uint8;
29 typedef signed short Sint16;
30 typedef unsigned short Uint16;
31 typedef signed int Sint32;
32 typedef unsigned int Uint32;
34 typedef signed long int Sint64;
35 typedef unsigned long int Uint64;
37 typedef signed long long int Sint64;
38 typedef unsigned long long int Uint64;
43 typedef Uint64 tPAddr;
44 typedef Uint64 tVAddr;
48 #define __ASM__ __asm__ __volatile__
54 #define HALT() __asm__ __volatile__ ("sti;\n\thlt")
56 * \brief Fire a magic breakpoint (bochs)
58 #define MAGIC_BREAK() __asm__ __volatile__ ("xchg %bx, %bx")
60 // Systemcall Registers
61 // TODO: Fix this structure
62 typedef struct sSyscallRegs
77 Uint StackPointer; // RSP
82 * \brief Short Spinlock structure
84 struct sShortSpinlock {
85 #if STACKED_LOCKS == 2
86 volatile void *Lock; //!< Lock value
88 volatile int Lock; //!< Lock value
92 int IF; //!< Interrupt state on call to SHORTLOCK
100 extern int IS_LOCKED(struct sShortSpinlock *Lock);
101 extern int CPU_HAS_LOCK(struct sShortSpinlock *Lock);
102 extern void SHORTLOCK(struct sShortSpinlock *Lock);
103 extern void SHORTREL(struct sShortSpinlock *Lock);
105 extern void Debug_PutCharDebug(char ch);
106 extern void Debug_PutStringDebug(const char *Str);
108 // TODO: Move this to acess.h
109 extern tPAddr MM_AllocateZero(tVAddr VAddr);