Boot之sysInit()

2022-01-24 14:39:10 浏览数 (1)

Vx69 X86 UP

代码语言:javascript复制
/*******************************************************************************
* This is the system start-up entry point for VxWorks in RAM,
* the first code executed after booting.
* It disables interrupts, sets up the stack,
* and jumps to the C routine usrInit() in usrConfig.c.
* The initial stack is set to grow down from the address of sysInit().
* This stack is used only by usrInit() and is never used again.
* Memory for the stack must be accounted for
* when determining the system load address.
*/
sysInit:
    /* lock interrupt */
    cli

    /* save the startType */
    movl  SP_ARG1(%esp),�x

    /* initialize stack pointer */
    movl  $FUNC(sysInit),%esp

    /* initialize frame pointer */
    movl  $0,�p

    /* initialize CR0 */
    /* clear PG(31), AM(18), WP(16), TS(3), EM(2), MP(1) */
    movl  %cr0, �x;
    andl  $0x7ffafff1, �x; 
    movl  �x, %cr0;

    /* initialize EFLAGS */
    xorl  �x, �x;
    pushl �x;
    popfl;

    /* initialize CR4 */
    xorl  �x, �x
    movl  �x, %cr4

    pushl �x               /* push the startType */
    movl  $FUNC(usrInit),�x
    movl  $FUNC(sysInit),�x/* push return address */
    pushl �x               /* for emulation for call */
    pushl $0                 /* push EFLAGS, 0 */
    pushl $0x0008            /* a selector 0x08 is 2nd one */
    pushl �x               /* push EIP,  FUNC(usrInit) */

    /* return */
    iret
x86

0 人点赞