Storage area allocation method and device, equipment and storage medium
By applying the storage area allocation method in an all-in-one device, using eSE and eSIM to share the same physical storage area, and through the conversion of virtual address to physical address, the problem of data storage area allocation between eSE and eSIM in consumer electronic devices is solved, and the sharing of data firewall and multi-service system data areas is realized.
Patent Information
- Application Number
- CN202411965186.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-30
- Publication Date
- 2025-04-08
- Estimated Expiration
- 2044-12-30
AI Technical Summary
In consumer electronic devices, how eSE and eSIM can effectively allocate and use user data storage areas for different services is an urgent problem to be solved. The prior art is difficult to achieve hard isolation of data firewalls and service data storage, and it is also difficult to realize the sharing of data areas of multi-service system.
By applying the memory area allocation method in an all-in-one device, eSE and eSIM share the same physical memory area. When any component is activated, it obtains its relational mapping table, converts the virtual address to the physical address, and accesses the physical storage area based on the target physical address.
The data firewall is realized to ensure hard isolation of service data storage, and at the same time, the sharing of data areas of multiple service systems is realized, improving the security and utilization of data storage.
Smart Images

Figure CN119781691A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of data storage, and in particular to a storage area allocation method, device, equipment and storage medium. Background Art
[0002] To ensure information security, smart terminals usually include an embedded secure element (eSE) and an embedded subscriber identity module (eSIM). The eSIM and eSE use two physically independent chips, each with its own operating system.
[0003] As consumer electronic devices have a demand for high integration, small size, low cost, and low energy consumption for chips such as Near Field Communication (NFC), eSIM, and eSE, some devices have begun to integrate eSE and eSIM in the same chip and implement two logically isolated virtual operating systems using software code.
[0004] How to allocate and use the user data storage area of different services of two virtual operating systems is an urgent problem to be solved. Summary of the invention
[0005] In order to solve the above technical problems, the present application provides a storage area allocation method, device, equipment and storage medium, which implement a data firewall and hard isolation of business data storage; and realize data area sharing of multiple business systems.
[0006] In a first aspect, the present application provides a storage area allocation method, which uses an all-in-one device, the all-in-one device includes an eSE and an eSIM, the eSE and the eSIM share the same physical storage area, the method includes: when any component is detected to be activated, obtaining a relationship mapping table of the activated component, the relationship mapping table includes a mapping relationship between a virtual address and a physical address, the activated component includes an eSE or an eSIM; obtaining an access request sent by the activated component, wherein the access request includes a target virtual address; determining a target physical address corresponding to the target virtual address in the mapping relationship table; and accessing the physical storage area based on the target physical address.
[0007] In the second aspect, the present application provides a storage area allocation device, which is configured on an all-in-one device, the all-in-one device includes an SE and an eSIM, the eSE and the eSIM share the same physical storage area, and the device includes: a mapping table acquisition module, which is used to obtain a relationship mapping table of the activated component when it is detected that any component is activated, the relationship mapping table includes a mapping relationship between a virtual address and a physical address, and the activated component includes an eSE or an eSIM; a target virtual address acquisition module, which is used to obtain a target virtual address sent by the activated component; a target physical address determination module, which is used to determine the target physical address corresponding to the target virtual address in the mapping relationship table; a storage area access module, which is used to access the physical storage area based on the target physical address.
[0008] In a third aspect, the present application provides an electronic device, which includes a storage area allocation device, and the electronic device includes: one or more processors; a storage device for storing one or more programs; when the one or more programs are executed by one or more processors, the one or more processors implement the storage area allocation method as described in the first aspect above.
[0009] In a fourth aspect, the present application provides a storage medium, which may be a computer-readable storage medium, storing a computer program thereon, which, when executed by a processor, implements the storage area allocation method in the first aspect described above.
[0010] In a fifth aspect, an embodiment of the present application provides a computer program product, which includes a computer program or instructions, and when the computer program or instructions are executed by a processor, the storage area allocation method as described in any one of the first aspects above is implemented.
[0011] Compared with the prior art, the technical solution provided by the embodiments of the present application has the following advantages:
[0012] The embodiment of the present application provides a storage area allocation method, device, equipment and storage medium. The method uses an all-in-one device, which includes an eSE and an eSIM. The eSE and the eSIM share the same physical storage area. The method includes: when any component is detected to be activated, obtaining a relationship mapping table of the activated component, the relationship mapping table includes a mapping relationship between a virtual address and a physical address, and the activated component includes an eSE or an eSIM; obtaining an access request sent by the activated component, wherein the access request includes a target virtual address; determining a target physical address corresponding to the target virtual address in the mapping relationship table; and accessing the physical storage area based on the target physical address. When the eSE and the eSIM are activated, the conversion from the virtual address to the physical address is realized through their corresponding relationship mapping tables, thereby realizing the allocation and use of the same data storage by different operating systems, realizing a data firewall, and realizing hard isolation of business data storage; and realizing the sharing of data areas of multiple business systems. BRIEF DESCRIPTION OF THE DRAWINGS
[0013] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0014] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0015] Figure 1 A flowchart of a storage area allocation method provided in an embodiment of the present application;
[0016] Figure 2a A schematic diagram of a structure in which a physical storage area provided in an embodiment of the present application is divided into two;
[0017] Figure 2b A schematic diagram of the structure of a physical storage area after virtual space conversion provided in an embodiment of the present application;
[0018] Figure 3 A schematic diagram of a flow chart of an optimized storage area allocation method provided in an embodiment of the present application;
[0019] Figure 4 This is a flowchart of an address conversion provided by an embodiment of the present application;
[0020] Figure 5 It is a flowchart of another address conversion provided by an embodiment of the present application;
[0021] Figure 6A schematic diagram of the overall process of address conversion provided in an embodiment of the present application;
[0022] Figure 7 A flowchart of another optimized storage area allocation method provided in an embodiment of the present application;
[0023] Figure 8 A schematic diagram of the structure of a storage area allocation device provided in an embodiment of the present application;
[0024] Fig. 9 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0025] In order to more clearly understand the above-mentioned purposes, features and advantages of the present application, the scheme of the present application will be further described below. It should be noted that the embodiments of the present application and the features in the embodiments can be combined with each other without conflict.
[0026] In the following description, many specific details are set forth to facilitate a full understanding of the present application, but the present application may also be implemented in other ways different from those described herein; obviously, the embodiments in the specification are only part of the embodiments of the present application, rather than all of the embodiments.
[0027] The term "including" and its variations used herein are open inclusions, i.e., "including but not limited to". The term "based on" means "based at least in part on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". The relevant definitions of other terms will be given in the following description.
[0028] It should be noted that the concepts such as "first" and "second" mentioned in this application are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units.
[0029] It should be noted that the modifications of "one" and "plurality" mentioned in the present application are illustrative rather than restrictive, and those skilled in the art should understand that unless otherwise clearly indicated in the context, it should be understood as "one or more".
[0030] As consumer electronic devices have high integration, small size, low cost, and low energy consumption requirements for NFC, eSIM, eSE and other chips, some have begun to integrate eSE and eSIM in the same chip and implement two logically isolated virtual operating systems using software code. How to allocate and use the user data storage area of different services of the two virtual operating systems is an urgent problem to be solved. There are mainly two solutions for how to allocate and use the user data storage area of different services of the two virtual operating systems:
[0031] The first method: two virtual operating systems share the same large physical storage area, and a manager is implemented by software. The manager implements the allocation algorithm to ensure that eSE and eSIM allocate and use storage resources. This solution is more dependent on the allocation algorithm, and when one business has problems or is attacked by security, the other business will also be affected because it cannot achieve physical data isolation.
[0032] The second method is to divide the data storage area into two parts. You can use the hardware memory protection unit (MPU) or software algorithm to set the storage area allocated by the operating system in use to be accessible, and set the other non-working storage area to be inaccessible, so as to achieve physical isolation. This allocation method generally needs to be divided only at the factory stage, and the amount of end-user data needs to be predicted. For example, in some extreme cases, a user only uses one of the eSIM or eSE, and the unused operating system will also allocate a storage area, resulting in insufficient storage space for the used operating system.
[0033] The above two allocation schemes have certain demand conflicts in the allocation of data storage. The data storage areas need to be independent / isolated from each other to provide data firewalls to ensure data security, and the data storage areas need to be shared to a certain extent to increase utilization.
[0034] In order to solve the above technical problems, the embodiment of the present application provides a storage area allocation method, which uses an all-in-one device, which includes an eSE and an eSIM, and the eSE and the eSIM share the same physical storage area. The method includes: when any component is detected to be activated, obtaining a relationship mapping table of the activated component, the relationship mapping table includes a mapping relationship between a virtual address and a physical address, and the activated component includes an eSE or an eSIM; obtaining an access request sent by the activated component, wherein the access request includes a target virtual address; determining a target physical address corresponding to the target virtual address in the mapping relationship table; and accessing the physical storage area based on the target physical address. Since the conversion from the virtual address to the physical address is realized through the corresponding relationship mapping table when the eSE and the eSIM are activated, the allocation and use of the same data storage by different operating systems is realized, a data firewall is realized, and hard isolation of business data storage is realized; and data area sharing of multiple business systems is realized.
[0035] The storage area allocation method provided by the present application is described in detail below in conjunction with the accompanying drawings and specific implementation methods.
[0036] Figure 1 This is a flow chart of a storage area allocation method in an embodiment of the present application. This embodiment can be applied to the case of allocating storage areas of an all-in-one device. The method can be executed by a storage area allocation device. The storage area allocation device can be implemented in software and / or hardware. The storage area allocation device can be configured in the all-in-one device. In other words, the storage area allocation method is applied to the all-in-one device. The all-in-one device includes an eSE and an eSIM, and the eSE and the eSIM share the same physical storage area.
[0037] The all-in-one device in the embodiment of the present application refers to a device that integrates the eSE and the eSIM into the same physical storage area. The all-in-one device is generally used in the field of mobile communications, such as smartphones and other portable devices.
[0038] The all-in-one device includes eSE and SIM. eSE can be understood as a security chip specially designed to store and process sensitive data. eSE can be used to store keys, certificates and other forms of encrypted data to ensure that sensitive information is not accessed without authorization. eSE is often used in mobile payment, digital identity authentication and other application scenarios that require high security. eSIM is a smart card for mobile phones. Its main function is to store user identification information, encryption keys and network authentication information, so that the phone can connect to a specific mobile network.
[0039] When eSE and eSIM are integrated together and share the same physical storage area, eSE and eSIM are not completely independent, but are closely integrated together and can work individually or in conjunction.
[0040] On a physical level, eSE and eSIM coexist in one physical chip, which reduces the need for internal device space and simplifies hardware design. This not only helps reduce costs but also improves device reliability.
[0041] Since eSE and eSIM are located on the same chip, the communication between eSE and eSIM is faster and has lower latency. This provides a smoother user experience when performing online payments. The integrated all-in-one device can not only support traditional SIM card functions such as connecting to mobile networks, but can also be expanded to support more value-added services such as NFC payment, electronic ticketing, etc., which are all achieved by leveraging the security features of eSE.
[0042] All-in-one devices achieve higher security, better performance and more flexible application expansion capabilities by integrating eSE and eSIM into the same physical storage area.
[0043] like Figure 1 As shown, the storage area allocation method provided in the embodiment of the present application mainly includes steps S101-S102.
[0044] S101. When any component is detected to be activated, a relationship mapping table of the activated component is obtained, wherein the relationship mapping table includes a mapping relationship between a virtual address and a physical address, and the activated component includes an eSE or an eSIM.
[0045] Since the all-in-one device includes eSE and eSIM, the activation of any component includes two situations: eSE is activated, or eSIM is activated. In the case of eSE being activated, the activated component is eSE, and in the case of eSIM being activated, the activated component is eSIM.
[0046] Specifically, when any component is detected to be activated, a relationship mapping table of the activated component is obtained, and the relationship mapping table includes a mapping relationship between a virtual address and a physical address, including: when an eSE is detected to be activated, the relationship mapping table of the eSE is obtained, and the eSE relationship mapping table includes a mapping relationship between a virtual address and a physical address of the eSE. When an eSIM is detected to be activated, the relationship mapping table of the eSIM is obtained, and the eSIM relationship mapping table includes a mapping relationship between a virtual address and a physical address of the eSIM.
[0047] In an all-in-one device including eSE and SIM, a task switching mechanism in a multi-tasking operating system (Real-Time Operating System, RTOS). Further, the current running task is switched from eSIM to eSE through RTOS task scheduling, that is, eSE is scheduled as the current running task through RTOS task scheduling, and then it is detected that eSE is activated. The current running task is switched from eSE to eSIM through RTOS task scheduling, that is, eSIM is scheduled as the current running task through RTOS task scheduling, and then it is detected that eSIM is activated.
[0048] Obtaining the relationship mapping table of the activated component includes: when detecting that the eSE is activated, obtaining the relationship mapping table corresponding to the eSE, and storing the relationship mapping table corresponding to the eSIM as a backup. When detecting that the eSIM is activated, obtaining the relationship mapping table corresponding to the eSIM, and storing the relationship mapping table corresponding to the eSE as a backup.
[0049] In a possible implementation, the relationship mapping table is in the form of a one-dimensional array, the array index represents the virtual address, and the array content indicates the physical address corresponding to the virtual address. Further, the relationship mapping table can be a MapTable. A MapTable is a table for managing and mapping resources. MapTable is usually used to manage and map memory addresses, security areas, permission control, etc.
[0050] When the currently running task is switched through RTOS task scheduling, the role of MapTable is to ensure that the memory and security settings of the current task and the new task can be correctly saved and restored when the component is switched. When any component is detected to be activated, the content in the current MapTable is used as the relationship mapping table of the current component, and the relationship mapping table of the current component is backed up to a temporary storage area. When switching to a new task (component is activated), the relationship mapping table of the activated component is restored from the temporary storage area, and the relationship mapping table of the activated component is copied to MapTable to achieve the management of the relationship mapping table. Ensure that the activated component can correctly access the memory and security areas it requires.
[0051] Specifically, when it is detected that eSE is activated, the content in the current MapTable is used as the relationship mapping table of eSIM, and the relationship mapping table of eSE is backed up to a temporary storage area. When switching to eSIM, the relationship mapping table of eSIM is restored from the temporary storage area, and the relationship mapping table of eSIM is copied to MapTable to manage the eSIM relationship mapping table. When it is detected that eSIM is activated, the content in the current MapTable is used as the relationship mapping table of eSIM, and the relationship mapping table of eSIM is backed up to a temporary storage area. When switching to eSE, the relationship mapping table of eSE is restored from the temporary storage area, and the relationship mapping table of eSE is copied to MapTable to manage the eSE relationship mapping table. Ensure that the activated component can correctly access the memory and security areas it requires.
[0052] In one possible implementation, a virtual space is created in a physical storage area, where the virtual space includes multiple virtual addresses; different virtual addresses are assigned to the eSE or the eSIM; and different security attributes are set for the virtual address assigned to the eSE and the virtual address assigned to the SIM.
[0053] like Figure 2a As shown, the operating system can be simply divided into eSE code area, eSIM code area, user data storage area 1, and user data storage area 2. The eSE code area is used to store the software code of the eSE operating system, the eSIM code area is used to store the software code of the eSIM operating system, the user data storage area 1 is used to store user data related to the eSE operating system, and the user data storage area 2 is used to store user data related to the eSIM operating system. In addition, for chips that support the trusted area (TrustZone), the data storage area can further divide the user data storage area into a security attribute area and divide the user data storage area 2 into a non-security attribute area. The above-mentioned user data storage area 1 and user data storage area 2 are stored in the same physical flash memory space. The user data storage area 1 and the user data storage area 2 are isolated by dividing the physical storage area into two. Although the hard isolation of the storage area is achieved, reuse becomes a problem.
[0054] exist Figure 2a Based on the physical storage area, two virtual spaces are created, and the virtual space includes at least one virtual address segment. The hardware of the physical storage area can support access to the virtual address segment. Furthermore, the virtual address access rights can be set through the chip MPU or the paging memory management unit (Memory Management Unit, MMU), and for chips that support TrustZone, security attributes can also be set separately.
[0055] The effect after setting is as follows Figure 2b As shown, from the perspective of eSE, the size of the area that can be accessed through the virtual address space is close to Figure 2a represents the sum of user data storage area 1 and user data storage area 2; from the perspective of eSIM, the size of the area that can be accessed through the virtual address space is close to Figure 2a Indicates the sum of user data storage area 1 and user data storage area 2.
[0056] Furthermore, different security attributes are set for the virtual address allocated to the eSE and the virtual address allocated to the eSIM.
[0057] Specifically, the virtual address is mapped to the physical address through the MPU or MMU, and different access rights are set for different virtual address areas. By configuring the MMU, independent virtual addresses can be set for the eSE and eSIM, and different security attributes can be set for the virtual addresses, such as read-only, writable, and non-executable. Furthermore, by configuring the MMU, the security attributes set for the virtual addresses assigned to the eSE are higher than the security attributes set for the virtual addresses assigned to the eSIM.
[0058] Furthermore, TrustZone technology is used to provide isolation between the secure environment and the non-secure environment at the hardware level. In this case, the data of the eSE and eSIM can be placed in the secure attribute area and the non-secure attribute area respectively, or independent security domains can be created for each of them, thereby improving data security.
[0059] The virtual address of the eSE is mapped to the physical address through the MPU or MMU, and the relationship mapping table of the eSE is constructed and stored based on the mapping relationship. The virtual address of the eSIM is mapped to the physical address through the MPU or MMU, and the relationship mapping table of the eSIM is constructed and stored based on the mapping relationship.
[0060] In the embodiment of the present application, different business data storage areas are divided into different virtual addresses and different access attributes are set for them. The data storage areas need to be independent / isolated to ensure data security, and the data storage areas need to be shared to a certain extent to improve utilization.
[0061] S102: Obtain an access request sent by the activated component, wherein the access request includes a target virtual address.
[0062] Among them, access request refers to the behavior of a program or operating system trying to access a physical address in the physical storage area. The above access can be a read (Read), write (Write) or execute (Execute) operation. Specifically: Read (Read) refers to the operation of obtaining data from a physical address in the physical storage area. This is the most common type of access. Almost all programs frequently perform read operations to obtain the values of variables, constants or other data structures. Write (Write) is an operation of writing data to a certain address in the physical storage area. Write operations are usually used to update the value of variables, modify data structures or store new data. Execute (Execute) refers to executing instructions starting from a certain address in the memory. This is the basis for program code execution. The CPU reads instructions from the memory and executes them.
[0063] A virtual address is a memory address used by an operating system or application at runtime. A virtual address does not directly point to a physical memory location, but is an address converted by the operating system and MMU. Each component has its own virtual address space, which means that different components can use the same virtual address without conflict.
[0064] The physical address is the address that actually exists on the memory chip (physical storage area). It is used by the memory controller to access the specific location of the memory module. The physical address is unique and directly corresponds to a byte in the physical memory.
[0065] Since virtual memory is used in the embodiment of the present application, the virtual address corresponding to the physical address to be accessed is carried in the access request. Therefore, the access request is parsed to obtain the virtual address written thereto, and the virtual address is used as the target virtual address.
[0066] Obtaining an access request sent by an activated component, wherein the access request includes a target virtual address, includes: when the activated component is an eSE, obtaining an access request sent by an eSE, wherein the access request includes a target virtual address that the eSE wants to access. Obtaining an access request sent by an activated component, wherein the access request includes a target virtual address, includes: when the activated component is an eSIM, obtaining an access request sent by an eSIM, wherein the access request includes a target virtual address that the eSIM wants to access.
[0067] S103: Determine the target physical address corresponding to the target virtual address in the mapping relationship table of the activated component.
[0068] Since the mapping relationship table includes the target physical address corresponding to the target virtual address, the corresponding physical address is queried in the mapping relationship table based on the target virtual address as the target physical address.
[0069] Specifically, determining the target physical address corresponding to the target virtual address in the mapping relationship table of the activated component includes: when the activated component is an eSE, determining the target physical address corresponding to the target virtual address in the mapping relationship table of the eSE. When the activated component is an eSIM, determining the target physical address corresponding to the target virtual address in the mapping relationship table of the eSIM.
[0070] S104: Access the physical storage area based on the target physical address.
[0071] The target physical address refers to the address in the physical storage area that the activated component wants to access eventually. The controller of the physical storage area and the storage area allocation device are connected through an address bus. The address bus is a group of wires used to transmit memory address information. The storage area allocation device transmits the converted target physical address to the memory controller through the address bus.
[0072] The memory controller is a hardware component responsible for managing access to physical storage areas. It receives a physical address from the address bus and performs corresponding memory operations based on the physical address.
[0073] If the access request is a read operation, the memory controller reads the data from the target physical address and transfers the data back to the activated component via the data bus. If the access request is a write operation, the memory controller writes the data to the target physical address.
[0074] The embodiment of the present application provides a storage area allocation method, which uses an all-in-one device, which includes an eSE and a SIM, and the eSE and the SIM share the same physical storage area. The method includes: when any component is detected to be activated, obtaining a relationship mapping table of the activated component, the relationship mapping table includes a mapping relationship between a virtual address and a physical address, and the activated component includes an eSE or a SIM; obtaining an access request sent by the activated component, wherein the access request includes a target virtual address; determining a target physical address corresponding to the target virtual address in the mapping relationship table; and accessing the physical storage area based on the target physical address. When the eSE and the SIM are activated, the conversion from the virtual address to the physical address is realized through their corresponding relationship mapping tables, thereby realizing the allocation and use of the same data storage by different operating systems, realizing a data firewall, and realizing hard isolation of business data storage; and realizing the sharing of data areas of multiple business systems.
[0075] Based on the above embodiments, the present application embodiment optimizes the storage area allocation method, such as Figure 3 As shown, the optimized storage area allocation method mainly includes the following steps:
[0076] S201. When it is detected that any component is activated, a relationship mapping table of the activated component is obtained, wherein the relationship mapping table includes a mapping relationship between a virtual address and a physical address, and the activated component includes an eSE or an eSIM.
[0077] S202: Obtain an access request sent by the activated component, wherein the access request includes a target virtual address.
[0078] The process of S201-S202 provided in the embodiment of the present application is the same as the process of S101-S102 provided in the above embodiment. For details, please refer to the description in the above embodiment, which will not be repeated in the embodiment of the present application.
[0079] S203: Determine the page code of the target virtual address based on the access target virtual address, the base address of the virtual space, and the page size of the virtual space.
[0080] Virtual space refers to the space of virtual addresses, and the base address of virtual space refers to the starting address of virtual address space. In a virtual memory system, each process has its own virtual address space, which starts from a fixed starting address. This starting address is the base address of virtual address space.
[0081] A page is a basic unit in memory management, used to map continuous virtual address space to physical address space. The size of each page is fixed, and common page sizes include 4KB, 8KB, 16KB, 64KB, etc. By dividing the memory into fixed-size pages, the operating system can manage memory more efficiently. Each page can be allocated, released, and mapped independently.
[0082] The page size of the virtual space refers to the size of each page in the virtual address space. This size is usually determined by the operating system and the hardware platform. For example, if the page size of the virtual space is 4KB, then each page in the virtual address space is 4KB in size.
[0083] Specifically, the offset of the virtual address relative to the base address is calculated, and then the page code of the target virtual address is calculated based on the offset and the page size of the virtual space.
[0084] Subtract the base address B1 of the virtual space from the target virtual address V1 to obtain the offset relative to the base address. Divide the offset by the page size PAGE_SIZE_1 of the virtual space to obtain the page code of the target virtual address.
[0085] The formula for the page encoding of the target virtual address is as follows:
[0086] virtual_page_number=(V1-B1) / PAGE_SIZE_1
[0087] virtual_page_number is the page number of the target virtual address, V1 is the target virtual address, B1 is the base address of the virtual space, and PAGE_SIZE_1 is the page size of the virtual space.
[0088] For example: target virtual address V1 = 0x1000; base address B1 of virtual space = 0x0000; page size PAGE_SIZE_1 of virtual space = 4096.
[0089] Calculate the offset of the virtual address relative to the base address: offset = V1 - B1 = 0x1000 - 0x0000 = 0x1000.
[0090] Calculate the page number of the virtual address: \text{virtual_page_number}=\frac{\text{offset}}{\text{PAGE_SIZE_1}}=
[0091] \frac{0x1000}{4096}=1.
[0092] S204: Determine an array with the page code of the target virtual address as the index, and use the content in the array as the page code of the target physical address.
[0093] In the relationship mapping table, which is in the form of a one-dimensional array, the array index indicates the page code of the virtual address, and the array content indicates the page code of the physical address corresponding to the virtual address. Further, the relationship mapping table is copied to MapTable. MapTable is a table for managing and mapping resources. MapTable is used to manage the relationship mapping table of eSE or eSIM.
[0094] Specifically, MapTable is the core component of address conversion. MapTable is a continuous RAM space in the form of a one-dimensional array. The index of the array, that is, the subscript of the array represents the page number (vPn) of the virtual address, and the content of the array is the page code (Pn) of the corresponding physical address. MapTable is placed in the chip, which can not only realize basic hardware address conversion, but also perform access permission control on the input virtual address.
[0095] After the page code of the target virtual address, since the index of the array in the MapTable is the page code of the virtual address, then the array with the page code of the target virtual address as the index is searched in the MapTable, and the content of the array is used as the page code of the target physical address.
[0096] For example: if the page code of the target virtual address is vP0, then the array index of the search array is vP0. After the search is found, the array content with the array index vP0 is used as the page code of the target physical address.
[0097] S205 . Determine the target physical address based on the page code of the target physical address.
[0098] In one possible implementation, the target physical address is determined based on the page code of the target physical address, including: if the page code of the target physical address is a real page code, the physical address corresponding to the real page code is used as the target physical address; if the page code of the target physical address is a preset page code, an unused physical address is determined from the physical storage area, and the unused physical address is used as the target physical address.
[0099] In the embodiment of the present application, the page codes of the physical addresses managed in the relationship mapping table mainly include two types: real page codes and preset page codes. The real page code means that the page code has an actual corresponding determined physical address in the actual physical storage area. The preset page code means that the page code does not actually correspond to a determined physical address in the actual physical storage area, and the page code is a specific page code.
[0100] The preset page code PZ is not within the normal physical page range. For example, the largest page index value is FFFF. When the value in the MapTable corresponding to the page code of the target virtual address is the preset page code PZ, the data content of the PZ page will be returned. The data of the PZ page is generally set to a special value (such as all 0 or all F), and the PZ page can be associated with multiple virtual pages.
[0101] If the page code of the target physical address is a real page code, the physical address corresponding to the real page code is used as the target physical address. Figure 4 As shown, in the relationship mapping table of eSE, the page code vP0 of the virtual address corresponds to the real page code P0, the page code vP2 of the virtual address corresponds to the real page code P7, the page code vP3 of the virtual address corresponds to the real page code P9, the page code vP4 of the virtual address corresponds to the real page code P4, and the page codes vP1, vP5, vP6, and vP7 of the virtual address correspond to the preset coding address PZ.
[0102] When the activated component is eSE, in the relationship mapping table of eSE, when the page code of the target virtual address is vP0, the page code of its target physical address is determined to be P0, and the physical address [0C010800H—0C011000H] corresponding to the page code P0 is used as the target physical address. When the page code of the target virtual address is vP2, the page code of its target physical address is determined to be P7, and the physical address [0C01 4000H—0C01 4800H] corresponding to the page code P7 is used as the target physical address. When the page code of the target virtual address is vP3, the page code of its target physical address is determined to be P9, and the physical address [0C01 5000H—0C01 5800H] corresponding to the page code P9 is used as the target physical address. When the page code of the target virtual address is vP4, the page code of its target physical address is determined to be P4, and the physical address [0C01 2800H—0C01 3000H] corresponding to the page code P4 is used as the target physical address.
[0103] like Figure 4 As shown, in the relationship mapping table of eSIM, the page code vP0 of the virtual address corresponds to the real page code P8, the page code vP3 of the virtual address corresponds to the real page code P5, the page code vP5 of the virtual address corresponds to the real page code P2, and the page codes vP1, vP2, vP4, vP6, and vP7 of the virtual address correspond to the preset coding address PZ.
[0104] When the activated component is an eSIM, in the relationship mapping table of the eSIM, when the page code of the target virtual address is vP0, the page code of its target physical address is determined to be P8, and the physical address [0C014800H—0C015000H] corresponding to the page code P8 is used as the target physical address. When the page code of the target virtual address is vP3, the page code of its target physical address is determined to be P5, and the physical address [0C01 3000H—0C01 3800H] corresponding to the page code P5 is used as the target physical address. When the page code of the target virtual address is vP5, the page code of its target physical address is determined to be P2, and the physical address [0C01 2000H—0C01 2800H] corresponding to the page code P2 is used as the target physical address.
[0105] The physical address corresponding to the real page code is used as the target physical address, specifically including: using the page code of the target virtual address to find the corresponding real page code of the target physical address in the MapTable, multiplying the real page code by the page size PAGE_SIZE_2 of the physical space to obtain the offset of the physical address. Add the offset of the physical address to the base address B2 of the physical address space to obtain the final target physical address.
[0106] Specifically, final_physical_address=physical_page_number*PAGE_SIZE_2+B2
[0107] Among them, final_physical_address is the target physical address, physical_page_number is the real page number of the target physical address, and PAGE_SIZE_2 is the page size of the physical space.
[0108] If the page code of the target physical address is a preset page code, an unused physical address is determined from the physical storage area, and the unused physical address is used as the target physical address.
[0109] like Figure 5 As shown, in the relationship mapping table of the eSE, the page code vP1 of the virtual address corresponds to the preset code address PZ. In the relationship mapping table of the eSIM, the page codes vP1 and vP2 of the virtual address correspond to the preset code address PZ.
[0110] When the activated component is eSE, in the relationship mapping table of eSE, when the page code of the target virtual address is vP1, determine the page code PZ of its target physical address, find a page that is not associated with the MapTable from the physical storage area, and write the data to the newly found page first. Similarly, when the activated component is eSIM, in the relationship mapping table of eSIM, when the page codes of the target virtual address are vP1 and vP2, determine the page code PZ of its target physical address, find a page that is not associated with the MapTable from the physical storage area, and write the data to the newly found page first.
[0111] Furthermore, after determining the unused physical address from the physical storage area and using the unused physical address as the target physical address, the method further includes: determining the page code corresponding to the unused physical address; and replacing the page code in the array content with the page code corresponding to the unused physical address.
[0112] Specifically, when the activated component is eSE, in the relationship mapping table of eSE, when the page code of the target virtual address is vP1, determine the page code PZ of its target physical address, find a page that is not associated with the MapTable from the physical storage area, and write the data to the newly found unused page. If the page code corresponding to the unused address is P2, then modify the array content corresponding to the page code vP1 of the target virtual address to P2.
[0113] When the activated component is eSIM, in the relationship mapping table of eSIM, when the page code of the target virtual address is vP1, determine the page code PZ of its target physical address, find a page that is not associated with MapTable from the physical storage area, and write the data to the newly found unused page first. The page code corresponding to the unused address is P10, then modify the array content corresponding to the page code vP1 of the target virtual address to P10.
[0114] S206: Access the physical storage area based on the target physical address.
[0115] like Figure 6 As shown, the target virtual address in the access request is obtained, and the target virtual address is converted to obtain a physical address, and the physical storage area is accessed through the physical address.
[0116] Specifically, if the access request is a read operation, due to the MapTable module implemented inside the chip, the conversion process is completed by hardware logic without software involvement. The virtual address can be directly converted to the physical address and the data stored in the physical address can be read. If the virtual address does not have access rights, an exception will be generated and fed back to the access request.
[0117] If the access request is a write operation, it is implemented through storage management software, which has a high security level and generally only runs in the privileged state of the chip.
[0118] If the access request is to write data, the physical page to be written is queried in software through the specific API call of the storage management module using the method provided in the embodiment of the present application. If it is a real page code, it is directly written to the corresponding physical page. If it is a preset real page code, a page that is not associated with the MapTable is found from the physical storage area, and the data is first written to the newly found page to complete the data writing.
[0119] The data storage area allocation method based on the eSIM and eSE all-in-one device proposed in the embodiment of the present application not only realizes the data firewall and hard isolation of business data storage, but also realizes the sharing of data areas of multiple business systems.
[0120] On the basis of the above embodiments, the embodiments of the present application further optimize the storage area allocation method, such as Figure 7 As shown, the optimized storage area allocation method mainly includes the following steps:
[0121] S301, initialize the counter.
[0122] A counter Counter is predefined and initialized to 0. The counter is used to record the number of unmanaged physical pages.
[0123] S302, traverse the page codes in the physical storage area.
[0124] Determine the total number of physical pages in the physical storage area. The total number of physical page codes can be obtained through system configuration or querying memory information. Use a loop to traverse all page codes in the physical storage area.
[0125] S303: If any page code is not stored in the relationship mapping table of the eSE and is not stored in the relationship mapping table of the eSIM, increase the value of the counter by a set value.
[0126] The counter value is used to represent the number of available pages in the physical storage area.
[0127] Optionally, the value is set to 1. If any page code is not stored in the relationship mapping table of the eSE and is not stored in the relationship mapping table of the eSIM, the value of the counter is increased by 1. The counter is used to count the number of unused pages in the physical storage area. If the page code is not stored in the relationship mapping table of the eSE, it means that the physical address corresponding to the page code is not used by the eSE. If it is not stored in the relationship mapping table of the eSIM, it means that the physical address corresponding to the page code is not used by the eSIM.
[0128] The page code is not stored in the relationship mapping table of the eSE, and is not stored in the relationship mapping table of the eSIM, indicating that the physical address corresponding to the page code is not used by the eSE or the eSIM. In other words, the physical address included in the page code is an unused physical address, so the value of the counter is increased by 1.
[0129] After the traversal is completed, the value of the counter is the number of unused page codes in the entire physical storage area.
[0130] S304: After the traversal is completed, the value of the counter is subtracted from the set minimum page value to obtain the current number of available pages.
[0131] Setting the minimum page value refers to the minimum page value reserved by the system. The minimum page value reserved by the system refers to the number of physical pages reserved in advance by the operating system or system manager to ensure the basic operation and stability of the system. These pages are usually not used by ordinary applications or user processes, but are dedicated to critical tasks and core services of the system. Reserving these pages helps prevent the system from crashing or becoming unstable due to insufficient memory. For example: the minimum page value X reserved by the system is 10 pages, which means that no matter how many physical pages there are in the system, at least 10 pages are reserved by the system and will not be allocated to ordinary applications or user processes.
[0132] After the traversal is completed, the value of the counter is the number of unused page codes in the entire physical storage area.
[0133] The value of the counter minus the set minimum page value is used to obtain the current number of available pages, which can be understood as the number of all unused page codes in the entire physical storage area minus the minimum page value reserved by the system, which is the number of pages available to ordinary applications or user processes.
[0134] S305: The product of the current number of available pages and the size of the physical page is taken as the number of available bytes.
[0135] Multiply the number of currently available physical pages by the page size to get the currently available physical storage space, which is in bytes.
[0136] For example: the physical page size is 4K, the current number of available pages is 10, then the number of available bytes is 40K.
[0137] In an embodiment of the present application, a statistical method for physical storage space is provided. By calculating the available physical storage space, memory resources can be better allocated to ensure that each application and service has sufficient memory to run. At the same time, it can help the system manage memory more effectively, reduce memory fragmentation, and improve memory utilization.
[0138] Figure 8 FIG. 1 is a schematic diagram of a storage area allocation device in an embodiment of the present application. Figure 8 As shown, the storage area allocation device 80 provided in the embodiment of the present application is configured in an all-in-one device, and the all-in-one device includes an embedded security element eSE and an embedded user identification card eSIM. The eSE and the eSIM share the same physical storage area. The storage area allocation device 80 provided in the embodiment of the present application mainly includes: a mapping table acquisition module 81, a target virtual address acquisition module 82, a target physical address determination module 83 and a storage area access module 84.
[0139] Among them, a mapping table acquisition module is used to obtain the relationship mapping table of the activated component when it is detected that any component is activated, the relationship mapping table of the activated component includes a mapping relationship between a virtual address and a physical address, and the activated component includes an eSE or an eSIM; a target virtual address acquisition module is used to obtain the target virtual address sent by the activated component; a target physical address determination module is used to determine the target physical address corresponding to the target virtual address in the mapping relationship table; a storage area access module is used to access the physical storage area based on the target physical address.
[0140] The embodiment of the present application provides a storage area allocation device, which is configured in an all-in-one device, and the all-in-one device includes eSE and eSIM, and eSE and eSIM share the same physical storage area. The device is used to execute the following process: when any component is detected to be activated, obtain the relationship mapping table of the activated component, the relationship mapping table includes the mapping relationship between the virtual address and the physical address, and the activated component includes eSE or eSIM; obtain the access request sent by the activated component, wherein the access request includes the target virtual address; determine the target physical address corresponding to the target virtual address in the mapping relationship table; access the physical storage area based on the target physical address. When eSE and eSIM are activated, the conversion from virtual address to physical address is realized through their corresponding relationship mapping tables, thereby realizing the allocation and use of the same data storage by different operating systems, realizing a data firewall, and realizing hard isolation of business data storage; and realizing the sharing of data areas of multiple business systems.
[0141] In one possible implementation, the relationship mapping table is in the form of a one-dimensional array, the array index represents the page code of the virtual address, and the array content indicates the page code of the physical address corresponding to the virtual address; the target physical address determination module 83 is specifically used to determine the page code of the target virtual address based on the target virtual address, the base address of the virtual space and the page size of the virtual space; determine an array with the page code of the target virtual address as the index, and use the content in the array as the page code of the target physical address; determine the target physical address based on the page code of the target physical address.
[0142] In one possible implementation, the target physical address determination module 83 is specifically used to, if the page code of the target physical address is a real page code, use the physical address corresponding to the real page code as the target physical address; if the page code of the target physical address is a preset page code, determine an unused physical address from the physical storage area, and use the unused physical address as the target physical address.
[0143] In a possible implementation, it also includes: a relationship mapping table management module, which is used to determine the page code corresponding to the unused physical address after taking the unused physical address as the target physical address; and replace the page code in the array content with the page code corresponding to the unused physical address.
[0144] In a possible implementation, it also includes: a page statistics module, used to initialize a counter; traverse the page codes in the physical storage area; if any page code is not stored in the relationship mapping table of the eSE and is not stored in the relationship mapping table of the eSIM, increase the value of the counter by a set value, and the value of the counter is used to represent the number of available pages in the physical storage area.
[0145] In a possible implementation, the page statistics module is further used to, after the traversal is completed, subtract the set minimum page value from the value of the counter to obtain the current number of available pages; and use the product of the current number of available pages and the size of the physical page as the number of available bytes.
[0146] In one possible implementation, the virtual address allocation module is used to create a virtual space in the physical storage area, where the virtual space includes multiple virtual addresses; allocate different virtual addresses to the eSE or eSIM; and set different security attributes for the virtual address allocated to the eSE and the virtual address allocated to the eSIM.
[0147] The storage area allocation device provided in the embodiment of the present application can execute the storage area allocation method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.
[0148] Fig. 9 is a schematic diagram of the structure of an electronic device provided by this embodiment. The electronic device may include a storage area allocation device, such as Fig. 9 As shown, the electronic device 900 includes a processor 910, a memory 920, an input device 930, and an output device 940; the number of the processor 910 in the electronic device can be one or more. Fig. 9 A processor 910 is taken as an example; the processor 910, the memory 920, the input device 930 and the output device 940 in the electronic device can be connected via a bus or other means. Fig. 9 The example of connecting through bus is taken in the following.
[0149] The memory 920, as a computer-readable storage medium, can be used to store software programs, computer executable programs and modules, such as program instructions / modules corresponding to the storage area allocation method in the embodiment of the present invention. The processor 910 executes various functional applications and data processing of the electronic device by running the software programs, instructions and modules stored in the memory 920, that is, implements the storage area allocation method provided in the embodiment of the present invention.
[0150] The memory 920 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created according to the use of the terminal, etc. In addition, the memory 920 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other non-volatile solid-state storage device. In some instances, the memory 920 may further include a memory remotely arranged relative to the processor 910, and these remote memories may be connected to the electronic device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0151] The input device 930 may be used to receive input digital or character information and generate key signal input related to user settings and function control of the electronic device, and may include a keyboard, a mouse, etc. The output device 940 may include a display device such as a display screen.
[0152] This embodiment also provides a storage medium containing computer executable instructions, which are used to implement the storage area allocation method provided in the embodiment of the present invention when executed by a computer processor.
[0153] Of course, the computer executable instructions of a storage medium including computer executable instructions provided by an embodiment of the present invention are not limited to the operations of the method described above, and can also execute related operations in the storage area allocation method provided by any embodiment of the present invention.
[0154] Through the above description of the implementation methods, the technicians in the relevant field can clearly understand that the present invention can be implemented by means of software and necessary general hardware, and of course it can also be implemented by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as a computer floppy disk, read-only memory (ROM), random access memory (RAM), flash memory (FLASH), hard disk or optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, server, or network device, etc.) to execute the methods described in each embodiment of the present invention.
[0155] It is worth noting that in the embodiment of the above-mentioned storage area allocation device, the various units and modules included are only divided according to functional logic, but are not limited to the above-mentioned division, as long as the corresponding functions can be achieved; in addition, the specific names of the functional units are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of the present invention.
[0156] It should be noted that, in this article, relational terms such as "first" and "second" are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
[0157] The above description is only a specific implementation of the present application, so that those skilled in the art can understand or implement the present application. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein can be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to the embodiments described herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A storage area allocation method, characterized in that: The method uses an all-in-one device, the all-in-one device includes an embedded security element eSE and an embedded user identity card eSIM, the eSE and the eSIM share the same physical storage area, and the method includes: When any component is detected to be activated, a relationship mapping table of the activated component is obtained, wherein the relationship mapping table includes a mapping relationship between a virtual address and a physical address, and the activated component includes an eSE or an eSIM; Obtaining an access request sent by the activated component, wherein the access request includes a target virtual address; Determining a target physical address corresponding to the target virtual address in a mapping relationship table of the activated component; The physical storage area is accessed based on the target physical address.
2. The method according to claim 1, characterized in that The relationship mapping table is in the form of a one-dimensional array, the array index represents the page code of the virtual address, and the array content indicates the page code of the physical address corresponding to the virtual address; Determining the target physical address corresponding to the target virtual address in the mapping relationship table of the activated component includes: Determining a page code of the target virtual address based on the target virtual address, a base address of the virtual space, and a page size of the virtual space; Determine an array with the page code of the target virtual address as an index, and use the content in the array as the page code of the target physical address; A target physical address is determined based on a page encoding of the target physical address.
3. The method according to claim 2, characterized in that Determining a target physical address based on a page code of the target physical address includes: If the page code of the target physical address is a real page code, taking the physical address corresponding to the real page code as the target physical address; If the page code of the target physical address is a preset page code, an unused physical address is determined from the physical storage area, and the unused physical address is used as the target physical address.
4. The method according to claim 3, characterized in that After taking the unused physical address as the target physical address, the method further includes: Determine the page code corresponding to the unused physical address; The page code in the array content is replaced by the page code corresponding to the unused physical address.
5. The method according to claim 1, characterized in that Also includes: Initialize the counter; Traversing the page codes in the physical storage area; If any page code is not stored in the relationship mapping table of the eSE and is not stored in the relationship mapping table of the eSIM, the value of the counter is increased by a set value, and the value of the counter is used to represent the number of available pages in the physical storage area.
6. The method according to claim 5, characterized in that Also includes: After the traversal is completed, the value of the counter is subtracted from the set minimum page value to obtain the current number of available pages; The product of the current number of available pages and the size of the physical page is taken as the number of available bytes.
7. The method according to claim 1, characterized in that Also includes: Creating a virtual space in the physical storage area, wherein the virtual space includes a plurality of virtual addresses; Assign different virtual addresses to eSE or eSIM; Different security attributes are set for the virtual address allocated to the eSE and the virtual address allocated to the eSIM.
8. A storage area allocation device, characterized in that: The device is configured in an all-in-one device, the all-in-one device includes an embedded security element eSE and an embedded user identity card eSIM, the eSE and the eSIM share the same physical storage area, and the device includes: A mapping table acquisition module, configured to acquire a relationship mapping table of the activated component when it is detected that any component is activated, wherein the relationship mapping table of the activated component includes a mapping relationship between a virtual address and a physical address, and the activated component includes an eSE or an eSIM; A target virtual address acquisition module, used for acquiring the target virtual address sent by the activated component; A target physical address determination module, used to determine the target physical address corresponding to the target virtual address in the mapping relationship table; A storage area access module is used to access the physical storage area based on the target physical address.
9. An electronic device, characterized in that: The device comprises: one or more processors; A storage device for storing one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement the storage area allocation method according to any one of claims 1 to 7.
10. A storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the storage area allocation method according to any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Apparatus, system, and method for implementing protected partitions in storage media
CN101292219A
Apparatus for core specific memory mapping
CN113614703A
Instant eSIM test profile generator
CN114556977A
Configuration file downloading method, communication device and computer equipment
CN118764476A
File system housing
CN1613047A