SimpleKernel 1.17.0
Loading...
Searching...
No Matches
cpu_io Namespace Reference

Namespaces

namespace  virtual_memory
 

Classes

struct  CalleeSavedContext
 
struct  TrapContext
 

Functions

void Pause ()
 
auto GetCurrentCoreId () -> size_t
 
void EnableInterrupt ()
 
void DisableInterrupt ()
 
bool GetInterruptStatus ()
 
void Mb ()
 
void Rmb ()
 
void Wmb ()
 

Detailed Description

Function Documentation

◆ DisableInterrupt()

void cpu_io::DisableInterrupt ( )
inline

Definition at line 41 of file cpu_io.h.

41 {
43 assert(env && "TestEnvironmentState not set for current thread");
44 auto& core = env->GetCurrentCoreEnv();
45 core.interrupt_enabled = false;
46}
static auto GetCurrentThreadEnvironment() -> TestEnvironmentState *
获取当前线程的环境实例指针(供 Mock 层调用)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ EnableInterrupt()

void cpu_io::EnableInterrupt ( )
inline

Definition at line 34 of file cpu_io.h.

34 {
36 assert(env && "TestEnvironmentState not set for current thread");
37 auto& core = env->GetCurrentCoreEnv();
38 core.interrupt_enabled = true;
39}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetCurrentCoreId()

auto cpu_io::GetCurrentCoreId ( ) -> size_t
inline

Definition at line 26 of file cpu_io.h.

26 {
28 assert(env &&
29 "TestEnvironmentState not set for current thread. "
30 "Did you forget to call SetCurrentThreadEnvironment()?");
31 return env->GetCoreIdForThread(std::this_thread::get_id());
32}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetInterruptStatus()

bool cpu_io::GetInterruptStatus ( )
inline

Definition at line 48 of file cpu_io.h.

48 {
50 assert(env && "TestEnvironmentState not set for current thread");
51 auto& core = env->GetCurrentCoreEnv();
52 return core.interrupt_enabled;
53}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Mb()

void cpu_io::Mb ( )
inline

Definition at line 56 of file cpu_io.h.

56{}
Here is the caller graph for this function:

◆ Pause()

void cpu_io::Pause ( )
inline

Definition at line 20 of file cpu_io.h.

20 {
21 // 在单元测试中使用 yield 避免死循环
22 std::this_thread::yield();
23}
Here is the caller graph for this function:

◆ Rmb()

void cpu_io::Rmb ( )
inline

Definition at line 57 of file cpu_io.h.

57{}
Here is the caller graph for this function:

◆ Wmb()

void cpu_io::Wmb ( )
inline

Definition at line 58 of file cpu_io.h.

58{}
Here is the caller graph for this function: