前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >Boot之sysInit()

Boot之sysInit()

作者头像
Taishan3721
发布2022-01-24 14:39:10
2040
发布2022-01-24 14:39:10
举报
文章被收录于专栏:这里只有VxWorks这里只有VxWorks

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),%ebx

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

    /* initialize frame pointer */
    movl  $0,%ebp

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

    /* initialize EFLAGS */
    xorl  %eax, %eax;
    pushl %eax;
    popfl;

    /* initialize CR4 */
    xorl  %eax, %eax
    movl  %eax, %cr4

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

    /* return */
    iret
本文参与 腾讯云自媒体同步曝光计划,分享自微信公众号。
原始发表:2022-01-18,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 这里只有VxWorks 微信公众号,前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档