#include "types.h" #include "arm.h" #include "param.h" #include "syscall.h" #include "proc.h" #interface "KernelRet.h" // ---- // typedef struct KernelRetImpl impl KernelRet { // __code next(....); // } KernelRetImpl; // ---- KernelRet* createKernelRetImpl(struct Context* cbc_context) { struct KernelRet* kernelRet = new KernelRet(); struct KernelRetImpl* kernelRet_impl = new KernelRetImpl(); kernelRet->kernelRet = (union Data*)kernelRet_impl; kernelRet->cbc_return = C_cbc_returnKernelRetImpl; kernelRet->exit = C_exitKernelRetImpl; kernelRet->swtch = C_swtchKernelRetImpl; return kernelRet; } extern __code trapret(void); __code cbc_returnKernelRetImpl(struct KernelRetImpl* kernelRet, int ret, __code next(...)) { int num = proc->cbc_arg.cbc_console_arg.num; if (num != SYS_exec) { proc->tf->r0 = ret; } goto trapret(); } extern __code exit(void); __code exitKernelRetImpl(struct KernelRetImpl* kernelRet, __code next(...)) { goto exit(); } extern __code swtch(void); __code swtchKernelRetImpl(struct KernelRetImpl* kernelRet, __code next(...)) { goto swtch(); }