MCPcopy Create free account
hub / github.com/Simple-XX/SimpleKernel / InitTaskContext

Function InitTaskContext

src/arch/riscv64/arch_main.cpp:72–83  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

70}
71
72auto InitTaskContext(cpu_io::CalleeSavedContext* task_context,
73 void (*entry)(void*), void* arg, uint64_t stack_top)
74 -> void {
75 // 清零上下文
76 std::memset(task_context, 0, sizeof(cpu_io::CalleeSavedContext));
77
78 task_context->ReturnAddress() =
79 reinterpret_cast<uint64_t>(kernel_thread_entry);
80 task_context->EntryFunction() = reinterpret_cast<uint64_t>(entry);
81 task_context->EntryArgument() = reinterpret_cast<uint64_t>(arg);
82 task_context->StackPointer() = stack_top;
83}
84
85auto InitTaskContext(cpu_io::CalleeSavedContext* task_context,
86 cpu_io::TrapContext* trap_context_ptr, uint64_t stack_top)

Callers 1

TaskControlBlockMethod · 0.50

Calls 1

memsetFunction · 0.85

Tested by

no test coverage detected