Wince6.0 system call

Source: Internet
Author: User

* ****************************** Loongembedded ******* *************************

Author: loongembedded (Kandi)

Time: 2012.04.12

Category: wince System Development

* ****************************** Loongembedded ******* *************************

The call process of the wince system is shown in:

Figure 1

1. Functions of coredll. dll

Applications in the wince system cannot directly deal with the wince operating system or hardware. When the application accesses the services provided by the wince system, it first uses coredll. dll.

The main function of coredll is to communicate with the application program and call the system of wince. It also appears in the user mode and kernel mode (coredll respectively. DLL and kcoredll. DLL), coredll provides core OS services, allowing applications to access computing resources under wince6.0, such as file systems, memory, devices, processes, and threads. Applications also use these services to manage and monitor the resources they need to complete their tasks. Through these services, applications can also share program code and other data information.

2. kernel. dll

In the wince6.0 Operating System (kernel), the expression in the Code is kernel. dll (that is, Kern. dll). In wince5.0, the expression in the kernel is nk.exe. in wince6.0, nk.exe only contains some oal code and programs that maintain compatibility.

The kernel provides basic OS functions for any wince6.0 device. These basic functions include process, thread, and memory management, in addition, the kernel provides a variety of services such as file management, thread scheduling, real-time performance, loader, system calling, power management, and OS. The kernel service allows applications to use these core functions.

3.nk.exe

Nk.exe(‑oal.exe) is an oal-layer process that loads the kernel during startup of the oal layer. DLL, oal is. DLL) and the Code layer between the target hardware platform, which facilitates the communication between the OS and the target device, and contains the handling of interruptions, timers, and general I/O control codes (IOCTLs.

4. system call handling process

System calling is a service provided by the operating system to applications. It is generally provided in the form of functions (system API functions). That is to say, when an application calls the API functions provided by the system, this is a system call.

A system call is a function of another process. When a system call occurs, coredll notifies the kernel and then the kernel calls an appropriate service process to process the system call. Each system call generates an exception that can be caught by the kernel:

(1) When a process generates a system call, it directly calls coredll. a wrapper function in the DLL (each time a different system call calls a different wrapper function). This wrapper function prepares function parameters for the kernel and then generates a software exception, this exception can be an undefined address exception or a CPU trap. When the kernel detects this software exception, the CPU execution right is changed from application to kernel.

(2) The kernel then processes this exception and determines the correct target process to send this function call request to which EXE file, or the kernel itself can implement this function call request. The target process implementing this function uses the same process heap and registry value as the original thread of the calling process to execute this function. Because this function is called by another process, the target process must be confirmed to exist in the system to ensure successful execution of this system call.

(3) During system calls, threads in the same user mode run in their respective priorities and can be migrated from the calling process to the process that implements the system call and returned from it. When a thread is migrated to another process, its access permission is changed to match the access permission of the currently running process.

4.1cross-region system call of kandi.exe, kernel. dll, and GWES. dll

Figure 2

For example, if the application kandi.exe calls createwindow () to create a window, it is converted to calling coredll. the corresponding packaging function create‑wexw () in DLL, and then coredll. DLL generates a software exception and then kernel. DLL handles this exception and kernel. the DLL selects an appropriate process for processing based on the current function call request. Here, the createmediawexw () function is in GWES.. DLL to load GWES. DLL to execute this function call, so that GWES. after the DLL is created, the system call is completed.

4.2cross-region system call of kandi.exe and coredll. dll

Figure 3

The application kandi.exe calls the CreateProcess () function to create a process and converts it to the coredll call. the corresponding packaging function xxx_createprocessw () in DLL, and then coredll. DLL generates a software exception and then kernel. DLL handles this exception, but because the xxx_createprocessw function is in the kernel. DLL, so you do not need to switch to other service processes, only in the kernel. DLL to complete the process creation, then return and end the system call.

4.3only system calls that can be implemented in kandi.exe are limited

Figure 4

The application kandi.exe calls the charlowerbuff () function to convert the string size to coredll. the corresponding packaging function xxx_createprocessw () in DLL, but because the charlowerbuffw function is in coredll. so coredll. dll will not generate software exceptions, and there is no need to switch the service process, but in coredll. in the DLL, you can directly convert the size of the string, then return and end the system call.

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.