mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2025-06-01 07:18:22 -04:00
kern: implement init through InterruptTaskManager.Initialize()
This commit is contained in:
parent
3c78bc4dbf
commit
3bcc4adb5c
8 changed files with 87 additions and 6 deletions
|
@ -59,6 +59,12 @@ namespace ams::kern::arm64::cpu {
|
|||
EnsureInstructionConsistency();
|
||||
}
|
||||
|
||||
ALWAYS_INLINE void SwitchProcess(u64 ttbr, u32 proc_id) {
|
||||
SetTtbr0El1(ttbr);
|
||||
ContextIdRegisterAccessor(0).SetProcId(proc_id).Store();
|
||||
InstructionMemoryBarrier();
|
||||
}
|
||||
|
||||
/* Helper for address access. */
|
||||
ALWAYS_INLINE bool GetPhysicalAddressWritable(KPhysicalAddress *out, KVirtualAddress addr, bool privileged = false) {
|
||||
const uintptr_t va = GetInteger(addr);
|
||||
|
|
|
@ -34,6 +34,11 @@ namespace ams::kern::arm64 {
|
|||
|
||||
static NOINLINE void Initialize(s32 core_id);
|
||||
|
||||
ALWAYS_INLINE void Activate(u32 proc_id) {
|
||||
cpu::DataSynchronizationBarrier();
|
||||
cpu::SwitchProcess(this->ttbr, proc_id);
|
||||
}
|
||||
|
||||
NOINLINE Result InitializeForKernel(void *table, KVirtualAddress start, KVirtualAddress end);
|
||||
Result Finalize();
|
||||
};
|
||||
|
|
|
@ -28,6 +28,7 @@ namespace ams::kern::arm64 {
|
|||
constexpr KSupervisorPageTable() : page_table(), ttbr0() { /* ... */ }
|
||||
|
||||
NOINLINE void Initialize(s32 core_id);
|
||||
NOINLINE void Activate();
|
||||
void Finalize(s32 core_id);
|
||||
};
|
||||
|
||||
|
|
|
@ -39,10 +39,16 @@ namespace ams::kern {
|
|||
private:
|
||||
TaskQueue task_queue;
|
||||
KThread *thread;
|
||||
private:
|
||||
static void ThreadFunction(uintptr_t arg);
|
||||
void ThreadFunctionImpl();
|
||||
public:
|
||||
constexpr KInterruptTaskManager() : task_queue(), thread(nullptr) { /* ... */ }
|
||||
|
||||
constexpr ALWAYS_INLINE KThread *GetThread() const { return this->thread; }
|
||||
constexpr KThread *GetThread() const { return this->thread; }
|
||||
|
||||
NOINLINE void Initialize();
|
||||
void EnqueueTask(KInterruptTask *task);
|
||||
|
||||
/* TODO: Actually implement KInterruptTaskManager. This is a placeholder. */
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue