Rev 2444 | Rev 3902 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 2444 | Rev 3485 | ||
|---|---|---|---|
| Line 245... | Line 245... | ||
| 245 | : "=r" (v) |
245 | : "=r" (v) |
| 246 | ); |
246 | ); |
| 247 | return v; |
247 | return v; |
| 248 | } |
248 | } |
| 249 | 249 | ||
| - | 250 | /** Write to MSR */ |
|
| - | 251 | static inline void write_msr(uint32_t msr, uint64_t value) |
|
| - | 252 | { |
|
| - | 253 | asm volatile ("wrmsr" : : "c" (msr), "a" ((uint32_t)(value)), |
|
| - | 254 | "d" ((uint32_t)(value >> 32))); |
|
| - | 255 | } |
|
| - | 256 | ||
| - | 257 | static inline uint64_t read_msr(uint32_t msr) |
|
| - | 258 | { |
|
| - | 259 | uint32_t ax, dx; |
|
| - | 260 | ||
| - | 261 | asm volatile ("rdmsr" : "=a"(ax), "=d"(dx) : "c" (msr)); |
|
| - | 262 | return ((uint64_t)dx << 32) | ax; |
|
| - | 263 | } |
|
| - | 264 | ||
| - | 265 | ||
| 250 | /** Return base address of current stack |
266 | /** Return base address of current stack |
| 251 | * |
267 | * |
| 252 | * Return the base address of the current stack. |
268 | * Return the base address of the current stack. |
| 253 | * The stack is assumed to be STACK_SIZE bytes long. |
269 | * The stack is assumed to be STACK_SIZE bytes long. |
| 254 | * The stack must start on page boundary. |
270 | * The stack must start on page boundary. |