8 Efer_sce_flag = 0x00000001, // Syscall Enable Flag
9 Efer_lme_flag = 0x00000100, // Long Mode Enable Flag
10 Efer_nxe_flag = 0x00000800, // Not-executable
11 Efer_svme_flag = 0x00001000, // Enable SVM
15 IMPLEMENTATION[amd64]:
18 #include "std_macros.h"
20 IMPLEMENT static inline
21 Mword Proc::stack_pointer()
24 asm volatile ("mov %%rsp, %0 \n" : "=r"(sp) );
28 IMPLEMENT static inline
29 void Proc::stack_pointer(Mword sp)
31 asm volatile ("mov %0, %%rsp \n" : : "r"(sp) );
34 IMPLEMENT static inline
35 Mword Proc::program_counter ()
38 asm volatile ("call 1f ; 1: pop %0" : "=r"(pc));
42 IMPLEMENT static inline
45 asm volatile (" .byte 0xf3, 0x90 #pause \n" );
49 * The following simple ASM statements need the clobbering to work around
50 * a bug in (at least) gcc-3.2.x up to x == 1. The bug was fixed on
51 * Jan 9th 2003 (see gcc-bugs #9242 and #8832), so a released gcc-3.2.2
52 * won't have it. It's safe to take the clobber statements out after
53 * some time (e.g. when gcc-3.3 is used as a standard compiler).
56 IMPLEMENT static inline
59 asm volatile ("hlt" : : : "memory");
62 IMPLEMENT static inline
65 asm volatile ("cli" : : : "memory");
68 IMPLEMENT static inline
71 asm volatile ("sti" : : : "memory");
74 IMPLEMENT static inline
75 Proc::Status Proc::cli_save()
78 asm volatile ("pushfq \n\t"
81 : "=g"(ret) : /* no input */ : "memory");
85 IMPLEMENT static inline
86 void Proc::sti_restore(Status st)
89 asm volatile ("sti" : : : "memory");
92 IMPLEMENT static inline
93 Proc::Status Proc::interrupts()
96 asm volatile ("pushfq \n"
98 : "=g"(ret) : /* no input */ : "memory");
102 IMPLEMENT static inline
103 void Proc::irq_chance()
105 asm volatile ("nop; nop;" : : : "memory");
111 Proc::rdmsr(Unsigned32 msr)
115 asm volatile ("rdmsr" : "=a" (l), "=d" (h) : "c" (msr));
116 return (((Mword)h) << 32) | l;
121 Proc::wrmsr(Unsigned32 msr, Unsigned64 value)
123 asm volatile ("wrmsr" : :
124 "a" ((Unsigned32)value),
125 "d" ((Unsigned32)(value >> 32)),
132 { return rdmsr(0xc0000080); }
136 Proc::efer(Mword value)
137 { wrmsr(0xc0000080, value); }