Data transmission method and device in microkernel operating system and electronic equipment

By determining the data transmission address from the user state in the microkernel operating system and allowing the system to enter the management mode, the problem of difficulty in large-capacity data transmission between the kernel state and the user state is solved, and data transmission efficiency and operating system performance are improved.

CN119883680APending Publication Date: 2025-04-25HANGZHOU HOLLYSYS AUTOMATION
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411956518.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-29
Publication Date
2025-04-25

AI Technical Summary

Technical Problem

In the microkernel operating system, large-capacity data cannot be effectively transmitted between the kernel state and the user state, resulting in kernel failure information, software crash information and thread operation status information that cannot be obtained by the user state.

Method used

By determining the data to be transmitted and the data transmission address in the user state, writing the data to the address, and sending the address to the kernel state using IPC messages, while allowing the operating system to enter the management mode, so that the kernel state can obtain data from the user state.

Benefits of technology

It realizes efficient transmission of large-capacity data between user state and kernel state, solves the problem of low IPC message transmission efficiency, and improves the real-time performance and user experience of the operating system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119883680A_ABST
    Figure CN119883680A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of computers, and provides a data transmission method and device in a microkernel operating system and electronic equipment. According to the method, in a microkernel operating system, after to-be-transmitted data is determined by a user mode, a data transmission address is determined in the user mode, the to-be-transmitted data is written into the data transmission address, and the data transmission address is sent to a kernel mode by using an IPC message; meanwhile, the user mode also utilizes a management mode command to enable the microkernel operating system to enter a management mode, so that the kernel mode can obtain the data to be transmitted from the data transmission address in the user mode, and high-efficiency transmission of large-capacity data in the user mode and the kernel mode is realized; the technical problem that the real-time performance of the operating system is reduced due to the fact that only a plurality of IPC messages can be used for transmitting large-capacity messages in the user mode and the kernel mode in the related technology is solved, the data transmission efficiency in the microkernel operating system is improved, and the user experience is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a data transmission method, device and electronic device in a microkernel operating system. Background Art

[0002] The kernel architecture of operating systems is mainly divided into macrokernel architecture and microkernel architecture. As microkernel operating systems are increasingly used in actual products, users have more and more demands for data interaction between kernel state and user state of microkernel operating systems. In microkernel operating systems, data transmission between kernel state and user state can only rely on IPC (Inter-Process Communication) messages.

[0003] However, IPC messages are based on general registers for data transmission, and can only transmit a few bytes of data at a time, which cannot meet the large data transmission requirements between kernel state and user state. This results in some useful kernel state data such as kernel fault information, software crash information, thread running status information, etc. being unable to be obtained by user state applications. Summary of the invention

[0004] In view of this, an embodiment of the present application provides a data transmission method, device and electronic device in a microkernel operating system to solve the problem in the prior art that large-capacity data cannot be transmitted between kernel state and user state in a microkernel operating system.

[0005] In a first aspect of an embodiment of the present application, a data transmission method in a microkernel operating system is provided. The microkernel operating system is an operating system with a management mode. The method is used to transmit data between a user state and a kernel state of the microkernel operating system. The method includes:

[0006] Step S11: The user state determines first data to be transmitted, where the first data to be transmitted is data that needs to be transmitted from the user state to the kernel state;

[0007] Step S12: The user state determines a data transmission address, writes the first data to be transmitted into the data transmission address, and sends the data transmission address to the kernel state using an inter-process communication IPC message;

[0008] Step S13: The user state uses the management mode command to make the operating system enter the management mode;

[0009] Step S14: The kernel state obtains the first data to be transmitted from the data transmission address.

[0010] In some embodiments, the data transfer address includes at least a virtual address and an address capacity in a user-mode memory management unit MMU;

[0011] Step S14 includes:

[0012] Step S141, the user state sends the data length of the first data to be transmitted to the kernel state using an IPC message;

[0013] Step S142: The kernel state verifies the legitimacy of the virtual address and data length in the received data transmission address;

[0014] Step S143: In response to determining that the legality verification is passed, the kernel state reads the first data to be transmitted into the kernel state data receiving area.

[0015] A second aspect of an embodiment of the present application provides a data transmission method in a microkernel operating system, wherein the microkernel operating system is an operating system with a management mode, and the method is used to transmit data between a user state and a kernel state of the microkernel operating system, and the method includes:

[0016] Step S31, the kernel state determines the second data to be transmitted, and sends a data transmission request to the user state using an inter-process communication IPC message, where the second data to be transmitted is data that needs to be transmitted from the kernel state to the user state;

[0017] Step S32: In response to receiving the data transmission request, the user state determines a data transmission address, and sends the data transmission address to the kernel state using an inter-process communication (IPC) message;

[0018] Step S33: The user state uses the management mode command to make the operating system enter the management mode;

[0019] Step S34: The kernel state writes the second data to be transmitted into the data transmission address.

[0020] In some embodiments, the data transfer address includes at least a virtual address and an address capacity in a user-mode memory management unit MMU;

[0021] Step S34 includes:

[0022] Step S341, the kernel state determines the data length of the second data to be transmitted;

[0023] Step S342: The kernel state verifies the legitimacy of the virtual address and data length in the received data transmission address;

[0024] Step S343: In response to determining that the legality verification is passed, the kernel state writes the second data to be transmitted into the data transmission address.

[0025] In some embodiments, after step S34, the method further includes:

[0026] Step S35: The kernel state sends a data transmission completion message to the user state using an IPC message, where the data transmission completion message carries the data length of the second data to be transmitted;

[0027] Step S36: The user state reads the second data to be transmitted from the data transmission address based on the data length.

[0028] In some embodiments, the kernel mode verifies the legitimacy of the virtual address and the data length, including:

[0029] Verifying whether the virtual address is a user-mode virtual address; and

[0030] Verify whether the data length exceeds the address capacity;

[0031] In response to determining that the virtual address is a user-mode virtual address and the data length does not exceed the address capacity, it is determined that the legality verification is passed.

[0032] In some embodiments, the data volumes of the first data to be transmitted and the second data to be transmitted are both larger than the maximum data volume of a single transmission of an IPC message.

[0033] In a third aspect of an embodiment of the present application, a data transmission device in a microkernel operating system is provided. The microkernel operating system is an operating system with a management mode. The device includes:

[0034] A data determination module is configured to determine first data to be transmitted from a user state in the microkernel operating system, where the first data to be transmitted is data that needs to be transmitted from the user state to the kernel state;

[0035] An address determination module is configured to determine a data transmission address from a user state, write the first data to be transmitted into the data transmission address, and send the data transmission address to a kernel state of the microkernel operating system using an inter-process communication IPC message;

[0036] The mode switching module is configured to use a management mode command in the user mode to make the operating system enter the management mode;

[0037] The acquisition module is configured to acquire the first data to be transmitted from the data transmission address in kernel mode.

[0038] In a fourth aspect of the embodiments of the present application, a data transmission device in a microkernel operating system is provided. The microkernel operating system is an operating system with a management mode. The device includes:

[0039] The data determination module is configured to determine the second data to be transmitted from the kernel state in the microkernel operating system, and send a data transmission request to the user state in the microkernel operating system by using an inter-process communication IPC message, wherein the second data to be transmitted is data that needs to be transmitted from the kernel state to the user state;

[0040] An address determination module is configured to determine a data transmission address in a user state in response to receiving a data transmission request, and send the data transmission address to a kernel state using an inter-process communication (IPC) message;

[0041] The mode switching module is configured to use a management mode command in the user mode to make the operating system enter the management mode;

[0042] The writing module is configured to write the second data to be transmitted into the data transmission address in kernel mode.

[0043] According to a fifth aspect of an embodiment of the present application, an electronic device is provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the above method when executing the computer program.

[0044] Compared with the prior art, the embodiments of the present application have the following beneficial effects: in a microkernel operating system, after determining the data to be transmitted, the user state in the present application determines a data transmission address in the user state, writes the data to be transmitted into the data transmission address, and sends the data transmission address to the kernel state using an IPC message. At the same time, the user state also uses a management mode command to make the microkernel operating system enter the management mode, so that the kernel state can obtain the data to be transmitted from the data transmission address in the user state, thereby achieving efficient transmission of large-capacity data in the user state and the kernel state, solving the technical problem in the related art that only multiple IPC messages can be used to transmit large-capacity messages in the user state and the kernel state, thereby reducing the real-time performance of the operating system, improving the data transmission efficiency in the microkernel operating system, and enhancing the user experience. BRIEF DESCRIPTION OF THE DRAWINGS

[0045] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0046] Figure 1 It is a schematic diagram of the principle of user mode and kernel mode virtual address conversion in the related technology.

[0047] Figure 2 It is a flow chart of a data transmission method in a microkernel operating system provided in an embodiment of the present application.

[0048] Figure 3 It is a flowchart of a method for obtaining first data to be transmitted from a data transmission address in kernel mode provided in an embodiment of the present application.

[0049] Figure 4 It is a flow chart of another data transmission method in a microkernel operating system provided in an embodiment of the present application.

[0050] Figure 5 It is a flowchart of a method for writing second data to be transmitted into a data transmission address in kernel mode provided by an embodiment of the present application.

[0051] Figure 6 It is a flowchart of another data transmission method in a microkernel operating system provided in an embodiment of the present application.

[0052] Figure 7 It is a schematic diagram of a data transmission device in a microkernel operating system provided in an embodiment of the present application.

[0053] Figure 8 It is a schematic diagram of a data transmission device in another microkernel operating system provided in an embodiment of the present application.

[0054] Fig. 9 It is a schematic diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0055] In the following description, specific details such as specific system structures, technologies, etc. are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present application. However, it should be clear to those skilled in the art that the present application may also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to prevent unnecessary details from obstructing the description of the present application.

[0056] A data transmission method and device in a microkernel operating system according to an embodiment of the present application will be described in detail below with reference to the accompanying drawings.

[0057] As mentioned above, the operating system kernel architecture is mainly divided into macro kernel architecture and micro kernel architecture. Most of the early operating systems adopted Monolithic Kernel, which means that the entire operating system, including Scheduling, Filesystem, Networking, Devicedriver, Memorymanagement and Paging, are completed in the kernel. Until now, most widely used operating systems, such as UNIX, Linux and Windows, use monolithic kernel operating systems. However, as the operating system becomes more and more complex, putting all these functions in the kernel makes the design difficulty increase rapidly, and the real-time performance of the operating system will also decrease.

[0058] Microkernel is a design concept opposite to MonolithicKernel. Its purpose is to shrink the kernel to the minimum and move all possible functional modules out of the kernel. Ideally, only AddressSpaceSupport, IPC and Scheduling are left in the kernel, and other functional modules run as user processes. For the kernel, they are no different from general user processes. They communicate with other user processes through IPC.

[0059] The basic idea of ​​microkernel design is to simplify kernel functions. The kernel only provides the most basic services such as task scheduling, inter-task communication, and interrupt processing. In a macrokernel system, the file system, device driver, virtual memory management, network protocol stack, etc. are all located in the kernel. In a microkernel system, these functions are not provided. In a microkernel, all system services are implemented in user mode.

[0060] Microkernel operating systems have been widely used in the embedded field due to their high reliability, high real-time performance and high security. Compared with macrokernel operating systems, the driver layer of microkernel operating systems is located in the user state, and peripheral data can directly interact with upper-level components or applications in the user state, thereby improving the efficiency of peripheral data transmission and the real-time performance of the system.

[0061] As microkernel operating systems are increasingly used in actual products, users have more and more demands for the interaction between kernel and user state data in microkernel operating systems. For example, the recording of kernel fault information and software crash information can help solve code quality problems in actual product applications; thread running status information helps application software manage threads and improve software stability.

[0062] Usually, the processor's operating system has an MMU (Memory Management Unit), whose main function is to realize the conversion between virtual addresses and physical addresses, and provide access control and cache management functions. The MMU memory management mechanism is an important component of modern operating systems and can improve the stability and security of the system.

[0063] Figure 1 This is a schematic diagram of the user state and kernel state virtual address conversion in the related technology. Figure 1As shown, the kernel state virtual address of the microkernel operating system uses the base address register 1 of the MMU and the kernel state address translation table to realize the mapping of the kernel state virtual address to the peripheral physical address; the user state virtual address uses the base address register 0 of the MMU and the user state address translation table to realize the mapping of the user state virtual address to the peripheral physical address. Among them, the peripheral physical address may include ROM (Read-Only Memory), RAM (Random Access Memory), etc.

[0064] Typically, embedded products and the like provide a large-capacity physical memory for their processors. The kernel state and user state of a microkernel operating system use the MMU memory management unit to obtain the virtual address of the DDR (Double Data Rate) memory. The physical address corresponding to the virtual address is managed and dynamically updated by the MMU memory management unit and cannot be directly obtained by the operating system.

[0065] The microkernel operating system uses the MMU memory management unit to allow both the user state and the kernel state to use continuous virtual addresses and the kernel state and user state virtual addresses are physically isolated and cannot access each other, thereby improving the stability and security of the system. When data needs to be transmitted between the user state and the kernel state, the related technology uses IPC messages based on general registers to transfer data between the user state and the kernel state.

[0066] However, IPC messages can only transmit a few bytes of data at a time, which cannot meet the large data transmission requirements between kernel state and user state. This results in some useful kernel state data such as kernel fault information, software crash information, thread running status information, etc. being unable to be obtained by user state applications.

[0067] That is to say, it is limited by the IPC message mechanism, which relies on the general registers of several CPUs to realize the message transmission between user state and kernel state. It can only transmit a few bytes at a time. If it is necessary to transmit kilobytes to megabytes of message content, it is necessary to send thousands to millions of IPC messages, which will seriously affect the real-time performance of the operating system. Obviously, it cannot meet the data transmission of large amounts of data between the kernel state and the user state of the microkernel operating system.

[0068] In view of this, an embodiment of the present application provides a data transmission method in a microkernel operating system, in which, after determining the data to be transmitted, the user state in the microkernel operating system determines a data transmission address in the user state, writes the data to be transmitted into the data transmission address, and sends the data transmission address to the kernel state using an IPC message. At the same time, the user state also uses a management mode command to make the microkernel operating system enter the management mode, so that the kernel state can obtain the data to be transmitted from the data transmission address in the user state, thereby achieving efficient transmission of large-capacity data in the user state and the kernel state, solving the technical problem in the related art that only multiple IPC messages can be used to transmit large-capacity messages in the user state and the kernel state, thereby reducing the real-time performance of the operating system, improving the data transmission efficiency in the microkernel operating system, and enhancing the user experience.

[0069] Figure 2 1 is a flow chart of a data transmission method in a microkernel operating system provided by an embodiment of the present application. Figure 2 As shown, the method comprises the following steps:

[0070] In step S11, the user state determines the first data to be transmitted.

[0071] The first data to be transmitted is data that needs to be transmitted from the user state to the kernel state.

[0072] In step S12, the user state determines a data transmission address, writes the first data to be transmitted into the data transmission address, and sends the data transmission address to the kernel state using an inter-process communication IPC message.

[0073] In step S13, the user mode uses the management mode command to make the operating system enter the management mode.

[0074] In step S14, the kernel state obtains the first data to be transmitted from the data transmission address.

[0075] In certain embodiments of the present application, the method may be executed by a microkernel operating system to transmit data between a user state and a kernel state of the microkernel operating system.

[0076] In some implementations, the microkernel operating system is an operating system with a management mode, wherein the management mode is also called a privileged mode, in which the kernel state can access the virtual address of the user state.

[0077] In certain embodiments of the present application, a user state in a microkernel operating system may determine first data to be transmitted, where the first data to be transmitted is data that needs to be transmitted from the user state to the kernel state.

[0078] In some embodiments of the present application, the user state may also determine a data transmission address and write the first data to be transmitted into the data transmission address. On the other hand, the user state may also send the determined data transmission address to the kernel state using an IPC message.

[0079] The data transmission address may be a user-mode virtual address, that is, a virtual address in a user-mode MMU.

[0080] In some implementations, the user state can use a management mode command to make the operating system enter the management mode. In one example, the user state can make the microkernel operating system temporarily enter the management mode by sending an enter management mode command. Different microkernel operating systems may have different enter management mode commands, which are not limited here.

[0081] In some embodiments of the present application, since the kernel state can access the virtual address of the user state in the management mode, after the user state causes the operating system to enter the management mode, the kernel state can use the received data transfer address to obtain the first data to be transmitted. In one example, the kernel state can search for the data transfer address in the MMU of the user state and obtain the first data to be transmitted from the data transfer address.

[0082] According to the technical solution provided by the embodiment of the present application, in a microkernel operating system, after the user state determines the data to be transmitted, the data transmission address is determined in the user state, the data to be transmitted is written into the data transmission address, and the data transmission address is sent to the kernel state by using an IPC message. At the same time, the user state also uses a management mode command to make the microkernel operating system enter the management mode, so that the kernel state can obtain the data to be transmitted from the data transmission address in the user state, thereby achieving efficient transmission of large-capacity data in the user state and the kernel state, solving the technical problem in the related art that only multiple IPC messages can be used to transmit large-capacity messages in the user state and the kernel state, thereby reducing the real-time performance of the operating system, improving the data transmission efficiency in the microkernel operating system, and enhancing the user experience.

[0083] In some embodiments of the present application, the data transfer address includes at least a virtual address va and an address capacity total in a user-mode memory management unit MMU. In one example, the user mode can determine the address capacity total in the data transfer address according to the determined data length len of the first data to be transferred, for example, setting total to be greater than or equal to len.

[0084] Figure 3 1 is a flow chart of a method for obtaining first data to be transmitted from a data transmission address in kernel mode provided by an embodiment of the present application. Figure 3 As shown, the method comprises the following steps:

[0085] In step S141, the user state sends the data length of the first data to be transmitted to the kernel state using an IPC message.

[0086] In step S142, the kernel state verifies the legitimacy of the virtual address and data length in the received data transmission address.

[0087] In step S143, in response to determining that the legality verification is passed, the kernel state reads the first data to be transmitted into the kernel state data receiving area.

[0088] In some embodiments of the present application, the kernel state obtains the first data to be transmitted from the data transmission address, and the user state sends the data length of the first data to be transmitted to the kernel state using an IPC message, and the kernel state performs a validity verification on the virtual address and data length in the received data transmission address. If the validity verification passes, the kernel state reads the first data to be transmitted into the kernel state data receiving area.

[0089] In one example, the user state may use a separate IPC message to send the data length to the kernel state, or may carry the data length in an IPC message that sends a data transmission address.

[0090] The specific implementation method of the legality verification will be described in detail later and will not be repeated here.

[0091] Figure 4 FIG. 1 is a flow chart of another data transmission method in a microkernel operating system provided by an embodiment of the present application. Figure 4 As shown, the method comprises the following steps:

[0092] In step S31, the kernel state determines the second data to be transmitted, and sends a data transmission request to the user state using an inter-process communication IPC message.

[0093] The second data to be transmitted is data that needs to be transmitted from the kernel state to the user state.

[0094] In step S32, in response to receiving the data transmission request, the user state determines a data transmission address, and sends the data transmission address to the kernel state using an inter-process communication IPC message.

[0095] In step S33, the user mode uses the management mode command to make the operating system enter the management mode.

[0096] In step S34, the kernel state writes the second data to be transmitted into the data transmission address.

[0097] In certain embodiments of the present application, the method may be executed by a microkernel operating system to transmit data between a user state and a kernel state of the microkernel operating system.

[0098] In some implementations, the microkernel operating system is an operating system with a management mode, wherein the management mode is also called a privileged mode, in which the kernel state can access the virtual address of the user state.

[0099] In some embodiments of the present application, the kernel state in the microkernel operating system can determine the second data to be transmitted, and the second data to be transmitted is data that needs to be transmitted from the kernel state to the user state. On the other hand, the kernel state can also use an IPC message to send a data transmission request to the user state.

[0100] After receiving the data transmission request, the user state can determine the data transmission address and send the data transmission address to the kernel state using an IPC message.

[0101] The data transmission address may be a user-mode virtual address, that is, a virtual address in a user-mode MMU.

[0102] In some implementations, the user state can use a management mode command to make the operating system enter the management mode. In one example, the user state can make the microkernel operating system temporarily enter the management mode by sending an enter management mode command. Different microkernel operating systems may have different enter management mode commands, which are not limited here.

[0103] In some embodiments of the present application, since the kernel state can access the virtual address of the user state in the management mode, after the user state causes the operating system to enter the management mode, the kernel state can write the second data to be transmitted into the data transmission address it received. In one example, the kernel state can search for the data transmission address in the MMU of the user state and write the second data to be transmitted into the data transmission address.

[0104] In some embodiments of the present application, the data transmission address includes at least a virtual address va and an address capacity total in a user-mode memory management unit MMU. In one example, the user mode can randomly determine the virtual address va and estimate the address capacity total according to actual conditions. In another example, the data transmission request can also carry the data length len of the second data to be transmitted, and then determine the address capacity total in the data transmission address according to the received data length len of the second data to be transmitted, for example, setting total to be greater than or equal to len.

[0105] Figure 5 1 is a flow chart of a method for writing the second data to be transmitted into the data transmission address in the kernel state provided by an embodiment of the present application. Figure 5 As shown, the method comprises the following steps:

[0106] In step S341, the kernel state determines the data length of the second data to be transmitted.

[0107] In step S342, the kernel state verifies the legitimacy of the virtual address and data length in the received data transmission address.

[0108] In step S343, in response to determining that the legality verification is passed, the kernel state writes the second data to be transmitted into the data transmission address.

[0109] In some examples of the present application, the kernel state writes the second data to be transmitted to the data transmission address, and the kernel state determines the data length of the second data to be transmitted, and performs a validity verification on the virtual address in the received data transmission address and the data length. If the verification is successful, the kernel state writes the second data to be transmitted to the data transmission address.

[0110] In some embodiments of the present application, Figure 4 The illustrated embodiment may further include the following steps:

[0111] In step S35, the kernel state sends a data transfer completion message to the user state using an IPC message.

[0112] The data transmission completion message carries the data length of the second data to be transmitted, or the data transmission request carries the data length of the second data to be transmitted.

[0113] In step S36 , the user state reads the second data to be transmitted from the data transmission address based on the data length.

[0114] That is to say, after the kernel state writes the second data to be transmitted into the data transmission address, the kernel state can also use the IPC message to send a data transmission completion message to the user. The data completion message can carry the data length of the second data to be transmitted. Alternatively, the data length of the second data to be transmitted can also be carried by the data transmission request sent from the kernel state to the user state.

[0115] After receiving the data transmission completion message, the user state can read the second data to be transmitted from the data transmission address based on the data length. In one example, the user state can read the second data to be transmitted at the determined virtual address va according to the data length len of the second data to be transmitted.

[0116] In some embodiments of the present application, the kernel state performs legitimacy verification on the virtual address and data length, which may be to verify whether the virtual address is a user state virtual address; and to verify whether the data length exceeds the address capacity; in response to determining that the virtual address is a user state virtual address and the data length does not exceed the address capacity, it is determined that the legitimacy verification has passed.

[0117] When the microkernel operating system allocates virtual addresses for user state and kernel state, the user state and kernel state virtual addresses can be identified with different identifiers. When the kernel state verifies whether the virtual address is a user state virtual address, it can be implemented by judging whether the identifier of the virtual address is the same as that of the user state virtual address. If they are the same, the virtual address is a user state virtual address, and if they are not the same, the virtual address is not a user state virtual address.

[0118] If it is determined that the virtual address is not a user-mode virtual address, or the data length exceeds the address capacity, the legitimacy verification fails, and the data transmission operation can be stopped.

[0119] In some embodiments of the present application, the data volume of the first data to be transmitted and the second data to be transmitted are both greater than the maximum data volume of a single transmission of an IPC message. In one example, the first data to be transmitted and the second data to be transmitted can be data related to kernel fault information, software crash information, or thread running status information.

[0120] Figure 6 FIG. 1 is a flow chart of another data transmission method in a microkernel operating system provided in an embodiment of the present application. Figure 6 As shown, when the user state needs to transfer data to the kernel state, the user state data transmission module can apply for a piece of memory with a virtual address of va and a size of total in the memory for data exchange, and send an initialization IPC message to transfer va and total to the kernel state data transmission module. The user state data transmission module writes the data to be transmitted to the above-mentioned memory address va and writes the data length len. The user state transmission module uses the management mode command to put the processor's operating system in management mode, and sends va and len to the kernel state data transmission module through the data transmission IPC message. The address legitimacy detection module detects whether va is within the user state address range and whether len exceeds the total range. After that, the memory data read and write module reads the data with the address va and the length len into the data receiving area of ​​the kernel state data transmission module.

[0121] Among them, the user-state transmission module can send a management mode command to the privileged mode management module of the operating system. After receiving the management mode command sent by the user state, the privileged mode management module can switch the microkernel operating system to management mode (i.e., privileged mode) and notify the kernel-state data transmission module that a mode switch has occurred.

[0122] On the other hand, when the kernel state needs to transfer data to the user state, the kernel state data transmission module sends a data transmission request IPC message to notify the user state data transmission module. The user state transmission module uses the management mode command to make the CPU enter the management mode and sends a data transmission IPC message to notify the kernel state data transmission module that data can be written. The address legitimacy detection module detects whether va is within the user state address range and whether len exceeds the total range, and then writes the kernel state data to the va address and the length len. After that, the kernel state data transmission module sends a data transmission completion IPC message carrying the data length len to notify the user state data transmission module to read the written len size data and enable the CPU to exit the management mode.

[0123] It is understandable that after completing the data transmission, the user state can release the data transmission address.

[0124] By adopting the technical solution provided in the embodiment of the present application, the user state can cause the processor operating system to temporarily enter the management mode through the management mode command, and send the user state data receiving virtual address to the kernel state through IPC. The kernel state processing program can then read and write the user state data receiving address normally.

[0125] At the same time, the kernel-state and user-state data transmission method based on the privileged management mode of the processor operating system and the large-capacity memory provided in the embodiment of the present application can effectively solve the data transmission needs of large data volumes of more than megabytes; the use of general DDR memory does not require additional storage hardware, has better versatility, and can meet the kernel-state and user-state data transmission needs under all microkernel operating systems.

[0126] All the above optional technical solutions can be arbitrarily combined to form optional embodiments of the present application, which will not be described one by one here.

[0127] The following is an embodiment of the device of the present application, which can be used to execute the embodiment of the method of the present application. For details not disclosed in the embodiment of the device of the present application, please refer to the embodiment of the method of the present application.

[0128] Figure 7 Schematic diagram of a data transmission device in a microkernel operating system provided in an embodiment of the present application. Figure 7 As shown, the device comprises:

[0129] The data determination module 701 is configured to determine the first data to be transmitted from the user state in the microkernel operating system, where the first data to be transmitted is data that needs to be transmitted from the user state to the kernel state.

[0130] The address determination module 702 is configured to determine the data transmission address from the user state, write the first data to be transmitted into the data transmission address, and send the data transmission address to the kernel state of the microkernel operating system using an inter-process communication IPC message.

[0131] The mode switching module 703 is configured to use a management mode command in the user mode to make the operating system enter the management mode.

[0132] The acquisition module 704 is configured to acquire the first data to be transmitted from the data transmission address in kernel mode.

[0133] According to the technical solution provided by the embodiment of the present application, in a microkernel operating system, after the user state determines the data to be transmitted, the data transmission address is determined in the user state, the data to be transmitted is written into the data transmission address, and the data transmission address is sent to the kernel state by using an IPC message. At the same time, the user state also uses a management mode command to make the microkernel operating system enter the management mode, so that the kernel state can obtain the data to be transmitted from the data transmission address in the user state, thereby achieving efficient transmission of large-capacity data in the user state and the kernel state, solving the technical problem in the related art that only multiple IPC messages can be used to transmit large-capacity messages in the user state and the kernel state, thereby reducing the real-time performance of the operating system, improving the data transmission efficiency in the microkernel operating system, and enhancing the user experience.

[0134] In some embodiments, the data transmission address includes at least a virtual address and an address capacity in a user-state memory management unit MMU; the kernel state obtains the first data to be transmitted from the data transmission address, including: the user state sends the data length of the first data to be transmitted to the kernel state using an IPC message; the kernel state performs a legitimacy verification on the virtual address and data length in the received data transmission address; in response to determining that the legitimacy verification is passed, the kernel state reads the first data to be transmitted into the kernel state data receiving area.

[0135] Figure 8 Schematic diagram of another data transmission device in a microkernel operating system provided in an embodiment of the present application. Figure 8 As shown, the device comprises:

[0136] The data determination module is configured to determine the second data to be transmitted from the kernel state in the microkernel operating system, and use an inter-process communication IPC message to send a data transmission request to the user state in the microkernel operating system. The second data to be transmitted is data that needs to be transmitted from the kernel state to the user state.

[0137] The address determination module is configured to determine the data transmission address in the user state in response to receiving the data transmission request, and send the data transmission address to the kernel state by using an inter-process communication IPC message.

[0138] The mode switching module is configured to use a management mode command in the user mode to make the operating system enter the management mode.

[0139] The writing module is configured to write the second data to be transmitted into the data transmission address in kernel mode.

[0140] In some embodiments, the data transmission address includes at least a virtual address and an address capacity in a user-mode memory management unit MMU; the kernel mode writes the second data to be transmitted into the data transmission address, including: the kernel mode determines the data length of the second data to be transmitted; the kernel mode performs a legitimacy verification on the virtual address and the data length in the received data transmission address; in response to determining that the legitimacy verification is passed, the kernel mode writes the second data to be transmitted into the data transmission address.

[0141] In some embodiments, after the kernel state writes the second data to be transmitted into the data transmission address, it also includes: the kernel state uses an IPC message to send a data transmission completion message to the user state, the data transmission completion message carries the data length of the second data to be transmitted, or the data transmission request carries the data length of the second data to be transmitted; the user state reads the second data to be transmitted from the data transmission address based on the data length.

[0142] In some implementations, the kernel state performs legitimacy verification on the virtual address and data length, including: verifying whether the virtual address is a user state virtual address; and verifying whether the data length exceeds the address capacity; in response to determining that the virtual address is a user state virtual address and the data length does not exceed the address capacity, determining that the legitimacy verification has passed.

[0143] In some implementations, the data volumes of the first data to be transmitted and the second data to be transmitted are both larger than the maximum data volume of a single transmission of an IPC message.

[0144] It should be understood that the size of the serial numbers of the steps in the above embodiments does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.

[0145] Fig. 9 Schematic diagram of an electronic device provided in an embodiment of the present application. Fig. 9 As shown, the electronic device 9 of this embodiment includes: a processor 901, a memory 902, and a computer program 903 stored in the memory 902 and executable on the processor 901. When the processor 901 executes the computer program 903, the steps in the above-mentioned method embodiments are implemented. Alternatively, when the processor 901 executes the computer program 903, the functions of the modules / units in the above-mentioned device embodiments are implemented.

[0146] The electronic device 9 may be a desktop computer, a notebook, a PDA, a cloud server, or other electronic device. The electronic device 9 may include, but is not limited to, a processor 901 and a memory 902. Those skilled in the art will appreciate that Fig. 9 The electronic device 9 is merely an example and does not limit the electronic device 9 , and may include more or less components than those shown in the figure, or different components.

[0147] The processor 901 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc.

[0148] The memory 902 may be an internal storage unit of the electronic device 9, for example, a hard disk or memory of the electronic device 9. The memory 902 may also be an external storage device of the electronic device 9, for example, a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the electronic device 9. The memory 902 may also include both an internal storage unit of the electronic device 9 and an external storage device. The memory 902 is used to store computer programs and other programs and data required by the electronic device.

[0149] Those skilled in the art can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example. In actual applications, the above-mentioned functions can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiments can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units.

[0150] If the integrated module / unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present application implements all or part of the processes in the above-mentioned embodiment method, and can also be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. The computer program may include computer program code, which may be in source code form, object code form, executable file or some intermediate form. Computer-readable media may include: any entity or device capable of carrying computer program code, recording medium, U disk, mobile hard disk, disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal and software distribution medium, etc.

[0151] The above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application, and should all be included in the protection scope of the present application.

Claims

1. A data transmission method in a microkernel operating system, characterized in that: The microkernel operating system is an operating system with a management mode, and the method is used to transmit data between the user state and the kernel state of the microkernel operating system; The method comprises: Step S11, the user state determines first data to be transmitted, where the first data to be transmitted is data that needs to be transmitted from the user state to the kernel state; Step S12: The user state determines a data transmission address, writes the first data to be transmitted into the data transmission address, and sends the data transmission address to the kernel state using an inter-process communication (IPC) message; Step S13, the user state uses a management mode command to make the operating system enter the management mode; Step S14: the kernel state obtains the first data to be transmitted from the data transmission address.

2. The method according to claim 1, characterized in that The data transmission address at least includes a virtual address and an address capacity in a user-mode memory management unit MMU; The step S14 comprises: Step S141, the user state sends the data length of the first data to be transmitted to the kernel state using an IPC message; Step S142, the kernel state verifies the legitimacy of the virtual address in the received data transmission address and the data length; Step S143: In response to determining that the legitimacy verification is passed, the kernel state reads the first data to be transmitted into the kernel state data receiving area.

3. A data transmission method in a microkernel operating system, characterized in that: The microkernel operating system is an operating system with a management mode, and the method is used to transmit data between the user state and the kernel state of the microkernel operating system; The method comprises: Step S31, the kernel state determines second data to be transmitted, and sends a data transmission request to the user state using an inter-process communication IPC message, where the second data to be transmitted is data that needs to be transmitted from the kernel state to the user state; Step S32: In response to receiving the data transmission request, the user state determines a data transmission address, and sends the data transmission address to the kernel state using an inter-process communication (IPC) message; Step S33, the user state uses a management mode command to make the operating system enter the management mode; Step S34: the kernel state writes the second data to be transmitted into the data transmission address.

4. The method according to claim 3, characterized in that The data transmission address at least includes a virtual address and an address capacity in a user-mode memory management unit MMU; The step S34 comprises: Step S341, the kernel state determines the data length of the second data to be transmitted; Step S342: the kernel state verifies the legitimacy of the virtual address in the received data transmission address and the data length; Step S343: In response to determining that the legitimacy verification passes, the kernel state writes the second data to be transmitted into the data transmission address.

5. The method according to claim 3, characterized in that: After step S34, the method further includes: Step S35: the kernel state sends a data transmission completion message to the user state using an IPC message, wherein the data transmission completion message carries the data length of the second data to be transmitted, or the data transmission request carries the data length of the second data to be transmitted; Step S36: The user state reads the second data to be transmitted from the data transmission address based on the data length.

6. The method according to claim 2 or 4, characterized in that: The kernel state verifies the legitimacy of the virtual address and data length, including: Verifying whether the virtual address is a user-mode virtual address; and Verifying whether the data length exceeds the address capacity; In response to determining that the virtual address is a user-mode virtual address and the data length does not exceed the address capacity, it is determined that the legitimacy verification is passed.

7. The method according to any one of claims 1 to 5, characterized in that The data amounts of the first data to be transmitted and the second data to be transmitted are both greater than the maximum data amount of a single transmission of an IPC message.

8. A data transmission device in a microkernel operating system, characterized in that: The microkernel operating system is an operating system with a management mode, and the device includes: A data determination module is configured to determine first data to be transmitted from a user state in a microkernel operating system, wherein the first data to be transmitted is data that needs to be transmitted from the user state to the kernel state; An address determination module is configured to determine a data transmission address from the user state, write the first data to be transmitted into the data transmission address, and send the data transmission address to the kernel state of the microkernel operating system using an inter-process communication IPC message; A mode switching module, configured to use a management mode command in the user state to make the operating system enter the management mode; The acquisition module is configured to acquire the first data to be transmitted from the data transmission address in the kernel state.

9. A data transmission device in a microkernel operating system, characterized in that: The microkernel operating system is an operating system with a management mode, and the device includes: a data determination module, configured to determine second data to be transmitted from the kernel state in the microkernel operating system, and send a data transmission request to the user state in the microkernel operating system by using an inter-process communication (IPC) message, wherein the second data to be transmitted is data that needs to be transmitted from the kernel state to the user state; An address determination module is configured to, in response to receiving the data transmission request, determine a data transmission address by the user state, and send the data transmission address to the kernel state using an inter-process communication (IPC) message; A mode switching module, configured to use a management mode command in the user state to make the operating system enter the management mode; The writing module is configured to write the second data to be transmitted into the data transmission address in the kernel state.

10. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.

Citation Information

Cited By

  • Fault detection method and device based on kernel mode and user mode, medium and product

    CN120768748A