Nk.exe Boot Process (Windows CE 5.0) 英文

本文来自msdn  http://msdn.microsoft.com/en-us/library/aa450578.aspx 方便查找

 

During the kernel boot process, the following calls are made in the order shown:

StartUp()

     KernelStart() / KernelInitialize()

          <Main kernel initialization function>

               OEMInitDebugSerial()

               OEMInit()

          KernelInit()

               HeapInit()

               InitMemoryPool()

               ProcInit()

               SchedInit()

     FirstSchedule()

          SystemStartupFunc()

          IOCTL_HAL_POSTINIT

For more information about kernel initialization and specific kernel initialization considerations, see Kernel Initialization.

StartUp()

StartUp is the first function called during kernel startup and it is responsible for initializing the CPU to a known state.

The StartUp function performs the following tasks:

  • Performs minimal processor and hardware initialization
  • Disables interrupts, caches, and the memory management unit (MMU)

Once the StartUp function has initialized the CPU, it calls the KernelStart or KernelInitialize function.

The StartUp function, found under %_WINCEROOT%\Platform\<Hardware Platform Name>\Src\Kernel\OAL\Startup.s, is usually written in assembly language and is shared with the boot loader.

KernelStart() / KernelInitialize()

The OEM adaptation layer (OAL) sets up any platform or CPU-specific settings that is required for the kernel to access ROM and RAM. To start the system, it then jumps to KernelInitialize, for x86-based hardware platforms, or KernelStart, for all other hardware platforms. At this point, the MMU and caches should not be enabled.

The KernelStart or KernelInitialize function performs the following tasks:

  • Initializes the first-level page table based on the contents of OEMAddressTable
  • Enables the MMU and caches

    Until the MMU is enabled, the kernel symbolic addresses are invalid and must be translated through the OEMAddressTable to obtain the correct physical addresses.

  • Initializes the stacks for each mode of operation

The implementation of the KernelStart and KernelInitialize function is under the private directory.

Once KernelStart or KernelInitialize has performed all its tasks, it calls the main initialization function for the kernel that you are using.

Main kernel initialization function

The main kernel initialization function is responsible for calling the OEM supplied initialization functions. It also performs the following tasks:

  • Initializes the debug serial port through a call to OEMInitDebugSerial
  • Displays the Windows CE sign-on message through the debug port
  • Initializes the hardware platform through a call to OEMInit

If you have an ARM kernel for example, KernelStart calls ARMInit as the main kernel initialization function.

OEMInitDebugSerial()

OEMInitDebugSerial initializes the debug serial port on the target device.

The debug functions typically communicate with a serial device. Because the boot loader implements the same code, a single implementation can be shared between the OAL and the boot loader.

These are serial debug functions that OEMs need to implement:

The NK banner is displayed after the OEMInitDebugSerial function completes.

OEMInit()

OEMInit is implemented by OEMs to initialize all hardware interfaces for the target device.

At this point in the kernel boot process, interrupts are disabled and the kernel is unable to handle exceptions. The only kernel service available to OEMInit is HookInterrupt. OEMInit can register interrupt service routines (ISRs) by calling HookInterrupt.

At this point in the boot process, the following hardware initialization is usually required:

  • Interrupts
  • System timer
  • KITL interface

Depending on the hardware, optional initialization would include:

  • Bus interfaces

Sample implementations of the OEMInit function can be found in %_WINCEROOT%\Platform\<Hardware Platform Name>\Src\Kernel\OAL\Init.c.

KernelInit()

The KernelInit function encapsulates the initialization of the kernel. It initializes the following parts of the kernel through calls to different initialization functions:

  • Heap
  • Memory pool
  • Kernel process
  • Scheduler

Upon exiting this function, the system is ready to schedule the first thread through SystemStartupFunc.

The implementation of the KernelInit function is under the private directory.

HeapInit()

HeapInit initializes the kernel heap.

The implementation of the HeapInit function is under the private directory.

InitMemoryPool()

InitMemoryPool initializes the kernel memory pool.

The implementation of the InitMemoryPool function is under the private directory.

ProcInit()

ProcInit initializes the Windows CE kernel process.

The implementation of the ProcInit function is under the private directory.

SchedInit()

SchedInit initializes the scheduler and creates the SystemStartupFunc thread.

The implementation of the SchedInit function is under the private directory.

FirstSchedule()

FirstSchedule starts the scheduler.

The implementation of the FirstSchedule function is under the private directory.

SystemStartupFunc()

SystemStartupFunc executes IOCTL_HAL_POSTINIT. Implementation of this function can be handled by OEM code to complete the kernel initialization process.

The implementation of the SystemStartupFunc function is under the private directory.

See Also

Filesys.exe Boot Process | Kernel Overview

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值