Windows CE 6.0 Startup Process Analysis

Source: Internet
Author: User

After straighten out the relationship between the above files, it may be easier to analyze the Startup Process of Windows CE 6.0.
1. startup function:
As you can see from the help documentation of Windows CE, wince6.0's startup is only related to oal.exe and kernel. dll. As for kitl. dll, it is only used to compile the operating system into a kitl function. Find the source code location for compiling oal.exe and kernel. dll on the Startup Process of Windows CE 6.0.
Oal.exe uses the startup function to initialize the hardware. Startup. the s code is shared with the bootloader startup code of the hardware platform. The preinit function switches the operating mode of the ARM processor to the Administrator mode, closes the MMU at the same time, and detects the cause of system startup, if it is a hot start, that is, the bootloader program has been started before the function is called, and the initialization of basic hardware is complete, it will jump directly to the oalstartup function; otherwise, you must initialize the hardware, such as hardware interruption shielding, memory, system clock frequency, and power management.
2. oalstartup function:
After the system hardware initialization is complete, startup calls the oalstartup function. The oalstartup function mainly transfers the oemaddresstable table to the kernel; then, call the kernelstart function to jump to the kernel oemaddresstable table. Each entry of the main function table defines the physical location, memory size, and Static Virtual Address mapped to the physical address;
◆ The Static Virtual Memory Address is defined within the buffer memory range;
◆ The kernel can create a non-buffered memory address pointing to the same physical address;
◆ For the same physical address, there is both a buffered virtual memory address and a non-buffered virtual memory address;
◆ Oemaddresstable must end with 0 at last;
◆ For MIPS and shx CPUs, The ing between physical addresses and virtual addresses is completed by the CPU, without the need to create oemaddresstable;
3. The main functions of the kernelstart function are as follows:
◆ Ing physical addresses to virtual addresses and virtual addresses to physical addresses in the oemaddresstable table;
◆ Clears the memory page table and the storage space (RAM or Dram) in the Kernel Parameter area.
◆ Read the ID of the CPU. The kernel determines the MMU processing of the arm based on the ID, because the MMU processing process of the ARM processor before armv6 and armv6 is different;
◆ Set and enable MMU and cache because MMU and cache are disabled in the startup function;
◆ Set the SP pointer for the working mode of the ARM processor. The ARM processor shares 7 different working modes (user, Fiq, IRQ, supervisor, abort, undefined, and system ), in addition to user and system modes, the other five working modes have specific SP pointer registers (which are called Shadow registers by the ARM processor );
◆ Read the kdatastruct struct required for Kernel startup;
◆ Call the arminit function to reposition the Windows CE Kernel Parameter ptoc and initialize the oeminitglobals global variable;
◆ Use mov PC and R12 command to jump to the entry position of kernel. dll, that is, the nkstartup function.
5. nkstartup function:
After the completion of hardware platform regionalization, the startup task of oal.exe is basically completed, and the rest of the startup work is taken over by the kernel-related and independent oal layer of the kernel. The main functions of kernel. dll are as follows:
◆ Extract the global variables required for Kernel startup from the struct parameter kdatastruct * pkdata and initialize the kernel global variables;
◆ Locates the oeminitglobals address, the initialization function of the oemglobal struct exclusive to Windows CE 6.0, which builds a bridge for communication between the kernel and the oal layer. The oemglobal struct defines the functions required by the oal layer. c files are initialized and compiled in oemmain. in lib and oemmain_statickitl.lib libraries, if oal links these two libraries, the function implementation bodies in the struct must be included;
◆ Call armsetup to set the ing between physical addresses and unbuffered virtual memory addresses, arm interrupt vectors, and stacks required by kernel mode.
◆ Call the oeminitdebugserial function to initialize and debug the serial port;
◆ Call oeminit to initialize the platform;
Note that the process of calling the oeminitdebugserial and oeminit functions by the nkstartup function is completely different from that of Windows CE 6.0, because in versions earlier than Windows CE 6.0, the kernel (kernel) OAL and kitl are compiled in an executable file. Shared variables between them can be accessed by using the extern keyword. In Windows CE 6.0, because the kernel, oal, and kitl are compiled into different executable files, mutual access between variables cannot be shared using the extern keyword, that is, the kernel cannot use the extern DWORD varx method to access the variable varx of the oal layer. Of course, the implementation body of the oal layer cannot access the kernel variable in the same way. To achieve kernel and OAL access sharing information, Windows CE 6.0 defines two structures: oemglobal and global.
When the Windows CE 6.0 kernel is started, the OS finds the oal entry location and then calls the entry function to exchange pointers with the global block so that the kernel can use the information in the oal layer, similarly, the oal layer can access the functions exported by the kernel.
Therefore, the above two functions are actually called through the oemglobal struct. The actual call location is $ (_ privateroot)/winceos/coreos/nk/oemstub. in C, the oeminitdebugserial and oeminit functions access oeminitdebugserial and oeminit in the oal layer through the oemglobal struct pointer.
Call the kernelfindmemory () function to split the ram region. In the Windows CE operating system, the RAM space is mainly divided into the storage memory and program memory, and the storage memory is mainly the file storage space, including kernel files and all target files copied to the system. The program memory is the storage space required for running the program.
◆ Kernelstart () Start the kernel.
6. kernelsstart function:
The kernelstart function and the previous kernelstart function belong to two completely different functions. The kernelstart function called in the nkstartup function is $ (_ privateroot) /winceos/coreos/nk/kernel/ARM/armtrap. the kernelstart function in the s file is used to call the kernel initialization function kernelinit and jump to the first startup task of the operating system.
7. kernelinit function:
The kernel initialization functions of Windows CE 6.0 are basically similar to those of other versions, mainly completing kernel initialization before the first thread is started, it mainly includes API function set initialization, heap initialization, initialization memory pool, process initialization, thread initialization, and file ing initialization.
8. firstschedule:
The firstschedule function is the final unconditional jump function during the startup of the Windows CE operating system. The first scheduling of Windows CE is actually an idle thread, because the Windows CE system has not been started yet, only when Windows CE is fully started and enters a stable state, and then the file system filesys is started. DLL, device management device. DLL, form image subsystem gews. DLL and shell program explore.exe.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.