Go to the source code of this file.
|
static INLINE void | enable_interrupts () |
|
static INLINE void | disable_interrupts () |
|
static INLINE void | hlt () |
|
static INLINE void | pause () |
|
static INLINE void | breakpoint () |
|
static INLINE void | icebp () |
|
static INLINE uint64_t | rdtsc () |
|
static INLINE uint64_t | rdtscp (uint32_t *procno) |
|
static INLINE void | lidt (PseudoDescriptor *idt) |
|
static INLINE void | lgdt (PseudoDescriptor *gdt) |
|
static INLINE void | ltr (uint16_t tss) |
|
static INLINE void | cpuid (uint32_t info, uint32_t *eax, uint32_t *ebx, uint32_t *ecx, uint32_t *edx) |
|
static INLINE void | wrmsr (uint32_t addr, uint64_t val) |
|
static INLINE uint64_t | rdmsr (uint32_t addr) |
|
static INLINE uint64_t | read_cr0 () |
|
static INLINE void | write_cr0 (uint64_t val) |
|
static INLINE uint64_t | read_cr2 () |
|
static INLINE uint64_t | read_cr3 () |
|
static INLINE void | write_cr3 (uint64_t val) |
|
static INLINE uint64_t | read_cr4 () |
|
static INLINE void | write_cr4 (uint64_t val) |
|
static INLINE uint64_t | read_dr0 () |
|
static INLINE void | write_dr0 (uint64_t val) |
|
static INLINE uint64_t | read_dr1 () |
|
static INLINE void | write_dr1 (uint64_t val) |
|
static INLINE uint64_t | read_dr2 () |
|
static INLINE void | write_dr2 (uint64_t val) |
|
static INLINE uint64_t | read_dr3 () |
|
static INLINE void | write_dr3 (uint64_t val) |
|
static INLINE uint64_t | read_dr6 () |
|
static INLINE void | write_dr6 (uint64_t val) |
|
static INLINE uint64_t | read_dr7 () |
|
static INLINE void | write_dr7 (uint64_t val) |
|
static INLINE uint16_t | read_ds () |
|
static INLINE void | write_ds (uint16_t val) |
|
static INLINE uint16_t | read_es () |
|
static INLINE void | write_es (uint16_t val) |
|
static INLINE uint16_t | read_fs () |
|
static INLINE void | write_fs (uint16_t val) |
|
static INLINE uint16_t | read_gs () |
|
static INLINE void | write_gs (uint16_t val) |
|
static INLINE void | clts () |
|
static INLINE void | fxsave (struct XSAVEArea *xsa) |
|
static INLINE void | fxrstor (struct XSAVEArea *xsa) |
|
static INLINE void | xsave (struct XSAVEArea *xsa, uint64_t mask) |
|
static INLINE void | xsaveopt (struct XSAVEArea *xsa, uint64_t mask) |
|
static INLINE void | xrstor (struct XSAVEArea *xsa, uint64_t mask) |
|
static INLINE void | outb (uint16_t port, uint8_t data) |
|
static INLINE void | outw (uint16_t port, uint16_t data) |
|
static INLINE void | outl (uint16_t port, uint32_t data) |
|
static INLINE uint8_t | inb (uint16_t port) |
|
static INLINE uint16_t | inw (uint16_t port) |
|
static INLINE uint32_t | inl (uint16_t port) |
|
◆ breakpoint()
static INLINE void breakpoint |
( |
| ) |
|
|
static |
Definition at line 29 of file amd64op.h.
30{
31 asm volatile("int3");
32}
◆ clts()
Definition at line 372 of file amd64op.h.
373{
374 asm volatile("clts");
375}
◆ cpuid()
Definition at line 85 of file amd64op.h.
87{
89
90 asm volatile("cpuid"
91 : "=a" (a), "=b" (b), "=c" (c), "=d" (d)
92 : "a" (info));
93
94 if (eax)
95 *eax = a;
96 if (ebx)
97 *ebx = b;
98 if (ecx)
99 *ecx = c;
100 if (edx)
101 *edx = d;
102}
◆ disable_interrupts()
static INLINE void disable_interrupts |
( |
| ) |
|
|
static |
Definition at line 14 of file amd64op.h.
15{
16 asm volatile("cli");
17}
◆ enable_interrupts()
static INLINE void enable_interrupts |
( |
| ) |
|
|
static |
Definition at line 9 of file amd64op.h.
10{
11 asm volatile("sti");
12}
◆ fxrstor()
Definition at line 386 of file amd64op.h.
387{
388 asm volatile("fxrstor %0"
389 :
390 : "m" (*xsa)
391 : "memory");
392}
◆ fxsave()
Definition at line 377 of file amd64op.h.
378{
379 asm volatile("fxsave %0"
380 : "=m" (*xsa)
381 :
382 : "memory");
383}
◆ hlt()
Definition at line 19 of file amd64op.h.
20{
21 asm volatile("hlt");
22}
◆ icebp()
Definition at line 34 of file amd64op.h.
35{
36 asm volatile(".byte 0xf1");
37}
◆ inb()
Definition at line 452 of file amd64op.h.
453{
455
456 asm volatile("inb %1, %0"
457 : "=a" (data)
458 :"d" (port));
459
460 return data;
461}
◆ inl()
Definition at line 474 of file amd64op.h.
475{
477
478 asm volatile("inl %1, %0"
479 : "=a" (data)
480 :"d" (port));
481
482 return data;
483}
◆ inw()
Definition at line 463 of file amd64op.h.
464{
466
467 asm volatile("inw %1, %0"
468 : "=a" (data)
469 :"d" (port));
470
471 return data;
472}
◆ lgdt()
Definition at line 70 of file amd64op.h.
71{
72 asm volatile("lgdt (%0)"
73 :
74 : "r" (gdt)
75 : "memory");
76}
◆ lidt()
Definition at line 62 of file amd64op.h.
63{
64 asm volatile("lidt (%0)"
65 :
67 : "memory");
68}
static InteruptGate64 idt[256]
◆ ltr()
Definition at line 78 of file amd64op.h.
79{
80 asm volatile("ltr %0"
81 :
82 : "r" (tss));
83}
◆ outb()
Definition at line 431 of file amd64op.h.
432{
433 asm volatile("outb %0, %1"
434 :
435 : "a" (data), "d" (port));
436}
◆ outl()
Definition at line 445 of file amd64op.h.
446{
447 asm volatile("outl %0, %1"
448 :
449 : "a" (data), "d" (port));
450}
◆ outw()
Definition at line 438 of file amd64op.h.
439{
440 asm volatile("outw %0, %1"
441 :
442 : "a" (data), "d" (port));
443}
◆ pause()
Definition at line 24 of file amd64op.h.
25{
26 asm volatile("pause");
27}
◆ rdmsr()
Definition at line 114 of file amd64op.h.
115{
117
118 asm volatile("rdmsr"
119 : "=a" (eax), "=d" (edx)
121
122 return edx << 32 | eax;
123}
◆ rdtsc()
Definition at line 39 of file amd64op.h.
40{
42
43 asm volatile("rdtsc"
44 : "=a" (lo), "=d" (hi));
45
47}
◆ rdtscp()
Definition at line 49 of file amd64op.h.
50{
52
53 asm volatile("rdtsc"
54 : "=a" (lo), "=d" (hi), "=c" (proc));
55
56 if (procno)
57 *procno = proc;
58
60}
◆ read_cr0()
Definition at line 129 of file amd64op.h.
130{
132
133 asm volatile("movq %%cr0, %0"
134 : "=r" (val));
135
136 return val;
137}
◆ read_cr2()
Definition at line 146 of file amd64op.h.
147{
149
150 asm volatile("movq %%cr2, %0"
151 : "=r" (val));
152
153 return val;
154}
◆ read_cr3()
Definition at line 156 of file amd64op.h.
157{
159
160 asm volatile("movq %%cr3, %0"
161 : "=r" (val));
162
163 return val;
164}
◆ read_cr4()
Definition at line 173 of file amd64op.h.
174{
176
177 asm volatile("movq %%cr4, %0"
178 : "=r" (val));
179
180 return val;
181}
◆ read_dr0()
Definition at line 194 of file amd64op.h.
195{
197
198 asm volatile("movq %%dr0, %0"
199 : "=r" (val));
200
201 return val;
202}
◆ read_dr1()
Definition at line 211 of file amd64op.h.
212{
214
215 asm volatile("movq %%dr1, %0"
216 : "=r" (val));
217
218 return val;
219}
◆ read_dr2()
Definition at line 228 of file amd64op.h.
229{
231
232 asm volatile("movq %%dr2, %0"
233 : "=r" (val));
234
235 return val;
236}
◆ read_dr3()
Definition at line 245 of file amd64op.h.
246{
248
249 asm volatile("movq %%dr3, %0"
250 : "=r" (val));
251
252 return val;
253}
◆ read_dr6()
Definition at line 262 of file amd64op.h.
263{
265
266 asm volatile("movq %%dr6, %0"
267 : "=r" (val));
268
269 return val;
270}
◆ read_dr7()
Definition at line 279 of file amd64op.h.
280{
282
283 asm volatile("movq %%dr7, %0"
284 : "=r" (val));
285
286 return val;
287}
◆ read_ds()
Definition at line 300 of file amd64op.h.
301{
303
304 asm volatile("movw %%ds, %0"
305 : "=r" (val));
306
307 return val;
308}
◆ read_es()
Definition at line 317 of file amd64op.h.
318{
320
321 asm volatile("movw %%es, %0"
322 : "=r" (val));
323
324 return val;
325}
◆ read_fs()
Definition at line 334 of file amd64op.h.
335{
337
338 asm volatile("movw %%fs, %0"
339 : "=r" (val));
340
341 return val;
342}
◆ read_gs()
Definition at line 351 of file amd64op.h.
352{
354
355 asm volatile("movw %%gs, %0"
356 : "=r" (val));
357
358 return val;
359}
◆ write_cr0()
Definition at line 139 of file amd64op.h.
140{
141 asm volatile("movq %0, %%cr0"
142 :
143 : "r" (val));
144}
◆ write_cr3()
Definition at line 166 of file amd64op.h.
167{
168 asm volatile("movq %0, %%cr3"
169 :
170 : "r" (val));
171}
◆ write_cr4()
Definition at line 183 of file amd64op.h.
184{
185 asm volatile("movq %0, %%cr4"
186 :
187 : "r" (val));
188}
◆ write_dr0()
Definition at line 204 of file amd64op.h.
205{
206 asm volatile("movq %0, %%dr0"
207 :
208 : "r" (val));
209}
◆ write_dr1()
Definition at line 221 of file amd64op.h.
222{
223 asm volatile("movq %0, %%dr1"
224 :
225 : "r" (val));
226}
◆ write_dr2()
Definition at line 238 of file amd64op.h.
239{
240 asm volatile("movq %0, %%dr2"
241 :
242 : "r" (val));
243}
◆ write_dr3()
Definition at line 255 of file amd64op.h.
256{
257 asm volatile("movq %0, %%dr3"
258 :
259 : "r" (val));
260}
◆ write_dr6()
Definition at line 272 of file amd64op.h.
273{
274 asm volatile("movq %0, %%dr6"
275 :
276 : "r" (val));
277}
◆ write_dr7()
Definition at line 289 of file amd64op.h.
290{
291 asm volatile("movq %0, %%dr7"
292 :
293 : "r" (val));
294}
◆ write_ds()
Definition at line 310 of file amd64op.h.
311{
312 asm volatile("movw %0, %%ds"
313 :
314 : "r" (val));
315}
◆ write_es()
Definition at line 327 of file amd64op.h.
328{
329 asm volatile("movw %0, %%es"
330 :
331 : "r" (val));
332}
◆ write_fs()
Definition at line 344 of file amd64op.h.
345{
346 asm volatile("movw %0, %%fs"
347 :
348 : "r" (val));
349}
◆ write_gs()
Definition at line 361 of file amd64op.h.
362{
363 asm volatile("movw %0, %%gs"
364 :
365 : "r" (val));
366}
◆ wrmsr()
Definition at line 104 of file amd64op.h.
105{
108
109 asm volatile("wrmsr"
110 :
111 :
"a" (eax),
"c" (
addr),
"d" (edx));
112}
◆ xrstor()
Definition at line 416 of file amd64op.h.
417{
420
421 asm volatile("xrstor %0"
422 :
423 : "m" (*xsa), "a" (lo), "d" (hi)
424 : "memory");
425}
◆ xsave()
Definition at line 394 of file amd64op.h.
395{
398
399 asm volatile("xsave %0"
400 : "=m" (*xsa)
401 : "a" (lo), "d" (hi)
402 : "memory");
403}
◆ xsaveopt()
Definition at line 405 of file amd64op.h.
406{
409
410 asm volatile("xsaveopt %0"
411 : "=m" (*xsa)
412 : "a" (lo), "d" (hi)
413 : "memory");
414}