RESTART(5spp)
NAME
restart − description of standalone communication block
SYNOPSIS
#include <prom/entrypt.h>
DESCRIPTION
The restart block is used to communicate information between various components of the MIPS standalone system. Information conveyed in the restart block allows the prom monitor to warm start existing program images, and dbgmon to communicate with its clients.
The format of a restart block is:
struct restart_blk {
intrb_magic;/* magic pattern */
int(*rb_restart)();/* restart routine */
intrb_occurred;/* to avoid loops on restart failure */
intrb_checksum;/* checksum of 1st 32 wrds of restrt */
char*rb_fbss;/* start of prom bss and stack area */
char*rb_ebss;/* end of prom bss and stack area */
/*
* These entries are for communication between the debug monitor
* and the client process being debugged
* NOTE: a return value of -1 from (*rb_vtop)() is distinguished
* to indicate that a translation could not be made.
*/
int(*rb_bpaddr)();/* breakpoint handler */
int(*rb_vtop)();/* virtual to physical conversion rtn */
};
Constants that are used in conjunction with the restart block are:
#defineRESTART_MAGIC0xfeedface
#defineRESTART_CSUMCNT32/* cksum 32 words of restart routine */
#defineRESTART_ADDR0xa0000400/* prom looks for restart block here */
The block is always located at physical address 0x400, and is referenced by the prom monitor via the k1seg address 0xa0000400. The fields in the restart block have the following uses:
rb_magic
This field is checked by the prom monitor at the time of a warm start to determine the validity of the restart block. In order for a warm start to occur this field must be equal to the value RESTART_MAGIC. This field must be assigned RESTART_MAGIC by the standalone program to indicate its desire to permit warm starts on its image.
rb_restart
This field indicates the address to transfer to in order to initiate a warm start on the current memory image. This field must be assigned by the standalone program.
rb_occurred
This field must be zero to allow a warm start, this field is set non-zero by the prom monitor once it has attempted a warm start to avoid infinite loops should the warm start fail.
rb_checksum
This field should be assigned the 32 bit, 2’s complement sum of the first 32 words starting with the address in rb_restart. The prom monitor calculates the sum of the first 32 words of the warm start routine and compares its sum with the value in rb_restart to insure that the restart code is valid.
rb_fbss
The address of the first word of memory used by prom for its bss segment. This address is a "k1seg" address. Note that the prom also "uses" the utlbmiss and general exception vectors along with the restart block itself, all of which lie outside of its bss region.
rb_ebss
The address of the first work beyond the prom bss segment.
rb_bpaddr
This location is non-zero if the debug monitor, dbgmon(1spp), is present. The non-zero contents of rb_bpaddr is the address of the debug monitor entry point for breakpoint handling. If rb_bpaddr is non-zero, standalone programs that field their own exceptions should transfer to this location if they receive a breakpoint exception via a "break 1" instruction. Before transferring to this location, the standalone program should restore all registers except "at" and "k0" to the contents the registers had at the time of the exception. The "k0" register should be set to the contents of the "at" register at the time of the fault and the "at" register should be loaded with the contents of rb_bpaddr and a jump register performed to enter the debug monitor breakpoint handler. If rb_bpaddr is zero, the debug monitor is not present; the breakpoint exception should then be reported and the program terminated.
rb_vtop
A standalone program may offer to translate "kuseg" or "k2seg" addresses to k0seg or k1seg addresses by assigning rb_vtop to the address of a routine which provides this service. This routine is called with a single parameter which is a kuseg or k2seg address, it should return a corresponding address in k0seg or k1seg. The translation should be based upon the current process identifier in the R2000 tlbhi register. If for some reason the translation can not be made, the routine should return -1. NOTE: currently the dbgmon command "dump" does not call the rb_vtop entry point for kuseg or k2seg addresses; the dump command must be given k0seg or k1seg addresses.