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
14 #define STACKED_LOCKS 2 // 0: No, 1: Per-CPU, 2: Per-Thread
15 #define LOCK_DISABLE_INTS 0
17 #define INVLPTR ((void*)0x0FFFFFFFFFFFFFFFULL)
19 //#define INT_MAX 0x7FFFFFFF
20 //#define UINT_MAX 0xFFFFFFFF
23 typedef signed char Sint8;
24 typedef unsigned char Uint8;
25 typedef signed short Sint16;
26 typedef unsigned short Uint16;
27 typedef signed int Sint32;
28 typedef unsigned int Uint32;
30 typedef signed long int Sint64;
31 typedef unsigned long int Uint64;
33 typedef signed long long int Sint64;
34 typedef unsigned long long int Uint64;
39 typedef Uint64 tPAddr;
40 typedef Uint64 tVAddr;
42 typedef Uint64 size_t;
45 #define __ASM__ __asm__ __volatile__
51 #define HALT() __asm__ __volatile__ ("sti;\n\thlt")
53 * \brief Fire a magic breakpoint (bochs)
55 #define MAGIC_BREAK() __asm__ __volatile__ ("xchg %bx, %bx")
57 // Systemcall Registers
58 // TODO: Fix this structure
59 typedef struct sSyscallRegs
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);
102 extern void Debug_PutCharDebug(char ch);
103 extern void Debug_PutStringDebug(const char *Str);
105 // TODO: Move this to acess.h
106 extern tPAddr MM_AllocateZero(tVAddr VAddr);