Data Structures | |||||||||||
struct | atomic | ||||||||||
The atomic variable structure. More... | |||||||||||
Defines | |||||||||||
#define | rdtsc(low, high) __asm__ __volatile__( "rdtsc" : "=a"(low), "=d"(high) ) | ||||||||||
Read the timestamp counter from the model-specific register and put it into two 32-bit registers. | |||||||||||
#define | rdtscll(val) __asm__ __volatile__( "rdtsc" : "=A"(val) ) | ||||||||||
Read the timestamp counter from the model-specific register and put it into eax:edx registers. This is a 64-bit value. | |||||||||||
#define | wmb() mb() | ||||||||||
A macro equivalent to the function mb(). | |||||||||||
#define | get_eip() ({ void *eip; __asm__("movl $1f,%0\n1:" : "=g" (eip)); eip; }) | ||||||||||
A macro that returns current instruction pointer. | |||||||||||
#define | in inportb | ||||||||||
A macro equivalent to the inportb(word port) function. | |||||||||||
#define | in16 inportw | ||||||||||
A macro equivalent to the inportw(word port) function. | |||||||||||
#define | in32 inportl | ||||||||||
A macro equivalent to the inportl(word port) function. | |||||||||||
#define | out outportb | ||||||||||
A macro equivalent to the outportb(word port, byte val) function. | |||||||||||
#define | out16 outportw | ||||||||||
A macro equivalent to the outportw(word port, word val) function. | |||||||||||
#define | out32 outportl | ||||||||||
A macro equivalent to the outportl(word port, dword val) function. | |||||||||||
#define | inportbm insb | ||||||||||
A macro equivalent to the insb(unsigned short port, void * addr, unsigned long count) function. | |||||||||||
#define | inportwm insw | ||||||||||
A macro equivalent to the insw(unsigned short port, void * addr, unsigned long count) function. | |||||||||||
#define | inportlm insl | ||||||||||
A macro equivalent to the insl(unsigned short port, void * addr, unsigned long count) function. | |||||||||||
#define | outportbm outsb | ||||||||||
A macro equivalent to the outsb(unsigned short port, void * addr, unsigned long count) function. | |||||||||||
#define | outportwm outsw | ||||||||||
A macro equivalent to the outsw(unsigned short port, void * addr, unsigned long count) function. | |||||||||||
#define | outportlm outsl | ||||||||||
A macro equivalent to the outsl(unsigned short port, void * addr, unsigned long count) function. | |||||||||||
#define | atomic_set(v, i) (((v)->counter) = (i)) | ||||||||||
Set the atomic value of v to i (guaranteed only 24 bits)
| |||||||||||
#define | atomic_read(v) ((v)->counter) | ||||||||||
Read the atomic value of v (guaranteed only 24 bits)
| |||||||||||
Typedefs | |||||||||||
typedef atomic | atomic_t | ||||||||||
The atomic variable structure. | |||||||||||
Functions | |||||||||||
__inline__ void | mb () | ||||||||||
Force strict CPU ordering (required for all out-of-order Intel CPUs to preserve the order of execution). | |||||||||||
__inline__ void | enable () | ||||||||||
Enable all interrupts. | |||||||||||
__inline__ void | disable () | ||||||||||
Disable all interrupts. | |||||||||||
__inline__ dword | GET_IF () | ||||||||||
Get the IF (interrupt enable flag) value from the EFLAGS register.
| |||||||||||
__inline__ void | SET_IF (dword IF) | ||||||||||
Set the IF (interrupt enable flag) value into the EFLAGS register.
| |||||||||||
__inline__ byte | inportb (word port) | ||||||||||
Get a byte from an I/O port.
| |||||||||||
__inline__ word | inportw (word port) | ||||||||||
Get a word from an I/O port.
| |||||||||||
__inline__ dword | inportl (word port) | ||||||||||
Get a dword from an I/O port.
| |||||||||||
__inline__ void | outportb (word port, byte val) | ||||||||||
Put a byte to an I/O port.
| |||||||||||
__inline__ void | outportw (word port, word val) | ||||||||||
Put a word to an I/O port.
| |||||||||||
__inline__ void | outportl (word port, dword val) | ||||||||||
Put a dword to an I/O port.
| |||||||||||
void | insb (unsigned short port, void *addr, unsigned long count) | ||||||||||
The string version of in().
| |||||||||||
void | insw (unsigned short port, void *addr, unsigned long count) | ||||||||||
The string version of in16().
| |||||||||||
void | insl (unsigned short port, void *addr, unsigned long count) | ||||||||||
The string version of in32().
| |||||||||||
void | outsb (unsigned short port, void *addr, unsigned long count) | ||||||||||
The string version of out().
| |||||||||||
void | outsw (unsigned short port, void *addr, unsigned long count) | ||||||||||
The string version of out16().
| |||||||||||
void | outsl (unsigned short port, void *addr, unsigned long count) | ||||||||||
The string version of out32().
| |||||||||||
__inline__ void | cpuid (int op, int *eax, int *ebx, int *ecx, int *edx) | ||||||||||
Get the CPUID information.
| |||||||||||
__inline__ void | atomic_inc (atomic_t *v) | ||||||||||
Perform an atomic increment.
| |||||||||||
__inline__ void | atomic_dec (atomic_t *v) | ||||||||||
Perform an atomic decrement.
| |||||||||||
__inline__ void | halt () | ||||||||||
Halt the system by disabling the CPU.
| |||||||||||
__inline__ void | breakpoint () | ||||||||||
Perform a breakpoint exeception. |
|
Read the atomic value of
|
|
Set the atomic value of
|
|
A macro that returns current instruction pointer.
|
|
A macro equivalent to the inportb(word port) function.
|
|
A macro equivalent to the inportw(word port) function.
|
|
A macro equivalent to the inportl(word port) function.
|
|
A macro equivalent to the insb(unsigned short port, void * addr, unsigned long count) function.
|
|
A macro equivalent to the insl(unsigned short port, void * addr, unsigned long count) function.
|
|
A macro equivalent to the insw(unsigned short port, void * addr, unsigned long count) function.
|
|
A macro equivalent to the outportb(word port, byte val) function.
|
|
A macro equivalent to the outportw(word port, word val) function.
|
|
A macro equivalent to the outportl(word port, dword val) function.
|
|
A macro equivalent to the outsb(unsigned short port, void * addr, unsigned long count) function.
|
|
A macro equivalent to the outsl(unsigned short port, void * addr, unsigned long count) function.
|
|
A macro equivalent to the outsw(unsigned short port, void * addr, unsigned long count) function.
|
|
Read the timestamp counter from the model-specific register and put it into two 32-bit registers.
|
|
Read the timestamp counter from the model-specific register and put it into eax:edx registers. This is a 64-bit value.
|
|
A macro equivalent to the function mb().
|
|
The atomic variable structure.
|
|
Perform an atomic decrement.
Definition at line 340 of file i386.h.
|
|
Perform an atomic increment.
Definition at line 331 of file i386.h.
|
|
Perform a breakpoint exeception.
Definition at line 358 of file i386.h.
00359 { 00360 __asm__ __volatile__ ("int3" : : : "memory"); 00361 } |
|
Get the CPUID information.
Definition at line 297 of file i386.h.
00298 { 00299 __asm__ __volatile__( 00300 "cpuid" 00301 : 00302 "=a" (*eax), 00303 "=b" (*ebx), 00304 "=c" (*ecx), 00305 "=d" (*edx) 00306 : 00307 "0" (op) 00308 ); 00309 __asm__ __volatile__ ("" : : : "eax", "ebx", "ecx", "edx"); 00310 } |
|
Disable all interrupts.
Definition at line 60 of file i386.h.
00061 { 00062 __asm__ __volatile__ ("cli" : : : "memory"); 00063 } |
|
Enable all interrupts.
Definition at line 53 of file i386.h.
00054 { 00055 __asm__ ("sti" : : : "memory"); 00056 } |
|
Get the IF (interrupt enable flag) value from the EFLAGS register.
Definition at line 68 of file i386.h.
00069 { 00070 register uint32_t IF; 00071 __asm__ __volatile__ ( 00072 "pushfl \n" 00073 "popl %%eax \n" 00074 "shrl $9, %%eax \n" 00075 "andl $1, %%eax \n" : "=a" (IF) : ); 00076 __asm__ __volatile__("" : : : "eax"); 00077 return( IF ); 00078 } |
|
Halt the system by disabling the CPU.
Definition at line 350 of file i386.h.
00351 {
00352 __asm__ __volatile__ ("cli\n hlt");
00353 }
|
|
Get a
Definition at line 110 of file i386.h.
00111 { 00112 // Get a byte from I/O port // 00113 register uint8_t val; 00114 __asm__ __volatile__ ("inb %%dx, %%al" : "=a" (val) : "d" (port)); 00115 return( val ); 00116 } |
|
Get a
Definition at line 133 of file i386.h.
00134 { 00135 register uint32_t val; 00136 __asm__ __volatile__ ("inl %%dx, %%eax" : "=a" (val) : "d" (port)); 00137 return( val ); 00138 } |
|
Get a
Definition at line 122 of file i386.h.
00123 { 00124 register uint16_t val; 00125 __asm__ __volatile__ ("inw %%dx, %%ax" : "=a" (val) : "d" (port)); 00126 return( val ); 00127 } |
|
The string version of in().
Copy a sequence of count bytes to the buffer addr from the port port. Definition at line 186 of file i386.h.
00187 { 00188 __asm__ __volatile__ ("rep ; insb": "=D"(addr), "=c"(count) : "d"(port), "0"(addr), "1"(count)); 00189 } |
|
The string version of in32().
Copy a sequence of count double words to the buffer addr from the port port. Definition at line 212 of file i386.h.
00213 { 00214 __asm__ __volatile__ ("rep ; insl": "=D"(addr), "=c"(count) : "d"(port), "0"(addr), "1"(count)); 00215 } |
|
The string version of in16().
Copy a sequence of count words to the buffer addr from the port port. Definition at line 199 of file i386.h.
00200 { 00201 __asm__ __volatile__ ("rep ; insw": "=D"(addr), "=c"(count) : "d"(port), "0"(addr), "1"(count)); 00202 } |
|
Force strict CPU ordering (required for all out-of-order Intel CPUs to preserve the order of execution).
Definition at line 38 of file i386.h.
00039 { 00040 __asm__ __volatile__ ("lock; addl $0,0(%%esp)": : :"memory"); 00041 } |
|
Put a
Definition at line 153 of file i386.h.
00154 { 00155 __asm__ __volatile__ ("outb %%al, %%dx" : : "d" (port), "a" (val)); 00156 } |
|
Put a
Definition at line 171 of file i386.h.
00172 { 00173 __asm__ __volatile__ ("outl %%eax, %%dx" : : "d" (port), "a" (val)); 00174 } |
|
Put a
Definition at line 162 of file i386.h.
00163 { 00164 __asm__ __volatile__ ("outw %%ax, %%dx" : : "d" (port), "a" (val)); 00165 } |
|
The string version of out().
Copy a sequence of count bytes to the port port from the buffer addr. Definition at line 237 of file i386.h.
00238 { 00239 __asm__ __volatile__ ("rep ; outsb": "=S"(addr), "=c"(count) : "d"(port), "0"(addr), "1"(count)); 00240 } |
|
The string version of out32().
Copy a sequence of count double words to the port port from the buffer addr. Definition at line 263 of file i386.h.
00264 { 00265 __asm__ __volatile__ ("rep ; outsl": "=S"(addr), "=c"(count) : "d"(port), "0"(addr), "1"(count)); 00266 } |
|
The string version of out16().
Copy a sequence of count words to the port port from the buffer addr. Definition at line 250 of file i386.h.
00251 { 00252 __asm__ __volatile__ ("rep ; outsw": "=S"(addr), "=c"(count) : "d"(port), "0"(addr), "1"(count)); 00253 } |
|
Set the IF (interrupt enable flag) value into the EFLAGS register.
Definition at line 85 of file i386.h.
00086 { 00087 __asm__ __volatile__ ( 00088 "pushfl \n" 00089 "popl %%eax \n" 00090 "orl $(1 << 9), %%eax\n" 00091 "andl %0, %%eax \n" 00092 "pushl %%eax \n" 00093 "popfl \n" : : "d" ((IF & 0x01) << 9) ); 00094 __asm__ __volatile__("" : : : "eax", "edx"); 00095 } |