delint for clang
[AROS.git] / arch / x86_64-pc / kernel / kernel_cpu.h
blob9a41dd542f66b230cdc3993ff1091e7524139bd1
1 /* CPU-specific definitions for x86-64 */
3 #ifndef KERNEL_CPU_H_
4 #define KERNEL_CPU_H_
6 #include <aros/x86_64/cpucontext.h>
8 #include "segments.h"
11 * We handle all 255 exception vectors. However vectors starting from 0x20
12 * are hardware IRQs which are handled separately. So - 32 raw exceptions.
14 #define EXCEPTIONS_COUNT 32
16 /* We use native context format, no conversion needed */
17 #define regs_t struct ExceptionContext
18 /* There are no private add-ons */
19 #define AROSCPUContext ExceptionContext
21 /* We have no VBlank emulation */
22 #define NO_VBLANK_EMU
24 /* User/supervisor mode switching */
25 #define cpumode_t __unused char
27 #define goSuper() 0
28 #define goUser()
29 #define goBack(mode)
31 /* A command to issue a syscall */
32 #define krnSysCall(num) asm volatile("int $0x80"::"a"(num):"memory")
34 #define IN_USER_MODE \
35 ({ \
36 short __value; \
37 __asm__ __volatile__ ("mov %%cs,%%ax":"=a"(__value)); \
38 (__value & 0x03); \
41 #define PRINT_CPUCONTEXT(regs) \
42 bug("[Kernel] Flags=0x%08X\n", regs->Flags); \
43 bug("[Kernel] stack=%04x:%012x rflags=%016x ip=%04x:%012x ds=0x%04X\n", \
44 regs->ss, regs->rsp, regs->rflags, regs->cs, regs->rip, regs->ds); \
45 bug("[Kernel] rax=%016lx rbx=%016lx rcx=%016lx rdx=%016lx\n", regs->rax, regs->rbx, regs->rcx, regs->rdx); \
46 bug("[Kernel] rsi=%016lx rdi=%016lx rbp=%016lx rsp=%016lx\n", regs->rsi, regs->rdi, regs->rbp, regs->rsp); \
47 bug("[Kernel] r08=%016lx r09=%016lx r10=%016lx r11=%016lx\n", regs->r8, regs->r9, regs->r10, regs->r11); \
48 bug("[Kernel] r12=%016lx r13=%016lx r14=%016lx r15=%016lx\n", regs->r12, regs->r13, regs->r14, regs->r15);
50 #define SP(regs) regs->rsp
52 #endif