ChorusOS 5.0 Board Support Package Developer's Guide

Hot Reboot

Code Example 5-5 is the hot reboot service routine source code provided in source_dir/nucleus/bsp/powerpc/sbc8260/src/reboot/reboot.c.


Example 5-5 hotReboot() routine

#define STACK_SIZE 0x400
char stack[STACK_SIZE];

    void
rebootHot(KnRebootReq* req)
{
    printf ("Hot reboot ...\n");

    /*
     * Extend the persistent memory w.r.t
 the reboot 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:

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.