NOVA
Stripped down NOVA kernel for the OSY course
Loading...
Searching...
No Matches
Cpu Class Reference

Public Types

enum  {
  EXC_NM = 7 , EXC_TS = 10 , EXC_GP = 13 , EXC_PF = 14 ,
  EXC_AC = 17
}

Static Public Member Functions

static ALWAYS_INLINE mword cr3 ()
static ALWAYS_INLINE void flush ()
static ALWAYS_INLINE void flush (mword addr)
static ALWAYS_INLINE void preempt_disable ()
static ALWAYS_INLINE void preempt_enable ()
ALWAYS_INLINE static NORETURN void shutdown ()
static ALWAYS_INLINE void cpuid (unsigned leaf, uint32 &eax, uint32 &ebx, uint32 &ecx, uint32 &edx)
static ALWAYS_INLINE void cpuid (unsigned leaf, unsigned subleaf, uint32 &eax, uint32 &ebx, uint32 &ecx, uint32 &edx)

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
28 {
29 EXC_NM = 7, /* No Math Coprocessor */
30 EXC_TS = 10, /* Invalid TSS */
31 EXC_GP = 13, /* General Protection */
32 EXC_PF = 14, /* Page Fault */
33 EXC_AC = 17 /* Alignment Check */
34 };

Member Function Documentation

◆ cpuid() [1/2]

ALWAYS_INLINE void Cpu::cpuid ( unsigned leaf,
uint32 & eax,
uint32 & ebx,
uint32 & ecx,
uint32 & edx )
inlinestatic
78 {
79 asm volatile ("cpuid" : "=a" (eax), "=b" (ebx), "=c" (ecx), "=d" (edx) : "a" (leaf));
80 }

◆ cpuid() [2/2]

ALWAYS_INLINE void Cpu::cpuid ( unsigned leaf,
unsigned subleaf,
uint32 & eax,
uint32 & ebx,
uint32 & ecx,
uint32 & edx )
inlinestatic
84 {
85 asm volatile ("cpuid" : "=a" (eax), "=b" (ebx), "=c" (ecx), "=d" (edx) : "a" (leaf), "c" (subleaf));
86 }

◆ cr3()

ALWAYS_INLINE mword Cpu::cr3 ( )
inlinestatic
38 {
39 mword cr3;
40 asm volatile ("mov %%cr3, %0" : "=r"(cr3));
41 return cr3;
42 }

◆ flush() [1/2]

ALWAYS_INLINE void Cpu::flush ( )
inlinestatic
46 {
47 mword cr3;
48 asm volatile ("mov %%cr3, %0; mov %0, %%cr3" : "=&r" (cr3));
49 }

◆ flush() [2/2]

ALWAYS_INLINE void Cpu::flush ( mword addr)
inlinestatic
53 {
54 asm volatile ("invlpg %0" : : "m" (*reinterpret_cast<mword *>(addr)));
55 }

◆ preempt_disable()

ALWAYS_INLINE void Cpu::preempt_disable ( )
inlinestatic
59 {
60 asm volatile ("cli" : : : "memory");
61 }

◆ preempt_enable()

ALWAYS_INLINE void Cpu::preempt_enable ( )
inlinestatic
65 {
66 asm volatile ("sti" : : : "memory");
67 }

◆ shutdown()

ALWAYS_INLINE static NORETURN void Cpu::shutdown ( )
inlinestatic
71 {
72 for (;;)
73 asm volatile ("cli; hlt");
74 }

The documentation for this class was generated from the following file: