Fix inconsistent EOL
This commit is contained in:
@@ -1,51 +1,51 @@
|
||||
#pragma once
|
||||
#include "threads.hpp"
|
||||
#include <stdio.hpp>
|
||||
|
||||
namespace JabyEngine {
|
||||
namespace Callback {
|
||||
namespace internal {
|
||||
static void execute_callback(Thread::Handle thread_handle, uint32_t parm) {
|
||||
if(CurrentThread::is_me(MainThread::Handle)) {
|
||||
CurrentThread::replace_with(thread_handle);
|
||||
CurrentThread::force_a0(parm);
|
||||
}
|
||||
SysCall::ReturnFromException();
|
||||
}
|
||||
|
||||
static uint32_t resume_callback(Thread::Handle handle) {
|
||||
SysCall::ChangeThread(handle);
|
||||
asm("sw $a0, %0" : "=m"(handle));
|
||||
return handle;
|
||||
}
|
||||
|
||||
namespace VSync {
|
||||
static constexpr size_t StackSize = 64;
|
||||
|
||||
extern SysCall::ThreadHandle thread_handle;
|
||||
extern uint32_t stack[StackSize];
|
||||
void routine();
|
||||
|
||||
static void [[deprecated("Currently not in use")]] execute() {
|
||||
execute_callback(VSync::thread_handle, 0);
|
||||
}
|
||||
}
|
||||
|
||||
namespace CD {
|
||||
static constexpr size_t StackSize = 256;
|
||||
|
||||
extern Thread::Handle thread_handle;
|
||||
extern uint32_t stack[StackSize];
|
||||
void routine(uint32_t irq);
|
||||
|
||||
static void execute(uint32_t irq) {
|
||||
execute_callback(CD::thread_handle, irq);
|
||||
}
|
||||
|
||||
static uint32_t resume() {
|
||||
return resume_callback(MainThread::Handle);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma once
|
||||
#include "threads.hpp"
|
||||
#include <stdio.hpp>
|
||||
|
||||
namespace JabyEngine {
|
||||
namespace Callback {
|
||||
namespace internal {
|
||||
static void execute_callback(Thread::Handle thread_handle, uint32_t parm) {
|
||||
if(CurrentThread::is_me(MainThread::Handle)) {
|
||||
CurrentThread::replace_with(thread_handle);
|
||||
CurrentThread::force_a0(parm);
|
||||
}
|
||||
SysCall::ReturnFromException();
|
||||
}
|
||||
|
||||
static uint32_t resume_callback(Thread::Handle handle) {
|
||||
SysCall::ChangeThread(handle);
|
||||
asm("sw $a0, %0" : "=m"(handle));
|
||||
return handle;
|
||||
}
|
||||
|
||||
namespace VSync {
|
||||
static constexpr size_t StackSize = 64;
|
||||
|
||||
extern SysCall::ThreadHandle thread_handle;
|
||||
extern uint32_t stack[StackSize];
|
||||
void routine();
|
||||
|
||||
static void [[deprecated("Currently not in use")]] execute() {
|
||||
execute_callback(VSync::thread_handle, 0);
|
||||
}
|
||||
}
|
||||
|
||||
namespace CD {
|
||||
static constexpr size_t StackSize = 256;
|
||||
|
||||
extern Thread::Handle thread_handle;
|
||||
extern uint32_t stack[StackSize];
|
||||
void routine(uint32_t irq);
|
||||
|
||||
static void execute(uint32_t irq) {
|
||||
execute_callback(CD::thread_handle, irq);
|
||||
}
|
||||
|
||||
static uint32_t resume() {
|
||||
return resume_callback(MainThread::Handle);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,55 +1,55 @@
|
||||
#pragma once
|
||||
#include <PSX/System/syscalls.hpp>
|
||||
|
||||
namespace JabyEngine {
|
||||
struct Thread {
|
||||
using Handle = SysCall::ThreadHandle;
|
||||
|
||||
static constexpr uint32_t idx_from_handle(SysCall::ThreadHandle thread) {
|
||||
return thread & 0xFFFF;
|
||||
}
|
||||
|
||||
static uintptr_t get_pic_of(Handle handle) {
|
||||
return table_of_tables.threads[idx_from_handle(handle)].epc;
|
||||
}
|
||||
|
||||
template<size_t N>
|
||||
static Handle create(void(*function)(uint32_t), uint32_t(&stack)[N]) {
|
||||
return SysCall::OpenThread(reinterpret_cast<void(*)()>(function), &stack[N - 1], SysCall::get_gp());
|
||||
}
|
||||
|
||||
static void set_kernel_mode_for(SysCall::ThreadHandle handle) {
|
||||
table_of_tables.threads[idx_from_handle(handle)].sr = 0x0;
|
||||
}
|
||||
|
||||
static void set_user_mode_for(SysCall::ThreadHandle handle) {
|
||||
table_of_tables.threads[idx_from_handle(handle)].sr = 0x40000404;
|
||||
}
|
||||
};
|
||||
|
||||
struct CurrentThread {
|
||||
static uintptr_t get_pic() {
|
||||
return table_of_tables.processes->current_tcb->epc;
|
||||
}
|
||||
|
||||
static void force_a0(uint32_t a0) {
|
||||
table_of_tables.processes->current_tcb->reg[4] = a0;
|
||||
}
|
||||
|
||||
static bool is_me(Thread::Handle handle) {
|
||||
return table_of_tables.processes->current_tcb == &table_of_tables.threads[Thread::idx_from_handle(handle)];
|
||||
}
|
||||
|
||||
static void replace_with(Thread::Handle handle) {
|
||||
table_of_tables.processes->current_tcb = &table_of_tables.threads[Thread::idx_from_handle(handle)];
|
||||
}
|
||||
};
|
||||
|
||||
struct MainThread {
|
||||
static constexpr const Thread::Handle Handle = 0xFF000000;
|
||||
|
||||
static uintptr_t get_pic() {
|
||||
return table_of_tables.threads[0].epc;
|
||||
}
|
||||
};
|
||||
#pragma once
|
||||
#include <PSX/System/syscalls.hpp>
|
||||
|
||||
namespace JabyEngine {
|
||||
struct Thread {
|
||||
using Handle = SysCall::ThreadHandle;
|
||||
|
||||
static constexpr uint32_t idx_from_handle(SysCall::ThreadHandle thread) {
|
||||
return thread & 0xFFFF;
|
||||
}
|
||||
|
||||
static uintptr_t get_pic_of(Handle handle) {
|
||||
return table_of_tables.threads[idx_from_handle(handle)].epc;
|
||||
}
|
||||
|
||||
template<size_t N>
|
||||
static Handle create(void(*function)(uint32_t), uint32_t(&stack)[N]) {
|
||||
return SysCall::OpenThread(reinterpret_cast<void(*)()>(function), &stack[N - 1], SysCall::get_gp());
|
||||
}
|
||||
|
||||
static void set_kernel_mode_for(SysCall::ThreadHandle handle) {
|
||||
table_of_tables.threads[idx_from_handle(handle)].sr = 0x0;
|
||||
}
|
||||
|
||||
static void set_user_mode_for(SysCall::ThreadHandle handle) {
|
||||
table_of_tables.threads[idx_from_handle(handle)].sr = 0x40000404;
|
||||
}
|
||||
};
|
||||
|
||||
struct CurrentThread {
|
||||
static uintptr_t get_pic() {
|
||||
return table_of_tables.processes->current_tcb->epc;
|
||||
}
|
||||
|
||||
static void force_a0(uint32_t a0) {
|
||||
table_of_tables.processes->current_tcb->reg[4] = a0;
|
||||
}
|
||||
|
||||
static bool is_me(Thread::Handle handle) {
|
||||
return table_of_tables.processes->current_tcb == &table_of_tables.threads[Thread::idx_from_handle(handle)];
|
||||
}
|
||||
|
||||
static void replace_with(Thread::Handle handle) {
|
||||
table_of_tables.processes->current_tcb = &table_of_tables.threads[Thread::idx_from_handle(handle)];
|
||||
}
|
||||
};
|
||||
|
||||
struct MainThread {
|
||||
static constexpr const Thread::Handle Handle = 0xFF000000;
|
||||
|
||||
static uintptr_t get_pic() {
|
||||
return table_of_tables.threads[0].epc;
|
||||
}
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user