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;
46 typedef Uint64 size_t;
49 #define __ASM__ __asm__ __volatile__
55 #define HALT() __asm__ __volatile__ ("sti;\n\thlt")
57 * \brief Fire a magic breakpoint (bochs)
59 #define MAGIC_BREAK() __asm__ __volatile__ ("xchg %bx, %bx")
61 // Systemcall Registers
62 // TODO: Fix this structure
63 typedef struct sSyscallRegs
78 Uint StackPointer; // RSP
83 * \brief Short Spinlock structure
85 struct sShortSpinlock {
86 #if STACKED_LOCKS == 2
87 volatile void *Lock; //!< Lock value
89 volatile int Lock; //!< Lock value
93 int IF; //!< Interrupt state on call to SHORTLOCK
101 extern int IS_LOCKED(struct sShortSpinlock *Lock);
102 extern int CPU_HAS_LOCK(struct sShortSpinlock *Lock);
103 extern void SHORTLOCK(struct sShortSpinlock *Lock);
104 extern void SHORTREL(struct sShortSpinlock *Lock);
106 extern void Debug_PutCharDebug(char ch);
107 extern void Debug_PutStringDebug(const char *Str);
109 // TODO: Move this to acess.h
110 extern tPAddr MM_AllocateZero(tVAddr VAddr);