5 Copyright © 1995-2012, The AROS Development Team. All rights reserved.
8 Desc: assembler-level specific definitions for x86 CPU
14 /* This file is very very incomplete :) */
16 #define HALT asm volatile("hlt")
18 /* Table descriptor used for lgdt and lidt commands */
23 } __attribute__((packed
));
25 /* Segment descriptor in the GDT */
31 unsigned type
:5, dpl
:2, p
:1;
32 unsigned limit_high
:4, avl
:1, l
:1, d
:1, g
:1;
34 } __attribute__((packed
));
37 * TaskStateStructure, defined only in matter of making life (setup)
42 unsigned int link
, /* link to previous task */
43 ssp
, /* Supervisor Stack Pointer */
44 ssp_seg
, /* SSP descriptor */
45 t0
,t1
, /* Stack for CPL1 code */
46 t2
,t3
, /* Stack for CPL2 code */
47 cr3
, /* used in paging */
48 eip
, /* Instruction pointer */
49 eflags
, /* Flags for given task */
50 r0
,r1
,r2
,r3
, /* 8 general purpouse registers */
52 es
,cs
,ss
,ds
,fs
,gs
, /* segment descriptors */
53 ldt
; /* LocalDescriptorTable */
54 unsigned short trap
,iomap
; /* trap flag and iomap pointer */
58 ({ long val; asm volatile("mov %%" #reg ",%0":"=r"(val)); val; })
60 #define wrcr(reg, val) \
61 do { asm volatile("mov %0,%%" #reg::"r"(val)); } while(0)
63 static inline void __attribute__((always_inline
)) rdmsr(uint32_t msr_no
, uint32_t *ret_lo
, uint32_t *ret_hi
)
67 asm volatile("rdmsr":"=a"(ret1
),"=d"(ret2
):"c"(msr_no
));
72 static inline uint32_t __attribute__((always_inline
)) rdmsri(uint32_t msr_no
)
76 asm volatile("rdmsr":"=a"(ret
):"c"(msr_no
));