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.
21 lines
478 B
C++
21 lines
478 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;
|
|
context.rsp = tos;
|
|
context.rbx = 0;
|
|
context.rbp = 0;
|
|
context.r12 = 0;
|
|
context.r13 = 0;
|
|
context.r14 = 0;
|
|
context.r15 = (uint64_t)param1;
|
|
}
|