28#ifndef _RTEMS_SCORE_CPU_ASM_H
29#define _RTEMS_SCORE_CPU_ASM_H
35static inline uint8_t inport_byte(uint16_t port)
38 __asm__
volatile (
"inb %1, %0"
44static inline uint16_t inport_word(uint16_t port)
47 __asm__
volatile (
"inw %1, %0"
53static inline uint32_t inport_long(uint16_t port)
56 __asm__
volatile (
"inl %1, %0"
62static inline void outport_byte(uint16_t port, uint8_t val)
64 __asm__
volatile (
"outb %0, %1" : :
"a" (val),
"Nd" (port) );
67static inline void outport_word(uint16_t port, uint16_t val)
69 __asm__
volatile (
"outw %0, %1" : :
"a" (val),
"Nd" (port) );
72static inline void outport_long(uint16_t port, uint32_t val)
74 __asm__
volatile (
"outl %0, %1" : :
"a" (val),
"Nd" (port) );
77static inline uint16_t amd64_get_cs(
void)
81 __asm__
volatile (
"movw %%cs, %0" :
"=r" (segment) :
"0" (segment) );
86static inline void amd64_set_cr3(uint64_t segment)
88 __asm__
volatile (
"movq %0, %%cr3" :
"=r" (segment) :
"0" (segment) );
91static inline void cpuid(
92 uint32_t
code, uint32_t *eax, uint32_t *ebx, uint32_t *ecx, uint32_t *edx
94 __asm__
volatile (
"cpuid"
95 :
"=a" (*eax),
"=b" (*ebx),
"=c" (*ecx),
"=d" (*edx)
99static inline uint64_t rdmsr(uint32_t msr)
102 __asm__
volatile (
"rdmsr" :
103 "=a" (low),
"=d" (high) :
105 return low | (uint64_t) high << 32;
108static inline void wrmsr(uint32_t msr, uint32_t low, uint32_t high)
110 __asm__
volatile (
"wrmsr" : :
111 "a" (low),
"d" (high),
"c" (msr) );
114static inline void amd64_enable_interrupts(
void)
116 __asm__
volatile (
"sti" );
119static inline void amd64_disable_interrupts(
void)
121 __asm__
volatile (
"cli" );
124static inline void stub_io_wait(
void)
131static inline void amd64_spinwait(
void)
133 __asm__
volatile(
"pause" : : :
"memory");
This header file provides basic definitions used by the API and the implementation.
Definition: inftrees.h:24