Use original code instead of frankensteining
This commit is contained in:
@@ -54,24 +54,41 @@ namespace JabyEngine {
|
||||
uint32_t lo;
|
||||
uint32_t sr;
|
||||
uint32_t cause;
|
||||
uint32_t unused2[6];
|
||||
uint32_t unused2[9];
|
||||
};
|
||||
|
||||
struct PCB {
|
||||
TCB* current_tcb;
|
||||
};
|
||||
|
||||
static __always_inline TCB* get_tcb_of_th(uint32_t id) {
|
||||
return reinterpret_cast<TCB*>((*reinterpret_cast<uint32_t*>(0x110)) + (id*4));
|
||||
}
|
||||
struct ToT {
|
||||
using ExCB = void;
|
||||
using EvCB = void;
|
||||
using FCB = void;
|
||||
|
||||
static __always_inline void set_tcb(TCB* adr) {
|
||||
reinterpret_cast<PCB*>(0x108)->current_tcb = adr;
|
||||
}
|
||||
ExCB* exception_chain;
|
||||
uint32_t exception_chain_size;
|
||||
PCB* processes;
|
||||
uint32_t processes_size;
|
||||
TCB* threads;
|
||||
uint32_t threads_size;
|
||||
uint32_t reserved_0;
|
||||
uint32_t reserved_1;
|
||||
EvCB* events;
|
||||
uint32_t events_size;
|
||||
uint32_t reserved_2;
|
||||
uint32_t reserved_3;
|
||||
uint32_t reserved_4;
|
||||
uint32_t reserved_5;
|
||||
uint32_t reserved_6;
|
||||
uint32_t reserved_7;
|
||||
FCB* files;
|
||||
uint32_t files_size;
|
||||
uint32_t reserved_8;
|
||||
uint32_t reserved_9;
|
||||
};
|
||||
|
||||
static __always_inline TCB& get_current_tcb() {
|
||||
return *reinterpret_cast<PCB*>(0x108)->current_tcb;
|
||||
}
|
||||
extern ToT table_of_tables;
|
||||
|
||||
namespace SysCall {
|
||||
static constexpr const uint32_t Table_A = 0xA0;
|
||||
@@ -113,6 +130,12 @@ namespace JabyEngine {
|
||||
|
||||
#define __syscall_function_cast(table, ...) reinterpret_cast<__VA_ARGS__>(table)
|
||||
|
||||
static __always_inline uint32_t* get_gp() {
|
||||
uint32_t* gp;
|
||||
__asm__("sw $gp, %0" : "=m"(gp));
|
||||
return gp;
|
||||
}
|
||||
|
||||
static __always_inline void* memcpy(void *dst, const void *src, size_t len) {
|
||||
register uint32_t FuncID asm("t1") = 0x2A;
|
||||
__asm__ volatile("" : "=r"(FuncID) : "r"(FuncID));
|
||||
|
Reference in New Issue
Block a user