Message processing method, device and storage medium

By establishing a mapping relationship between custom messages and FF-A protocol messages in the terminal device, the problem of standardization of message transmission between components within the device is solved, and the efficiency and versatility of message transmission are achieved without affecting the original software framework. characteristics, adapting to the popularization needs of general-purpose chips.

CN117009108BActive Publication Date: 2024-08-27HONOR DEVICE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311022647.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-02-24
Publication Date
2024-08-27
Estimated Expiration
2043-02-24

AI Technical Summary

Technical Problem

The existing technology makes it difficult to realize the execution logic adjustment and standardization of message transmission between components within the terminal device without affecting the original software framework of the equipment manufacturer, especially in the scenario after universal chips are popularized.

Method used

By establishing a mapping relationship between custom messages and target protocol messages in the terminal device, the versatility of cross-component interactive messages is achieved. The FF-A protocol is used to standardize SMC calls to avoid direct transmission of custom messages and ensure the efficiency and standardization of message transmission.

Benefits of technology

Without affecting the original software framework of the device, it achieves the versatility of cross-component interactive messages within the device and the efficiency of message transmission, reduces the scope of code modification, avoids data splitting, and meets the universal requirements for message transmission.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117009108B
    Figure CN117009108B
Patent Text Reader

Abstract

An embodiment of the present application provides a message processing method, device and storage medium, the method is applied to an electronic device, the electronic device includes a first component and a second component, the method includes: when the first component sends a first message to the second component, by obtaining a second message corresponding to the first message, the second message is sent to the second component, and the second message is used to indicate the first message. The first message is a custom message for interaction between components in the device, and the second message is a preset message defined by the target protocol. The above scheme implements the universality requirements of cross-component interaction messages in the device, and maintains the efficiency of message transmission without affecting the original software framework of the device.
Need to check novelty before this filing date? Find Prior Art

Description

[0001] This application is a divisional application. The application number of the original application is 202310158762.3, and the original application date is February 24, 2023. The entire contents of the original application are incorporated into this application by reference. Technical Field

[0002] The present application relates to the field of terminal technology, and in particular to a message processing method, device and storage medium. Background Art

[0003] Currently, different terminal equipment manufacturers usually use customized security monitor calls (SMCs) to implement data transmission for information exchange between components within the device, such as transmitting data from components with lower exception levels (EL) of the device to components with higher exception levels.

[0004] However, with the popularization of general-purpose chips, standardized SMC calls are needed. How to adjust the execution logic between components within the device without affecting the original software framework of the equipment manufacturer is a problem that needs to be solved urgently. Summary of the invention

[0005] The embodiments of the present application provide a message processing method, device and storage medium, which are applied to the field of terminal technology to achieve the universality requirements of cross-component interactive messages within a device and maintain the efficiency of message transmission without affecting the original software framework of the device.

[0006] In a first aspect, an embodiment of the present application proposes a message processing method, which is applied to an electronic device, wherein the electronic device includes a first component and a second component, and the permission level of the first component is lower than the permission level of the second component; the message processing method includes: the first component obtains a first message, and the first message is a message sent by the first component to the second component; the first component determines a second message corresponding to the first message, and the second message is a preset message defined by the target protocol, and the second message is used to indicate the first message; the first component sends the second message to the second component.

[0007] Exemplarily, the first component may be a component of the Android kernel, and the second component may be a virtual machine monitor, the virtual machine monitor having a higher privilege level than the component of the Android kernel. The first message is a device-defined message, and the second message may be a message specified by the FF-A protocol.

[0008] In the above scheme, when the first component needs to send a first message to the second component, it does not send the first message directly. Instead, it determines the target protocol message type corresponding to the first message, such as the second message, and sends the second message to indicate the first message, thereby achieving the universality of cross-component interaction messages within the device and maintaining the efficiency of message transmission without affecting the device software framework.

[0009] In an optional embodiment of the first aspect, the first component determines the second message corresponding to the first message, including: the first component determines the second message corresponding to the first message by querying a preset message mapping relationship; wherein the message mapping relationship includes multiple messages sent by the first component to the second component, and a mapping relationship between each message and the message defined by the target protocol.

[0010] The second message in the message mapping relationship may correspond to one or more custom messages of one or more devices.

[0011] In the above scheme, by configuring the message mapping relationship at the code level, when the device executes a message call, it queries the message mapping relationship and transmits the message type that complies with the target protocol, thereby maintaining the efficiency of message transmission.

[0012] In an optional embodiment of the first aspect, the electronic device further includes a third component, and a permission level of the third component is greater than a permission level of the second component; the method further includes: the second component forwards the second message to the third component.

[0013] Exemplarily, the second component may be a virtual machine monitor, and the third component may be a secure partition management (SPM) component, the privilege level of the secure partition management component being greater than that of the virtual machine monitor. The secure partition management component is used to process and forward messages between different security partitions and messages between different operating environments, such as the second message.

[0014] In the above scheme, messages flowing from lower-privilege-level components to higher-privilege-level components adopt the message types specified by the target protocol to achieve standardization of message transmission.

[0015] In an optional embodiment of the first aspect, the electronic device also includes a fourth component, the fourth component is located in a first operating environment of the electronic device, and the first component is located in a second operating environment of the electronic device; the method also includes: the third component forwards the second message to the fourth component; the fourth component obtains the first message corresponding to the second message.

[0016] Exemplarily, the first operating environment is a secure operating environment, and the second operating environment is a non-secure operating environment. The third component may be the above-mentioned secure partition management component, and the fourth component may be a component of a trusted execution environment operating system. In this example, the permission level of the secure partition management component is greater than the permission level of the component of the trusted execution environment operating system.

[0017] In an optional embodiment of the first aspect, the fourth component obtains the first message corresponding to the second message, including: the fourth component obtains the first message corresponding to the second message by querying a register of the electronic device; the first message and the second message are stored in the register.

[0018] In the above scheme, after a lower-privilege-level component receives a message forwarded from a higher-privilege-level component, it can read the specific content indicated by the message from the register. The register stores the correspondence between the custom message and the message specified by the target protocol, as well as the message content of the custom message. This implementation has little impact on the original software framework of the device and maintains the efficiency of message transmission.

[0019] In an optional embodiment of the first aspect, the method further includes: the first component writing the first message into a first register of the electronic device, and the first component writing the second message into a second register of the electronic device.

[0020] In the above scheme, the first message and the second message are written into different registers respectively, so that the components in the data stream transmission process can read the specific content of the transmission message from the registers. The components in the data stream transmission process here include a component that forwards the second message (such as the third component mentioned above), and a component that finally receives the second message (such as the fourth component mentioned above).

[0021] In an optional embodiment of the first aspect, the method also includes: the fourth component generates a third message in response to the first message; the fourth component determines a fourth message corresponding to the third message, the fourth message is a message defined by the target protocol, and the fourth message is used to indicate the third message; the fourth component sends the fourth message to the first component via the third component and the second component.

[0022] The third message is a response message to the first message, and the third message is a device-defined message. The message mapping relationship includes a correspondence between the third message and the fourth message. Similar to the second message, the fourth message can correspond to one or more device-defined messages.

[0023] In the above scheme, when the fourth component returns the response message of the first message, it also needs to map the response message to the message specified by the target protocol based on the message mapping relationship, and forward it through multiple components so that the first component receives the message specified by the target protocol and then reads the content of the response message. Message transmission meets the generalization requirements.

[0024] In an optional embodiment of the first aspect, the method further includes: the fourth component writes the third message into a third register of the electronic device, and the fourth component writes the fourth message into a fourth register of the electronic device.

[0025] In the above solution, the third message and the fourth message are written into different registers respectively, so that the components in the data stream transmission process can read the specific content of the transmission message from the register.

[0026] In a second aspect, an embodiment of the present application provides an electronic device, comprising: a processor and a memory; the memory stores computer-executable instructions; the processor executes the computer-executable instructions stored in the memory, so that the electronic device performs any method as in the first aspect.

[0027] Electronic devices may also be called terminals, user equipment (UE), mobile stations (MS), mobile terminals (MT), etc. Electronic devices may be mobile phones, smart TVs, wearable devices, tablet computers, computers with wireless transceiver functions, virtual reality (VR) terminal devices, augmented reality (AR) terminal devices, wireless terminals in industrial control, wireless terminals in self-driving, wireless terminals in remote medical surgery, wireless terminals in smart grids, wireless terminals in transportation safety, wireless terminals in smart cities, wireless terminals in smart homes, etc.

[0028] In a third aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method of the first aspect is implemented.

[0029] In a fourth aspect, an embodiment of the present application provides a computer program product, which includes a computer program. When the computer program is executed, the computer executes the method of the first aspect.

[0030] In a fifth aspect, an embodiment of the present application provides a chip, the chip including a processor, the processor being used to call a computer program in a memory to execute the method described in the first aspect.

[0031] It should be understood that the second to fifth aspects of the present application correspond to the technical solutions of the first aspect of the present application, and the beneficial effects achieved by each aspect and the corresponding feasible implementation methods are similar and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0032] Figure 1 A schematic diagram of a device software framework provided in an embodiment of the present application;

[0033] Figure 2A schematic diagram of the software architecture of a device provided in an embodiment of the present application that is not adapted to FF-A;

[0034] Figure 3 A schematic diagram of the software architecture of the device adapted to FF-A provided in the embodiment of the present application;

[0035] Figure 4 A flowchart of a message processing method provided in an embodiment of the present application;

[0036] Figure 5 A schematic diagram of a message mapping relationship provided for an embodiment of the present application;

[0037] Figure 6 A schematic diagram of a message mapping relationship provided for an embodiment of the present application;

[0038] Figure 7 A schematic diagram of storing message data of two SMC calls provided in an embodiment of the present application;

[0039] Figure 8 A schematic diagram of the interaction of internal components of an electronic device provided in an embodiment of the present application;

[0040] Fig. 9 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application;

[0041] Fig.10 A schematic diagram of the structure of a chip provided in an embodiment of the present application. DETAILED DESCRIPTION

[0042] In order to facilitate the clear description of the technical solutions of the embodiments of the present application, in the embodiments of the present application, the words "first" and "second" are used to distinguish the same items or similar items with basically the same functions and effects. For example, the first message, the second message, the third message and the fourth message are only used to distinguish different messages sent in the device, and their sequence is not limited. For another example, the first register and the second register are only used to distinguish different registers. Those skilled in the art can understand that the words "first" and "second" do not limit the quantity and execution order, and the words "first" and "second" do not necessarily limit them to be different.

[0043] In the embodiments of the present application, "at least one" refers to one or more, and "plurality" refers to two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent the existence of A alone, the existence of A and B at the same time, and the existence of B alone, where A and B can be singular or plural. The character " / " generally indicates that the previous and next associated objects are in an "or" relationship. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, at least one of a, b or c can represent a, b, c, ab, ac, bc or abc, where a, b, c can be single or multiple.

[0044] In the embodiments of the present application, the words "exemplary" or "for example" are used to indicate examples, illustrations or descriptions. Any embodiment or design described as "exemplary" or "for example" in the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary" or "for example" is intended to present related concepts in a specific way.

[0045] The following first briefly introduces the professional terms involved in the embodiments of the present application.

[0046] EL: Exception level, mainly refers to the permission level of executing programs on the Android system. Usually, the permission levels are set from high to low as EL0, EL1, EL2 and EL3, that is, EL0 has the lowest permission level and EL3 has the highest permission level.

[0047] Firmware: The device driver stored inside the device. Only through the firmware operating system can the operation of a specific machine be implemented according to the standard device driver.

[0048] FF-A:Firmware Framework for A-Profile processors, a standard protocol that can be used when interacting across components within a device, can be used to The interaction between various software images is universalized on the Cortex-A chip.

[0049] ATF: trusted firmware, The trusted firmware on the chip can be seen as fixed in The program code on .

[0050] SMC: secure monitor call, security monitor call, is The assembly instruction implements the request message interaction from low EL to high EL level. The SMC instruction can be used to pass the parameters of the request message, such as writing the parameters to the device register.

[0051] For example, Figure 1 A schematic diagram of a device software framework provided in an embodiment of the present application.

[0052] Figure 1 The normal world on the left is a non-secure operating environment, which includes one or more virtual machines (VMs) and a hypervisor. The guest operating system (Guest OS) is the system software running on the virtual machine and is an important part of the virtual machine. For example, the Guest OS is the Android operating system. In addition, various applications also run on the virtual machine. The hypervisor is responsible for managing the virtual machines, processing and forwarding messages between virtual machines and messages between different operating environments. Figure 1 Various applications in the application layer are located at the abnormal level EL0 layer, the Android operating system is located at the EL1 layer, and the virtual machine monitor is located at the EL2 layer. The permission level of the virtual machine monitor is greater than the permission level of the Android operating system, and the permission level of the Android operating system is greater than the permission level of the application.

[0053] Figure 1 The secure world on the right side of the figure is a secure operating environment, which may include one or more secure partitions (SPs), such as Figure 1 SP0 and SP1 in it. Taking SP0 as an example, SP0 can include one or more applications, as well as a TEE (Trusted Execution Environment) operating system (OS). The secure partition manager (SPM) can be used to process and forward messages between different security partitions and messages between different operating environments. For example, SPM is used to forward messages between components of SP0 and SP1, and SPM is used to forward messages between components of the normal world and the secure world. SPM includes SPMC (secure partition manager core) and SPMD (secure partition manager dispatch).

[0054] based on Figure 1As shown in the software architecture, existing device vendors use customized SMC instructions to interact with the Android OS kernel, TEE OS kernel, and secure partition management SPM of their devices, that is, different device vendors use their own SMC instructions.

[0055] For example, Figure 2 The software architecture diagram of the device provided in the embodiment of the present application is not adapted to FF-A. Figure 2 As shown, the Android OS kernel and TEE OS at the EL1 layer, and the SPD (secure payload dispatch) at the EL3 layer all use the SMC calls customized by the device vendor to pass the parameters of the request message, that is, use private SMC calls to implement cross-component message interaction. For example, a certain business code in the Android OS kernel includes private SMC instructions, and another example is that a certain business code in the TEE OS includes private SMC instructions, and another example is that the SPM code includes private SMC instructions.

[0056] based on Figure 2 In the software architecture shown, the data flow between the normal world and the secure world is as follows: the Android OS kernel sends a request message to the virtual machine monitor through a private SMC call, and writes the parameters of the request message into the register; the virtual monitor forwards the request message to the SPD, and the SPD can read the parameters of the request message from the register; the SPD can forward the data request to the TEE OS, and the TEE OS can read the parameters of the request message from the register, and finally forward the request message from the normal world to the secure world. After receiving the request message, the TEE OS can return the response message corresponding to the request message to the Android OS kernel through the SPD and the virtual monitor in turn.

[0057] At present, in view of the SMC calls defined by different equipment manufacturers, it is necessary to standardize (generalize) the SMC calls to adapt to the FF-A protocol framework. However, adapting to the FF-A protocol may have a relatively large impact on the device software framework itself, for example: the call chain of private SMC calls is relatively long, and there are many triggering points, resulting in a large scope of code modifications.

[0058] In this regard, the embodiment of the present application shows a message processing method, which adapts the relevant configuration of the FF-A specification to the Android OS kernel and TEE OS of the EL1 layer of the device, and the SPM of the EL3 layer to realize the standard SMC call. The main idea of ​​this method is as follows: in accordance with the definition of the FF-A specification, by establishing a mapping relationship between private messages (custom messages) and standard FF-A messages, the identifier of the private message, the message parameters, and the identifier of the standard FF-A message are recorded in the corresponding position of the device register to realize the transmission of the internal message parameters of the device, bringing the following effects: the overall software framework is not affected, and the upper-level business of the code is not affected; the scope of code modification is reduced to avoid problems such as missing modifications caused by large-scale code modification; make full use of the protocol field to avoid data splitting and maintain message transmission efficiency.

[0059] The message processing method provided by the embodiment of the present application is described in detail below in conjunction with the accompanying drawings. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments.

[0060] Figure 3 A schematic diagram of the software architecture of the device adapted to FF-A provided in the embodiment of the present application. Figure 2 compared to, Figure 3 The software architecture shown mainly adapts the code layer of the Android OS kernel, TEE OS, and SPM in ATF to the FF-A specification. By configuring the message mapping relationship and the storage location of messages and parameters in the code of the Android OS kernel, TEE OS, and SPM, the SMC call adapted to the standard FF-A is realized, and the message parameter transmission inside the device is realized.

[0061] based on Figure 3 The software architecture shown in the figure, the embodiment of the present application provides a message processing method. Figure 4 The solution provided in this application is described in detail.

[0062] Figure 4 A flowchart of a message processing method provided by an embodiment of the present application. The message processing method of this embodiment is applied to an electronic device, the electronic device includes a first component and a second component, and the permission level of the first component is lower than the permission level of the second component. Figure 4 As shown, the message processing method includes the following steps:

[0063] S401. The first component obtains a first message.

[0064] The first message is a message sent by the first component to the second component, and the first message is a message customized by the equipment manufacturer. The first component can transmit the first message through a private SMC call. However, in order to adapt to the target protocol (such as the FF-A specification protocol), the first component can implement a standard SMC call through message mapping, and the details can be seen in the following steps.

[0065] S402. The first component determines the second message corresponding to the first message.

[0066] The second message is a preset message defined by the target protocol. In a possible implementation, the first component determines the second message corresponding to the first message by querying a preset message mapping relationship. The second message is used to indicate the first message.

[0067] The message mapping relationship includes multiple messages (custom messages / private messages) sent by the first component to the second component, and a mapping relationship between each message and a message defined by the target protocol.

[0068] For example, Figure 5 A schematic diagram of a message mapping relationship provided in an embodiment of the present application. Figure 5 As shown, the customized messages of the equipment vendor include TSP_MSG_1, TSP_MSG_2, TSP_MSG_3, TSP_MSG_4 and TSP_MSG_5, and the messages defined by the target protocol include FFA_MSG_WAIT, FFA_INTERRUPT and FFA_MSG_SEND_DIRECT_RESP. Among them, TSP_MSG_1 and TSP_MSG_2 have a corresponding relationship with FFA_MSG_WAIT, TSP_MSG_3 has a corresponding relationship with FFA_INTERRUPT, and TSP_MSG_4 and TSP_MSG_5 have a corresponding relationship with FFA_MSG_SEND_DIRECT_RESP.

[0069] It should be noted that Figure 5 As an example only, one custom message corresponds to only one FF-A message, but one FF-A message may correspond to multiple custom messages.

[0070] In the existing solution, the above message mapping relationship is not preset in the electronic device, and the device directly transmits the first message through a private SMC call. Figure 6 A schematic diagram of a message mapping relationship provided for an embodiment of the present application. Figure 6 Multiple custom messages shown with Figure 5The difference is that the device directly transmits each custom message through SMC call, that is, through SMC call, the transmitted SMC message is the same as the custom message, and the SMC message is not compatible with the FF-A protocol.

[0071] It is understandable that since different equipment vendors customize the interaction messages between their components, the universality of the messages is poor.

[0072] Compared with the existing solution, this embodiment can realize cross-component message interaction by presetting the message mapping relationship, and use messages that adapt to the underlying chip protocol (such as FF-A protocol) to transmit data. The cross-component message interaction here mainly refers to sending messages from a low-privilege component to a high-privilege component, for example, Figure 3 The message sent by the Android OS kernel to the virtual machine monitor, or the message sent by the TEE OS to the SPM.

[0073] S403. The first component writes the first message into the first register, and writes the second message into the second register.

[0074] After determining the second message corresponding to the first message, the first component needs to write the first message and the second message into the register so that other components can read the first message and the second message through the register. For ease of reading, the relevant data of the first message can be written into the first register, and the relevant data of the second message can be written into the second register.

[0075] For ease of understanding, the following are Figure 5 and Figure 6 The message data storage process of the SMC call shown is described. Figure 7 A schematic diagram of message data storage for two SMC calls provided in an embodiment of the present application.

[0076] In a possible implementation, for Figure 6 In the case of directly transmitting an SMC message through a private SMC call, it is assumed that the SMC message includes parameters A0 to A4, and the registers used by the SMC message include X0 to X4. Among them, A0 indicates the identifier of the SMC message, which is used to indicate the service type of the message, and A1 to A4 are multiple data contents carried in the SMC message. The parameters A0 to A4 of the SMC message can be written into registers X0 to X4 respectively, as shown in FIG. Figure 7 As shown in (a).

[0077] In a possible implementation, for Figure 5In the case of transmitting the FF-A message through the standard SMC call shown, the SMC message may correspond to the aforementioned first message, and the FF-A message may correspond to the aforementioned second message. Assume that the SMC message includes parameters A0 to A4, which is the same as the aforementioned implementation. Since the standard SMC call transmits the FF-A message, it is necessary to configure the corresponding register to store the relevant data of the FF-A message.

[0078] For example, Figure 7 As shown in (b), registers X0 to X2 can be configured to store relevant data of the FF-A message, for example, X0 stores the identifier of the FF-A message, which is used to indicate the service type of the message, X1 stores the identifiers of the sender and receiver of the FF-A message, and X3 stores other parameters of the FF-A message. At the same time, registers X3 to X7 are configured to store relevant data of the SMC message, for example, parameters A0 to A4 in the SMC message are written into registers X0 to X4 respectively. Figure 7 Compared with (a), the parameter storage location of the SMC message is offset, or in other words, the parameters A0 to A4 originally passed to registers X0 to X4 are offset and stored in registers X3 to X7 defined by the FF-A protocol.

[0079] Combination Figure 7 In the register shown in (b), the relevant data of the first message is written into the first register, and the first register includes registers X3 to X7. The relevant data of the second message is written into the second register, and the second register includes registers X0 to X2.

[0080] In this step, the first component needs to write the first message and the second message into the designated register respectively, so that other components (such as the second component, etc.) can obtain the relevant data of the first message and the second message through the designated register. Other components can also know that the first message and the second message have a corresponding relationship through the storage location of the relevant data of the first message and the second message, so as to improve the efficiency of cross-component message transmission.

[0081] S404. The first component sends a second message to the second component.

[0082] In the message processing method shown in the above embodiment, when the first component sends the first message to the second component, the first component obtains the second message corresponding to the first message, and finally sends the second message to the second component, and the second message is used to indicate the first message. The first message is a custom message for interaction between components in the device, and the second message is a preset message defined by the target protocol. The above scheme implements the universality requirements of cross-component interaction messages in the device, and maintains the efficiency of message transmission without affecting the original software framework of the device. In terms of technical implementation, the above scheme realizes message mapping when the SMC is called by constructing a mapping relationship between custom messages and preset messages defined by the target protocol in the device, avoiding message data splitting (that is, avoiding splitting the original custom message into multiple messages for sending), and maintaining the efficiency of message transmission.

[0083] In addition, the above solution can avoid large-scale code modification. By configuring message mapping and mapping of message parameters and registers, when executing SMC calls, the messages defined by the target protocol can be transmitted between components, meeting the universal requirements of message transmission and maintaining the efficiency of message transmission. The device software framework is not affected, and the upper-layer business of the code is not affected.

[0084] In some embodiments, the electronic device further includes a third component, wherein the permission level of the third component is greater than the permission level of the second component. After S404, the message processing method further includes:

[0085] S405. The second component forwards the second message to the third component.

[0086] In some embodiments, the electronic device further includes a fourth component, the fourth component is located in the first operating environment of the electronic device, and the first component is located in the second operating environment of the electronic device. After S405, the message processing method further includes:

[0087] S406. The third component forwards the second message to the fourth component.

[0088] For example, Figure 8 The following is a schematic diagram of the interaction of internal components of an electronic device provided in an embodiment of the present application. Figure 8 As shown, the first component and the second component are located in the second operating environment (normal world) of the electronic device, the fourth component is located in the first operating environment (secure world) of the electronic device, the permission level of the first component and the fourth component is EL1, the permission level of the second component is EL2, and the permission level of the third component is EL3. Based on the previous description of the permission level, it can be seen that in this example, the permission level of the first component is less than the permission level of the second component, and the permission level of the third component is greater than the permission level of the second component.

[0089] based on Figure 8It can be seen that the second message flows out from the first component, is forwarded by the second component and the third component in turn, and is finally received by the fourth component, realizing the transmission of the message from the ordinary world to the secure world. The second message is a message defined by the target protocol.

[0090] S407. The fourth component obtains the first message corresponding to the second message.

[0091] The fourth component can obtain the first message corresponding to the second message by querying the register of the electronic device. The register of the electronic device stores relevant data of the first message and the second message, such as Figure 7 as shown in (b).

[0092] In the message processing method shown in the above embodiment, the messages transmitted between components are all messages defined by the target protocol, thereby achieving the universality of cross-component interactive messages.

[0093] In some embodiments, after the fourth component learns the first message corresponding to the second message, it may further perform the following steps:

[0094] S408. The fourth component generates a third message.

[0095] The fourth component generates a third message in response to the first message. The third message can be regarded as a response message of the first message.

[0096] S409. The fourth component determines the fourth message corresponding to the third message.

[0097] Similar to S402, the fourth component can determine the fourth message corresponding to the third message by querying the preset message mapping relationship. The fourth message is a preset message defined by the target protocol, for example, the fourth message is an FF-A message.

[0098] It is understandable that when the fourth component returns a response message to the first component, it also needs to map the third message customized by the equipment vendor to the fourth message defined by the target protocol based on the preset message mapping relationship to meet the universal requirements of cross-component interaction messages. The fourth message is used to indicate the third message.

[0099] S410. The fourth component writes the third message into the third register, and writes the fourth message into the fourth register.

[0100] In this step, the principle of writing the third message and the fourth message into the register is consistent with the principle of writing the first message and the second message into the register in S403. The relevant data of the third message can be written into the third register, and the relevant data of the fourth message can be written into the fourth register. For details, please refer to the above and will not be repeated here.

[0101] Optionally, the third register may be the first register, such as Figure 7The fourth register may be the second register, such as Figure 7 (b) shows registers X3 to X7.

[0102] S411. The fourth component sends a fourth message to the third component.

[0103] S412. The third component forwards the fourth message to the second component.

[0104] S413. The second component forwards the fourth message to the first component.

[0105] like Figure 8 As shown, the fourth message flows out from the fourth component, is forwarded by the third component and the second component in sequence, and is finally received by the first component, thereby realizing the transmission of the message from the secure world to the ordinary world. The fourth message is a message defined by the target protocol.

[0106] S414. The first component obtains the third message corresponding to the fourth message.

[0107] In the message processing method shown in the above embodiment, when the fourth component sends the third message to the third component, it obtains the fourth message corresponding to the third message, and finally sends the fourth message to the third component, and the fourth message is used to indicate the third message. Among them, the third message is a custom message for interaction between components in the device, and the fourth message is a preset message defined by the target protocol. By constructing the message mapping and the mapping of message parameters and registers, the message defined by the target protocol is transmitted between components, the universality requirements of message transmission are met, and the efficiency of message transmission is maintained.

[0108] The method for sorting the device list in the embodiment of the present application has been described above, and the device for performing the method for sorting the list in the embodiment of the present application is described below. Those skilled in the art can understand that the method and the device can be combined and referenced with each other, and the relevant device provided in the embodiment of the present application can perform the steps in the method for sorting the list in the embodiment of the present application.

[0109] The message processing method provided in the embodiment of the present application can be applied to electronic devices with communication functions. The electronic devices include terminal devices, and the specific device form of the terminal devices can be referred to in the invention content section, which will not be repeated here.

[0110] An embodiment of the present application provides an electronic device, which includes: a processor and a memory; the memory stores computer-executable instructions; the processor executes the computer-executable instructions stored in the memory, so that the electronic device executes the above method.

[0111] For example, Fig. 9 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. Fig. 9 As shown, the electronic device includes a processor 901, a communication line 904 and at least one communication interface ( Fig. 9 The communication interface 903 is used as an example for explanation).

[0112] The processor 901 may be a general-purpose central processing unit (CPU), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits for controlling the execution of the program of the present application.

[0113] Communications link 904 may include circuitry to transmit information between the above-described components.

[0114] The communication interface 903 uses any transceiver or other device for communicating with other devices or communication networks, such as Ethernet, wireless local area networks (WLAN), etc.

[0115] In some embodiments, the electronic device may further include a memory 902 .

[0116] The memory 902 may be a read-only memory (ROM) or other types of static storage devices that can store static information and instructions, a random access memory (RAM) or other types of dynamic storage devices that can store information and instructions, or an electrically erasable programmable read-only memory (EEPROM), a compact disc read-only memory (CD-ROM) or other optical disc storage, optical disc storage (including compressed optical disc, laser disc, optical disc, digital versatile disc, Blu-ray disc, etc.), a magnetic disk storage medium or other magnetic storage device, or any other medium that can be used to carry or store the desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited thereto. The memory may exist independently and be connected to the processor via a communication line 904. The memory may also be integrated with the processor.

[0117] The memory 902 is used to store computer-executable instructions for executing the solution of the present application, and the execution is controlled by the processor 901. The processor 901 is used to execute the computer-executable instructions stored in the memory 902, thereby implementing the method provided by the embodiment of the present application.

[0118] The computer-executable instructions in the embodiments of the present application may also be referred to as application program codes, which is not specifically limited in the embodiments of the present application.

[0119] As an example, the processor 901 may include one or more CPUs.

[0120] As an example, an electronic device may include multiple processors. Each processor may be a single-CPU processor or a multi-CPU processor. The processor herein may refer to one or more devices, circuits, and / or processing cores for processing data (e.g., computer program instructions).

[0121] The embodiment of the present application provides a chip. The chip includes a processor, and the processor is used to call a computer program in a memory to execute the technical solution in the above embodiment. Its implementation principle and technical effect are similar to those of the above related embodiments, and will not be repeated here.

[0122] For example, Fig.10 This is a schematic diagram of the structure of a chip provided in an embodiment of the present application. Fig.10 As shown, chip 1000 includes one or more (including two) processors 1020 and a communication interface 1030 .

[0123] In some embodiments, memory 1040 stores the following elements: executable modules or data structures, or a subset of executable modules or data structures, or an extended set of executable modules or data structures.

[0124] In the embodiment of the present application, the memory 1040 may include a read-only memory and a random access memory, and provide instructions and data to the processor 1020. A portion of the memory 1040 may also include a non-volatile random access memory (NVRAM).

[0125] In the embodiment of the present application, the memory 1040, the communication interface 1030 and the memory 1040 are coupled together through the bus system 1010. The bus system 1010 may include a power bus, a control bus and a status signal bus in addition to a data bus. Fig.10 Various buses are labeled as bus system 1010 .

[0126] The method described in the above embodiment of the present application can be applied to the processor 1020, or implemented by the processor 1020. The processor 1020 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by an integrated logic circuit of hardware or software instructions in the processor 1020. The above processor 1020 can be a general-purpose processor (for example, a microprocessor or a conventional processor), a digital signal processor (digital signal processing, DSP), an application specific integrated circuit (application specific integrated circuit, ASIC), a field-programmable gate array (field-programmable gate array, FPGA) or other programmable logic devices, discrete gates, transistor logic devices or discrete hardware components. The processor 1020 can implement or execute the disclosed methods, steps and logic block diagrams in the embodiments of the present application.

[0127] In the above embodiments, the instructions stored in the memory for execution by the processor may be implemented in the form of a computer program product. The computer program product may be pre-written in the memory, or may be downloaded and installed in the memory in the form of software.

[0128] The embodiment of the present application also provides a computer-readable storage medium, which stores a computer program. The above method is implemented when the computer program is executed by the processor. The method described in the above embodiment can be implemented in whole or in part by software, hardware, firmware, or any combination thereof. If implemented in software, the function can be stored as one or more instructions or codes on a computer-readable medium or transmitted on a computer-readable medium. Computer-readable media may include computer storage media and communication media, and may also include any medium that can transfer a computer program from one place to another. The storage medium may be any target medium that can be accessed by a computer.

[0129] In one possible implementation, a computer-readable medium may include RAM, ROM, a read-only CD or other optical disk storage, a disk storage or other magnetic storage device, or any other medium targeted to carry or store the required program code in the form of instructions or data structures, and accessible by a computer. Moreover, any connection is appropriately referred to as a computer-readable medium. For example, if a coaxial cable, fiber optic cable, twisted pair, digital subscriber line (DSL) or wireless technology (such as infrared, radio and microwave) is used to transmit software from a website, server or other remote source, the coaxial cable, fiber optic cable, twisted pair, DSL or wireless technologies such as infrared, radio and microwave are included in the definition of the medium. Disks and optical disks as used herein include optical disks, laser disks, optical disks, digital versatile disks (DVD), floppy disks and blue-ray disks, where disks usually reproduce data magnetically, while optical disks reproduce data optically using lasers. The above combinations should also be included in the scope of computer-readable media.

[0130] An embodiment of the present application provides a computer program product, which includes a computer program. When the computer program is executed, the computer executes the above method.

[0131] The embodiments of the present application are described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processing unit of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable device to generate a machine, so that the instructions executed by the processing unit of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0132] The above specific implementation methods further illustrate the purpose, technical solutions and beneficial effects of the present application in detail. It should be understood that the above are only specific implementation methods of the present application and are not used to limit the protection scope of the present application. Any modifications, equivalent substitutions, improvements, etc. made on the basis of the technical solutions of the present application should be included in the protection scope of the present application.

Claims

1. A message processing method, characterized in that: Applied to an electronic device, the electronic device includes a first component and a second component, the first component and the second component are both located in a non-secure operating environment of the electronic device, and the permission level of the first component is lower than the permission level of the second component; the method includes: The first component obtains a first message; The first component determines a second message having a mapping relationship with the first message, the second message is a preset message defined by a target protocol, and the first message is a device-defined message; The first component sends the second message to the second component.

2. The method according to claim 1, characterized in that The first component determines a second message having a mapping relationship with the first message, including: The first component determines a second message having a mapping relationship with the first message by querying a preset message mapping relationship; wherein the message mapping relationship includes multiple custom messages and a mapping relationship between each custom message and a message defined by a target protocol.

3. The method according to claim 1, characterized in that The electronic device further includes a third component, and the permission level of the third component is greater than the permission level of the second component; the method further includes: The second component forwards the second message to the third component.

4. The method according to claim 3, characterized in that The electronic device further includes a fourth component, and the fourth component is located in a safe operating environment of the electronic device; and the method further includes: The third component forwards the second message to the fourth component; The fourth component obtains the first message having a mapping relationship with the second message.

5. The method according to claim 4, characterized in that The fourth component obtains the first message having a mapping relationship with the second message, including: The fourth component obtains the first message having a mapping relationship with the second message by querying a register of the electronic device; the first message and the second message having a mapping relationship are stored in the register.

6. The method according to any one of claims 1 to 5, characterized in that: The method further comprises: The first component writes the first message to a first register of the electronic device, and The first component writes the second message to a second register of the electronic device.

7. The method according to claim 4, characterized in that The method further comprises: The fourth component generates a third message in response to the first message; The fourth component determines a fourth message having a mapping relationship with the third message, wherein the fourth message is a message defined by the target protocol; The fourth component sends the fourth message to the first component through the third component and the second component.

8. The method according to claim 7, characterized in that The fourth component determines a fourth message having a mapping relationship with the third message, including: The fourth component determines a fourth message having a mapping relationship with the third message by querying a preset message mapping relationship.

9. The method according to claim 7, characterized in that: The method further comprises: The fourth component writes the third message to a third register of the electronic device, and The fourth component writes the fourth message to a fourth register of the electronic device.

10. An electronic device, characterized in that: include: Processor and memory; The memory stores computer-executable instructions; The processor executes the computer-executable instructions stored in the memory, so that the electronic device performs the method according to any one of claims 1 to 9.

11. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 9 is implemented.

12. A computer program product, characterized in that The invention comprises a computer program which, when being executed, causes a computer to execute the method according to any one of claims 1 to 9.