4 * arch/i386/include/arch.h
10 #define KERNEL_BASE 0xC0000000
13 // Allow nested spinlocks?
14 #define STACKED_LOCKS 2 // 0: No, 1: Per-CPU, 2: Per-Thread
15 #define LOCK_DISABLE_INTS 0
17 // - Processor/Machine Specific Features
18 #if ARCH != i386 && ARCH != i486 && ARCH != i586
19 # error "Unknown architecture '" #ARCH "'"
34 #define __ASM__ __asm__ __volatile__
38 * \brief Short Spinlock structure
40 struct sShortSpinlock {
41 #if STACKED_LOCKS == 2
42 volatile void *Lock; //!< Lock value
44 volatile int Lock; //!< Lock value
48 int IF; //!< Interrupt state on call to SHORTLOCK
59 #define HALT() __asm__ __volatile__ ("hlt")
61 * \brief Fire a magic breakpoint (bochs)
63 #define MAGIC_BREAK() __asm__ __volatile__ ("xchg %bx, %bx")
66 typedef unsigned int Uint; // Unsigned machine native integer
67 typedef unsigned char Uint8;
68 typedef unsigned short Uint16;
69 typedef unsigned long Uint32;
70 typedef unsigned long long Uint64;
71 typedef signed int Sint; // Signed Machine Native integer
72 typedef signed char Sint8;
73 typedef signed short Sint16;
74 typedef signed long Sint32;
75 typedef signed long long Sint64;
79 typedef Uint64 tPAddr;
80 typedef Uint32 tVAddr;
84 Uint edi, esi, ebp, kesp;
85 Uint ebx, edx, ecx, eax;
86 Uint int_num, err_code;
92 Uint Resvd1[4]; // GS, FS, ES, DS
93 Uint Arg4, Arg5; // EDI, ESI
95 Uint Resvd2[1]; // Kernel ESP
102 Uint RetHi; // High 32 bits of ret
109 Uint Resvd3[5]; // Int, Err, Eip, CS, ...
110 Uint StackPointer; // ESP
111 Uint Resvd4[1]; // SS
127 extern int IS_LOCKED(struct sShortSpinlock *Lock);
128 extern int CPU_HAS_LOCK(struct sShortSpinlock *Lock);
129 extern void SHORTLOCK(struct sShortSpinlock *Lock);
130 extern void SHORTREL(struct sShortSpinlock *Lock);
132 #endif // !defined(_ARCH_H_)