Example 4-5 is the hot reboot service routine source code provided in src/nucleus/bsp/powerpc/sbc8260/src/reboot/reboot.c.
#define STACK_SIZE 0x400 char stack[STACK_SIZE]; void rebootHot(KnRebootReq* req) { printf ("Hot reboot ...\n"); /* * Extend the persistemt memory w.r.t the rebbot request */ prstExtend(&rebootDesc.hot.prstMem, &req->u.hot); /* * switch to a private stack */ call_and_switch_stack(req, rebootHot_cont, stack + STACK_SIZE); } void rebootHot_cont(KnRebootReq* req) { /* * Disable I/D-Caches. */ cachesDisable(); /* * Disable pagination. */ setMSR(getMSR() & ~(MSR_IR | MSR_DR)); /* * Reboot */ rebootEntry(&rebootDesc, &bootParams); }
This hot reboot service routine:
Allocates, if required, a new persistent memory device descriptor. See "prstExtend() Routine" for details.
Enters in the real mode, disabling the memory management unit.
Jumps to the bootconf program reboot entry point.
Note that the implementation switches from the original stack to a small stack area which is statically allocated in the reboot program data segment. This occurs prior to the MMU disabling to ensure that the current stack is safely accessible in the real mode. See "call_and_switch_stack() routine" for details.