Memory area allocation method, apparatus, device, and storage medium

By using a relational mapping table and hardware settings to convert virtual addresses to physical addresses in an all-in-one device that shares the physical storage area for eSE and eSIM, the data storage area allocation problem during eSE and eSIM integration is solved, data isolation and sharing are achieved, and the security and utilization of the device are improved.

CN119781691BActive Publication Date: 2025-12-26BEIJING TSINGTENG MICROSYSTEM CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411965186.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-12-30
Publication Date
2025-12-26
Estimated Expiration
2044-12-30

AI Technical Summary

Technical Problem

In consumer electronics devices, how can we allocate and use user data storage areas for different services when eSE and eSIM are integrated on the same chip? This requires ensuring the independence/isolation of data storage areas to provide a data firewall and guarantee data security, while also achieving a certain degree of data storage area sharing to improve utilization.

Method used

By having eSE and eSIM share the same physical memory area in an all-in-one device, a relational mapping table is used to translate virtual addresses to physical addresses. Combined with the MPU and MMU to set access permissions for virtual addresses, hard isolation and sharing are achieved.

Benefits of technology

It enables different operating systems to allocate and use the same data storage, provides a data firewall, achieves hard isolation of business data storage, and enables data sharing among multiple business systems, thereby improving the security and utilization of the equipment.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119781691B_ABST
    Figure CN119781691B_ABST
Patent Text Reader

Abstract

The application relates to the technical field of data storage, and particularly provides a storage area allocation method and device, equipment and a storage medium, the method comprises the following steps: the method is applied to a multi-in-one device, the multi-in-one device comprises an eSE and a SIM, the eSE and the SIM share a same physical storage area, the method comprises the following steps: when detecting that any component is activated, a relationship mapping table of the activated component is acquired, the relationship mapping table comprises a mapping relationship between a virtual address and a physical address, the activated component comprises the eSE or the SIM; an access request sent by the activated component is acquired, wherein the access request comprises a target virtual address; a target physical address corresponding to the target virtual address is determined in the mapping relationship table; and the physical storage area is accessed based on the target physical address. The data firewall is realized, the business data storage is hard isolated, and the data areas of multiple business systems are shared.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of data storage, and particularly relates to a storage area allocation method and device, equipment and a storage medium. BACKGROUND

[0002] In order to ensure information security, an intelligent terminal usually includes an embedded secure element (eSE) and an embedded subscriber identity module (eSIM), the eSIM and the eSE use two physically independent chips respectively, and each chip is operated by its own operating system.

[0003] With the demand of high integration, small size, low cost and low energy consumption of chips such as near field communication (NFC), eSIM and eSE in consumer electronics, some two virtual operating systems that are logically isolated by software code and integrated in the same chip have appeared.

[0004] How to allocate and use the user data storage areas of different services of the two virtual operating systems is a problem to be solved. SUMMARY

[0005] In order to solve the above technical problems, the present application provides a storage area allocation method, device, equipment and storage medium, realizes a data firewall, realizes hard isolation of service data storage, and realizes sharing of multi-service system data areas.

[0006] In a first aspect, the present application provides a storage area allocation method, the method is applied to a multi-in-one device, the multi-in-one device includes an eSE and an eSIM, the eSE and the eSIM share the same physical storage area, and the method includes the following steps: when detecting that any component is 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 the eSE or the 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 a second aspect, the present application provides a storage area allocation apparatus, which is configured in a multi-in-one device, the multi-in-one device comprising an SE and an eSIM, the eSE and the eSIM sharing a same physical storage area, the apparatus comprising: a mapping table acquisition module, configured to acquire a relationship mapping table of an activated component when detecting that any component is activated, the relationship mapping table comprising a mapping relationship between a virtual address and a physical address, the activated component comprising the eSE or the eSIM; a target virtual address acquisition module, configured to acquire a target virtual address sent by the activated component; a target physical address determination module, configured to determine a target physical address corresponding to the target virtual address in the mapping relationship table; and a storage area access module, configured to access the physical storage area based on the target physical address.

[0008] In a third aspect, the present application provides an electronic device, the electronic device comprising the storage area allocation apparatus, the electronic device comprising: one or more processors; a storage apparatus configured to store one or more programs; and 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 in the first aspect.

[0009] In a fourth aspect, the present application provides a storage medium, which can be a computer readable storage medium, and the storage medium has stored thereon a computer program, and the program is executed by a processor to implement the storage area allocation method in the first aspect.

[0010] In a fifth aspect, the present application provides a computer program product, the computer program product comprising a computer program or instructions, and the computer program or instructions are executed by a processor to implement the storage area allocation method in any one of the first aspect.

[0011] Compared with the prior art, the technical scheme 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 and equipment and a storage medium, the method is applied to a multi-in-one device, the multi-in-one device comprises an eSE and an eSIM, the eSE and the eSIM share a same physical storage area, and the method comprises the following steps: when detecting that any component is activated, obtaining a relationship mapping table of the activated component, the relationship mapping table comprising a mapping relationship between a virtual address and a physical address, the activated component comprising the eSE or the eSIM; obtaining an access request sent by the activated component, wherein the access request comprises 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 virtual address to the physical address is converted through the corresponding relationship mapping table, so that the allocation and use of the same data storage by different operating systems are realized, the data firewall is realized, the business data storage is hard isolated, and the multi-service system data area sharing is realized. BRIEF DESCRIPTION OF DRAWINGS

[0013] The drawings incorporated into the specification and forming a part of the specification, show embodiments consistent with the present application, and together with the specification, serve to explain the principles of the present application.

[0014] In order to more clearly illustrate the technical solutions of the embodiments of the present application or the prior art, the drawings needed to be used in the embodiments or the prior art description will be briefly introduced. Obviously, for those skilled in the art, other drawings can also be obtained without creative labor.

[0015] Figure 1 A flowchart of a storage area allocation method provided by the embodiment of the present application is shown in the figure.

[0016] Figure 2a A structure diagram of a physical storage area divided into two parts provided by the embodiment of the present application is shown in the figure.

[0017] Figure 2b A structure diagram of a physical storage area converted by a virtual space provided by the embodiment of the present application is shown in the figure.

[0018] Figure 3 A flowchart of an optimized storage area allocation method provided by the embodiment of the present application is shown in the figure.

[0019] Figure 4 A flowchart of address conversion provided by the embodiment of the present application is shown in the figure.

[0020] Figure 5 Another flowchart of address conversion provided by the embodiment of the present application is shown in the figure.

[0021] Figure 6A schematic diagram of an overall process of address conversion provided by an embodiment of the present application is shown in FIG. 1.

[0022] Figure 7 A schematic diagram of a process of another optimized memory area allocation method provided by an embodiment of the present application is shown in FIG. 2.

[0023] Figure 8 A schematic diagram of a structure of a memory area allocation apparatus provided by an embodiment of the present application is shown in FIG. 3.

[0024] Figure 9 A schematic diagram of a structure of an electronic device provided by an embodiment of the present application is shown in FIG. 4. DETAILED DESCRIPTION

[0025] In order to more clearly understand the above objectives, features and advantages of the present application, the solutions 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, if possible.

[0026] In the following description, a lot of specific details are set forth in order to facilitate a thorough understanding of the present application, but the present application can also be implemented in other different manners from those described herein; obviously, the embodiments described in the specification are only some embodiments of the present application, not all the embodiments.

[0027] The term "comprising" and its variants as used herein are open-ended, that is "including but not limited to". The term "based on" is "at least partially based 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". Related definitions of other terms will be given in the following description.

[0028] It should be noted that the terms "first", "second", and the like mentioned in the present application are only used to distinguish different devices, modules or units, and are not intended to limit the order or interdependence of the functions performed by these devices, modules or units.

[0029] It should be noted that the terms "one", "multiple" mentioned in the present application are illustrative and not restrictive, and those skilled in the art should understand that, unless otherwise explicitly indicated in the context, it should be understood as "one or more".

[0030] With the demand of high integration, small size, low cost and low energy consumption for chips such as NFC, eSIM, eSE and the like in consumer electronics, there are some chips that integrate eSE and eSIM in the same chip and realize logical isolation of the two virtual operating systems by software code. How to allocate and use the user data storage area of different services of the two virtual operating systems is a problem to be solved. There are mainly two kinds of solutions for how to allocate and use the user data storage area of different services of the two virtual operating systems:

[0031] The first kind: the two virtual operating systems share the same large physical storage area, and a manager is realized by software to realize an allocation algorithm to guarantee the allocation and use of storage resources by eSE and eSIM. This solution is more dependent on the allocation algorithm, and when the other service has a problem or is attacked, the other service will also be affected due to the inability to realize data isolation at the physical layer.

[0032] The second kind: the data storage area is divided into two parts, and the storage area allocated by the operating system in use can be set as accessible by means of hardware storage protection unit (MPU) or software algorithm, and the storage area of the other operating system not in use is set as inaccessible to realize physical layer isolation. This allocation method generally needs to be divided at the factory stage, and the amount of user data needs to be predicted, such as some extreme cases where a user only uses one of eSIM or eSE, and the operating system not in use will also be allocated a storage area, causing the storage space of the operating system in use to be insufficient.

[0033] The above two allocation schemes have certain demand contradictions in the allocation of data storage, which need to provide a data firewall for mutual independence / isolation of data storage areas to guarantee data security, and also need to realize sharing of data storage areas to some extent to provide usage rate.

[0034] To solve the above technical problems, the embodiment of the present application provides a storage area allocation method, which applies a multi-in-one device, the multi-in-one device including an eSE and an eSIM, the eSE and the eSIM sharing a same physical storage area, the method including: when detecting that any component is activated, obtaining a relationship mapping table of the activated component, the relationship mapping table including a mapping relationship between a virtual address and a physical address, the activated component including the eSE or the 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 eSE and the eSIM are activated, the conversion from the virtual address to the physical address is realized through the corresponding relationship mapping table, and then the allocation and use of the same data storage by different operating systems are realized, the data firewall is realized, the business data storage hard isolation is realized, and the multi-business system data area sharing is realized.

[0035] The storage area allocation method provided by the embodiment of the present application will be described in detail below in combination with the drawings and specific embodiments.

[0036] Figure 1 For a flowchart of the storage area allocation method in the embodiment of the present application, the embodiment can be applicable to the allocation of the storage area of the multi-in-one device, the method can be executed by a storage area allocation apparatus, the storage area allocation apparatus can be realized in the form of software and / or hardware, and the storage area allocation apparatus can be configured in the multi-in-one device. In other words, the storage area allocation method is applied to the multi-in-one device. The multi-in-one device includes an eSE and an eSIM, and the eSE and the eSIM share a same physical storage area.

[0037] The multi-in-one device in the embodiment of the present application refers to a device integrating the eSE and the eSIM into a same physical storage area, and the multi-in-one device is usually used in the field of mobile communication, such as a smart phone and other portable devices.

[0038] The multi-in-one device includes an eSE and an eSIM, the eSE can be understood as a secure chip specially designed to store and process sensitive data. The eSE can be used to store keys, certificates and other forms of encrypted data to ensure that sensitive information cannot be accessed without authorization. The eSE is often used in application scenarios that require high security, such as mobile payment and digital identity verification. The eSIM is a smart card for mobile phones, mainly used to store user identification information, encryption keys and network authentication information, so that the mobile phone can connect to a specific mobile network.

[0039] When the eSE and the eSIM are integrated together, they share a same physical storage area, and the eSE and the eSIM are not completely independent, but are closely combined together and can work independently or cooperatively.

[0040] At the physical level, the eSE and eSIM coexist in one physical chip, reducing the demand for internal space of the device and simplifying the hardware design. Not only helps to reduce the cost, but also improves the reliability of the device.

[0041] Since the eSE and eSIM are located on the same chip, the communication speed between the eSE and the eSIM is faster and the delay is lower. When performing online payment, a more smooth user experience can be provided. The integrated multi-in-one device can not only support the traditional SIM card function, such as connecting a mobile network, but also can support more value-added services, such as NFC payment, electronic ticketing, etc., which are realized by utilizing the security features of the eSE.

[0042] The multi-in-one device realizes higher security, better performance and more flexible application expansion capability by integrating the eSE and the eSIM into the same physical storage area.

[0043] As shown in Figure 1 The storage area allocation method provided by the embodiment of the present application mainly includes steps S101-S102.

[0044] S101, when detecting that any component is activated, obtaining the relationship mapping table of the activated component, the relationship mapping table including the mapping relationship between the virtual address and the physical address, the activated component including the eSE or the eSIM.

[0045] Since the multi-in-one device includes the eSE and the eSIM, any component being activated includes: the eSE being activated, or the eSIM being activated, both cases. In the case of the eSE being activated, the activated component is the eSE, and in the case of the eSIM being activated, the activated component is the eSIM.

[0046] Specifically, when detecting that any component is activated, obtaining the relationship mapping table of the activated component, the relationship mapping table including the mapping relationship between the virtual address and the physical address, including: when detecting that the eSE is activated, obtaining the relationship mapping table of the eSE, the eSE relationship mapping table including the mapping relationship between the virtual address and the physical address of the eSE. When detecting that the eSIM is activated, obtaining the relationship mapping table of the eSIM, the eSIM relationship mapping table including the mapping relationship between the virtual address and the physical address of the eSIM.

[0047] In a multi-task operating system (RTOS) in a multi-OS device including eSE and SIM, a task switching mechanism. Further, the current running task is switched from eSIM to eSE by the RTOS task scheduling, i.e. eSE is scheduled as the current running task by the RTOS task scheduling, and it is detected that eSE is activated. The current running task is switched from eSE to eSIM by the RTOS task scheduling, i.e. eSIM is scheduled as the current running task by the RTOS task scheduling, and it is detected that eSIM is activated.

[0048] Obtaining the relationship mapping table of the activated component includes: in the case that eSE is detected to be activated, obtaining the relationship mapping table corresponding to eSE, and storing the relationship mapping table corresponding to eSIM as a backup. In the case that eSIM is detected to be activated, obtaining the relationship mapping table corresponding to eSIM, and storing the relationship mapping table corresponding to 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 a virtual address, and the array content indicates a physical address corresponding to the virtual address. Further, the relationship mapping table can be a MapTable. The MapTable is a table used for managing and mapping resources. The MapTable is usually used for managing and mapping memory addresses, security areas, permission controls, etc.

[0050] When the current running task is switched by the RTOS task scheduling, the role of the 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 taken 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 (the 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 the MapTable, so as to realize the management of the relationship mapping table. It is ensured that the activated component can correctly access the required memory and security area.

[0051] Specifically, when detecting that the eSE is activated, the content in the current MapTable is taken as the relationship mapping table of the eSE, and the relationship mapping table of the eSE is backed up to a temporary storage area. When switching to the eSIM, the relationship mapping table of the eSIM is restored from the temporary storage area, and the relationship mapping table of the eSIM is copied to the MapTable to realize the management of the relationship mapping table of the eSIM. When detecting that the eSIM is activated, the content in the current MapTable is taken as the relationship mapping table of the eSIM, and the relationship mapping table of the eSIM is backed up to a temporary storage area. When switching to the eSE, the relationship mapping table of the eSE is restored from the temporary storage area, and the relationship mapping table of the eSE is copied to the MapTable to realize the management of the relationship mapping table of the eSE. It is ensured that the activated component can correctly access the required memory and security area.

[0052] In one possible implementation, a virtual space is created in the physical storage area, the virtual space includes a plurality of virtual addresses; different virtual addresses are allocated to the eSE or the eSIM; and different security attributes are set for the virtual addresses allocated to the eSE and the virtual addresses allocated to the eSIM.

[0053] As shown in Figure 2a , the operating system can be simply divided into an eSE code area, an eSIM code area, a user data storage area 1, and a 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 the user data related to the eSE operating system, and the user data storage area 2 is used to store the user data related to the eSIM operating system. In addition, for a chip supporting a TrustZone, the data storage area can further divide the user data storage area into a security attribute area and a non-security attribute area. The above-mentioned user data storage area 1 and the user data storage area 2 are stored in the same physical flash memory space, and the user data storage area 1 and the user data storage area 2 are isolated by dividing the physical storage area into two parts. Although the storage area is hard-isolated, reuse becomes a problem.

[0054] On the basis of Figure 2a , two virtual spaces are created in the physical storage area, and the virtual spaces include at least one virtual address segment. Further, the hardware of the physical storage area can support the access of the virtual address segment. Further, the virtual address access authority can be set by a chip MPU or a paging memory management unit (MMU), and for a chip supporting a TrustZone, a security attribute can also be set separately.

[0055] The effect after the setting is as followsFigure 2b As shown from the perspective of the eSE, the size of the accessible region through the virtual address space is close to Figure 2a The sum of the user data storage area 1 and the user data storage area 2; as shown from the perspective of the eSIM, the size of the accessible region through the virtual address space is close to Figure 2a The sum of the user data storage area 1 and the user data storage area 2.

[0056] Further, the virtual address allocated to the eSE and the virtual address allocated to the eSIM are set with different security attributes.

[0057] Specifically, the virtual address is mapped to the physical address by the MPU or the MMU, and different access permissions are set for different virtual address regions. By configuring the MMU, independent virtual addresses can be set for the eSE and the eSIM, and different security attributes such as read-only, writable, and non-executable are set for the virtual addresses. Further, the security attribute set for the virtual address allocated to the eSE is higher than the security attribute set for the virtual address allocated to the eSIM.

[0058] Further, the 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 the eSIM can be placed in the secure attribute area and the non-secure attribute area respectively, or independent security domains can be created for them, thereby improving the security of the data.

[0059] The virtual address of the eSE is mapped to the physical address by the MPU or the MMU, and a 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 by the MPU or the MMU, and a relationship mapping table of the eSIM is constructed and stored based on the mapping relationship.

[0060] In the embodiments of the present application, different service data storage areas are divided into different virtual addresses, and different access attributes are set for them. The independent / isolated data storage areas are required to ensure data security, and the data storage areas are required to be shared to some extent to improve the utilization rate.

[0061] S102, an access request sent by an activated component is acquired, wherein the access request includes a target virtual address.

[0062] The access request refers to the behavior of a program or operating system attempting to access a certain physical address in the physical storage. The above access can be a read, write or execute operation. Specifically: read refers to the operation of obtaining data from a certain physical address in the physical storage. This is the most common type of access, and almost all programs will frequently perform read operations to obtain the values of variables, constants or other data structures. Write refers to the operation of writing data to a certain address in the physical storage. Write operations are usually used to update the values of variables, modify data structures or store new data. Execute refers to starting to execute instructions from a certain address in memory. This is the basis for program code execution, and the CPU will read instructions from memory and execute them.

[0063] The virtual address is the memory address used by the operating system or application during runtime. The virtual address is not a direct pointer to a location in physical memory, but 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). It is the specific location used by the memory controller to access the memory module. The physical address is unique and directly corresponds to a byte in physical memory.

[0065] Since the virtual memory is used in the embodiments of the present application, the virtual address corresponding to the physical address that the access request wants to access is carried in the access request. Therefore, the access request is parsed to obtain the virtual address written to it, and the virtual address is taken as the target virtual address.

[0066] The access request sent by the activated component is obtained, wherein the access request includes a target virtual address, including: when the activated component is eSE, the access request sent by eSE is obtained, wherein the access request includes the target virtual address that eSE wants to access. The access request sent by the activated component is obtained, wherein the access request includes a target virtual address, including: when the activated component is eSIM, the access request sent by eSIM is obtained, wherein the access request includes the target virtual address that eSIM wants to access.

[0067] S103, determining 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 physical address corresponding to the target virtual address in the mapping relationship table is queried 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; and 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, accessing the physical storage area based on the target physical address.

[0071] The target physical address refers to an address in a physical storage area that the activated component wants to finally access. 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 the physical storage area. It receives the physical address from the address bus and performs the corresponding memory operation according to the physical address.

[0073] If the access request is a read operation, the memory controller reads data from the target physical address and transmits the data back to the activated component through a data bus. If the access request is a write operation, the memory controller writes data to the target physical address.

[0074] The embodiment of the present application provides a storage area allocation method, which applies a multi-in-one device including an eSE and a SIM, and the eSE and the SIM share the same physical storage area. The method includes: when detecting that any component is activated, obtaining a relationship mapping table of the activated component, the relationship mapping table including a mapping relationship between a virtual address and a physical address, the activated component including the eSE or the 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. Since the eSE and the SIM are activated, the conversion of the virtual address to the physical address is realized through the corresponding relationship mapping table, thereby realizing the allocation and use of the same data storage by different operating systems, realizing the data firewall, realizing the hard isolation of business data storage, and realizing the sharing of the multi-business system data area.

[0075] On the basis of the above-mentioned embodiment, the embodiment of the present application optimizes the storage area allocation method, as shown in Figure 3 The optimized storage area allocation method mainly includes the following steps:

[0076] S201, when detecting that any component is activated, obtaining a relationship mapping table of the activated component, the relationship mapping table including a mapping relationship between a virtual address and a physical address, the activated component including an eSE or an eSIM.

[0077] S202, obtaining an access request sent by the activated component, wherein the access request includes a target virtual address.

[0078] The S201-S202 provided by the embodiments of the present application have the same process as the S101-S102 provided by the above-described embodiments, and the specific description can be referred to the description in the above-described embodiments, which will not be repeated here.

[0079] S203, determining a page code of the target virtual address based on the target virtual address, a reference address of a virtual space and a page size of the virtual space.

[0080] The virtual space refers to the space of the virtual address, and the reference address of the virtual space refers to the starting address of the virtual address space. In the virtual memory system, each process has its own virtual address space, which starts from a fixed starting address. This starting address is the reference address of the virtual address space.

[0081] The page is a basic unit in memory management, which is used to map the continuous virtual address space to the physical address space. The size of each page is fixed, and the common page sizes are 4KB, 8KB, 16KB, 64KB, etc. By dividing the memory into fixed-size pages, the operating system can more efficiently manage the memory. Each page can be independently allocated, released and mapped.

[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 together. 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 reference 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 reference address B1 of the virtual space from the target virtual address V1 to obtain the offset offset relative to the reference address. Divide the offset 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 of the page code of the target virtual address is as follows:

[0086] virtual_page_number = (V1-B1) / PAGE_SIZE_1

[0087] virtual_page_number is the page code 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, the target virtual address V1 = 0x1000, the base address B1 of the virtual space = 0x0000, and the page size PAGE_SIZE_1 of the 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 code of the virtual address: \text{virtual_page_number}=\frac{\text{offset}}{\text{PAGE_SIZE_1}}=\frac{0x1000}{4096}=1.

[0091] \frac{0x1000}{4096}=1.

[0092] S204, determine the array indexed by the page code of the target virtual address, and the content in the array as the page code of the target physical address.

[0093] 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. Further, the relationship mapping table is copied to the MapTable. The MapTable is a table for managing and mapping resources. The relationship mapping table of the eSE or eSIM is managed by the MapTable.

[0094] Specifically, the MapTable is the core component of address conversion. The MapTable is a continuous RAM space in the form of a one-dimensional array. The index of the array, i.e., 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. The MapTable is placed in the chip, which not only realizes the basic address conversion of hardware, but also controls the access permission of 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, the array indexed by the page code of the target virtual address is queried in the MapTable, and the content of the array is taken as the page code of the target physical address.

[0096] For example, if the page code of the target virtual address is vP0, the index of the lookup array is the array of vP0, and after the lookup, the content of the array with the index of vP0 is taken as the page code of the target physical address.

[0097] S205, determining the target physical address based on the page code of the target physical address.

[0098] In one possible implementation, determining the target physical address based on the 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; and if the page code of the target physical address is a preset page code, determining an unused physical address from the physical storage area and taking the unused physical address as the target physical address.

[0099] In the embodiments 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 refers to a page code that has an actual corresponding determined physical address in the actual physical storage area. The preset page code refers to a page code that does not have an actual corresponding determined physical address in the actual physical storage area. 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 maximum page index value FFFF. When the page code of the target virtual address corresponds to the preset page code PZ in the MapTable, the data content of the PZ page is 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 taken as the target physical address. As shown in FIG. 2B, in the relationship mapping table of the 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 code address PZ. Figure 4

[0102] ​When the activated component is an eSE, in the eSE's relational mapping table, if the page code of the target virtual address is vP0, determine the page code of its target physical address P0, and use the physical address [0C010800H—0C011000H] corresponding to page code P0 as the target physical address. If the page code of the target virtual address is vP2, determine the page code of its target physical address P7, and use the physical address [0C014000H—0C014800H] corresponding to page code P7 as the target physical address. If the page code of the target virtual address is vP3, determine the page code of its target physical address P9, and use the physical address [0C015000H—0C015800H] corresponding to page code P9 as the target physical address. If the page code of the target virtual address is vP4, determine the page code of its target physical address P4, and use the physical address [0C012800H—0C013000H] corresponding to page code P4 as the target physical address.

[0103] like Figure 4 As shown, in the eSIM relationship mapping table, the real page code P8 corresponds to the page code vP0 of the virtual address, the real page code P5 corresponds to the page code vP3 of the virtual address, the real page code P2 corresponds to the page code vP5 of the virtual address, and the page codes vP1, vP2, vP4, vP6, and vP7 of the virtual address correspond to the preset encoding address PZ.

[0104] When the activated component is an eSIM, in the eSIM relationship mapping table, if the page code of the target virtual address is vP0, its target physical address page code is determined to be P8, and the physical address [0C014800H—0C015000H] corresponding to page code P8 is used as the target physical address. If the page code of the target virtual address is vP3, its target physical address page code is determined to be P5, and the physical address [0C013000H—0C013800H] corresponding to page code P5 is used as the target physical address. If the page code of the target virtual address is vP5, its target physical address page code is determined to be P2, and the physical address [0C012000H—0C012800H] corresponding to page code P2 is used as the target physical address.

[0105] The target physical address is obtained by using the physical address corresponding to the actual page encoding. Specifically, this involves: finding the corresponding actual page encoding of the target physical address in the MapTable using the page encoding of the target virtual address; multiplying the actual page encoding by the physical space page size PAGE_SIZE_2 to obtain the offset of the physical address; and adding 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] Where final_physical_address is the target physical address, physical_page_number is the actual page number of the target physical address, and PAGE_SIZE_2 is the page size of the physical space.

[0108] If the page encoding of the target physical address is the preset page encoding, then an unused physical address is determined from the physical storage area and used as the target physical address.

[0109] like Figure 5 As shown, in the eSE relationship mapping table, the page code vP1 of the virtual address corresponds to the preset code address PZ. In the eSIM relationship mapping table, the page codes vP1 and vP2 of the virtual addresses correspond to the preset code address PZ.

[0110] When the activated component is an eSE, in the eSE's relational mapping table, if the page code of the target virtual address is vP1, determine the page code of its target physical address PZ, find a page in the physical storage area that is not associated with the MapTable, and write the data to the newly found page. Similarly, when the activated component is an eSIM, in the eSIM's relational mapping table, if the page codes of the target virtual addresses are vP1 and vP2, determine the page code of its target physical address PZ, find a page in the physical storage area that is not associated with the MapTable, and write the data to the newly found page.

[0111] Furthermore, after identifying unused physical addresses from the physical storage area and using them as target physical addresses, the process also 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 eSE's relational mapping table, if the page code of the target virtual address is vP1, the page code of its target physical address is determined to be PZ. A page not associated with the MapTable is found in the physical storage area, and the data is first written to the newly found unused page. If the page code corresponding to the unused address is P2, then the array content corresponding to the page code vP1 of the target virtual address is modified to P2.

[0113] 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 vP1, the page code PZ of the target physical address is determined, a page not associated with the MapTable is found from the physical storage area, and data is first written to the newly found unused page. The page code corresponding to the unused address is P10, and then the array content corresponding to the page code vP1 of the target virtual address is modified to P10.

[0114] S206, access the physical storage area based on the target physical address.

[0115] As shown in Figure 6 , the target virtual address in the access request is obtained, the target virtual address is converted through address conversion 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, the conversion process is completed by hardware logic without the participation of software, and the virtual address can be directly converted into a physical address, and the data stored in the physical address can be read. If the virtual address does not have access permission, an exception message will be generated, and the exception message will be fed back to the access request.

[0117] If the access request is a write operation, it is realized by a storage management software, which has a high security level and is generally run in a privileged state of the chip.

[0118] If the access request is a write data, through the specific API call of the storage management module, the physical page to be written is queried by the method provided in the embodiment of the application in a software manner. If it is a real page code, it is directly written into the corresponding physical page. If it is a preset real page code, a page not associated with the MapTable is found from the physical storage area, and data is first written to the newly found page, thereby completing the data write.

[0119] The data storage area allocation method based on the eSIM and eSE multi-combination device is provided in the embodiment of the application. The data firewall is realized, the business data storage is hard isolated, and the data area of the multi-business system is shared.

[0120] On the basis of the above-mentioned embodiment, the storage area allocation method is further optimized in the embodiment of the application, as shown in Figure 7 , 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] The total number of physical pages in the physical storage area is determined. The total number of page codes can be obtained by system configuration or querying memory information. A loop is used 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 not stored in the relationship mapping table of the eSIM, the value of the counter is increased by a set value.

[0126] The value of the counter is used to represent the number of available pages in the physical storage area.

[0127] Optionally, the set value is 1. If any page code is not stored in the relationship mapping table of the eSE and 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. The page code is not stored in the relationship mapping table of the eSE, which means that the physical address corresponding to the page code is not used by the eSE. Not stored in the relationship mapping table of the eSIM, which 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 not stored in the relationship mapping table of the eSIM, which means that the physical address corresponding to the page code is not used by the eSE and not used by 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 by a set minimum page value to obtain the current available page number.

[0131] Setting a minimum page limit refers to the minimum number of pages reserved by the system. This minimum page limit is a set of physical pages that the operating system or system administrator pre-reserves to ensure basic system operation and stability. These pages are typically not used by ordinary applications or user processes, but are dedicated to critical system tasks and core services. Reserving these pages helps prevent the system from crashing or becoming unstable due to insufficient memory. For example, a minimum reserved page limit X of 10 pages means that regardless of the total number of physical pages 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 complete, the counter value represents the number of unused page codes in the entire physical storage area.

[0133] The number of currently available pages is obtained by subtracting the set minimum page value from the counter value. This can be understood as the number of unused page codes in the entire physical storage area minus the minimum page value reserved by the system, which is the number of pages that can be used by ordinary applications or user processes.

[0134] S305. The product of the current number of available pages and the size of the physical page is used as the number of available bytes.

[0135] Multiply the number of currently available physical pages by the page size to obtain the currently available physical storage space, which is in bytes.

[0136] For example, if the physical page size is 4K and the current number of available pages is 10, then the number of available bytes is 40K.

[0137] This application provides a method for calculating physical storage space. By calculating the available physical storage space, memory resources can be allocated more effectively, ensuring that each application and service can obtain enough 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 This is a schematic diagram of a storage area allocation device according to an embodiment of this application, as shown below. Figure 8 As shown, the storage area allocation device 80 provided in this application embodiment is configured in an all-in-one device, which 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 this application embodiment 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] The mapping table acquisition module is configured to acquire a relationship mapping table of an activated component when any component is detected to be activated, the relationship mapping table of the activated component including a mapping relationship between a virtual address and a physical address, the activated component including the eSE or the eSIM.

[0140] Embodiments of the present application provide a storage area allocation device, which is configured in a multi-in-one device, the multi-in-one device including an eSE and an eSIM, the eSE and the eSIM sharing a same physical storage area. The device is configured to perform the following processes: acquiring a relationship mapping table of an activated component when any component is detected to be activated, the relationship mapping table including a mapping relationship between a virtual address and a physical address, the activated component including the eSE or the eSIM; acquiring an access request sent by the activated component, the access request including 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 corresponding relationship mapping table is used to realize the conversion from a virtual address to a physical address, thereby realizing the allocation and use of a same data storage by different operating systems, realizing the data firewall, realizing the hard isolation of service data storage, and realizing the sharing of multi-service system data areas.

[0141] In one possible implementation, the relationship mapping table is in a one-dimensional array form, the array index representing a page code of a virtual address, and the array content indicating a page code of a physical address corresponding to the virtual address. The target physical address determination module 83 is specifically configured to determine a page code of the target virtual address based on the target virtual address, a reference address of a 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 the content in the array as a page code of a target physical address; and 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 configured to, if the page code of the target physical address is a real page code, take a physical address corresponding to the real page code as the target physical address; and 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 take the unused physical address as the target physical address.

[0143] In a possible implementation, the method further includes: a relationship mapping table management module, configured to, after the unused physical address is used as the target physical address, determine a page code corresponding to the unused 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, the method further includes: a page statistics module, configured 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 a value of the counter by a set value, the value of the counter representing a number of available pages in the physical storage area.

[0145] In a possible implementation, the page statistics module is further configured to, after the traversal ends, subtract a set minimum page value from the value of the counter to obtain a current number of available pages; and multiply the current number of available pages by a size of a physical page to obtain the number of available bytes.

[0146] In a possible implementation, the virtual address allocation module is configured to create a virtual space in the physical storage area, the virtual space including a plurality of virtual addresses; allocate different virtual addresses to the eSE and the eSIM; and set different security attributes for the virtual addresses allocated to the eSE and the eSIM.

[0147] The storage area allocation apparatus provided by the embodiments of the present application can perform the storage area allocation method provided by any of the embodiments of the present application, and has the corresponding function modules and beneficial effects of performing the method.

[0148] Figure 9 is a structural schematic diagram of an electronic device provided by the embodiments of the present application. The electronic device can include a storage area allocation apparatus, such as Figure 9 As shown in the figure, the electronic device 900 includes a processor 910, a memory 920, an input device 930, and an output device 940; the number of processors 910 in the electronic device can be one or more, Figure 9 In the figure, the processor 910 in the electronic device 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 through a bus or other means, Figure 9 In the figure, the connection through the bus is taken as an example.

[0149] The memory 920, as a kind of computer readable storage medium, can be used to store software programs, computer executable programs and modules, such as the program instructions / modules corresponding to the storage area allocation method in the embodiment of the present application.The processor 910 performs 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, realizes the storage area allocation method provided by the embodiment of the present application.

[0150] The memory 920 can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system and at least one application required by a function;The data storage area can store data created according to the use of the terminal and the like.In addition, the memory 920 can include a high-speed random access memory, and can also include a non-volatile memory, such as at least one magnetic disk storage device, a flash memory device, or other non-volatile solid-state memory device.In some examples, the memory 920 can further include a memory remotely arranged with respect to the processor 910, and these remote memories can be connected to the electronic device through a network.The 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 a combination thereof.

[0151] The input device 930 can 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 can include a keyboard, a mouse and the like.The output device 940 can include a display device such as a display screen.

[0152] The embodiment also provides a storage medium containing computer executable instructions, which are used to implement the storage area allocation method provided by the embodiment of the present application when executed by a computer processor.

[0153] Of course, the computer executable instructions of the storage medium containing computer executable instructions provided by the embodiment of the present application are not limited to the method operations as described above, but can also perform the related operations in the storage area allocation method provided by any embodiment of the present application.

[0154] Through the above description of the embodiments, those skilled in the art can clearly understand that the present application can be realized by means of software and necessary universal hardware, and of course can also be realized by hardware, but in many cases the former is a better embodiment. Based on such understanding, the technical solutions of the present application 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 floppy disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a FLASH, a hard disk, or an optical disc, etc., and includes a number of instructions to make a computer device (which can be a personal computer, a server, or a network device, etc.) execute the methods described in various embodiments of the present application.

[0155] It is worth noting that in the above embodiments of the storage area allocation apparatus, each unit and module included is only divided according to functional logic, but is not limited to the above division, as long as the corresponding functions can be realized; in addition, the specific names of each functional unit are only for the convenience of mutual differentiation, and do not limit the protection scope of the present application.

[0156] It should be noted that in this paper, relationship 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 the entities or operations. Moreover, the terms "include", "contain" or any other variants thereof are intended to cover non-exclusive inclusion, so that the process, method, article or device including a series of elements not only includes those elements, but also includes other elements not explicitly listed, or includes elements inherent to such process, method, article or device. Without more limitations, the element defined by the sentence "including a…" does not exclude the presence of other identical elements in the process, method, article or device including the element.

[0157] The above is only a specific embodiment of the present application, which enables those skilled in the art to understand or implement the present application. Various modifications of 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 these embodiments described herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A memory region allocation method, characterized by, The method applies a multi-in-one device including an embedded secure element (eSE) and an embedded subscriber identity module (eSIM), the eSE and the eSIM sharing a same physical storage area, and the method includes: when detecting that any component is activated, obtaining a relationship mapping table of the activated component, the relationship mapping table including a mapping relationship between a virtual address and a physical address, the activated component including the eSE or the 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 of the activated component; accessing the physical storage area based on the target physical address.

2. The method of claim 1, wherein, The relationship mapping table is in a one-dimensional array form, an array index representing a page code of a virtual address, and array content indicating a page code of a 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 reference address of a virtual space, and a page size of the virtual space; determining an array indexed by the page code of the target virtual address, and content in the array as a page code of a target physical address; determining the target physical address based on the page code of the target physical address.

3. The method of claim 2, wherein, Determining the target physical address based on the page code of the target physical address includes: if the page code of the target physical address is a real page code, taking a 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, determining an unused physical address from the physical storage area, and taking the unused physical address as the target physical address.

4. The method of claim 3, wherein, After taking the unused physical address as the target physical address, further including: determining a page code corresponding to the unused physical address; replacing a page code in the array content with the page code corresponding to the unused physical address.

5. The method of claim 1, wherein, Further including: initializing a counter; traversing 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, increasing a value of the counter by a set value, the value of the counter representing a number of available pages in the physical storage area.

6. The method of claim 5, wherein, Further including: after the traversal ends, subtracting a set minimum page value from the value of the counter to obtain a current available page number; multiplying the current available page number by a size of a physical page to obtain an available byte number.

7. The method of claim 1, wherein, Further including: creating a virtual space in the physical storage area, the virtual space including a plurality of virtual addresses; allocating different virtual addresses to the eSE or the eSIM; setting different security attributes for the virtual addresses allocated to the eSE and the virtual addresses allocated to the eSIM.

8. A storage area allocation apparatus characterized by comprising: The device is configured in a multi-in-one device including an embedded secure element (eSE) and an embedded subscriber identity module (eSIM), the eSE and the eSIM sharing a same physical storage area, and the device includes: a mapping table obtaining module, configured to obtain a relationship mapping table of an activated component when detecting that any component is activated, the relationship mapping table of the activated component including a mapping relationship between a virtual address and a physical address, the activated component including the eSE or the eSIM; a target virtual address obtaining module, configured to obtain a target virtual address sent by the activated component; a target physical address determining module, configured to determine a target physical address corresponding to the target virtual address in the mapping relationship table; a storage area accessing module, configured to access the physical storage area based on the target physical address.

9. An electronic device, comprising: The device includes: one or more processors; a storage device configured to store 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-7.

10. A storage medium having stored thereon a computer program, characterized in that The program is executed by the processor to implement the storage area allocation method according to any one of claims 1-7.

Citation Information

Patent Citations

  • Apparatus, system, and method for implementing protected partitions in storage media

    CN101292219A

  • Configuration file downloading method, communication device and computer equipment

    CN118764476A