You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

22 lines
558 B
C++

#include "context.h"
#include "../debug/output.h"
void panic(){
DBG << "panic!\n" << flush;
while(1);
}
void prepareContext(void* tos, Context& context, void (*kickoff)(void*),
void* param1) {
((uint64_t*)tos)[0] = (uint64_t)panic;
((uint64_t*)tos)[-1] = (uint64_t)kickoff;
((uint64_t*)tos)[-2] = (uint64_t)fake_systemv_abi;
context.rsp = (void*)(((uint64_t) tos)-16);
context.rbx = 0;
context.rbp = 0;
context.r12 = 0;
context.r13 = 0;
context.r14 = 0;
context.r15 = (uint64_t)param1;
}