VxWorks Romstar Function Analysis
LMJX 2004-8-26 email: limiao@yeah.net
The following is a necessary deletion of Romstart, mainly removes some pre-compilation options.
Void Romstart
(
Fast Int StartType / * Start Type * /
)
{
Volatile / * to Force Absolute Adression * /
Funcptr absentry; / * to avoid pc relative jump subsroutine * /
$$ <<
Note:
The role of the Volatile key is to make the compiler do not optimize the specified variables, which ensures that the variable is taken to a new value each time. Volatile is often used to modify global or static or in multi-task environments to allow variables to be changed.
>> $$
/ *
* Copy from rom to ram, minus the commitsed image
* if Compressed Boot Rom Which Relies on BinArray
* APPEARING LAST IN DATA Segment.
* /
(Funcptr) ROM_OFFSET (COPYLONGS)) (ROM_TEXT_ADRS, (UINT) Rominit,
((Uint) binaRrayStart - (uint) Rominit / sizeof (long);
$$ <<
Note:
This segment code copies the non-compressed portion in the ROM to the RAM. ROM_OFFSET (COPYLONGS) calculates the address in the ROM and then the function is called. The BinArrayStart address is installed later is compressed code and data.
>> $$
/ * CLEAR All Memory if Cold booting * /
IF (StartType & Boot_Clear)
{
$$ <<
Note:
If it is a cold start, 0- (Rominit - Stack_Save) and the RAM after the BinArrayStart.
>> $$
Filllongs ((uint *) (Sys_MEM_BOTTOM),
(Uint) Rominit - stack_save - (uint) sys_mem_bottom /
SizeOf (long), 0);
Filllongs ((uint *) binaRrayStart,
((Uint) SYS_MEM_TOP - (uint) binaRaystart / sizeof (long), 0);
/ *
* Ensure the boot line is null. This is necessary for those
* Targets whose boot line is excluded from cleaning.
* /
$$ <<
Note:
Clear 0 in boot_line_adrs, to ensure the correctness of bootline.
>> $$
* (Boot_line_adrs) = eos;
}
/ * Jump to vxworks entry point (instance uncompressing) * /
{
$$ <<
Note:
Defining the compressed content into RAM_DST_ADRS, ie RAM_High_ADRS.
>> $$
IF (uncmp_rtn (uchar *) ROM_OFFSET (BINARRAYSTART),
(Uchar *) RAM_DST_ADRS, & BINARRAYEND - BINARRAYSTART "= OK) Return; / * if we return the rom's will halt * /
ABSENTRY = (Funcptr) RAM_DST_ADRS; / * COMPRESSEDENTRY () * /
}
$$ <<
Note:
Transfer to the RAM.
>> $$
(ABSENTRY) (STARTTYPE);
}