2014-05-09 22:11:18 -04:00
|
|
|
// Copyright 2014 Citra Emulator Project / PPSSPP Project
|
|
|
|
// Licensed under GPLv2
|
|
|
|
// Refer to the license.txt file included.
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "common/common_types.h"
|
2014-05-13 22:29:31 -04:00
|
|
|
#include "core/hle/kernel/kernel.h"
|
2014-05-09 22:11:18 -04:00
|
|
|
|
|
|
|
enum ThreadStatus {
|
2014-05-13 22:00:11 -04:00
|
|
|
THREADSTATUS_RUNNING = 1,
|
|
|
|
THREADSTATUS_READY = 2,
|
|
|
|
THREADSTATUS_WAIT = 4,
|
|
|
|
THREADSTATUS_SUSPEND = 8,
|
|
|
|
THREADSTATUS_DORMANT = 16,
|
|
|
|
THREADSTATUS_DEAD = 32,
|
2014-05-09 22:11:18 -04:00
|
|
|
|
|
|
|
THREADSTATUS_WAITSUSPEND = THREADSTATUS_WAIT | THREADSTATUS_SUSPEND
|
|
|
|
};
|
|
|
|
|
|
|
|
struct ThreadContext {
|
|
|
|
void reset();
|
|
|
|
|
|
|
|
u32 reg[16];
|
|
|
|
u32 cpsr;
|
|
|
|
u32 pc;
|
|
|
|
};
|
|
|
|
|
2014-05-13 22:00:11 -04:00
|
|
|
class Thread;
|
|
|
|
|
|
|
|
Thread* __KernelCreateThread(UID& id, UID module_id, const char* name, u32 priority, u32 entrypoint,
|
|
|
|
u32 arg, u32 stack_top, u32 processor_id, int stack_size=0x4000);
|
2014-05-14 20:50:30 -04:00
|
|
|
|
|
|
|
UID __KernelCreateThread(UID module_id, const char* name, u32 priority, u32 entry_point, u32 arg,
|
|
|
|
u32 stack_top, u32 processor_id, int stack_size=0x4000);
|
|
|
|
|
2014-05-13 22:00:11 -04:00
|
|
|
void __KernelResetThread(Thread *t, int lowest_priority);
|
|
|
|
void __KernelChangeReadyState(Thread *thread, UID thread_id, bool ready);
|
|
|
|
void __KernelChangeReadyState(UID thread_id, bool ready);
|
|
|
|
Thread* __KernelNextThread();
|
|
|
|
void __KernelSaveContext(ThreadContext *ctx);
|
|
|
|
void __KernelLoadContext(ThreadContext *ctx);
|
|
|
|
void __KernelSwitchContext(Thread *target, const char *reason);
|
2014-05-14 20:50:30 -04:00
|
|
|
bool __KernelSwitchToThread(UID thread_id, const char *reason);
|
2014-05-13 22:00:11 -04:00
|
|
|
UID __KernelSetupRootThread(UID module_id, int arg, int prio, int stack_size=0x4000);
|
2014-05-14 20:50:30 -04:00
|
|
|
int __KernelRotateThreadReadyQueue(int priority=0);
|
2014-05-13 22:00:11 -04:00
|
|
|
|
2014-05-09 22:11:18 -04:00
|
|
|
void __KernelThreadingInit();
|
|
|
|
void __KernelThreadingShutdown();
|
|
|
|
|
|
|
|
//const char *__KernelGetThreadName(SceUID threadID);
|
|
|
|
//
|
|
|
|
//void __KernelSaveContext(ThreadContext *ctx);
|
|
|
|
//void __KernelLoadContext(ThreadContext *ctx);
|
|
|
|
|
|
|
|
//void __KernelSwitchContext(Thread *target, const char *reason);
|