KernOS
cpu.cpp
Go to the documentation of this file.
1 //
2 // Created on 5/19/20.
3 //
4 
5 #include <common.h>
6 #include <utilities.h>
7 #include <kprintf.h>
8 #include <registers.h>
9 
10 namespace INIT
11 {
30  void SSE()
31  {
32  asm volatile (
33  "mov %%cr0, %%eax\n"
34  "orl %0, %%eax\n"
35  "andl %1, %%eax\n"
36  "mov %%eax, %%cr0\n"
37  "mov %%cr4, %%eax\n"
38  "orl %2, %%eax\n"
39  "orl %3, %%eax\n"
40  "mov %%eax, %%cr4\n"
41  : // no output
42  : "n"(DWord<CR0::MP>()),
43  "n"(~DWord<CR0::EM>()),
44  "n"(DWord<CR4::OSFXSR>()),
45  "n"(DWord<CR4::OSXMMEXCPT>())
46  );
47 
48  kassert(ReadCR0() & DWord<CR0::MP>(), "MP bit of cr0 must be set for SSE support\n");
49  kassert(~(ReadCR0() & DWord<CR0::EM>()), "EM bit of cr0 must be disabled for SSE support\n");
50  kassert(ReadCR4() & (DWord<CR4::OSFXSR>() | DWord<CR4::OSXMMEXCPT>()));
51  }
52 } // namespace INIT
void SSE()
initialize Streaming Single Instruction Multiple Data (SIMD) Extensions, (SSE)
Definition: cpu.cpp:30
contains all kernel initialization routines
Definition: cpu.h:10