Physical memory data management method and system of credential operation system
Patent Information
- Application Number
- CN202411277533.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-12
- Publication Date
- 2024-12-20
- Estimated Expiration
- 2044-09-12
Smart Images

Figure CN119166544A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computers, and more specifically, to a physical memory data management method and system for an information-based operating system. Background Art
[0002] Operating systems focus on supporting trusted applications, which are called trusted operating systems, and have extremely high security requirements. In trusted operating systems, dangerous data is often concentrated in memory, so it is necessary to have strong physical memory data detection and management capabilities to ensure the stability of trusted operating systems and the security of the data stored in them.
[0003] Traditional operating systems usually rely on virtual memory management to process memory data, but the requirements of trusted operating systems are more stringent and need to be able to scan physical memory in real time to identify and process any potentially dangerous data. This can not only deal with malware or data leaks, but also prevent possible hardware failures or other runtime errors in memory.
[0004] However, the traditional virtual memory management method cannot adapt to the needs of the trusted operating system. Therefore, how to provide a physical memory data management method to achieve accurate monitoring and management of the content data of the physical memory, and timely discover and handle abnormal situations that may threaten the operation of the trusted operating system, is a problem that urgently needs to be solved in this application. Summary of the invention
[0005] In view of this, the present application provides a physical memory data management method and system for a trusted operating system, with the purpose of realizing accurate monitoring and management of the content data of the physical memory, and timely discovering and handling abnormal situations that may threaten the operation of the trusted operating system.
[0006] The first aspect of the present application provides a physical memory data management method of an ICT operating system, which is applicable to the ICT operating system, wherein the ICT operating system includes a kernel space and a user space, and the method includes:
[0007] Allocate a section of physical memory from the kernel space, obtain a virtual address of the physical memory, and map the virtual address of the physical memory to a memory page of the physical memory to determine a physical address of the physical memory;
[0008] Creating a user virtual space in the user space, and mapping the physical memory to the user virtual space according to the page frame number corresponding to the memory page and the physical address of the physical memory;
[0009] Generate a system call of the physical memory according to the operation information of the physical memory, the physical address of the physical memory, the memory size of the physical memory and a preset file path;
[0010] In response to a user's physical memory editing operation on the physical memory, a physical memory editing function corresponding to the physical memory editing operation is executed through the system call to complete the corresponding physical memory editing operation.
[0011] Optionally, if the physical memory editing operation is a memory allocation operation, the responding to the user's physical memory editing operation on the physical memory, executing a physical memory editing function corresponding to the physical memory editing operation through the system call to complete the corresponding physical memory editing operation, includes:
[0012] In response to a memory allocation operation of the user on the physical memory, determining a memory allocation function corresponding to the memory allocation operation according to an operation name of the memory allocation operation in the system call;
[0013] The memory allocation function is executed through the operation command in the system call, so that when the memory size of the requested memory indicated by the memory allocation operation is smaller than the memory size of the physical memory, the virtual address of the requested memory is mapped to the memory page of the requested memory; the memory page of the requested memory is converted into the physical address of the requested memory, and a memory management object of the requested memory is generated according to the virtual address of the requested memory, the physical address of the requested memory and the memory information structure generated based on the information of the requested memory, so as to complete the corresponding memory allocation operation.
[0014] Optionally, if the physical memory editing operation is a memory release operation, the responding to the user's physical memory editing operation on the physical memory, executing a physical memory editing function corresponding to the physical memory editing operation through the system call to complete the corresponding physical memory editing operation, includes:
[0015] In response to a memory release operation of the user on the physical memory, determining a memory release function corresponding to the memory release operation according to an operation name of the memory release operation in the system call;
[0016] Executing the memory release function through the operation command in the system call to obtain the memory management object and the virtual address of the physical memory according to the physical address of the physical memory; releasing the physical memory, the virtual address of the physical memory and the memory management object of the physical memory, and deleting the memory management object to complete the corresponding memory release operation;
[0017] The memory management object of the physical memory is obtained by generating a memory management structure of the physical memory according to the physical address of the physical memory, the virtual address of the physical memory and the information of the physical memory, and initializing the memory information structure.
[0018] Optionally, if the physical memory editing operation is a memory initialization operation, in response to the user's physical memory editing operation on the physical memory, executing a physical memory editing function corresponding to the physical memory editing operation through the system call to complete the corresponding physical memory editing operation includes:
[0019] In response to a user's memory initialization operation on the physical memory, determining a memory initialization function corresponding to the memory initialization operation according to an operation name corresponding to the memory initialization operation in the system call;
[0020] The memory initialization function is executed through the operation command in the system call, so that when the file path input by the user based on the memory initialization operation is detected, the file content obtained according to the file path is filled into the physical memory; when the file path input by the user based on the memory initialization operation is not detected, the filling content of the physical memory is determined to be 0 to complete the corresponding memory initialization operation.
[0021] Optionally, if the physical memory editing operation is a memory display operation, the responding to the user's physical memory editing operation on the physical memory, executing a physical memory editing function corresponding to the physical memory editing operation through the system call to complete the corresponding physical memory editing operation, includes:
[0022] In response to a memory display operation of the user on the physical memory, determining a memory display function corresponding to the memory display operation according to an operation name of the memory display operation in the system call;
[0023] The memory display function is executed through the operation command in the system call to detect that the user passes in the physical address of the physical memory based on the memory display operation, and then obtain and display the memory management object of the physical memory according to the physical address of the physical memory; if it is not detected that the user inputs the physical address of the physical memory based on the memory display operation, obtain and display the memory management object of the physical memory according to the process number of the physical memory; and the memory management object of the physical memory is displayed to complete the corresponding memory display operation.
[0024] Optionally, if the physical memory editing operation is a memory reduction operation, the responding to the user's physical memory editing operation on the physical memory, executing a physical memory editing function corresponding to the physical memory editing operation through the system call to complete the corresponding physical memory editing operation, includes:
[0025] In response to a memory reduction operation of the user on the physical memory, determining a memory reduction function corresponding to the memory reduction operation according to an operation name of the memory reduction operation in the system call;
[0026] The memory reduction function is executed through the operation command in the system call to detect that the user passes in the physical address of the physical memory based on the memory reduction operation, and then obtain the available capacity of the physical memory according to the physical address of the physical memory; if it is not detected that the user passes in the physical address of the physical memory based on the memory reduction operation, the physical address is obtained according to the process number of the physical memory to obtain the available capacity of the physical memory; if the available capacity of the physical memory is not less than the reduced capacity indicated by the memory reduction operation, the available capacity of the physical memory is reduced according to the reduced capacity to complete the corresponding memory reduction operation.
[0027] Optionally, if the physical memory editing operation is a memory detailed information operation, the responding to the user's physical memory editing operation on the physical memory, executing a physical memory editing function corresponding to the physical memory editing operation through the system call to complete the corresponding physical memory editing operation, includes:
[0028] In response to a user's memory detailed information operation on the physical memory, determining a memory detailed information function corresponding to the memory detailed information operation according to an operation name of the memory detailed information operation in the system call;
[0029] The memory detailed information function is executed through the operation command in the system call to detect that the user has passed in the physical address of the physical memory based on the memory detailed information operation, and then the available capacity of the physical memory is obtained according to the physical address of the physical memory; if the user has not passed in the physical address of the physical memory based on the memory detailed information operation, the physical address is obtained according to the process number of the physical memory to obtain the available capacity of the physical memory; a predefined temporary variable of the physical memory is obtained, and the physical address and the available capacity of the physical memory are stored in the temporary variable to obtain a target variable; the target variable is passed in a corresponding parameter pointer to release the target variable, and the corresponding memory detailed information operation is completed.
[0030] Optionally, if the physical memory editing operation is a memory data insertion operation, the responding to the user's physical memory editing operation on the physical memory, executing a physical memory editing function corresponding to the physical memory editing operation through the system call to complete the corresponding physical memory editing operation, includes:
[0031] In response to a user's memory data insertion operation on the physical memory, determining a memory data insertion function corresponding to the memory data insertion operation according to an operation name of the memory data insertion operation in the system call;
[0032] The memory data insertion function is executed through the operation command in the system call to detect that the user passes the physical address of the physical memory based on the memory data insertion operation, and obtain the available capacity of the physical memory according to the physical address of the physical memory; if the user does not detect that the physical address of the physical memory is passed based on the memory data insertion operation, the physical address is obtained according to the process number of the physical memory to obtain the available capacity of the physical memory; if the available capacity of the physical memory is not less than the amount of memory data inserted as indicated by the memory data insertion operation; the memory input is inserted into the physical memory to complete the corresponding memory data insertion operation.
[0033] A second aspect of the present application provides a physical memory data management system for an ICT operating system, which is applicable to the ICT operating system, wherein the ICT operating system includes a kernel space and a user space, and the system includes:
[0034] A physical memory allocation unit is used to allocate a section of physical memory from the kernel space, obtain a virtual address of the physical memory, and map the virtual address of the physical memory to a memory page of the physical memory to determine a physical address of the physical memory;
[0035] A mapping unit, configured to create a user virtual space in the user space, and map the physical memory to the user virtual space according to a page frame number corresponding to the memory page and a physical address of the physical memory;
[0036] a system call generating unit, configured to generate a system call of the physical memory according to the operation information of the physical memory, the physical address of the physical memory, the memory size of the physical memory and a preset file path;
[0037] The physical memory editing unit is used to respond to the user's physical memory editing operation on the physical memory, and execute the physical memory editing function corresponding to the physical memory editing operation through the system call to complete the corresponding physical memory editing operation.
[0038] Optionally, if the physical memory editing operation is a memory allocation operation, in response to a user's physical memory editing operation on the physical memory, a physical memory editing unit that executes a physical memory editing function corresponding to the physical memory editing operation through the system call to complete the corresponding physical memory editing operation is specifically used to:
[0039] In response to a memory allocation operation of the user on the physical memory, determining a memory allocation function corresponding to the memory allocation operation according to an operation name of the memory allocation operation in the system call;
[0040] The memory allocation function is executed through the operation command in the system call, so that when the memory size of the requested memory indicated by the memory allocation operation is smaller than the memory size of the physical memory, the virtual address of the requested memory is mapped to the memory page of the requested memory; the memory page of the requested memory is converted into the physical address of the requested memory, and a memory management object of the requested memory is generated according to the virtual address of the requested memory, the physical address of the requested memory and the memory information structure generated based on the information of the requested memory, so as to complete the corresponding memory allocation operation.
[0041] The present application provides a physical memory data management method and system for an ICT operating system, which is applicable to an ICT operating system, wherein the ICT operating system includes a kernel space; a virtual address of the physical memory is obtained by allocating a section of physical memory from the kernel space; the virtual address of the physical memory is mapped to a memory page of the physical memory, and the memory page of the physical memory is converted to a physical address of the physical memory; a user virtual space is created in the user space, and the physical memory is mapped to the user virtual space according to the page frame number corresponding to the memory page and the physical address of the physical memory; a system call of the physical memory is generated according to the operation information of the physical memory, the physical address of the physical memory, the memory size of the physical memory and a pre-set file path; in response to a user's physical memory editing operation on the physical memory, a physical memory editing function corresponding to the physical memory editing operation is executed through the system call to complete the corresponding physical memory editing operation. The technical solution provided by the present application allocates a section of physical memory from the kernel space and creates a user virtual space in the user space, so that the physical memory can be mapped to the user virtual space according to the page frame number and physical address corresponding to the physical memory, thereby better protecting the physical memory and ensuring the stability of the trusted operating system and the security of the data; and, the present solution can also generate a system call for the physical memory based on the operation information of the physical memory, the physical address of the physical memory, the memory size of the physical memory and the pre-set file path, and through the system call, the user is supported to perform corresponding physical memory editing operations on the physical memory, thereby realizing accurate monitoring and management of the memory data of the physical memory, reducing the risk of the trusted operating system being attacked or data leaked, and thereby improving the overall security and reliability of the trusted operating system. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] 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, the drawings described below are only embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying any creative work.
[0043] Figure 1 A flow chart of a method for managing physical memory data of a trusted operating system provided in an embodiment of the present application;
[0044] Figure 2 A schematic diagram of the structure of a physical memory data management system of a trusted operating system provided in an embodiment of the present application;
[0045] Figure 3 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0046] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0047] In this application, relational terms such as first and second, etc. are used only 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 "comprise", "include" 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, an element defined by the statement "comprises a ..." does not exclude the presence of other identical elements in the process, method, article or device including the element.
[0048] See also Figure 1 , shows a flow chart of a physical memory data management method provided in an embodiment of the present application, which is applicable to a trusted operating system, wherein the trusted operating system includes a kernel space and a user space, and the physical memory data management method specifically includes the following steps:
[0049] S101: Allocate a section of physical memory from the kernel space, obtain a virtual address of the physical memory, and map the virtual address of the physical memory to a memory page of the obtained physical memory to determine a physical address of the physical memory.
[0050] In the specific execution process of step S101, a physical memory of size PAGE_SIZE is allocated from the kernel space by kmalloc using the slab allocator, and the PID of the process of the physical memory, the memory size of the physical memory and the actual available length are recorded. At the same time, the process of the physical memory will feedback the virtual address corresponding to the physical memory, wherein the memory size of the physical memory is PAGE_SIZE, and PAGE_SIZE is the size of a memory page; the virtual address of the physical memory is mapped to the memory page of the physical memory through a pre-set memory page mapping function, and finally the memory page of the physical memory is converted to the physical address of the physical memory through a physical address conversion function. Among them, the code example for determining the physical address of the physical memory is as follows:
[0051]
[0052] It should be noted that virt_to_page is a preset memory page mapping function, and page_to_phys is a preset physical address translation function.
[0053] Furthermore, in an embodiment of the present application, information of physical memory is obtained; a memory management structure of the physical memory is generated according to the physical address of the physical memory, the virtual address of the physical memory and the information of the physical memory, and the memory information structure is initialized to obtain a memory management object of the physical memory.
[0054] It should be noted that the information of the physical memory at least includes the process ID (Process Identifier, PID) of the physical memory process, the starting physical address of the available capacity of the physical memory, the memory size of the physical memory, the number of memory pages of the physical memory, etc. Among them, the PID is a unique identifier assigned by the operating system to each running process, which is used to identify the identity of the process.
[0055] In some embodiments, a memory information structure of the physical memory can be generated based on the process ID (PID) of the physical memory, the physical address of the physical memory, the virtual address of the physical memory, the starting physical address of the available capacity of the physical memory, the memory size of the physical memory, and the number of memory pages of the physical memory, as shown in Table 1, and the memory information structure of the physical memory is initialized to generate a memory management object of the physical memory.
[0056] Table 1:
[0057]
[0058]
[0059] S102: Create a user virtual space in the user space, and map the physical memory to the user virtual space according to the page frame number corresponding to the memory page and the physical address of the physical memory.
[0060] In the specific process of executing step S102, after obtaining the physical address of the physical memory, the page frame number (PEN number) of the memory page of the physical memory can be further obtained, and a new memory area is created in the user space of the Xinchuang operating system by mmap, that is, a new user virtual space is created in the user space, and the physical memory is mapped to the user virtual space according to the PEN number of the memory page and the physical address of the physical memory through the remap_pfn_ranges method. Among them, the remap_pfn_ranges method indicates that the physical memory is mapped to the specified virtual address space. Therefore, the corresponding physical memory can be mapped to the user virtual space according to the PEN number of the memory page and the physical address of the physical memory through the remap_pfn_ranges method.
[0061] S103: Generate a system call of the physical memory according to the operation information of the physical memory, the physical address of the physical memory, the memory size of the physical memory and the preset file path.
[0062] In an embodiment of the present application, operation information related to the physical memory to be allocated can be pre-set, wherein the operation information includes operands, operation names and physical memory editing functions corresponding to multiple physical memory editing operations; corresponding system call parameters are generated according to the physical address of the physical memory, the physical size of the physical memory, the pre-set file path and the operation name corresponding to each physical memory editing operation, as shown in Table 2, so as to generate a system call corresponding to the physical memory according to the system call parameters, so as to respond to the user's physical memory editing operation on the physical memory when detecting the user's physical memory editing operation, and execute the physical memory editing function corresponding to the physical memory editing operation through the system call to complete the corresponding physical memory editing operation.
[0063] Table 2:
[0064]
[0065]
[0066] It should be noted that the physical memory editing operations that can be preset may be memory allocation operations, memory release operations, memory initialization operations, memory display operations, memory reduction operations, memory detailed information operations, memory data insertion operations, etc.; at the same time, a correspondence between the operation name and the operation value of each physical memory editing operation, and a correspondence between the operation name and the physical memory editing function of each physical memory editing operation may also be established; wherein the correspondence between the operation name of each operation and the operation value of each operation may be as shown in the following Table 3:
[0067] Table 3:
[0068] Operation name for physical memory edit operation Operation value for physical memory edit operations ALLOC (operation name for memory allocation operation) 0 (operation value for memory allocation operations) FREE (operation name of the memory release operation) 1 (operation value of memory release operation) INIT (operation name of memory initialization operation) 2 (operation value of memory initialization operation) DEC (operation name of memory display operation) 3 (operation value of memory display operation) SHOW(operation name of memory reduction operation) 4 (operation value for memory reduction operation) INSERT(operation name of memory detail operation) 5 (operation value for memory detail operation) INFO (operation name of the memory data insertion operation) 6 (operation value of memory data insertion operation)
[0069] In actual application, after obtaining the information of physical memory, the system call corresponding to the physical memory can be generated according to the operation command of the physical memory, the physical address, the physical size of the physical memory, the preset file path and the operation name corresponding to each physical memory editing operation. The code example corresponding to the generation process of the system call of the physical memory can be as follows:
[0070]
[0071]
[0072]
[0073] S104: In response to the user's physical memory editing operation on the physical memory, a physical memory editing function corresponding to the physical memory editing operation is executed through a system call to complete the corresponding physical memory editing operation.
[0074] In the process of specifically executing step S104, after the system call for physical memory is generated, it can be detected in real time whether there is a physical memory editing operation performed by the user on the physical memory; when the user's physical memory editing operation is detected, the user's physical memory editing operation can be responded to, and the physical memory editing function corresponding to the physical memory editing operation can be determined according to the operation name corresponding to the physical memory editing operation in the system call for physical memory; the physical memory editing function is executed through the operation command in the system call to complete the corresponding physical memory editing operation.
[0075] As an implementation method of an embodiment of the present application, if the physical memory editing operation is a memory allocation operation, in response to the user's physical memory editing operation on the physical memory, the physical memory editing function corresponding to the physical memory editing operation is executed through a system call to complete the corresponding physical memory editing operation. The specific process can be: in response to the user's memory allocation operation on the physical memory, the memory allocation function corresponding to the memory allocation operation is determined according to the operation name of the memory allocation operation in the system call; the memory allocation function is executed through the operation command in the system call, so that when the memory size of the requested memory indicated by the memory allocation operation is smaller than the memory size of the physical memory, the virtual address of the requested memory is mapped to the memory page of the requested memory; the memory page of the requested memory is converted into the physical address of the requested memory, and a memory management object of the requested memory is generated according to the virtual address of the requested memory, the physical address of the requested memory and the memory information structure generated by the information of the requested memory to complete the corresponding memory allocation operation.
[0076] It should be noted that the information for applying for memory at least includes: the information for applying for memory at least includes the PID of the applied memory, the starting physical address of the available capacity of the applied memory, the memory size of the applied memory, the number of memory pages of the applied memory, etc.
[0077] In actual application, it is possible to detect in real time whether there is an operand input by the user. When the operand input by the user is detected, it can be determined that the user is currently performing a physical memory editing operation. If the operand input by the user is 0, it can be determined that the physical memory editing operation performed by the user is a memory allocation operation, and then the user's memory allocation operation can be responded to, and the memory allocation operation function corresponding to the memory allocation operation can be determined according to the operation name of the memory allocation operation in the system call.
[0078] A memory allocation function is executed through an operation command in a system call to allocate a section of requested memory, and a virtual address fed back by the process of the requested memory is obtained; corresponding memory data is set for the requested memory; it is determined whether the memory size of the requested memory indicated by the memory allocation operation is smaller than the memory size of the physical memory; if the memory size of the requested memory is smaller than the memory size of the physical memory, a corresponding virtual address is allocated to the requested memory according to the process of the requested memory, and the virtual address of the requested memory is mapped to a memory page of the requested memory, and the memory page of the requested memory is converted to a physical address of the requested memory, and finally a memory information structure of the requested memory is generated according to the virtual address of the requested memory, the physical address of the requested memory, the PID of the requested memory, the starting physical address of the available capacity of the requested memory, the memory size of the requested memory and the number of memory pages of the memory, and the memory information structure of the requested memory is initialized to generate a memory management object of the requested memory.
[0079] It should be noted that the code example corresponding to the memory allocation operation function corresponding to the memory allocation operation can be as follows:
[0080]
[0081]
[0082] As an implementation method of an embodiment of the present application, if the physical memory editing operation is a memory release operation, in response to the user's physical memory editing operation on the physical memory, the physical memory editing operation corresponding to the physical memory editing operation is executed through a system call. The process to complete the corresponding physical memory editing operation can specifically be: in response to the user's memory release operation on the physical memory, the memory release function corresponding to the memory release operation is determined according to the operation name of the memory release operation in the system call; the memory release function is executed through the operation command in the system call to obtain the memory management object and the virtual address of the physical memory according to the physical address of the physical memory; the physical memory, the virtual address of the physical memory and the memory management object of the physical memory are released, and the memory management object is deleted to complete the corresponding memory release operation.
[0083] In actual application, it is possible to detect in real time whether there is an operand input by the user for the physical memory. When the operand input by the user is detected, it can be determined that the user has performed a physical memory editing operation on the physical memory; if the operand input by the user is 1, it can be determined that the physical memory editing operation performed by the user on the physical memory is a memory release operation, and then the user's memory release operation can be responded to, and the memory release operation function corresponding to the memory release operation can be determined according to the operation name of the memory release operation in the system call. The memory release function is executed through the operation command in the system call to obtain the physical address (physical address of the physical memory) passed in when the user performs the memory release operation, and the memory management object and virtual address of the physical memory are obtained according to the physical address of the physical memory; the physical memory, the memory management object of the physical memory and the virtual address of the physical memory are released, and finally the memory management object of the physical memory is deleted to complete the corresponding memory release operation. Among them, the user can also pass in the physical address of other physical memories, which is not limited in this embodiment of the present application.
[0084] It should be noted that the code example corresponding to the memory release operation function corresponding to the memory release operation may be as follows:
[0085]
[0086] As an implementation method of an embodiment of the present application, if the physical memory editing operation is a memory initialization operation, in response to the user's physical memory editing operation on the physical memory, the physical memory editing function corresponding to the physical memory editing operation is executed through a system call to complete the corresponding physical memory editing operation. The specific process may be: in response to the user's memory initialization operation on the physical memory, a memory initialization function corresponding to the memory initialization operation is determined according to the operation name corresponding to the memory initialization operation in the system call; the memory initialization function is executed through the operation command in the system call, and when a file path input by the user based on the memory initialization operation is detected, the file content obtained according to the file path is filled into the physical memory; when the file path input by the user based on the memory initialization operation is not detected, the fill content of the physical memory is determined to be 0, so as to complete the corresponding memory initialization operation.
[0087] In actual application, it is possible to detect in real time whether there is an operand input by the user for the physical memory. When the operand input by the user is detected, it can be determined that the user has performed a physical memory editing operation on the physical memory; if the operand input by the user is 2, it can be determined that the physical memory editing operation performed by the user on the physical memory is a memory initialization operation, and then the user's memory initialization operation can be responded to, and the memory initialization operation function corresponding to the memory initialization operation can be determined according to the operation name of the memory initialization operation in the system call. The memory initialization function is executed through the operation command in the system call to obtain the physical address (physical address of the physical memory) passed in when the user performs the memory initialization operation; if the user does not pass in the corresponding file path when performing the memory initialization operation, it can be determined that the filling content of the physical memory corresponding to the physical address is 0; if the user passes in the corresponding file path when performing the memory initialization operation, it can be first determined whether the content size of the file content corresponding to the file path is greater than the available capacity of the physical memory; if not, the file content obtained according to the file path is filled into the physical memory; if greater, the file content corresponding to the file path can be written from the starting physical address of the available capacity of the physical memory until the physical memory is full, so as to complete the corresponding memory initialization operation.
[0088] It should be noted that the code example corresponding to the memory initialization operation function corresponding to the memory initialization operation can be as follows:
[0089]
[0090]
[0091] It should be noted that, in the above code example, the Init operation specifies that the physical memory of the corresponding physical address is filled with 0 or a specified file (the file corresponding to the file path passed in by the user; if path_name (file path) is NULL, the filling content of the physical memory is determined to be 0; otherwise, the file content corresponding to path_name is filled into the physical memory; and. If the size of the file content exceeds the available capacity of the physical memory, the file content corresponding to the file path is written from the starting physical address of the available capacity of the physical memory until the physical memory is full. If the filling is successful, 0 is returned. If it fails, the return value is defined as: -1: paddr not allocated; -2: file opening failed, which can be defined according to actual applications, and is not limited in this embodiment of the present application.
[0092] As an implementation method of an embodiment of the present application, if the physical memory editing operation is a memory display operation, in response to the user's physical memory editing operation on the physical memory, the physical memory editing operation corresponding to the physical memory editing operation is executed through a system call. The process to complete the corresponding physical memory editing operation can specifically be: in response to the user's memory display operation on the physical memory, the memory display function corresponding to the memory display operation is determined according to the operation name of the memory display operation in the system call; the memory display function is executed through the operation command in the system call to detect that when the user passes in the physical address of the physical memory based on the memory display operation, the memory management object of the physical memory is obtained and displayed according to the physical address of the physical memory, and the memory management object is displayed; if the user is not detected to input the physical address of the physical memory based on the memory display operation, the memory management object of the physical memory is obtained and displayed according to the process number of the physical memory.
[0093] In actual application, it is possible to detect in real time whether there is an operand input by the user for the physical memory. When the operand input by the user is detected, it can be determined that the user is currently performing a physical memory editing operation on the physical memory; if the operand input by the user is 3, it can be determined that the physical memory editing operation performed by the user on the physical memory is a memory display operation, and then the user's memory display operation can be responded to, and the memory display operation function corresponding to the memory display operation can be determined according to the operation name of the memory display operation in the system call. The memory display function is executed through the operation command in the system call to detect whether the user passes in the corresponding physical address (physical address of the physical memory) when performing the memory display operation; if it is detected that the user passes in the corresponding physical address when performing the memory display operation, the memory management object of the corresponding physical memory can be obtained according to the physical address, and the memory management object of the physical memory can be printed (displayed); if the physical address passed in by the user when performing the memory operation is not detected, the memory management object of the physical memory can be obtained according to the PID of the process of the physical memory, and the memory management object of the physical memory can be printed to complete the corresponding memory display operation.
[0094] It should be noted that the code example corresponding to the memory display operation function corresponding to the memory display operation may be as follows:
[0095]
[0096] It should be noted that, in the above code example, the Info operation indicates the return of the real-time available capacity, available ratio, starting physical address, starting physical address of available capacity and memory management object of the physical memory allocated by the process; if the user passes in the physical address paddr when performing the memory display operation, the real-time available capacity, available ratio, starting physical address, starting physical address of available capacity and memory management object of the physical memory corresponding to the physical address are returned according to the physical address; if the user does not pass in the physical address paddr when performing the memory display operation, the real-time available capacity, available ratio, starting physical address, starting physical address of available capacity and memory management object of the physical memory are returned according to the PID of the process of the physical memory; 0 is returned when the memory display is successful; -1 is returned when the memory display fails.
[0097] As an implementation method of an embodiment of the present application, if the physical memory editing operation is a memory reduction operation, in response to the user's physical memory editing operation on the physical memory, the physical memory editing operation corresponding to the physical memory editing operation is executed through a system call. The process to complete the corresponding physical memory editing operation can specifically be: in response to the user's memory reduction operation on the physical memory, the memory reduction function corresponding to the memory reduction operation is determined according to the operation name of the memory reduction operation in the system call; the memory reduction function is executed through the operation command in the system call, and when the physical address of the physical memory passed in by the user based on the memory reduction operation is detected, the available capacity of the physical memory is obtained according to the physical address of the physical memory; if the physical address of the physical memory passed in by the user based on the memory reduction operation is not detected, the available capacity of the physical memory is obtained by obtaining the physical address according to the process number of the physical memory; if the available capacity of the physical memory is greater than the reduced capacity indicated by the memory reduction operation, the available capacity of the physical memory is reduced according to the reduced capacity to complete the corresponding memory reduction operation.
[0098] In actual application, it is possible to detect in real time whether there is an operand input by the user for physical memory. When the operand input by the user is detected, it can be determined that the user is currently performing a physical memory editing operation on the physical memory. If the operand input by the user is 4, it can be determined that the physical memory editing operation performed by the user on the physical memory is a memory reduction operation, and then the user's memory reduction operation can be responded to, and the memory reduction operation function corresponding to the memory reduction operation can be determined according to the operation name of the memory reduction operation in the system call. A memory reduction function is executed through an operation command in a system call to detect whether a corresponding physical address (physical address of physical memory) is passed in when a user performs a memory display operation; if it is detected that a corresponding physical address is passed in when a user performs a memory display operation, the available capacity of the corresponding physical memory can be obtained according to the physical address; if the physical address of the physical memory passed in by the user based on the memory reduction operation is not detected, the available capacity of the physical memory is obtained according to the process ID (PID) of the physical memory; it is determined whether the available capacity of the physical memory is less than the reduced capacity indicated by the memory reduction operation; if the available capacity of the physical memory is not less than the reduced capacity indicated by the memory reduction operation, the available capacity of the physical memory is reduced according to the reduced capacity; if the available capacity of the physical memory is less than the reduced capacity, a prompt message indicating that the capacity reduction of the physical memory has failed can be fed back.
[0099] It should be noted that the code example corresponding to the memory reduction operation function corresponding to the memory reduction operation may be as follows:
[0100]
[0101]
[0102] It should be noted that in the above code example, the Dec operation indicates to reduce the available capacity of the physical memory, and writes 1 to the content of the physical memory after the available capacity is reduced; 0 is returned when the available capacity of the physical memory is successfully reduced; the return value in case of failure is defined as follows: -1: the reduced capacity exceeds the available capacity.
[0103] As an implementation method of an embodiment of the present application, if the physical memory editing operation is a memory detailed information operation, in response to the user's physical memory editing operation on the physical memory, the physical memory editing function corresponding to the physical memory editing operation is executed through a system call to complete the corresponding physical memory editing operation. The process may specifically be: in response to the user's memory detailed information operation on the physical memory, the memory detailed information function corresponding to the memory detailed information operation is determined according to the operation name of the memory detailed information operation in the system call; the memory detailed information function is executed through the operation command in the system call to detect that when the physical address of the physical memory is passed in by the user based on the memory detailed information operation, the available capacity of the physical memory is obtained according to the physical address of the physical memory; if the physical address of the physical memory passed in by the user based on the memory detailed information operation is not detected, the physical address is obtained according to the process number of the physical memory to obtain the available capacity of the physical memory; a pre-defined temporary variable of the physical memory is obtained, and the physical address and available capacity of the physical memory are stored in the temporary variable to obtain a target variable; the target variable is passed in to the corresponding parameter pointer to release the target variable to complete the corresponding memory detailed information operation.
[0104] In actual application, it is possible to detect in real time whether there is an operand input by the user for physical memory. When the operand input by the user is detected, it can be determined that the user is currently performing a physical memory editing operation on the physical memory. If the operand input by the user is 5, it can be determined that the physical memory editing operation performed by the user on the physical memory is a memory detailed information operation, and then the user's memory detailed information operation can be responded to, and the memory detailed information operation function corresponding to the memory detailed information operation can be determined according to the operation name of the memory detailed information operation in the system call. The memory detailed information function is executed through the operation command in the system call to detect whether the user passes in the corresponding physical address (physical address of physical memory) when performing the memory display operation; if it is detected that the user passes in the corresponding physical address when performing the memory display operation, the available capacity of the corresponding physical memory can be obtained according to the physical address; if the physical address of the physical memory passed in by the user based on the memory detailed information operation is not detected, the physical address is obtained according to the process ID (PID) of the physical memory to obtain the available capacity of the physical memory; a predefined temporary variable of the physical memory is obtained, and the physical address and available capacity of the physical memory are copied to the temporary variable to convert the content in the physical address and available capacity of the physical memory into readable information, and finally the target variable storing the physical address and available capacity is passed to the parameter pointer to achieve the purpose of displaying the memory detailed information of the physical memory and complete the corresponding memory detailed information operation.
[0105] It should be noted that the code example corresponding to the memory detailed information operation function corresponding to the memory detailed information operation can be as follows:
[0106]
[0107]
[0108] It should be noted that, in the above code example, the Show operation indicates that the contents of the physical address and available capacity of the physical memory are converted into readable information and printed to the pointer parameter to complete the corresponding memory detailed information; returnvalue: 0 is fed back when the memory detailed information is successfully displayed, and -1 is returned when the memory detailed information is successfully displayed.
[0109] As an implementation method of an embodiment of the present application, if the physical memory editing operation is a memory data insertion operation, in response to the user's physical memory editing operation on the physical memory, the physical memory editing function corresponding to the physical memory editing operation is executed through a system call to complete the corresponding physical memory editing operation. The process may specifically be: in response to the user's memory data insertion operation on the physical memory, a memory data insertion function corresponding to the memory data insertion operation is determined according to the operation name of the memory data insertion operation in the system call; the memory data insertion function is executed through the operation command in the system call to detect the physical address of the physical memory passed in by the user based on the memory data insertion operation, and the available capacity of the physical memory is obtained according to the physical address of the physical memory; if the physical address of the physical memory passed in by the user based on the memory data insertion operation is not detected, the physical address is obtained according to the process number of the physical memory to obtain the available capacity of the physical memory; if the available capacity of the physical memory is greater than the amount of memory data indicated to be inserted by the memory data insertion operation; the memory input is inserted into the physical memory to complete the corresponding memory data insertion operation.
[0110] In actual application, it is possible to detect in real time whether there is an operand input by the user for physical memory. When the operand input by the user is detected, it can be determined that the user is currently performing a physical memory editing operation on the physical memory. If the operand input by the user is 5, it can be determined that the physical memory editing operation performed by the user on the physical memory is a memory data insertion operation, and then the user's memory data insertion operation can be responded to, and the memory data insertion function corresponding to the memory data insertion operation can be determined according to the operation name of the memory data insertion operation in the system call. A memory data insertion function is executed through an operation command in a system call to detect whether a user has passed in a corresponding physical address (physical address of a physical memory) when performing a memory display operation; if it is detected that a user has passed in a corresponding physical address when performing a memory display operation, the available capacity of the corresponding physical memory can be obtained according to the physical address; if it is not detected that a user has passed in a physical address of a physical memory based on a memory detailed information operation, the available capacity of the physical memory can be obtained by obtaining the physical address according to a process ID (PID) of the physical memory; it is determined whether the available capacity of the physical memory is less than the amount of memory data inserted as indicated by the memory data insertion operation; if the available capacity of the physical memory is not less than the amount of memory data inserted as indicated by the memory data insertion operation; the memory input is inserted into the physical memory to complete the corresponding memory data insertion operation; if the available capacity of the physical memory is less than the amount of memory data, a prompt message indicating that the memory data insertion has failed can be output.
[0111] It should be noted that the code example corresponding to the memory data insertion operation function corresponding to the memory data insertion operation may be as follows:
[0112]
[0113]
[0114] It should be noted that in the above code example, the Insert operation indicates that the passed string (memory data) is inserted into the requested physical memory; returnvalue: the corresponding content is returned when the memory data is successfully inserted, and the return value is defined as follows when the memory data insertion fails: -1: the string is too long (the amount of memory data is too large).
[0115] The present application provides a physical memory data management method, by allocating a section of physical memory from the kernel space of the trusted operating system and creating a user virtual space in the user space, so that the physical memory can be mapped to the user virtual space according to the page frame number and physical address corresponding to the physical memory, so as to better protect the physical memory and ensure the stability of the trusted operating system and the security of data; and, the scheme can also generate a system call for the physical memory according to the operation information of the physical memory, the physical address of the physical memory, the memory size of the physical memory and the pre-set file path; through the system call, the user is supported to perform physical memory editing operations such as memory allocation operation, memory release operation, memory initialization operation, memory display operation, memory reduction operation, memory detailed information operation, memory data insertion operation on the physical memory, so as to realize the accurate monitoring and management of the memory data of the physical memory, reduce the risk of the trusted operating system being attacked or data leaked, and thus improve the overall security and reliability of the trusted operating system. In addition, the system administrator can scan the allocated physical memory regularly or in real time to detect and clear any potential abnormal data, thereby further reducing the risk of the system being attacked or data leaked.
[0116] Based on the physical memory data management method of the trusted operating system provided in the above-mentioned embodiment of the present application, correspondingly, the embodiment of the present application also provides a physical memory data management system of the trusted operating system, such as Figure 2 As shown, the physical memory data management system of the trusted operating system is applicable to the trusted operating system, which includes a kernel space and a user space. The physical memory data management system of the trusted operating system includes:
[0117] The physical memory allocation unit 21 is used to allocate a section of physical memory from the kernel space, obtain a virtual address of the physical memory, and map the virtual address of the physical memory to a memory page of the physical memory to determine the physical address of the physical memory;
[0118] A mapping unit 22 is used to create a user virtual space in the user space, and map the physical memory to the user virtual space according to the page frame number corresponding to the memory page and the physical address of the physical memory;
[0119] The system call generating unit 23 is used to generate a system call of the physical memory according to the operation information of the physical memory, the physical address of the physical memory, the memory size of the physical memory and the preset file path;
[0120] The physical memory editing unit 24 is used to respond to the user's physical memory editing operation on the physical memory, and execute the physical memory editing function corresponding to the physical memory editing operation through system call to complete the corresponding physical memory editing operation.
[0121] The specific principles and execution processes of each unit in the physical memory data management system of the trusted operating system disclosed in the above-mentioned embodiment of the present application are the same as the physical memory data management method of the trusted operating system disclosed in the above-mentioned embodiment of the present application. Please refer to the corresponding parts of the physical memory data management method of the trusted operating system disclosed in the above-mentioned embodiment of the present application, and no further details will be given here.
[0122] The present application provides a physical memory data management system for an ICT operating system, which is applicable to the ICT operating system, and the ICT operating system includes a kernel space; a virtual address of the physical memory is obtained by allocating a section of physical memory from the kernel space; the virtual address of the physical memory is mapped to a memory page of the physical memory, and the memory page of the physical memory is converted to a physical address of the physical memory; a user virtual space is created in the user space, and the physical memory is mapped to the user virtual space according to the page frame number corresponding to the memory page and the physical address of the physical memory; a system call for the physical memory is generated according to the operation information of the physical memory, the physical address of the physical memory, the memory size of the physical memory and a pre-set file path; in response to the user's physical memory editing operation on the physical memory, the physical memory editing function corresponding to the physical memory editing operation is executed through the system call to complete the corresponding physical memory editing operation. The technical solution provided by the present application allocates a section of physical memory from the kernel space and creates a user virtual space in the user space, so as to map the physical memory to the user virtual space according to the page frame number and physical address corresponding to the physical memory, thereby better protecting the physical memory and ensuring the stability of the trusted operating system and the security of the data; and, the present solution can also generate a system call for the physical memory based on the operation information of the physical memory, the physical address of the physical memory, the memory size of the physical memory and the pre-set file path, and through the system call, support the user to perform corresponding physical memory editing operations on the physical memory, thereby realizing accurate monitoring and management of the memory data of the physical memory, reducing the risk of the trusted operating system being attacked or data leaked, and thereby improving the overall security and reliability of the trusted operating system.
[0123] Optionally, if the physical memory editing operation is a memory allocation operation, in response to the user's physical memory editing operation on the physical memory, a physical memory editing unit that executes a physical memory editing function corresponding to the physical memory editing operation through a system call to complete the corresponding physical memory editing operation is specifically used to:
[0124] In response to a user's memory allocation operation on physical memory, a memory allocation function corresponding to the memory allocation operation is determined according to an operation name of the memory allocation operation in a system call;
[0125] The memory allocation function is executed through the operation command in the system call, so that when the memory size of the requested memory indicated by the memory allocation operation is smaller than the memory size of the physical memory, the virtual address of the requested memory is mapped to the memory page of the requested memory; the memory page of the requested memory is converted into the physical address of the requested memory, and a memory management object of the requested memory is generated according to the virtual address of the requested memory, the physical address of the requested memory and the memory information structure generated by the requested memory information, so as to complete the corresponding memory allocation operation.
[0126] Optionally, if the physical memory editing operation is a memory release operation, in response to the user's physical memory editing operation on the physical memory, a physical memory editing unit that executes a physical memory editing function corresponding to the physical memory editing operation through a system call to complete the corresponding physical memory editing operation is specifically used for:
[0127] In response to a user's memory release operation on physical memory, a memory release function corresponding to the memory release operation is determined according to an operation name of the memory release operation in a system call;
[0128] Execute a memory release function through an operation command in a system call to obtain a memory management object and a virtual address of the physical memory according to a physical address of the physical memory; release the physical memory, the virtual address of the physical memory and the memory management object of the physical memory, and delete the memory management object to complete a corresponding memory release operation;
[0129] The memory management object of the physical memory is obtained by generating a memory management structure of the physical memory according to the physical address of the physical memory, the virtual address of the physical memory and the information of the physical memory, and initializing the memory information structure.
[0130] Optionally, if the physical memory editing operation is a memory initialization operation, in response to the user's physical memory editing operation on the physical memory, a physical memory editing unit that executes a physical memory editing function corresponding to the physical memory editing operation through a system call to complete the corresponding physical memory editing operation is specifically used to:
[0131] In response to a user's memory initialization operation on a physical memory, a memory initialization function corresponding to the memory initialization operation is determined according to an operation name corresponding to the memory initialization operation in a system call;
[0132] The memory initialization function is executed through the operation command in the system call to detect the file path input by the user based on the memory initialization operation, and the file content obtained according to the file path is filled into the physical memory; when the file path input by the user based on the memory initialization operation is not detected, the filling content of the physical memory is determined to be 0 to complete the corresponding memory initialization operation.
[0133] Optionally, if the physical memory editing operation is a memory display operation, in response to the user's physical memory editing operation on the physical memory, a physical memory editing unit that executes a physical memory editing function corresponding to the physical memory editing operation through a system call to complete the corresponding physical memory editing operation is specifically used to:
[0134] In response to a user's memory display operation on physical memory, a memory display function corresponding to the memory display operation is determined according to an operation name of the memory display operation in a system call;
[0135] The memory display function is executed through the operation command in the system call to detect that the user passes in the physical address of the physical memory based on the memory display operation, and then obtain and display the memory management object of the physical memory according to the physical address of the physical memory; if the user is not detected to input the physical address of the physical memory based on the memory display operation, the memory management object of the physical memory is obtained and displayed according to the process number of the physical memory; the memory management object of the physical memory is displayed to complete the corresponding memory display operation.
[0136] Optionally, if the physical memory editing operation is a memory reduction operation, in response to the user's physical memory editing operation on the physical memory, a physical memory editing unit that executes a physical memory editing function corresponding to the physical memory editing operation through a system call to complete the corresponding physical memory editing operation is specifically used to:
[0137] In response to a memory reduction operation of a user on a physical memory, a memory reduction function corresponding to the memory reduction operation is determined according to an operation name of the memory reduction operation in a system call;
[0138] The memory reduction function is executed through the operation command in the system call to detect the physical address of the physical memory passed in by the user based on the memory reduction operation, and the available capacity of the physical memory is obtained according to the physical address of the physical memory; if the physical address of the physical memory passed in by the user based on the memory reduction operation is not detected, the physical address is obtained according to the process number of the physical memory to obtain the available capacity of the physical memory; if the available capacity of the physical memory is not less than the reduced capacity indicated by the memory reduction operation, the available capacity of the physical memory is reduced according to the reduced capacity to complete the corresponding memory reduction operation.
[0139] Optionally, if the physical memory editing operation is a memory detailed information operation, in response to the user's physical memory editing operation on the physical memory, a physical memory editing unit that executes a physical memory editing function corresponding to the physical memory editing operation through a system call to complete the corresponding physical memory editing operation is specifically used to:
[0140] In response to a user's memory detailed information operation on physical memory, a memory detailed information function corresponding to the memory detailed information operation is determined according to an operation name of the memory detailed information operation in a system call;
[0141] The memory detailed information function is executed through the operation command in the system call to detect that the physical address of the physical memory passed in by the user based on the memory detailed information operation, and the available capacity of the physical memory is obtained according to the physical address of the physical memory; if the physical address of the physical memory passed in by the user based on the memory detailed information operation is not detected, the physical address is obtained according to the process number of the physical memory to obtain the available capacity of the physical memory; a pre-defined temporary variable of the physical memory is obtained, and the physical address and the available capacity of the physical memory are stored in the temporary variable to obtain the target variable; the target variable is passed into the corresponding parameter pointer to release the target variable, and the corresponding memory detailed information operation is completed.
[0142] Optionally, if the physical memory editing operation is a memory data insertion operation, in response to the user's physical memory editing operation on the physical memory, a physical memory editing unit that executes a physical memory editing function corresponding to the physical memory editing operation through a system call to complete the corresponding physical memory editing operation is specifically used for:
[0143] In response to a user's memory data insertion operation on a physical memory, a memory data insertion function corresponding to the memory data insertion operation is determined according to an operation name of the memory data insertion operation in a system call;
[0144] The memory data insertion function is executed through the operation command in the system call to detect the physical address of the physical memory passed by the user based on the memory data insertion operation, and the available capacity of the physical memory is obtained according to the physical address of the physical memory; if the physical address of the physical memory passed by the user based on the memory data insertion operation is not detected, the physical address is obtained according to the process number of the physical memory to obtain the available capacity of the physical memory; if the available capacity of the physical memory is not less than the data amount of the memory data inserted by the memory data insertion operation; the memory input is inserted into the physical memory to complete the corresponding memory data insertion operation.
[0145] The present application embodiment provides an electronic device, such as Figure 3 As shown, the electronic device includes a processor 301 and a memory 302, the memory 302 is used to store program codes and data for physical memory data management of the trusted operating system, and the processor 301 is used to call the program instructions in the memory to execute the steps shown in the physical memory data management method of the trusted operating system in the above embodiment.
[0146] An embodiment of the present application provides a storage medium, which includes a storage program, wherein when the program is running, the device where the storage medium is located is controlled to execute the physical memory data management method of the trusted computing operating system shown in the above embodiment.
[0147] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system or system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment. The system and system embodiments described above are merely schematic, in which the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.
[0148] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0149] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present application. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may 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 shown herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.
[0150] The above are only preferred implementations of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.
Claims
1. A physical memory data management method for a trusted operating system, characterized in that: Applicable to a trusted operating system, the trusted operating system includes a kernel space and a user space, and the method includes: Allocate a section of physical memory from the kernel space, obtain a virtual address of the physical memory, and map the virtual address of the physical memory to a memory page of the physical memory to determine a physical address of the physical memory; Creating a user virtual space in the user space, and mapping the physical memory to the user virtual space according to the page frame number corresponding to the memory page and the physical address of the physical memory; Generate a system call of the physical memory according to the operation information of the physical memory, the physical address of the physical memory, the memory size of the physical memory and a preset file path; In response to a user's physical memory editing operation on the physical memory, a physical memory editing function corresponding to the physical memory editing operation is executed through the system call to complete the corresponding physical memory editing operation.
2. The method according to claim 1, characterized in that If the physical memory editing operation is a memory allocation operation, the responding to the user's physical memory editing operation on the physical memory, executing a physical memory editing function corresponding to the physical memory editing operation through the system call to complete the corresponding physical memory editing operation, includes: In response to a memory allocation operation of the user on the physical memory, determining a memory allocation function corresponding to the memory allocation operation according to an operation name of the memory allocation operation in the system call; The memory allocation function is executed through the operation command in the system call, so that when the memory size of the requested memory indicated by the memory allocation operation is smaller than the memory size of the physical memory, the virtual address of the requested memory is mapped to the memory page of the requested memory; the memory page of the requested memory is converted into the physical address of the requested memory, and a memory management object of the requested memory is generated according to the virtual address of the requested memory, the physical address of the requested memory and the memory information structure generated based on the information of the requested memory, so as to complete the corresponding memory allocation operation.
3. The method according to claim 1, characterized in that If the physical memory editing operation is a memory release operation, the responding to the user's physical memory editing operation on the physical memory, executing a physical memory editing function corresponding to the physical memory editing operation through the system call to complete the corresponding physical memory editing operation, includes: In response to a memory release operation of the user on the physical memory, determining a memory release function corresponding to the memory release operation according to an operation name of the memory release operation in the system call; Executing the memory release function through the operation command in the system call to obtain the memory management object and the virtual address of the physical memory according to the physical address of the physical memory; releasing the physical memory, the virtual address of the physical memory and the memory management object of the physical memory, and deleting the memory management object to complete the corresponding memory release operation; The memory management object of the physical memory is obtained by generating a memory management structure of the physical memory according to the physical address of the physical memory, the virtual address of the physical memory and the information of the physical memory, and initializing the memory information structure.
4. The method according to claim 1, characterized in that: If the physical memory editing operation is a memory initialization operation, in response to the user's physical memory editing operation on the physical memory, executing a physical memory editing function corresponding to the physical memory editing operation through the system call to complete the corresponding physical memory editing operation, including: In response to a user's memory initialization operation on the physical memory, determining a memory initialization function corresponding to the memory initialization operation according to an operation name corresponding to the memory initialization operation in the system call; The memory initialization function is executed through the operation command in the system call, so that when the file path input by the user based on the memory initialization operation is detected, the file content obtained according to the file path is filled into the physical memory; when the file path input by the user based on the memory initialization operation is not detected, the filling content of the physical memory is determined to be 0 to complete the corresponding memory initialization operation.
5. The method according to claim 1, characterized in that If the physical memory editing operation is a memory display operation, the responding to the user's physical memory editing operation on the physical memory, executing a physical memory editing function corresponding to the physical memory editing operation through the system call to complete the corresponding physical memory editing operation, includes: In response to a memory display operation of the user on the physical memory, determining a memory display function corresponding to the memory display operation according to an operation name of the memory display operation in the system call; The memory display function is executed through the operation command in the system call to detect that the user passes in the physical address of the physical memory based on the memory display operation, and then obtain and display the memory management object of the physical memory according to the physical address of the physical memory; if it is not detected that the user inputs the physical address of the physical memory based on the memory display operation, obtain and display the memory management object of the physical memory according to the process number of the physical memory; and the memory management object of the physical memory is displayed to complete the corresponding memory display operation.
6. The method according to claim 1, characterized in that If the physical memory editing operation is a memory reduction operation, the responding to the user's physical memory editing operation on the physical memory, executing a physical memory editing function corresponding to the physical memory editing operation through the system call to complete the corresponding physical memory editing operation, includes: In response to a memory reduction operation of the user on the physical memory, determining a memory reduction function corresponding to the memory reduction operation according to an operation name of the memory reduction operation in the system call; The memory reduction function is executed through the operation command in the system call to detect that the user passes in the physical address of the physical memory based on the memory reduction operation, and then obtain the available capacity of the physical memory according to the physical address of the physical memory; if it is not detected that the user passes in the physical address of the physical memory based on the memory reduction operation, the physical address is obtained according to the process number of the physical memory to obtain the available capacity of the physical memory; if the available capacity of the physical memory is not less than the reduced capacity indicated by the memory reduction operation, the available capacity of the physical memory is reduced according to the reduced capacity to complete the corresponding memory reduction operation.
7. The method according to claim 1, characterized in that If the physical memory editing operation is a memory detailed information operation, the responding to the user's physical memory editing operation on the physical memory, executing a physical memory editing function corresponding to the physical memory editing operation through the system call to complete the corresponding physical memory editing operation, includes: In response to a user's memory detailed information operation on the physical memory, determining a memory detailed information function corresponding to the memory detailed information operation according to an operation name of the memory detailed information operation in the system call; The memory detailed information function is executed through the operation command in the system call to detect that the user has passed in the physical address of the physical memory based on the memory detailed information operation, and then the available capacity of the physical memory is obtained according to the physical address of the physical memory; if the user has not passed in the physical address of the physical memory based on the memory detailed information operation, the physical address is obtained according to the process number of the physical memory to obtain the available capacity of the physical memory; a predefined temporary variable of the physical memory is obtained, and the physical address and the available capacity of the physical memory are stored in the temporary variable to obtain a target variable; the target variable is passed in a corresponding parameter pointer to release the target variable, and the corresponding memory detailed information operation is completed.
8. The method according to claim 1, characterized in that If the physical memory editing operation is a memory data insertion operation, the responding to the user's physical memory editing operation on the physical memory, executing a physical memory editing function corresponding to the physical memory editing operation through the system call to complete the corresponding physical memory editing operation, includes: In response to a user's memory data insertion operation on the physical memory, determining a memory data insertion function corresponding to the memory data insertion operation according to an operation name of the memory data insertion operation in the system call; The memory data insertion function is executed through the operation command in the system call to detect that the user passes the physical address of the physical memory based on the memory data insertion operation, and obtain the available capacity of the physical memory according to the physical address of the physical memory; if the user does not detect that the physical address of the physical memory is passed based on the memory data insertion operation, the physical address is obtained according to the process number of the physical memory to obtain the available capacity of the physical memory; if the available capacity of the physical memory is not less than the amount of memory data inserted as indicated by the memory data insertion operation; the memory input is inserted into the physical memory to complete the corresponding memory data insertion operation.
9. A physical memory data management system for a trusted operating system, characterized in that: Applicable to the trusted operating system, the trusted operating system includes a kernel space and a user space, and the system includes: A physical memory allocation unit is used to allocate a section of physical memory from the kernel space, obtain a virtual address of the physical memory, and map the virtual address of the physical memory to a memory page of the physical memory to determine a physical address of the physical memory; A mapping unit, configured to create a user virtual space in the user space, and map the physical memory to the user virtual space according to a page frame number corresponding to the memory page and a physical address of the physical memory; a system call generating unit, configured to generate a system call of the physical memory according to the operation information of the physical memory, the physical address of the physical memory, the memory size of the physical memory and a preset file path; The physical memory editing unit is used to respond to the user's physical memory editing operation on the physical memory, and execute the physical memory editing function corresponding to the physical memory editing operation through the system call to complete the corresponding physical memory editing operation.
10. The system according to claim 9, characterized in that If the physical memory editing operation is a memory allocation operation, in response to the user's physical memory editing operation on the physical memory, a physical memory editing unit that executes a physical memory editing function corresponding to the physical memory editing operation through the system call to complete the corresponding physical memory editing operation is specifically used for: In response to a memory allocation operation of the user on the physical memory, determining a memory allocation function corresponding to the memory allocation operation according to an operation name of the memory allocation operation in the system call; The memory allocation function is executed through the operation command in the system call, so that when the memory size of the requested memory indicated by the memory allocation operation is smaller than the memory size of the physical memory, the virtual address of the requested memory is mapped to the memory page of the requested memory; the memory page of the requested memory is converted into the physical address of the requested memory, and a memory management object of the requested memory is generated according to the virtual address of the requested memory, the physical address of the requested memory and the memory information structure generated based on the information of the requested memory, so as to complete the corresponding memory allocation operation.
Citation Information
Patent Citations
Memory control method and memory control device
CN105335306A
VMI-based file system fine-grained monitoring method
CN107391234A
Method, device and terminal for dynamically detecting simulator
CN110147329A
Network card testing method and device, computer equipment and computer readable storage medium
CN113849277A
Electronic system, operating method thereof, and operating method of memory device
US20230229493A1
