Merge branch 'lab3' into lab4
This commit is contained in:
19
inc/x86.h
19
inc/x86.h
@@ -3,6 +3,10 @@
|
||||
|
||||
#include <inc/types.h>
|
||||
|
||||
#define MSR_IA32_SYSENTER_CS 0x174
|
||||
#define MSR_IA32_SYSENTER_EIP 0x176
|
||||
#define MSR_IA32_SYSENTER_ESP 0x175
|
||||
|
||||
static inline void
|
||||
breakpoint(void)
|
||||
{
|
||||
@@ -261,4 +265,19 @@ xchg(volatile uint32_t *addr, uint32_t newval)
|
||||
return result;
|
||||
}
|
||||
|
||||
static inline void
|
||||
write_msr(uint32_t reg, uint32_t low, uint32_t high) {
|
||||
asm volatile("wrmsr\n\t"
|
||||
:: "c" (reg), "a" (low), "d" (high));
|
||||
}
|
||||
|
||||
static inline void
|
||||
read_msr(uint32_t reg, uint32_t* low, uint32_t* high) {
|
||||
uint32_t eax, edx;
|
||||
asm volatile("rdmsr\n\t"
|
||||
: "=a" (eax), "=d" (edx) : "c" (reg));
|
||||
*low = eax;
|
||||
*high = edx;
|
||||
}
|
||||
|
||||
#endif /* !JOS_INC_X86_H */
|
||||
|
||||
Reference in New Issue
Block a user