WO2024021995A1 - Memory access method and apparatus - Google Patents

Memory access method and apparatus Download PDF

Info

Publication number
WO2024021995A1
WO2024021995A1 PCT/CN2023/104015 CN2023104015W WO2024021995A1 WO 2024021995 A1 WO2024021995 A1 WO 2024021995A1 CN 2023104015 W CN2023104015 W CN 2023104015W WO 2024021995 A1 WO2024021995 A1 WO 2024021995A1
Authority
WO
WIPO (PCT)
Prior art keywords
address space
virtual address
processing component
page
label
Prior art date
Application number
PCT/CN2023/104015
Other languages
French (fr)
Chinese (zh)
Inventor
韦康
李海程
王楠
Original Assignee
华为技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 华为技术有限公司 filed Critical 华为技术有限公司
Publication of WO2024021995A1 publication Critical patent/WO2024021995A1/en

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/08Addressing or allocation; Relocation in hierarchically structured memory systems, e.g. virtual memory systems
    • G06F12/10Address translation
    • G06F12/109Address translation for multiple virtual address spaces, e.g. segmentation

Definitions

  • Embodiments of the present application relate to the field of computers, and in particular, to a memory access method and device.
  • the microkernel architecture is an operating system architecture that includes a microkernel and system services. Among them, the microkernel is used to implement the core functions of the operating system in the kernel state, such as tasks, threads, and kernel state memory management.
  • System services include multiple components, which are used to implement process management, file management, and user-mode memory management of the operating system in user mode.
  • the operating system usually uses a delayed loading mechanism for memory access: when allocating memory for a user's access request, it only allocates a virtual address space and does not allocate an actual physical address space. In this way, a page fault will be triggered when the operating system accesses the virtual address space.
  • the kernel of the operating system can detect the page fault exception and call the page fault exception handler (page fault handler) to allocate the physical address space corresponding to the virtual address space. Based on the allocation result, the memory access requester can access the physical address space to achieve memory access.
  • the microkernel in the kernel mode and lacks sufficient page fault exception handling information. It needs to be called in the user mode through a specific page fault exception handler in the system service (such as the user mode memory management service).
  • the page fault exception handler In this way, inter-process communication (IPC) is formed between different page fault exception handlers, causing the efficiency of memory access to be greatly affected.
  • IPC inter-process communication
  • This application provides a memory access method and device to solve the above problems.
  • the virtual address space is allocated a processing component label in advance to avoid inter-process communication between a specific page fault exception processing component and the target processing component, thereby improving the efficiency of memory access.
  • embodiments of the present application provide a memory access method.
  • the method includes: obtaining a first access request, which is used to indicate access to the first virtual address space; if a memory access request corresponding to the first virtual address space is detected.
  • First page missing exception obtain the processing component label of the first virtual address space; wherein, the processing component label of the first virtual address space is used to identify the first processing component corresponding to the first virtual address space; based on the first virtual address space
  • the processing component label instructs the first processing component to perform exception processing on the first page missing exception.
  • the first processing component performs exception processing on the first page missing exception, which may include allocating a physical address space for the first virtual address space, that is, the first After the exception caused by the page fault exception has been resolved, the requester of the first access request, such as the first memory access request component, can access the first virtual address space normally.
  • the target processing component can be directly instructed to handle the page missing exception based on the label for page missing exceptions that occur during memory access, thereby avoiding specific page missing exceptions.
  • the efficiency decrease caused by the inter-process interaction between the exception handling component and the target processing component improves the memory access efficiency.
  • the processing component label can directly indicate the exception handling component corresponding to the virtual address space. Compared with the fixed division of the virtual address space range, it can ensure the flexible use of the virtual address space and avoid application scenarios caused by the fixed division of the virtual address space range. Not compatible.
  • FIG. 9 is an exemplary schematic diagram of a scenario of adding an exception handling component label provided by the embodiment of the present application.
  • the first virtual address space may be virtual address space 1, and accordingly, the processing component label may be label 2.
  • FIG. 15 is a schematic diagram of a processing scenario illustrating an exemplary page fault exception processing method. As shown in Figure 15, if the processing component label of the first virtual address space is a file type label, the first processing component can provide file memory page fault exception processing services.
  • obtaining a processing component label of the first virtual address space includes:
  • the processing component label is included in the target page table entry of the page table of the first virtual address space; the page table is when the first virtual address space is pre-allocated.
  • the target page table entry is a page table entry in the page table used to record the physical address space information corresponding to the first virtual address space.
  • the present application creates a page table before handling the page fault exception, for example, when allocating virtual memory space. In this way, this application can use the page table to record the exception handler label, thereby using the exception handler label to handle page missing exceptions.
  • the exception handler label can be added to the virtual address space without introducing a complex data structure.
  • FIG. 10c is a structural diagram of a page table for recording tags provided by an embodiment of the present application
  • FIG. 10d is another structural diagram of a page table for recording tags provided by an embodiment of the present application.
  • the first virtual address space can be the virtual address space VA
  • the page table of the first virtual address space can be the Level 0 Page Table in Figure 10c; or the first virtual address space.
  • the page table may be a multi-level page table as shown in Figure 10d.
  • the target page table entry is the page table entry where the exception handler label Lablem is located in the page table shown in Figure 10c or Figure 10d.
  • the processing result of the first processing component may include updating the page table; wherein updating the page table is for the first processing component to allocate a physical address space to the first virtual address space. , and the target page table entry is updated based on the physical address space; thus, the first memory access request component can access the first virtual address space based on the updated page table.
  • the first processing component after allocating a physical address space to the first virtual address space, the first processing component updates the target page table entry based on the physical address space to obtain an updated page table, thereby ensuring that the page missing exception is resolved, and Access to the first virtual address space based on updating the page table.
  • FIG. 10a is an exemplary structural diagram of a page table when mapping has been established
  • FIG. 10b is an exemplary structural diagram of a page table when mapping has been established.
  • the update page table may be the page table shown in Figure 10c or Figure 10d.
  • the processing component label is generated according to the memory type of the first virtual address space and the component identifier of the processing component corresponding to the memory type.
  • the processing component label is generated by using the memory type of the first virtual address space and the component identification of the corresponding processing component, which can ensure the accuracy of the processing component identified by the processing component label.
  • the method in response to the processing feedback information of the first processing component, after accessing the first virtual address space, the method further includes:
  • the second access request is used to indicate access to the second virtual address space
  • Designating a processing component to handle the second page missing exception may include allocating a physical address space for the second virtual address space. That is, the exception caused by the second page missing exception has been resolved, and the requester of the second access request, such as the second The memory access request component can normally access the second virtual address space.
  • the processing component label may include: the processing component label does not exist in the page table, or the format of the processing component label does not comply with the preset label format (such as the label is "empty" or the label does not contain the processing component). logo, etc.).
  • the processing component label does not meet the preset conditions, it means that the acquisition of the processing component label fails.
  • the designated processing component is an anonymous page processing component; accordingly, if the memory type of the first virtual address space is the anonymous page type, allocate The processing component label of is empty.
  • the anonymous page processing component is used as the designated processing component, so that there is no need to add a processing component label to the first virtual address space of the anonymous page type to streamline the missing information. Page exception handling process and reduce storage space costs, thereby further improving the efficiency of memory access
  • the page fault exception handling label may not be added to the physical address space page table entry corresponding to the virtual address space of the anonymous memory type.
  • the physical address space page table entry may be empty, or may be "unlabeled" in Figure 15.
  • instructing the first processing component to perform exception handling on the first page fault exception based on the processing component tag of the first virtual address space includes:
  • the target processing component information is determined through the pre-established corresponding relationship between tags and processing component information, so that the first processing component can be timely and accurately instructed to perform exception processing through the target processing component information.
  • the convenience of maintaining the corresponding relationship between the first processing component and the processing component label can be improved. For example, when the target processing component information is updated, there is no need to reassign the processing component label, and the corresponding relationship can be updated.
  • the method further includes:
  • key-value pairs are generated through at least one processing component tag and processing component information corresponding to at least one processing component tag, so as to create a page fault exception handling table that records the key-value pairs.
  • the corresponding relationship between the pre-established tags and the processing component information is in the form of key-value pairs, making the query faster and further improving efficiency.
  • FIG. 13 is an exemplary structural diagram of a page fault exception handling table.
  • the page fault exception handling table can be the table in Figure 13, the processing component label is label label1, and the corresponding processing component information is entry fault handler entry 1.
  • a memory access device which includes:
  • a request acquisition module configured to acquire a first access request, where the first access request is used to indicate access to the first virtual address space
  • the label acquisition module is configured to obtain a processing component label of the first virtual address space if a first page fault exception corresponding to the first virtual address space is detected; wherein the processing component label of the first virtual address space is used to identify the corresponding the first processing component in the first virtual address space;
  • the exception handling module is configured to instruct the first processing component to perform exception handling on the first page fault exception based on the processing component label of the first virtual address space.
  • the first processing component performs exception processing on the first page missing exception, which may include allocating a physical address space for the first virtual address space. That is, the exception caused by the first page missing exception has been resolved, and the requester of the first access request, for example, A memory access request component can normally access the first virtual address space.
  • the tag acquisition module is further configured as:
  • the processing component label is included in the target page table entry of the page table of the first virtual address space (belonging to, or located in, do not write it as an action);
  • the page table is established when the first virtual address space is pre-allocated; the target page table entry is a page table entry in the page table used to record the physical address space information corresponding to the first virtual address space.
  • the processing result of the first processing component may include updating the page table; wherein updating the page table means that the first processing component allocates a physical address space to the first virtual address space. , and is obtained by updating the target page table entry based on the physical address space; thus, the first memory access request component can access the first virtual address space based on the updated page table.
  • the processing component label is generated according to the memory type of the first virtual address space and the component identifier of the processing component corresponding to the memory type.
  • the request acquisition module is further configured to obtain a second access request, and the second access request is used to indicate access to the second virtual address space;
  • the label acquisition module is also configured to obtain a processing component label of the second virtual address space if a second page fault exception corresponding to the second virtual address space is detected; wherein the processing component label of the second virtual address space is used to identify Corresponding to the second processing component of the second virtual address space; detecting whether the processing component label of the second virtual address space meets the preset condition;
  • the exception handling module is also configured to instruct the designated processing component to perform exception handling on the second page fault exception if it is not satisfied.
  • Designating a processing component to handle the second page missing exception may include allocating a physical address space for the second virtual address space. That is, the exception caused by the second page missing exception has been resolved, and the requester of the second access request, such as the second The memory access request component can normally access the second virtual address space.
  • the designated processing component is an anonymous page processing component; accordingly, if the memory type of the first virtual address space is the anonymous page type, allocate The processing component label of is empty.
  • the exception handling module is further configured as:
  • the device further includes:
  • the registration module is configured to respond to the pre-assigned at least one processing component tag, generate a key-value pair based on the at least one processing component tag and the processing component information respectively corresponding to the at least one processing component tag; create a record key-value pair
  • the page missing exception handling table obtains the corresponding relationship between pre-established labels and processing component information.
  • the second aspect and any implementation manner of the second aspect respectively correspond to the first aspect and any implementation manner of the first aspect.
  • the technical effects corresponding to the second aspect and any implementation manner of the second aspect may be referred to the technical effects corresponding to the above-mentioned first aspect and any implementation manner of the first aspect, which will not be described again here.
  • embodiments of the present application provide an electronic device, including: a processor and a transceiver; a memory for storing one or more programs; when the one or more programs are processed by the one or more processors Execution causes the one or more processors to implement the method in the first aspect or any possible implementation manner of the first aspect.
  • embodiments of the present application provide a computer-readable storage medium, including a computer program, which is characterized in that when the computer program is run on a computer system, the computer system is caused to execute the first aspect or the first aspect. method in any possible implementation of the aspect.
  • embodiments of the present application provide a chip, including one or more interface circuits and one or more processors; the interface circuit is used to receive signals from a memory of an electronic device and send the data to the processor.
  • the signal includes a computer instruction stored in a memory; when the processor executes the computer instruction, the electronic device is caused to perform any of the possible tasks of the second to third aspects or the second to third aspects.
  • embodiments of the present application provide a computer program, which includes instructions for executing the method in the first aspect or any possible implementation of the first aspect.
  • Figure 1 is a schematic structural diagram of an exemplary microkernel architecture
  • Figure 2 is a schematic diagram of multiple page fault exception handling services exemplarily shown
  • Figure 3 is a schematic flow chart of an exemplary memory access method
  • Figure 4 is a schematic diagram of a processing scenario illustrating an exemplary page missing exception processing method
  • Figure 5 is a structural diagram of an exemplary page fault exception handling architecture
  • Figure 6 is a structural diagram of an exemplary page fault exception handling architecture
  • Figure 7 is an exemplary structural diagram of the electronic device 600 provided by the embodiment of the present application.
  • Figure 8 is an exemplary flow chart of adding an exception handling component label provided by the embodiment of the present application.
  • Figure 9 is an exemplary schematic diagram of a scenario for adding an exception handling component label provided by an embodiment of the present application.
  • Figure 10a is an exemplary structural diagram of a page table when mapping has been established
  • Figure 10b is an exemplary structural diagram of the page table when mapping has been established
  • Figure 10c is a structural diagram of a page table for recording tags provided by an embodiment of the present application.
  • Figure 10d is another structural diagram of a page table for recording tags provided by an embodiment of the present application.
  • Figure 11 is a structural diagram of an exemplary page fault exception handling architecture
  • Figure 12 is an exemplary flow chart of the memory access method provided by the embodiment of the present application.
  • Figure 13 is an exemplary structural diagram of a page fault exception handling table
  • Figure 14a is a structural diagram of an exemplary page fault exception handling architecture
  • Figure 14b is a structural diagram of an exemplary page fault exception handling architecture
  • Figure 15 is a schematic diagram of a processing scenario illustrating an exemplary page fault exception handling method
  • Figure 16 is an exemplary schematic block diagram of a device 1600 provided by an embodiment of the present application.
  • a and/or B can mean: A exists alone, A and B exist simultaneously, and they exist alone. B these three situations.
  • first and second in the description and claims of the embodiments of this application are used to distinguish different objects, rather than to describe a specific order of objects.
  • first target object, the second target object, etc. are used to distinguish different target objects, rather than to describe a specific order of the target objects.
  • multiple processing units refer to two or more processing units; multiple systems refer to two or more systems.
  • multiple processing units refer to two or more processing units; multiple systems refer to two or more systems.
  • FIG. 1 is a schematic structural diagram of an exemplary microkernel architecture.
  • the microkernel architecture includes: system service layer and kernel layer, which uses a delay processing mechanism for memory access.
  • the microkernel performs memory access, it triggers a page missing exception of the delay processing mechanism.
  • the page missing exception means that the virtual address space requested to be accessed does not have a corresponding physical address space.
  • the microkernel architecture's handling of page missing exceptions includes the following steps:
  • the microkernel sends page fault information to the memory management service.
  • the memory management service refers to the memory management service running in the kernel state.
  • the page fault information may include: the virtual address space requested by the memory access that triggers the page fault exception, that is, the virtual memory, the access request identifier and other information based on which the memory management service allocates the physical address space.
  • the virtual address space refers to the address space set separately by the operating system for each process to ensure the isolation of the process. Virtual address space can also be called virtual memory, which is a logical concept of memory.
  • Physical address space corresponds to the actual memory resources.
  • the operating system associates the virtual address space with the physical address space to achieve actual access to memory resources, thereby achieving more flexible access and management of actual memory through the logical concept of virtual address space.
  • the memory management service forwards the page fault information to the page fault exception handling service.
  • This memory management service runs in kernel mode and can serve as a specific page fault exception handler.
  • the memory management service can determine the page missing exception handler based on the page missing information, thereby forwarding the page missing information to the page missing exception handling service.
  • different system services such as memory management services, file management services, driver management services, etc.
  • access requests for different system services access different virtual address spaces.
  • FIG. 2 is a schematic diagram illustrating multiple page fault exception handling services.
  • the operating system can divide the virtual address space into unfixed divisions: anonymous memory, IO memory, file memory and IO memory, etc. Unfixed partitioning can result in IO memory corresponding to two different virtual address space ranges.
  • the non-fixed division can be carried out according to the usage requirements of the virtual address space, and can be flexibly changed according to the usage requirements.
  • the microkernel can capture the page fault exception and the page fault information, and the memory management service can determine the exception handling service, that is, the exception handler, to handle the page fault exception in different address spaces based on the page fault information forwarded by the microkernel.
  • anonymous memory page fault exception processing services for anonymous memory (such as kernel mode or user mode memory management services), file memory page fault exception processing services for file memory (such as file management services), IO memory page fault exception processing services Processing services (such as driver management services).
  • IPC inter-process communication
  • Memory access has certain requirements for efficiency and is a performance-sensitive path. IPC has a large negative impact on performance-sensitive paths, resulting in a decrease in memory access efficiency.
  • FIG. 3 is a schematic flow chart of a memory access method.
  • memory access applied to the microkernel architecture shown in Figure 1 can include the following steps:
  • the memory management service allocates a virtual address space.
  • the memory management service can allocate a virtual address space when receiving a memory allocation instruction sent by the microkernel.
  • the memory allocation instruction is generated when the microkernel obtains (such as detects and receives) a memory access request from a memory access requester (such as a memory access request component) and sends it to the memory management service.
  • the memory allocation instruction may include the identification of the access request, information about the target object requested to be accessed, etc.
  • the microkernel detects a page fault exception in the virtual address space.
  • the memory requester accesses the virtual address space.
  • the microkernel captures the page fault exception caused by the memory requester's access to the virtual address space, that is, it detects the page fault exception in the virtual address space.
  • the microkernel sends page fault information to the memory management service.
  • the microkernel When the microkernel detects a page missing exception in the virtual address space, it sends page missing information to the memory management service.
  • the memory management service sends the page fault information to the page fault exception handling service.
  • S303 to S304 in the embodiment of FIG. 3 are the same steps as S101 to S102 in the embodiment of FIG. 1.
  • S101 to S102 in the embodiment of FIG. 1 please refer to the description of the embodiment of FIG. 1 and will not be described again here.
  • S305 The page fault exception handling service allocates a physical address space based on the page fault information.
  • the page fault exception handling service After the page fault exception handling service receives the page fault information sent by the memory management service, it can allocate the physical address space based on the page fault information. For example, the page fault exception handling service can select one physical page from multiple physical pages obtained by dividing the physical storage space (such as memory) according to the page fault information, and determine it as the allocated physical address space. Alternatively, the page missing exception handling service can copy the data on the physical storage space (such as a disk) to a certain physical page in the memory through the file management module and the driver module based on the page missing information, and then determine the physical page as the allocated The physical address space is. For specific physical address space allocation methods, please refer to relevant existing technologies and will not be described again here.
  • the page fault exception handling service creates a page table that records the mapping relationship between the virtual address space and the physical address space based on the allocation result.
  • the page fault exception handling service After the page fault exception handling service allocates the physical address space, it can create a page table that records the mapping relationship between the virtual address space and the physical address space based on the allocation result, that is, the allocated physical address space.
  • the page table is a data structure, and the recorded mapping relationship can realize the association between the virtual address space and the physical address space.
  • the page fault exception handling service After the page fault exception handling service creates the page table, it can store the page table in a storage space that the microkernel can access, for example, in memory.
  • the page fault exception handling service can send exception handling feedback to the microkernel to inform the microkernel that the page fault exception processing is completed.
  • the page fault exception handling service does not need to inform the microkernel that the page fault exception processing is completed, and there is no need to send exception handling feedback to the microkernel.
  • the page fault exception handling service completes the page fault exception processing, which may include: the page fault exception processing service allocates a physical address space to the virtual address space where the page fault exception occurs. In this way, the memory access requester can access the virtual address space according to the page table.
  • the memory access requester accesses the virtual address space according to the page table, which may include: the memory access requester determines the target physical address space corresponding to the virtual address space according to the mapping relationship recorded in the page table, and accesses the target physical address space. address space.
  • the access method of the memory access requester to the target physical address space can be determined according to the target access request, which may specifically include: reading the target resource in the target physical address space, or writing the target resource into the target physical address space.
  • the target access request refers to the access request corresponding to the above-mentioned virtual address space, and the target resource can be determined based on the resource identifier and other information indicated by the target access request.
  • FIG. 4 is a schematic diagram of a processing scenario illustrating an exemplary page fault exception processing method.
  • the operating system performs a fixed division of the virtual address space, and the resulting anonymous memory, file memory and IO memory respectively correspond to unique virtual address space ranges.
  • the IO memory under the unfixed division in Figure 2 can correspond to two different virtual address space ranges, while the fixed division in Figure 4
  • the lower IO memory corresponds to a unique virtual address space range. Different virtual address space ranges correspond to different page fault exception handling services.
  • the virtual address space range of anonymous memory corresponds to the anonymous memory page missing exception handling service
  • the virtual address space range of file memory corresponds to the file memory page missing exception handling service
  • the virtual address space range of IO memory corresponds to the IO memory page missing exception handling service.
  • the virtual address space is fixedly divided, resulting in the inability to flexibly divide it according to usage requirements. Such fixed restrictions can also easily lead to limited applicable scenarios.
  • POSIX Portable Operating System Interface of UNIX
  • the virtual address ranges of file memory and IO memory are limited, causing the embodiment in Figure 4 to be incompatible with POSIX.
  • the embodiment of this application provides a memory access method.
  • the microkernel when the microkernel detects a page fault exception in the virtual address space corresponding to the access request, it can directly determine the page fault exception processing service based on the exception handling component label of the virtual address space, thereby directly communicating with the page fault exception processing service Interaction to achieve memory access. In this way, the inter-process interaction between the specific exception handler and the page fault exception handler can be avoided, thereby improving the efficiency of memory access.
  • the processing component tag added according to the memory type of the virtual address space can directly indicate the page fault exception processing component of the memory type. Compared with the fixed division of the virtual address space range according to the memory type, the flexibility of the virtual address space can be guaranteed. Use to avoid incompatibility problems in application scenarios caused by fixed division of virtual address space ranges.
  • the memory access method in this application is also applicable to wireless radio frequency remote units (RRUs), smart TVs, laptop computers, and desktop computers.
  • RRUs wireless radio frequency remote units
  • Electronic devices such as small computers, handheld computers (such as tablet computers, smart phones, etc.), smart wearable devices (such as smart bracelets, smart watches, smart rings, etc.).
  • FIG. 5 is a structural diagram of an exemplary page fault exception handling architecture.
  • the electronic device may include an operating system with a microkernel architecture, which specifically may include a system service layer and a kernel layer.
  • page fault exception processing is performed through the microkernel of the kernel layer and the page fault exception processing service of the system service layer to implement memory access.
  • the structures illustrated in the embodiments of the present application do not constitute specific limitations to the above-mentioned electronic devices.
  • the above-mentioned electronic device may include more or fewer components than shown in the figures, or some components may be combined, some components may be separated, or some components may be arranged differently.
  • the components illustrated may be implemented in hardware, software, or a combination of software and hardware.
  • FIG. 6 is a structural diagram illustrating a page fault exception handling architecture.
  • the operating system in the above-mentioned electronic device may include a microkernel architecture with multiple operating domains.
  • the architecture shown in Figure 6 is similar to Figure 5, except that the number of operating domains is n, and n is greater than 1.
  • running domain D1, running domain D2,..., and running domain Dn Each runtime domain is used to run system services belonging to different processes.
  • the page fault exception handling service may include multiple processes running in the running domain D1 to the running domain Dn. That is to say, the page missing exception handling service may run in each running domain, and different running domains are independent of each other.
  • the microkernel performs the same processing and interaction on each operating domain.
  • the operating systems of multiple operating domains provided in this embodiment are generally used in scenarios where resource isolation is required.
  • the control subsystem and entertainment subsystem have isolation requirements.
  • the car OS can have the architecture shown in Figure 6.
  • FIG. 7 is an exemplary structural diagram of an electronic device 600 provided by an embodiment of the present application. As shown in FIG. 7 , the electronic device 600 may be an electronic device belonging to the architecture shown in FIG. 5 or FIG. 6 .
  • the electronic device 600 shown in FIG. 7 is only an example, and the electronic device 600 may have more or fewer components than shown in the figure, may combine two or more components, or may Available in different component configurations.
  • the various components shown in Figure 7 may be implemented in hardware, software, or a combination of hardware and software including one or more signal processing and/or application specific integrated circuits.
  • the electronic device 600 may include: a processor 610, an external memory interface 620, an internal memory 621, a universal serial bus (USB) interface 630, a charging management module 640, a power management module 641, a battery 642, an antenna 1, an antenna 2.
  • SIM subscriber identification module
  • the sensor module 680 may include a pressure sensor 680A, a gyro sensor 680B, an air pressure sensor 680C, a magnetic sensor 680D, an acceleration sensor 680E, a distance sensor 680F, a proximity light sensor 680G, a fingerprint sensor 680H, a temperature sensor 680J, a touch sensor 680K, and ambient light.
  • the processor 610 may include one or more processing units.
  • the processor 610 may include an application processor (application processor, AP), a modem processor, a graphics processing unit (GPU), and an image signal processor. (image signal processor, ISP), controller, memory, video codec, digital signal processor (digital signal processor, DSP), baseband processor, and/or neural-network processing unit (NPU) wait.
  • application processor application processor, AP
  • modem processor graphics processing unit
  • GPU graphics processing unit
  • image signal processor image signal processor
  • controller memory
  • video codec digital signal processor
  • DSP digital signal processor
  • NPU neural-network processing unit
  • different processing units can be independent devices or integrated in one or more processors.
  • the controller may be the nerve center and command center of the electronic device 600 .
  • the controller can generate operation control signals based on the instruction operation code and timing signals to complete the control of fetching and executing instructions.
  • the processor 610 may also be provided with a memory for storing instructions and data.
  • the memory in processor 610 is cache memory. This memory may hold instructions or data that have been recently used or recycled by processor 610 . If processor 610 needs to use the instructions or data again, it can be called directly from the memory. Repeated access is avoided and the waiting time of the processor 610 is reduced, thus improving the efficiency of the system.
  • processor 610 may include one or more interfaces.
  • Interfaces may include integrated circuit (inter-integrated circuit, I2C) interface, integrated circuit built-in audio (inter-integrated circuit sound, I2S) interface, pulse code modulation (pulse code modulation, PCM) interface, universal asynchronous receiver and transmitter (universal asynchronous receiver/transmitter (UART) interface, mobile industry processor interface (MIPI), general-purpose input/output (GPIO) interface, subscriber identity module (SIM) interface, and /or universal serial bus (USB) interface, etc.
  • I2C integrated circuit
  • I2S integrated circuit built-in audio
  • PCM pulse code modulation
  • UART universal asynchronous receiver and transmitter
  • MIPI mobile industry processor interface
  • GPIO general-purpose input/output
  • SIM subscriber identity module
  • USB universal serial bus
  • the I2C interface is a bidirectional synchronous serial bus, including a serial data line (SDA) and a serial clock line (derail clock line, SCL).
  • processor 610 may include multiple sets of I2C buses.
  • the processor 610 can separately couple the touch sensor 680K, charger, flash, camera 693, etc. through different I2C bus interfaces.
  • the processor 610 can be coupled to the touch sensor 580K through an I2C interface, so that the processor 610 and the touch sensor 680K communicate through the I2C bus interface to implement the touch function of the electronic device 600 .
  • the I2S interface can be used for audio communication.
  • processor 610 may include multiple sets of I2S buses.
  • the processor 610 can be coupled with the audio module 670 through the I2S bus to implement communication between the processor 610 and the audio module 670.
  • the audio module 670 can transmit audio signals to the wireless communication module 660 through the I2S interface to implement the function of answering calls through a Bluetooth headset.
  • the PCM interface can also be used for audio communications to sample, quantize and encode analog signals.
  • the audio module 670 and the wireless communication module 660 may be coupled through a PCM bus interface.
  • the audio module 670 can also transmit audio signals to the wireless communication module 660 through the PCM interface to implement the function of answering calls through a Bluetooth headset. Both the I2S interface and the PCM interface can be used for audio communication.
  • the UART interface is a universal serial data bus used for asynchronous communication.
  • the bus can be a bidirectional communication bus. It converts the data to be transmitted between serial communication and parallel communication.
  • a UART interface is typically used to connect the processor 610 and the wireless communication module 660 .
  • the processor 610 communicates with the Bluetooth module in the wireless communication module 660 through the UART interface to implement the Bluetooth function.
  • the audio module 670 can transmit audio signals to the wireless communication module 660 through the UART interface to implement the function of playing music through the Bluetooth headset.
  • the MIPI interface can be used to connect the processor 610 with peripheral devices such as the display screen 694 and the camera 693 .
  • MIPI interfaces include camera serial interface (CSI), display serial interface (DSI), etc.
  • the processor 610 and the camera 693 communicate through the CSI interface to implement the shooting function of the electronic device 600 .
  • the processor 610 and the display screen 694 communicate through the DSI interface to implement the display function of the electronic device 600 .
  • the GPIO interface can be configured through software.
  • the GPIO interface can be configured as a control signal or as a data signal.
  • the GPIO interface can be used to connect the processor 610 with the camera 693, display screen 694, wireless communication module 660, audio module 670, sensor module 680, etc.
  • the GPIO interface can also be configured as an I2C interface, I2S interface, UART interface, MIPI Interface etc.
  • the USB interface 630 is an interface that complies with the USB standard specifications. Specifically, it can be a Mini USB interface, a Micro USB interface, a USB Type C interface, etc.
  • the USB interface 530 can be used to connect a charger to charge the electronic device 600, and can also be used to transmit data between the electronic device 600 and peripheral devices. It can also be used to connect headphones to play audio through them. This interface can also be used to connect other electronic devices, such as AR devices, etc.
  • the interface connection relationship between the modules illustrated in the embodiment of the present application is only a schematic illustration and does not constitute a structural limitation of the electronic device 600 .
  • the electronic device 600 may also adopt different interface connection methods in the above embodiments, or a combination of multiple interface connection methods.
  • the charge management module 640 is used to receive charging input from the charger.
  • the charger can be a wireless charger or a wired charger.
  • the charging management module 640 may receive charging input from the wired charger through the USB interface 630 .
  • the charging management module 640 may receive wireless charging input through the wireless charging coil of the electronic device 600 . While charging the battery 642, the charging management module 640 can also provide power to the electronic device through the power management module 641.
  • the power management module 641 is used to connect the battery 642, the charging management module 640 and the processor 610.
  • the power management module 641 receives input from the battery 642 and/or the charging management module 640, and supplies power to the processor 610, internal memory 621, external memory, display screen 694, camera 693, wireless communication module 660, etc.
  • the power management module 641 can also be used to detect battery capacity, battery cycle times, battery health status (leakage, impedance) and other parameters.
  • the power management module 641 may also be provided in the processor 610.
  • the power management module 641 and the charging management module 640 can also be provided in the same device.
  • the wireless communication function of the electronic device 600 can be implemented through the antenna 1, the antenna 2, the mobile communication module 650, the wireless communication module 660, the modem processor and the baseband processor.
  • Antenna 1 and Antenna 2 are used to transmit and receive electromagnetic wave signals.
  • Each antenna in electronic device 600 may be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve antenna utilization. For example: Antenna 1 can be reused as a diversity antenna for a wireless LAN. In other embodiments, antennas may be used in conjunction with tuning switches.
  • the mobile communication module 650 can provide wireless communication solutions including 2G/3G/4G/5G applied to the electronic device 600 .
  • the mobile communication module 650 may include at least one filter, switch, power amplifier, low noise amplifier (LNA), etc.
  • the mobile communication module 650 can receive electromagnetic waves through the antenna 1, perform filtering, amplification and other processing on the received electromagnetic waves, and transmit them to the modem processor for demodulation.
  • the mobile communication module 650 can also amplify the signal modulated by the modem processor and convert it into electromagnetic waves through the antenna 1 for radiation.
  • at least part of the functional modules of the mobile communication module 650 may be disposed in the processor 610 .
  • at least part of the functional modules of the mobile communication module 650 and at least part of the modules of the processor 610 may be provided in the same device.
  • a modem processor may include a modulator and a demodulator.
  • the modulator is used to modulate the low-frequency baseband signal to be sent into a medium-high frequency signal.
  • the demodulator is used to demodulate the received electromagnetic wave signal into a low-frequency baseband signal.
  • the demodulator then transmits the demodulated low-frequency baseband signal to the baseband processor for processing.
  • the application processor outputs sound signals through audio devices (not limited to speaker 670A, receiver 670B, etc.), or displays images or videos through display screen 694.
  • the modem processor may be a stand-alone device.
  • the modem processor may be independent of the processor 610 and may be provided in the same device as the mobile communication module 650 or other functional modules.
  • the wireless communication module 660 can provide applications on the electronic device 600 including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) network), Bluetooth (bluetooth, BT), and global navigation satellites.
  • WLAN wireless local area networks
  • System global navigation satellite system, GNSS
  • frequency modulation frequency modulation, FM
  • near field communication technology near field communication, NFC
  • infrared technology infrared, IR
  • the wireless communication module 660 may be one or more devices integrating at least one communication processing module.
  • the wireless communication module 660 receives electromagnetic waves through the antenna 2, frequency modulates and filters the electromagnetic wave signals, and sends the processed signals to the processor 610.
  • the wireless communication module 660 can also receive the signal to be sent from the processor 610, frequency modulate it, amplify it, and convert it into electromagnetic waves through the antenna 2 for radiation.
  • the antenna 1 of the electronic device 600 is coupled to the mobile communication module 650, and the antenna 2 is coupled to the wireless communication module 660, so that the electronic device 600 can communicate with the network and other devices through wireless communication technology.
  • the wireless communication technology may include global system for mobile communications (GSM), general packet radio service (GPRS), code division multiple access (CDMA), broadband code division multiple access (wideband code division multiple access, WCDMA), time-division code division multiple access (TD-SCDMA), long term evolution (LTE), BT, GNSS, WLAN, NFC, FM, and /or IR technology, etc.
  • the GNSS may include global positioning system (GPS), global navigation satellite system (GLONASS), Beidou navigation satellite system (BDS), quasi-zenith satellite system (quasi -zenith satellite system (QZSS) and/or satellite based augmentation systems (SBAS).
  • GPS global positioning system
  • GLONASS global navigation satellite system
  • BDS Beidou navigation satellite system
  • QZSS quasi-zenith satellite system
  • SBAS satellite based augmentation systems
  • the electronic device 600 implements display functions through a GPU, a display screen 694, an application processor, and the like.
  • the GPU is an image processing microprocessor and is connected to the display screen 694 and the application processor. GPUs are used to perform mathematical and geometric calculations for graphics rendering.
  • Processor 610 may include one or more GPUs that execute program instructions to generate or alter display information.
  • the display screen 694 is used to display images, videos, etc.
  • Display 694 includes a display panel.
  • the display panel can use a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active matrix organic light emitting diode or an active matrix organic light emitting diode (active-matrix organic light emitting diode).
  • LCD liquid crystal display
  • OLED organic light-emitting diode
  • AMOLED organic light-emitting diode
  • FLED flexible light-emitting diode
  • Miniled MicroLed, Micro-oLed, quantum dot light emitting diode (QLED), etc.
  • the electronic device 600 may include 1 or N display screens 694, where N is a positive integer greater than 1.
  • the electronic device 600 can implement the shooting function through an ISP, a camera 693, a video codec, a GPU, a display screen 694, and an application processor.
  • the ISP is used to process the data fed back by the camera 693. For example, when taking a photo, the shutter is opened, the light is transmitted to the camera sensor through the lens, the optical signal is converted into an electrical signal, and the camera sensor passes the electrical signal to the ISP for processing, and converts it into an image visible to the naked eye. ISP can also perform algorithm optimization on image noise, brightness, and skin color. ISP can also optimize the exposure, color temperature and other parameters of the shooting scene. In some embodiments, the ISP may be provided in camera 693.
  • Camera 693 is used to capture still images or video.
  • the object passes through the lens to produce an optical image that is projected onto the photosensitive element.
  • the photosensitive element can be a charge coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor.
  • CMOS complementary metal-oxide-semiconductor
  • the photosensitive element converts the optical signal into an electrical signal, and then passes the electrical signal to the ISP to convert it into a digital image signal.
  • ISP outputs digital image signals to DSP for processing.
  • DSP converts digital image signals into standard RGB, YUV and other format image signals.
  • the electronic device 600 may include 1 or N cameras 693, where N is a positive integer greater than 1.
  • Digital signal processors are used to process digital signals. In addition to digital image signals, they can also process other digital signals. For example, when the electronic device 600 selects a frequency point, the digital signal processor is used to perform Fourier transform on the frequency point energy.
  • Video codecs are used to compress or decompress digital video.
  • Electronic device 600 may support one or more video codecs. In this way, the electronic device 600 can play or record videos in multiple encoding formats, such as: moving picture experts group (MPEG) 1, MPEG2, MPEG3, MPEG4, etc.
  • MPEG moving picture experts group
  • MPEG2 MPEG2, MPEG3, MPEG4, etc.
  • NPU is a neural network (NN) computing processor.
  • NN neural network
  • Intelligent cognitive applications of the electronic device 600 can be implemented through the NPU, such as image recognition, face recognition, speech recognition, text understanding, etc.
  • the external memory interface 620 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 600.
  • the external memory card communicates with the processor 610 through the external memory interface 620 to implement the data storage function. Such as saving music, videos, etc. files in external memory card.
  • Internal memory 621 may be used to store computer executable program code, which includes instructions.
  • the processor 610 executes instructions stored in the internal memory 621 to execute various functional applications and data processing of the electronic device 600 .
  • the internal memory 621 may include a program storage area and a data storage area. Among them, the stored program area can store an operating system, at least one application program required for a function (such as a sound playback function, an image playback function, etc.).
  • the storage data area may store data created during use of the electronic device 600 (such as audio data, phone book, etc.).
  • the internal memory 621 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, universal flash storage (UFS), etc.
  • the electronic device 600 can implement audio functions through the audio module 670, the speaker 670A, the receiver 670B, the microphone 670C, the headphone interface 670D, and the application processor. Such as music playback, recording, etc.
  • the audio module 670 is used to convert digital audio information into analog audio signal output, and is also used to convert analog audio input into digital audio signals. Audio module 670 may also be used to encode and decode audio signals. In some embodiments, the audio module 670 may be disposed in the processor 610, or some functional modules of the audio module 670 may be disposed in the processor 610.
  • FIG. 8 is a schematic flowchart of adding an exception handling component label according to an embodiment of the present application.
  • an exception handling component label is added to the virtual address space in advance to respond to page missing exceptions in subsequent memory accesses and implement memory access.
  • this process can be applied to memory management services of electronic devices, which may include but is not limited to the following steps:
  • FIG. 9 is an exemplary schematic diagram of a scenario of adding an exception handling component label provided by an embodiment of the present application.
  • the memory management service in this embodiment may include but is not limited to a virtual memory allocation module (such as Virtual memory allocator), a label generation module (such as fault handler label gen), and a label addition module (such as PTE marker).
  • the memory management service calls the virtual memory allocation module to execute S901 and apply for a virtual address space to achieve the effect of allocating the virtual address space.
  • the overall virtual address space includes virtual address space 0 and virtual address space 1.
  • the memory management service calls the virtual memory allocation module to apply for virtual address space 1 from the operating system, thereby allocating the virtual address space to the target access request.
  • the target access request is the access request that triggers the virtual address space allocation, that is, the access request for the memory access performed by this application.
  • the memory management service calls the label generation module to perform S902 to generate a label, and then calls the label adding module to perform S903 to add the label.
  • the label generated by the memory management service calling the label generation module is label 2.
  • This label 2 can be added to the data structure used to record the exception handler label (such as the label "PTE").
  • the data structure can be, for example, a table.
  • the exception handler label recorded in this table is label 1, for example. It can be understood that the execution steps of S902 and S901 are not limited, and S902 can also be executed before S901, or S902 can be executed at the same time as S901. S902 and S901 can be executed before S903.
  • the way in which the label generation module generates the exception handler label may include: the label generation module obtains the component identification of the page missing exception handling component, which is the process identification (such as service id), based on This identifier determines the exception handler label to generate a page missing exception handler label with a uniform format for easy management.
  • the label generation module may determine the component identifier as the exception handler label.
  • the exception handler label may be the label "file fault handler label".
  • the label generation module can also obtain the domain identification (such as domain id) of the operating domain targeted by the target access request, and combine the domain identification and The above component identifiers are fused, for example, spliced, to obtain the exception handler label.
  • the exception handler label can be the label "Running domain D1 file fault handler label (D1 file fault handler label)", or the label “Running domain D1 file fault handler label” Exception handling component label (domain1 file fault handler label)".
  • the above page fault exception handler tag can be used not only to determine the page fault exception handling service, but also to perform permission verification.
  • the permission refers to establishing a mapping between the virtual address space and the physical address space. relationship permissions.
  • the IO memory page fault exception handling service (IO manager) initiates the establishment of an unauthorized mapping relationship: when establishing a mapping relationship between a virtual address space whose memory type is file memory and the corresponding physical address space, the memory access requester can use the page table to The page fault exception handler label corresponding to the virtual address space in the virtual address space rejects the establishment request of the IO memory page fault exception handling service. In this way, the stability of the operating system can be improved.
  • the memory management service calls the label addition module to perform steps including but not limited to the following:
  • the label generation module After the memory management service calls the label generation module to generate the exception handler label, it calls the label adding module to create a page table that records the mapping relationship between the virtual address space and the physical address space based on the allocation result.
  • the page table is used in the operating system shown in Figure 1 to record the mapping relationship between the virtual address space and the physical address space.
  • Unused page table entries For example, a row of page table entries includes page table entries that record virtual address space information (such as indexes), and page table entries that record physical address space information (such as indexes).
  • Unused page table entries are: unallocated physical address space In the row of the virtual address space, the page table entry records the physical address space information (such as index). Based on this, after the memory management service of this application allocates the virtual address space, based on the allocation result, it creates a record of the virtual address space and The page table of the physical address space mapping relationship to write page fault exception handler tags to unused page table entries. In this way, this application can directly use the existing data structure of the microkernel: the page table to store the page missing exception handler label, thereby eliminating the need to introduce new complex data structures into the microkernel. While improving memory access efficiency, it can maintain Microkernel is simple enough.
  • FIG. 10a is an exemplary structural diagram of a page table when mapping has been established.
  • each row of the Level0 Page Table can include two page table entries: the base address L0 Addr Base and the mapping entry Entry0.
  • the base address L0 Addr Base is used to record the information of the virtual address space VA
  • the mapping entry Entry0 is used to record the information of the physical address space PA.
  • the microkernel can obtain the specified bits in the virtual address space VA, such as VA[47:39], as an index, and search for the base address L0 Addr Base in the first-level page table according to the index, thereby obtaining the corresponding physical address space PA[47: 39].
  • FIG. 10b is an exemplary structural diagram of the page table when mapping has been established.
  • the page tables can include: one-level page table Level0 Page Table, two-level page table Level1 Page Table, three-level page table Table Level2 Page Table and four-level page table Level3 Page Table.
  • Each level page table is similar to the first-level page table in Figure 10a. The difference is that the page table entries from Level0 Page Table to Level2 Page Table: mapping entry Entry0 to mapping entry Entry2, the records may be used for the next level page table.
  • the first address for the search rather than the physical address space information of the final search result. For example, a microkernel can perform the following steps to find the final physical address space:
  • the microkernel obtains the specified bit in the virtual address space VA, such as VA[47:39], as an index, and searches the base address L0 Addr Base in the first-level page table according to the index, and obtains the corresponding first address of the second-level page table Level1 Page Table. .
  • the microkernel obtains VA[38:30] from the first address of the second-level page table Level1 Page Table as an index, searches the base address L1 Addr Base in the second-level page table according to this index, and obtains the corresponding first address of the third-level page table Level2 Page Table. address.
  • the microkernel obtains VA[29:21] from the first address of the third-level page table Level2 Page Table as an index, searches the base address L2 Addr Base in the third-level page table according to this index, and obtains the corresponding first address of the fourth-level page table Level3 Page Table. address.
  • the microkernel obtains VA[20:12] from the first address of the fourth-level page table Level3 Page Table as an index, searches the base address L3 Addr Base in the fourth-level page table according to this index, and obtains the physical address space PA[47:12].
  • the page table established through S802 in the embodiment of the present application is similar to the page table shown in Figure 10a and Figure 10b. The difference is that the page table entry recording the mapping entry in the page table established through S802 is a free page table entry, that is, it is not used. page table entry. The same parts will not be described again here. For details, please refer to the description of Figure 10a and Figure 10b.
  • the memory management service calls the label adding module to create the above page table with unused page table entries, it continues to call the label adding module to add the processor label of the corresponding virtual address space in the page table entry of the physical address space information of the page table.
  • the page table entries of the physical address space information of the page table are unused page table entries in the page table, for example, the unused page table entries in the last level page table in the multi-level page table in Figure 10b: mapping entry Entry3.
  • FIG. 10c is a structural diagram of a page table for recording tags provided by an embodiment of the present application. As shown in Figure 10c, the memory management module can call the label adding module to add the exception handler label in the mapping entry Entry0 of the first-level page table Level0.
  • the memory management module obtains VA[47:39] of the allocated virtual address space VA as an index, and adds the exception handler label Lablem to the first-level page table according to the index.
  • Figure 10d is another structural diagram of a page table for recording tags according to an embodiment of the present application.
  • the memory management module can call the label adding module to add the exception handler label in the mapping entry Entry3 of the multi-level page table Level3.
  • the memory management module obtains VA[47:39] of the allocated virtual address space VA as an index. According to this index, it finds the mapping entry Entry3 in the four-level page table Level3 Page Table step by step, thereby changing the exception handler label Lablem to Level 3 Page Table.
  • the search process for page table entries in the multi-level page table can be referred to the description in Figure 10b above, and will not be described again here.
  • Page fault exception handler labels can be divided into multiple types according to the type of virtual address space.
  • Each The number of page fault exception handler tags can be multiple. For example, when the memory type is file memory and there are multiple virtual address spaces, each virtual address space corresponds to one file fault handler label. That is to say, the number of file fault handler labels is multiple.
  • FIG. 11 is a structural diagram of an exemplary page fault exception handling architecture.
  • the page fault exception processing architecture which is the architecture of the electronic device, includes: a label generation module and a label adding module in the user-mode memory management service of the system service layer. These two modules are the same as those in the embodiment of Figure 9. The same modules are the same modules to implement the page missing exception handler label adding process shown in Figure 8 of this application and the embodiment of the label generation scenario shown in Figure 9 .
  • S1101 includes: the user-mode memory management service calls the label adding module to add the exception handler label generated by the label generation module to the data structure recording the exception handler label.
  • the system service layer may also include thread management services, IO management services, file management services and other services for handling page missing exceptions.
  • Figure 12 is an exemplary flow chart of the memory access method provided by the embodiment of the present application. As shown in Figure 12, the memory access method may include but is not limited to the following steps:
  • the microkernel detects a page fault exception in the virtual address space.
  • the above-mentioned S1201 is the same step as the S302 in the embodiment of FIG. 3 of this application, and will not be described again. For details, please refer to the description of the above-mentioned S302.
  • the microkernel determines the page fault exception handling service based on the handler label of the virtual address space.
  • the microkernel can determine the page missing exception handling service based on the handler label of the virtual address space.
  • the handler label of the virtual address space includes: an exception handling component label added to the virtual address space in advance according to the memory type of the virtual address space.
  • the exception handling component tag is added in advance through the method provided in the embodiment of FIG. 8 .
  • Each exception handling component label is used to indicate the page fault exception handling service corresponding to the virtual address space of a memory type, that is, the exception handling component.
  • the exception handling component label of the virtual address space is file memory page fault exception handling service. Label (such as file fault handler label).
  • the microkernel determines the page fault exception handling service based on the handler label of the virtual address space. Specifically, the microkernel searches for the page fault exception handler of the virtual address space where the page fault exception exists from the pre-stored page table. Tag, determine the processing service information corresponding to the found tag from the pre-established correspondence relationship between tags and processing service information, and determine the page missing exception processing service based on the processing service information.
  • the specific way in which the microkernel searches for the page fault exception handler label is similar to the process of searching the physical address space in the embodiments of Figure 10a and Figure 10b. Both of them traverse the page table. The difference is that the search results are different. The same parts will not be described again here. For details, please refer to the description of the embodiment in Figure 10a and Figure 10b.
  • the kernel layer of the electronic device shown in Figure 11 may include an exception handling registration module to establish the page missing exception handler label and page missing exception handler information generated by the user mode memory management service. (such as interaction portals, or calling interfaces, etc.).
  • the kernel-state memory management service belongs to the microkernel, which can also include a Trusted Computing Base (TCB) module and an interactive communication module (such as an IPC module).
  • TLB Trusted Computing Base
  • IPC module interactive communication module
  • the user-mode memory management service can call the label adding module to perform step S1102 and send a registration request to the exception handling registration module to establish the correspondence between the page missing exception handler label and the page missing exception handling entry (fault handler entry). Relationship, that is, registering the page missing exception handling entry.
  • FIG. 13 is an exemplary structural diagram of a page fault exception handling table. As shown in Figure 13, the corresponding relationship between the page fault exception handler label and the page fault exception processing entry can be a page fault exception handling table (fault handler table). The structure of the page fault exception handling table can be key-value pairs. In an optional implementation, the page-fault exception handling table may include a default page-fault exception handling entry (not shown in the figure) and several page-fault exception handling entries corresponding to specific exception handler tags.
  • the establishment of the page-fault exception handling table complies with the following two constraints:
  • the first constraint is: the content in the page-fault exception handling table entry cannot be empty, that is, the entry default label as the key There must be content in the table entry default fault handler entry as the value.
  • the second constraint is: the contents of different table entries as keys, that is, the default labels of exception handlers, are different, and each default label corresponds to an exception handling entry, default fault handler entry.
  • label label1 corresponds to the entry fault handler entry1
  • label label2 corresponds to the entry fault handler entry2
  • label labelm corresponds to the entry fault handler entrym.
  • the exception handling registration module can abstract four primitives: fault_handler_table_init, fault_handler_table_register, fault_handler_table_dispatcher, and fault_handler_table_unregister.
  • a primitive refers to a program segment composed of several instructions, which is used to implement a specific function and cannot be interrupted during execution. The following introduces the meaning of each primitive abstracted by the exception handling registration module:
  • fault_handler_table_init Initialize the page fault exception handling table fault handler table, and specify the table item default label and table item default fault handler entry.
  • fault_handler_table_register Receive the page fault exception handler label label and fault handler entry key-value pair sent by the label adding module, find the free entry in the page fault exception handling table, that is, the unused entry, and fill in the key-value pair.
  • fault_handler_table_dispatcher Find the corresponding table entry based on the input label and return the entry fault handler entry in the table entry. It can be understood that this primitive is used to determine the page fault exception handler.
  • fault_handler_table_unregister Find the corresponding table entry based on the input label and remove the corresponding table entry.
  • the kernel-mode memory management service in the microkernel calls the exception handling registration module to search the above-mentioned page-fault exception handling table and obtains the entry fault handler entry of the page-fault exception handler.
  • the page fault exception handler label corresponding to the virtual address space will be overwritten by the physical address space, that is, it will be overwritten as The mapping relationship between the physical address space and the virtual address space instead of the valid page fault exception handler label, then the microkernel can send the page fault exception information to the default page fault exception handler, which will handle it This type of page fault exception occurs.
  • the default page fault exception handler may be, for example, an anonymous memory page fault processing service. In this way, it can be applied to the scenario where there is no valid page fault exception handler label, which expands the scope of application of the present application.
  • Figure 14a is a structural diagram illustrating an exemplary page fault exception handling architecture.
  • the electronic device can also include a hardware layer.
  • the hardware layer can specifically include components such as CPU, memory, network card, disk, etc.
  • Figure 14b is a structural diagram illustrating an exemplary page fault exception handling architecture.
  • each operating domain may include the modules shown in Figure 12. The functions of each module can be seen in the description of Figure 11, and will not be described again here.
  • running domain D1 includes thread management service, IO management service, file management service and user-mode memory management service.
  • the user-mode memory management service has a new label generation module and a label addition module.
  • Running domain D2 includes thread management service, IO management service, file management service and user-mode memory management service.
  • the user-mode memory management service has a new label generation module and label addition module.
  • the architecture shown in Figure 14b may also include a hardware layer. For details, please refer to the hardware layer shown in Figure 14a.
  • FIG 11, Figure 14a and Figure 14b are all exemplary descriptions of the architecture of the electronic device that implements the embodiments of Figures 8 and 9.
  • the electronic device may include more or Fewer parts, or combining some parts, or splitting some parts, or different parts arrangement.
  • the components illustrated may be implemented in hardware, software, or a combination of software and hardware.
  • the exception handling component label can be added according to the memory type of the virtual address space. Compared with the fixed division of the virtual address space range according to the memory type of the virtual address space, the flexible use of the virtual address space can be ensured and the fixed division can be avoided. Incompatibility issues in applicable scenarios.
  • the microkernel sends page fault information to the determined page fault exception handling service.
  • the microkernel After the microkernel determines the exception handler label, it can send page fault information to the determined page fault exception handling service.
  • an exception handling calling module can also be added to the kernel-mode memory management service in the electronic device. Based on this, the kernel-mode memory management service in the microkernel can call the exception handling calling module to execute S1103, find the exception handling entry from the exception handling registration module, and the exception handling calling module executes S1204, and send the page fault information to the found exception handling entry.
  • the indicated page fault exception handling service (such as file management service).
  • the electronic device can also include a hardware layer.
  • the hardware layer can specifically include components such as CPU, memory, network card, disk, etc.
  • FIG 14b is a structural diagram illustrating an exemplary page fault exception handling architecture. As shown in Figure 14b, for an electronic device with multiple operating domains, each operating domain may include Figure 11 For the modules shown, the functions of each module can be found in the description in Figure 11 and will not be described again here.
  • S502 The microkernel sends the page fault information to the page fault exception handling service corresponding to the tag.
  • S501 to S502 are the same steps as the S1202 to S1203 in FIG. 12 and will not be described again here. For details, please refer to the description of S1202 to S1203 in the above-mentioned embodiment of FIG. 12 .
  • the processing of page missing exceptions in the memory access of this application avoids the inter-process communication between the memory management service and the page missing exception handling service in the system service layer, and the interaction between different services occurs. Between the kernel layer and the system service layer, there is no inter-process communication in the system service layer to handle page fault exceptions.
  • the page fault exception handling service allocates the physical address space based on the page fault information.
  • S1204 is the same step as S305 in the embodiment of FIG. 3 and will not be described again here. For details, please refer to the description of S305 in the embodiment of FIG. 3 .
  • the page fault exception handling service updates the page table entry of the physical address space information based on the mapping relationship between the virtual address space and the physical address space.
  • S1205 is a similar step to S307 in the embodiment of FIG. 3, and the same parts will not be described again here.
  • the difference is that when the page missing exception handling service executes S1205, there is a pre-stored page table for recording the page missing exception handler label that can be used directly.
  • the page fault exception handling service can update the page table entries of the physical address space information based on the mapping relationship between the virtual address space and the physical address space, that is, the allocated physical address space will be allocated according to the mapping between the physical address space and the virtual address space. relationship, updated to the pre-stored page table.
  • the pre-stored page table can be the page table shown in Figure 10d, and the allocated physical address space is the physical address space PA[47:12].
  • the page fault exception handling service can be based on the mapping between the physical address space and the virtual address space VA. relationship, that is, you can find the index relationship of the exception handler label Lablem according to Figure 10d, update the exception handler label Lablem in the mapping entry Entry3 to the physical address space PA[47:12], and obtain the updated page table as shown in Figure 10b page table shown. That is to say, the page table before updating records the mapping relationship between the virtual address space and the exception handler tag, and the updated page table records the mapping relationship between the virtual address space and the allocated physical address space.
  • the page fault exception handling service sends exception handling feedback to the microkernel.
  • S1206 is the same step as S308 in the embodiment of FIG. 3 and will not be described again here. For details, please refer to the description of S308 in the embodiment of FIG. 3 .
  • the memory access requester can access the virtual address space based on the updated page table.
  • the specific access of the memory access requester to the virtual address space is similar to the access of the memory access requester to the virtual address space in the embodiment of Figure 3. The same parts will not be described again here. For details, see the relevant description of the embodiment of Figure 3. The difference is that in the embodiment of FIG. 12, the memory access requester uses the updated page table instead of the page table created by the page fault exception handling service after allocating the physical address space.
  • the microkernel when the microkernel detects a page missing exception in the virtual address space corresponding to the access request, it can directly determine the page missing exception processing service based on the exception handling component label of the virtual address space, thereby directly communicating with the page missing exception. Handle service interactions and implement memory access. In this way, the inter-process interaction between the specific exception handler and the page fault exception handler can be avoided, thereby improving the efficiency of memory access.
  • the processing component tag added according to the memory type of the virtual address space can directly indicate the page fault exception processing component of the memory type. Compared with the fixed division of the virtual address space range according to the memory type, the flexibility of the virtual address space can be guaranteed. Use to avoid incompatibility problems in application scenarios caused by fixed division of virtual address space ranges.
  • the kernel-mode memory management service can call the fault_handler_table_init interface provided by the exception handling registration module to initialize the pre-stored page fault exception handling table.
  • S902 in FIG. 9 when S902 in FIG. 9 is executed before S901 or simultaneously with S901, S902 can be used as a step in the startup phase to generate a page missing exception handler label.
  • S1102 can also be used as a step in the startup phase to realize the registration of the page missing exception handler entry.
  • the virtual memory allocation phase may include: the user-mode memory management service allocates the virtual address space, creates a page table, and based on the virtual address The memory type of the space determines the corresponding page fault exception tag, and the page fault exception tag is added to the page table type.
  • the page fault exception processing stage may include: the microkernel obtains the page fault exception label corresponding to the virtual address space where the page fault exception occurs by traversing the page table, and the kernel mode memory management service in the microkernel obtains the page fault exception label by calling the exception.
  • the fault_handler_table_dispatcher interface provided by the processing registration module module finds the page fault exception processing entry corresponding to the page fault exception tag.
  • the kernel state memory management service in the microkernel calls the exception processing calling module and sends the page fault exception information to the corresponding page fault exception processing entry according to the page fault exception processing entry. system server business processing.
  • the memory access stage can be entered.
  • the description of the memory access requester's access to the virtual address space in the above embodiment please refer to the description of the memory access requester's access to the virtual address space in the above embodiment.
  • FIG. 15 is a schematic diagram of a processing scenario of a method for handling a page missing exception.
  • the memory type of the allocated virtual address space may be anonymous memory, IO memory or file memory.
  • the microkernel determines the page table entry corresponding to the virtual address space by traversing the page table (page walk), and obtains the page missing exception handler label, such as the IO type label "IO exception handler label ( io fault handler label)".
  • the kernel-mode memory management service in the microkernel calls the exception handling registration module to find the exception handling entry (such as exception handling entry 1 (fault handler entry1)) from the page fault exception handling table according to the IO type label.
  • the kernel-mode memory management service in the microkernel calls the fault_handler_table_dispatche interface of the exception handling calling module, and distributes the page missing exception to the IO memory page missing exception handling service (IO manager) of the system service layer for processing.
  • the page missing exception corresponding to the virtual address space of the anonymous memory type is similar to that of the IO memory type. The difference is that the specific exception handler label and exception handling service are anonymous type label and anonymous memory page missing exception handling service respectively. The same parts will not be repeated here. For details, see the above description of IO memory types.
  • the virtual address space of the anonymous memory type often occupies a relatively large area. For this reason, the user-mode memory management service may not be included in the physical address space page table entry corresponding to the virtual address space of the anonymous memory type. Add page missing exception handling label.
  • the physical address space page table entry can be empty, or can be "unlabeled" as shown in Figure 15, to streamline the page fault exception handling process and reduce storage space costs, thereby further improving the efficiency of memory access.
  • the anonymous memory page fault processing service can be used as the default page fault exception handling service. In this way, when the tag is missing, the microkernel will forward the page fault exception information to the default page fault exception handler.
  • the page missing exception handling in the above embodiments of the present application refers to the page missing exception handling in the mapping attribute dimension, that is, the memory type dimension. It is understandable that page fault exception processing can be from another dimension.
  • 1Major Page Fault (Major Page Fault) is also called Hard Page Fault (Hard Page Fault), which refers to The memory that needs to be accessed is not in the virtual address space, nor in the physical address space, and needs to be loaded from a slow device.
  • a slow device refers to an abnormal status end device (host or storage) in the Storage Area Network (SAN) network. The abnormal status is manifested in the fact that the end device (host or storage) cannot respond normally and quickly.
  • SAN Storage Area Network
  • Minor Page Fault Minor page fault
  • Soft Page Fault soft page fault
  • the page missing exception handler label can be divided according to the difference between 1 and 2.
  • the page missing exception handling entry corresponding to the page missing exception handler label is 1
  • the page fault exception processing unit in 2.
  • the electronic device includes corresponding hardware and/or software modules that perform each function.
  • the embodiments of the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a function is performed by hardware or computer software driving the hardware depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions in conjunction with the embodiments for each specific application, but such implementation should not be considered to be beyond the scope of the embodiments of the present application.
  • This embodiment can divide the electronic device into functional modules according to the above method examples.
  • each functional module can be divided corresponding to each function, or two or more functions can be integrated into one processing module.
  • the above integrated modules can be hard Implemented in the form of software. It should be noted that the division of modules in this embodiment is schematic and is only a logical function division. In actual implementation, there may be other division methods.
  • FIG. 16 is an exemplary schematic block diagram of a device 1600 provided by an embodiment of the present application.
  • the device 1600 may include: a processor 1601 and a transceiver/transceiver pin 1602.
  • memory 1603 is also included.
  • bus 1604 includes a power bus, a control bus, and a status signal bus in addition to a data bus.
  • bus 1604 various buses are referred to as bus 1604 in the figure.
  • the memory 1603 may be used for instructions in the foregoing method embodiments.
  • the processor 1601 can be used to execute instructions in the memory 1603, and control the receiving pin to receive signals, and control the transmitting pin to send signals.
  • the device 1600 may be the electronic device or a chip of the electronic device in the above method embodiment.
  • This embodiment also provides a computer storage medium.
  • Computer instructions are stored in the computer storage medium.
  • the electronic device causes the electronic device to execute the above related method steps to implement the large screen service in the above embodiment.
  • Cross-device transfer control methods are also provided.
  • This embodiment also provides a computer program product.
  • the computer program product When the computer program product is run on a computer, it causes the computer to perform the above related steps to implement the cross-device flow control method of large-screen services in the above embodiment.
  • the embodiments of the present application also provide a device.
  • This device may be a chip, a component or a module.
  • the device may include a connected processor and a memory; where the memory is used to store computer execution instructions.
  • the processor can execute the computer execution instructions stored in the memory, so that the chip executes the cross-device flow control method of large-screen services in the above method embodiments.
  • the electronic equipment, computer storage media, computer program products or chips provided in this embodiment are all used to execute the corresponding methods provided above. Therefore, the beneficial effects they can achieve can be referred to the corresponding methods provided above. The beneficial effects of the method will not be repeated here.
  • the disclosed devices and methods can be implemented in other ways.
  • the device embodiments described above are only illustrative.
  • the division of modules or units is only a logical function division.
  • there may be other division methods for example, multiple units or components may be combined or can be integrated into another device, or some features can be ignored, or not implemented.
  • the coupling or direct coupling or communication connection between each other shown or discussed may be through some interfaces, and the indirect coupling or communication connection of the devices or units may be in electrical, mechanical or other forms.
  • a unit described as a separate component may or may not be physically separate.
  • a component shown as a unit may be one physical unit or multiple physical units, that is, it may be located in one place, or it may be distributed to multiple different places. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
  • each functional unit in each embodiment of the present application can be integrated into one processing unit, or each unit can exist physically alone, or two or more units can be integrated into one unit.
  • the above integrated units can be implemented in the form of hardware or software functional units.
  • Integrated units may be stored in a readable storage medium if they are implemented in the form of software functional units and sold or used as independent products.
  • the technical solutions of the embodiments of the present application are essentially or contribute to the existing technology, or all or part of the technical solution can be embodied in the form of a software product, and the software product is stored in a storage medium , including several instructions to cause a device (which can be a microcontroller, a chip, etc.) or a processor to execute all or part of the steps of the methods of various embodiments of the embodiments of this application.
  • the aforementioned storage media include: U disk, mobile hard disk, read only memory (ROM), random access memory (RAM), magnetic disk or optical disk and other media that can store program code.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Memory System Of A Hierarchy Structure (AREA)

Abstract

Embodiments of the present application provide a memory access method and apparatus. The method comprises: during the handling of a page fault corresponding to a virtual address space, according to a handling component label used for identifying a target handling component corresponding to the virtual address space, directly instructing the target handling component to perform fault handling on the page fault, that is, solving the problem of page fault, so that a requester of an access request can access the virtual address space. Thus, according to the present application, inter-process communication between a specific page fault handling component and the target handling component may be reduced, thereby improving memory access efficiency.

Description

内存访问方法及装置Memory access method and device
本申请要求于2022年07月25日提交中国国家知识产权局、申请号为202210878562.0、申请名称为“内存访问方法及装置”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims priority to the Chinese patent application filed with the State Intellectual Property Office of China on July 25, 2022, with application number 202210878562.0 and the application title "Memory Access Method and Device", the entire content of which is incorporated into this application by reference. .
技术领域Technical field
本申请实施例涉及计算机领域,尤其涉及一种内存访问方法及装置。Embodiments of the present application relate to the field of computers, and in particular, to a memory access method and device.
背景技术Background technique
微内核(micro kernel)架构是一种包括微内核和系统服务的操作系统架构。其中,微内核用于在内核态实现操作系统的核心功能,例如,任务,线程和内核态内存管理等功能。系统服务包括多个组件,多个组件分别用于在用户态实现操作系统的进程管理,文件管理,以及用户态内存管理等。The microkernel architecture is an operating system architecture that includes a microkernel and system services. Among them, the microkernel is used to implement the core functions of the operating system in the kernel state, such as tasks, threads, and kernel state memory management. System services include multiple components, which are used to implement process management, file management, and user-mode memory management of the operating system in user mode.
相关技术中,操作系统对内存访问通常采用延时加载的机制:为用户的访问请求分配内存时仅分配虚拟地址空间,不分配实际的物理地址空间。这样,在操作系统访问该虚拟地址空间时会触发缺页异常(page fault)。此时,操作系统的内核可以检测到该缺页异常,并调用缺页异常处理者(page fault handler)分配该虚拟地址空间对应的物理地址空间。基于分配结果,访存请求者可以访问该物理地址空间,实现内存访问。In related technologies, the operating system usually uses a delayed loading mechanism for memory access: when allocating memory for a user's access request, it only allocates a virtual address space and does not allocate an actual physical address space. In this way, a page fault will be triggered when the operating system accesses the virtual address space. At this time, the kernel of the operating system can detect the page fault exception and call the page fault exception handler (page fault handler) to allocate the physical address space corresponding to the virtual address space. Based on the allocation result, the memory access requester can access the physical address space to achieve memory access.
但是,在微内核架构的操作系统中,微内核处于内核态,缺乏足够的缺页异常处理信息,需要通过系统服务中的特定缺页异常处理者(如用户态内存管理服务)调用处于用户态的缺页异常处理者。这样,不同缺页异常处理者之间形成了进程间通信(inter-process communication,IPC),导致内存访问的效率受到较大影响。However, in an operating system with a microkernel architecture, the microkernel is in the kernel mode and lacks sufficient page fault exception handling information. It needs to be called in the user mode through a specific page fault exception handler in the system service (such as the user mode memory management service). The page fault exception handler. In this way, inter-process communication (IPC) is formed between different page fault exception handlers, causing the efficiency of memory access to be greatly affected.
发明内容Contents of the invention
本申请提供一种内存访问方法及装置,以解决上述问题。在该方法中,通过预先为虚拟地址空间分配处理组件标签,以避免特定缺页异常处理组件与目标处理组件间的进程间通信,从而提升内存访问的效率。This application provides a memory access method and device to solve the above problems. In this method, the virtual address space is allocated a processing component label in advance to avoid inter-process communication between a specific page fault exception processing component and the target processing component, thereby improving the efficiency of memory access.
第一方面,本申请实施例提供一种内存访问方法,该方法包括:获取第一访问请求,第一访问请求用于指示访问第一虚拟地址空间;若检测到对应于第一虚拟地址空间的第一缺页异常,获取第一虚拟地址空间的处理组件标签;其中,第一虚拟地址空间的处理组件标签用于标识对应于第一虚拟地址空间的第一处理组件;基于第一虚拟地址空间的处理组件标签,指示第一处理组件对第一缺页异常进行异常处理第一处理组件对第一缺页异常进行异常处理,可以包括为第一虚拟地址空间分配物理地址空间,也就是第一缺页异常引起的异常已解决,则第一访问请求的请求者例如第一访存请求组件,能够正常访问第一虚拟地址空间。In a first aspect, embodiments of the present application provide a memory access method. The method includes: obtaining a first access request, which is used to indicate access to the first virtual address space; if a memory access request corresponding to the first virtual address space is detected. First page missing exception, obtain the processing component label of the first virtual address space; wherein, the processing component label of the first virtual address space is used to identify the first processing component corresponding to the first virtual address space; based on the first virtual address space The processing component label instructs the first processing component to perform exception processing on the first page missing exception. The first processing component performs exception processing on the first page missing exception, which may include allocating a physical address space for the first virtual address space, that is, the first After the exception caused by the page fault exception has been resolved, the requester of the first access request, such as the first memory access request component, can access the first virtual address space normally.
本申请实施例中,通过预先为虚拟地址空间添加处理组件标签,可以针对内存访问过程中发生的缺页异常,根据该标签直接指示目标处理组件进行缺页异常的异常处理,从而避免特定缺页异常处理组件与目标处理组件的进程间交互导致的效率下降,提高内存访问效率。其中,处理组件标签可以直接指示虚拟地址空间对应的异常处理组件,与按照固定划分的虚拟地址空间范围相比,可以保证对虚拟地址空间的灵活使用,避免固定划分虚拟地址空间范围导致的应用场景不兼容。In the embodiment of the present application, by adding a processing component label to the virtual address space in advance, the target processing component can be directly instructed to handle the page missing exception based on the label for page missing exceptions that occur during memory access, thereby avoiding specific page missing exceptions. The efficiency decrease caused by the inter-process interaction between the exception handling component and the target processing component improves the memory access efficiency. Among them, the processing component label can directly indicate the exception handling component corresponding to the virtual address space. Compared with the fixed division of the virtual address space range, it can ensure the flexible use of the virtual address space and avoid application scenarios caused by the fixed division of the virtual address space range. Not compatible.
示例性的,图9为本申请实施例提供的异常处理组件标签的添加场景的一个示例性的示意图。如图9所示,第一虚拟地址空间可以为虚拟地址空间1,相应地,处理组件标签可以为标签2。图15为示例性示出的一种缺页异常处理方法的处理场景示意图。如图15所示,若第一虚拟地址空间的处理组件标签为文件类型标签,第一处理组件可以为文件内存缺页异常处理服务。Exemplarily, FIG. 9 is an exemplary schematic diagram of a scenario of adding an exception handling component label provided by the embodiment of the present application. As shown in Figure 9, the first virtual address space may be virtual address space 1, and accordingly, the processing component label may be label 2. FIG. 15 is a schematic diagram of a processing scenario illustrating an exemplary page fault exception processing method. As shown in Figure 15, if the processing component label of the first virtual address space is a file type label, the first processing component can provide file memory page fault exception processing services.
根据第一方面,获取第一虚拟地址空间的处理组件标签,包括:According to the first aspect, obtaining a processing component label of the first virtual address space includes:
根据第一虚拟地址空间,从页表中查找处理组件标签;其中,处理组件标签包含在第一虚拟地址空间的页表的目标页表项中;页表为在预先分配第一虚拟地址空间时建立;目标页表项为页表中用于记录第一虚拟地址空间对应的物理地址空间信息的页表项。 According to the first virtual address space, search the processing component label from the page table; wherein, the processing component label is included in the target page table entry of the page table of the first virtual address space; the page table is when the first virtual address space is pre-allocated. Establish; the target page table entry is a page table entry in the page table used to record the physical address space information corresponding to the first virtual address space.
本申请实施例中,本申请在处理缺页异常之前,例如在分配了虚拟内存空间时即创建页表。这样,本申请可以将页表用于记录异常处理者标签,从而将异常处理者标签用于进行缺页异常的处理,无需引入复杂的数据结构即可为虚拟地址空间添加异常处理者标签。In the embodiment of the present application, the present application creates a page table before handling the page fault exception, for example, when allocating virtual memory space. In this way, this application can use the page table to record the exception handler label, thereby using the exception handler label to handle page missing exceptions. The exception handler label can be added to the virtual address space without introducing a complex data structure.
示例性的,图10c为本申请实施例提供的记录标签的页表的一种结构图;图10d为本申请实施例提供的记录标签的页表的另一种结构图。如图10c或者图10d所示,第一虚拟地址空间可以为虚拟地址空间VA,第一虚拟地址空间的页表可以为图10c中的一级页表Level0 Page Table;或者第一虚拟地址空间的页表可以为图10d中的多级页表。目标页表项为图10c或者图10d所示页表中的异常处理者标签Lablem所在的页表项。Exemplarily, FIG. 10c is a structural diagram of a page table for recording tags provided by an embodiment of the present application; FIG. 10d is another structural diagram of a page table for recording tags provided by an embodiment of the present application. As shown in Figure 10c or Figure 10d, the first virtual address space can be the virtual address space VA, and the page table of the first virtual address space can be the Level 0 Page Table in Figure 10c; or the first virtual address space. The page table may be a multi-level page table as shown in Figure 10d. The target page table entry is the page table entry where the exception handler label Lablem is located in the page table shown in Figure 10c or Figure 10d.
根据第一方面,或者以上第一方面的任意一种实现方式,第一处理组件的处理结果可以包括更新页表;其中,更新页表为第一处理组件为第一虚拟地址空间分配物理地址空间,并基于物理地址空间对目标页表项进行更新得到;从而第一访存请求组件可以根据更新页表,访问第一虚拟地址空间。According to the first aspect, or any implementation of the first aspect above, the processing result of the first processing component may include updating the page table; wherein updating the page table is for the first processing component to allocate a physical address space to the first virtual address space. , and the target page table entry is updated based on the physical address space; thus, the first memory access request component can access the first virtual address space based on the updated page table.
本申请实施例中,第一处理组件为第一虚拟地址空间分配物理地址空间后,基于物理地址空间对目标页表项进行更新,以得到更新页表,从而保证缺页异常的异常解决,以及根据更新页表对第一虚拟地址空间的访问。In the embodiment of the present application, after allocating a physical address space to the first virtual address space, the first processing component updates the target page table entry based on the physical address space to obtain an updated page table, thereby ensuring that the page missing exception is resolved, and Access to the first virtual address space based on updating the page table.
示例性的,图10a为示例性示出的已建立映射时页表的一种结构图;图10b为示例性示出的已建立映射时页表的另一种结构图。如图10c或者图10d所示,更新页表可以为图10c或者图10d中所示的页表。Exemplarily, FIG. 10a is an exemplary structural diagram of a page table when mapping has been established; FIG. 10b is an exemplary structural diagram of a page table when mapping has been established. As shown in Figure 10c or Figure 10d, the update page table may be the page table shown in Figure 10c or Figure 10d.
根据第一方面,或者以上第一方面的任意一种实现方式,处理组件标签为根据第一虚拟地址空间的内存类型,和内存类型对应的处理组件的组件标识生成。According to the first aspect, or any implementation of the above first aspect, the processing component label is generated according to the memory type of the first virtual address space and the component identifier of the processing component corresponding to the memory type.
本申请实施例中,通过第一虚拟地址空间的内存类型和相应的处理组件的组件标识生成处理组件标签,可以保证处理组件标签所标识的处理组件的准确性。In the embodiment of the present application, the processing component label is generated by using the memory type of the first virtual address space and the component identification of the corresponding processing component, which can ensure the accuracy of the processing component identified by the processing component label.
根据第一方面,或者以上第一方面的任意一种实现方式,响应于第一处理组件的处理反馈信息,访问第一虚拟地址空间之后,方法还包括:According to the first aspect, or any implementation of the above first aspect, in response to the processing feedback information of the first processing component, after accessing the first virtual address space, the method further includes:
获取第二访问请求,第二访问请求用于指示访问第二虚拟地址空间;Obtain a second access request, the second access request is used to indicate access to the second virtual address space;
若检测到对应于第二虚拟地址空间的第二缺页异常,获取第二虚拟地址空间的处理组件标签;其中,第二虚拟地址空间的处理组件标签用于标识对应于第二虚拟地址空间的第二处理组件;If a second page fault exception corresponding to the second virtual address space is detected, obtain the processing component label of the second virtual address space; wherein, the processing component label of the second virtual address space is used to identify the processing component label corresponding to the second virtual address space. second processing component;
检测第二虚拟地址空间的处理组件标签是否满足预设条件;Detect whether the processing component label of the second virtual address space meets the preset conditions;
若不满足,指示指定处理组件对第二缺页异常进行异常处理。指定处理组件对第二缺页异常进行异常处理,可以包括为第二虚拟地址空间分配物理地址空间,也就是第二缺页异常引起的异常已解决,则第二访问请求的请求者例如第二访存请求组件,能够正常访问第二虚拟地址空间。If not, instruct the designated processing component to handle the second page fault exception. Designating a processing component to handle the second page missing exception may include allocating a physical address space for the second virtual address space. That is, the exception caused by the second page missing exception has been resolved, and the requester of the second access request, such as the second The memory access request component can normally access the second virtual address space.
本申请实施例中,通过指定处理组件也就是为缺页异常提供默认处理组件,可以应对处理组件标签不满足预设条件的情况,从而进一步提高内存访问的成功率,提高用户体验。In the embodiment of this application, by specifying a processing component, that is, providing a default processing component for page missing exceptions, it is possible to deal with the situation where the processing component label does not meet the preset conditions, thereby further improving the success rate of memory access and improving user experience.
示例性的,处理组件标签不满足预设条件可以包括:页表中不存在处理组件标签,或者处理组件标签的格式不符合预设的标签格式(如标签为“空”或者标签不包含处理组件标识等)。也就是说,处理组件标签不满足预设条件意味着处理组件标签获取失败。For example, if the processing component label does not meet the preset conditions, it may include: the processing component label does not exist in the page table, or the format of the processing component label does not comply with the preset label format (such as the label is "empty" or the label does not contain the processing component). logo, etc.). In other words, if the processing component label does not meet the preset conditions, it means that the acquisition of the processing component label fails.
根据第一方面,或者以上第一方面的任意一种实现方式,指定处理组件为匿名页处理组件;相应地,若第一虚拟地址空间的内存类型为匿名页类型,为第一虚拟地址空间分配的处理组件标签为空。According to the first aspect, or any implementation of the above first aspect, the designated processing component is an anonymous page processing component; accordingly, if the memory type of the first virtual address space is the anonymous page type, allocate The processing component label of is empty.
本申请实施例中,对于匿名内存类型的虚拟地址空间占比较大的场景,将匿名页处理组件作为指定处理组件,从而无需为匿名页类型的第一虚拟地址空间添加处理组件标签,以精简缺页异常处理流程和降低存储空间成本,从而进一步提高内存访问的效率In the embodiment of the present application, for the scenario where the anonymous memory type virtual address space occupies a relatively large proportion, the anonymous page processing component is used as the designated processing component, so that there is no need to add a processing component label to the first virtual address space of the anonymous page type to streamline the missing information. Page exception handling process and reduce storage space costs, thereby further improving the efficiency of memory access
示例性的,可以在匿名内存类型的虚拟地址空间对应的物理地址空间页表项中不添加缺页异常处理标签。例如,该物理地址空间页表项可以为空,或者可以为图15中的“无标签”。For example, the page fault exception handling label may not be added to the physical address space page table entry corresponding to the virtual address space of the anonymous memory type. For example, the physical address space page table entry may be empty, or may be "unlabeled" in Figure 15.
根据第一方面,或者以上第一方面的任意一种实现方式,基于第一虚拟地址空间的处理组件标签,指示第一处理组件对第一缺页异常进行异常处理,包括:According to the first aspect, or any implementation of the first aspect above, instructing the first processing component to perform exception handling on the first page fault exception based on the processing component tag of the first virtual address space includes:
基于第一虚拟地址空间的处理组件标签和预先建立的标签与处理组件信息的对应关系,确定目标处理组件信息;Determine the target processing component information based on the processing component label of the first virtual address space and the pre-established correspondence between the label and the processing component information;
基于目标处理组件信息,指示第一处理组件对第一缺页异常进行异常处理。 Based on the target processing component information, instruct the first processing component to perform exception processing on the first page fault exception.
本申请实施例中,通过预先建立的标签与处理组件信息的对应关系,确定目标处理组件信息,从而可以通过目标处理组件信息及时、准确地指示第一处理组件进行异常处理。与直接在处理组件标签上标记处理组件信息相比,通过该标签与处理组件信息的对应关系,可以提高维护第一处理组件与处理组件标签的对应关系的便捷性。例如,目标处理组件信息更新时,无需重新分配处理组件标签,更新该对应关系即可。In the embodiment of the present application, the target processing component information is determined through the pre-established corresponding relationship between tags and processing component information, so that the first processing component can be timely and accurately instructed to perform exception processing through the target processing component information. Compared with directly marking the processing component information on the processing component label, through the corresponding relationship between the label and the processing component information, the convenience of maintaining the corresponding relationship between the first processing component and the processing component label can be improved. For example, when the target processing component information is updated, there is no need to reassign the processing component label, and the corresponding relationship can be updated.
根据第一方面,或者以上第一方面的任意一种实现方式,若检测到第一虚拟地址空间对应的第一缺页异常,获取第一虚拟地址空间的处理组件标签之前,方法还包括:According to the first aspect, or any implementation of the above first aspect, if a first page fault exception corresponding to the first virtual address space is detected, before obtaining the processing component label of the first virtual address space, the method further includes:
响应于预先分配的至少一种处理组件标签,基于至少一种处理组件标签和至少一种处理组件标签分别对应的处理组件信息,生成键值对;In response to the pre-assigned at least one processing component tag, generate a key-value pair based on the at least one processing component tag and the processing component information respectively corresponding to the at least one processing component tag;
创建记录键值对的缺页异常处理表,得到预先建立的标签与处理组件信息的对应关系。Create a page fault exception handling table that records key-value pairs, and obtain the corresponding relationship between pre-established labels and processing component information.
本申请实施例中,通过至少一种处理组件标签和至少一种处理组件标签分别对应的处理组件信息,生成键值对,以创建记录键值对的缺页异常处理表。这样,预先建立的标签与处理组件信息的对应关系是键值对形式的,查询更加快捷,进一步提高效率。In the embodiment of the present application, key-value pairs are generated through at least one processing component tag and processing component information corresponding to at least one processing component tag, so as to create a page fault exception handling table that records the key-value pairs. In this way, the corresponding relationship between the pre-established tags and the processing component information is in the form of key-value pairs, making the query faster and further improving efficiency.
示例性的,图13为示例性示出的一种缺页异常处理表的结构图。如图13所示,缺页异常处理表可以为图13中的表,处理组件标签为标签label1,相应的处理组件信息为入口fault handler entry 1。Exemplarily, FIG. 13 is an exemplary structural diagram of a page fault exception handling table. As shown in Figure 13, the page fault exception handling table can be the table in Figure 13, the processing component label is label label1, and the corresponding processing component information is entry fault handler entry 1.
第二方面,本申请实施例提供一种内存访问装置,该装置包括:In a second aspect, embodiments of the present application provide a memory access device, which includes:
请求获取模块,被配置为获取第一访问请求,第一访问请求用于指示访问第一虚拟地址空间;A request acquisition module configured to acquire a first access request, where the first access request is used to indicate access to the first virtual address space;
标签获取模块,被配置为若检测到对应于第一虚拟地址空间的第一缺页异常,获取第一虚拟地址空间的处理组件标签;其中,第一虚拟地址空间的处理组件标签用于标识对应于第一虚拟地址空间的第一处理组件;The label acquisition module is configured to obtain a processing component label of the first virtual address space if a first page fault exception corresponding to the first virtual address space is detected; wherein the processing component label of the first virtual address space is used to identify the corresponding the first processing component in the first virtual address space;
异常处理模块,被配置为基于第一虚拟地址空间的处理组件标签,指示第一处理组件对第一缺页异常进行异常处理。第一处理组件对第一缺页异常进行异常处理,可以包括为第一虚拟地址空间分配物理地址空间,也就是第一缺页异常引起的异常已解决,则第一访问请求的请求者例如第一访存请求组件,能够正常访问第一虚拟地址空间。The exception handling module is configured to instruct the first processing component to perform exception handling on the first page fault exception based on the processing component label of the first virtual address space. The first processing component performs exception processing on the first page missing exception, which may include allocating a physical address space for the first virtual address space. That is, the exception caused by the first page missing exception has been resolved, and the requester of the first access request, for example, A memory access request component can normally access the first virtual address space.
根据第二方面,标签获取模块,进一步被配置为:According to the second aspect, the tag acquisition module is further configured as:
根据第一虚拟地址空间,从页表中查找处理组件标签;其中,处理组件标签包含在(属于、或者位于都行,不要写成动作)第一虚拟地址空间的页表的目标页表项中;页表为在预先分配第一虚拟地址空间时建立;目标页表项为页表中用于记录第一虚拟地址空间对应的物理地址空间信息的页表项。According to the first virtual address space, search the processing component label from the page table; wherein, the processing component label is included in the target page table entry of the page table of the first virtual address space (belonging to, or located in, do not write it as an action); The page table is established when the first virtual address space is pre-allocated; the target page table entry is a page table entry in the page table used to record the physical address space information corresponding to the first virtual address space.
根据第二方面,或者以上第二方面的任意一种实现方式,第一处理组件的处理结果可以包括更新页表;其中,更新页表为第一处理组件为第一虚拟地址空间分配物理地址空间,并基于物理地址空间对标页表项进行更新得到;从而第一访存请求组件可以根据更新页表,访问第一虚拟地址空间。According to the second aspect, or any implementation of the second aspect above, the processing result of the first processing component may include updating the page table; wherein updating the page table means that the first processing component allocates a physical address space to the first virtual address space. , and is obtained by updating the target page table entry based on the physical address space; thus, the first memory access request component can access the first virtual address space based on the updated page table.
根据第二方面,或者以上第二方面的任意一种实现方式,处理组件标签为根据第一虚拟地址空间的内存类型,和内存类型对应的处理组件的组件标识生成。According to the second aspect, or any implementation of the above second aspect, the processing component label is generated according to the memory type of the first virtual address space and the component identifier of the processing component corresponding to the memory type.
根据第二方面,或者以上第二方面的任意一种实现方式,请求获取模块,还被配置为获取第二访问请求,第二访问请求用于指示访问第二虚拟地址空间;According to the second aspect, or any implementation of the second aspect above, the request acquisition module is further configured to obtain a second access request, and the second access request is used to indicate access to the second virtual address space;
标签获取模块,还被配置为若检测到对应于第二虚拟地址空间的第二缺页异常,获取第二虚拟地址空间的处理组件标签;其中,第二虚拟地址空间的处理组件标签用于标识对应于第二虚拟地址空间的第二处理组件;检测第二虚拟地址空间的处理组件标签是否满足预设条件;The label acquisition module is also configured to obtain a processing component label of the second virtual address space if a second page fault exception corresponding to the second virtual address space is detected; wherein the processing component label of the second virtual address space is used to identify Corresponding to the second processing component of the second virtual address space; detecting whether the processing component label of the second virtual address space meets the preset condition;
异常处理模块,还被配置为若不满足,指示指定处理组件对第二缺页异常进行异常处理。指定处理组件对第二缺页异常进行异常处理,可以包括为第二虚拟地址空间分配物理地址空间,也就是第二缺页异常引起的异常已解决,则第二访问请求的请求者例如第二访存请求组件,能够正常访问第二虚拟地址空间。The exception handling module is also configured to instruct the designated processing component to perform exception handling on the second page fault exception if it is not satisfied. Designating a processing component to handle the second page missing exception may include allocating a physical address space for the second virtual address space. That is, the exception caused by the second page missing exception has been resolved, and the requester of the second access request, such as the second The memory access request component can normally access the second virtual address space.
根据第二方面,或者以上第二方面的任意一种实现方式,指定处理组件为匿名页处理组件;相应地,若第一虚拟地址空间的内存类型为匿名页类型,为第一虚拟地址空间分配的处理组件标签为空。According to the second aspect, or any implementation of the second aspect above, the designated processing component is an anonymous page processing component; accordingly, if the memory type of the first virtual address space is the anonymous page type, allocate The processing component label of is empty.
根据第二方面,或者以上第二方面的任意一种实现方式,异常处理模块,进一步被配置为:According to the second aspect, or any implementation of the second aspect above, the exception handling module is further configured as:
基于第一虚拟地址空间的处理组件标签和预先建立的标签与处理组件信息的对应关系,确定目标 处理组件信息;Determine the target based on the processing component label of the first virtual address space and the pre-established correspondence between the label and the processing component information. Process component information;
基于目标处理组件信息,指示第一处理组件对第一缺页异常进行异常处理。Based on the target processing component information, instruct the first processing component to perform exception processing on the first page fault exception.
根据第二方面,或者以上第二方面的任意一种实现方式,装置还包括:According to the second aspect, or any implementation of the second aspect above, the device further includes:
注册模块,被配置为响应于预先分配的至少一种处理组件标签,基于至少一种处理组件标签和至少一种处理组件标签分别对应的处理组件信息,生成键值对;创建记录键值对的缺页异常处理表,得到预先建立的标签与处理组件信息的对应关系。The registration module is configured to respond to the pre-assigned at least one processing component tag, generate a key-value pair based on the at least one processing component tag and the processing component information respectively corresponding to the at least one processing component tag; create a record key-value pair The page missing exception handling table obtains the corresponding relationship between pre-established labels and processing component information.
第二方面以及第二方面的任意一种实现方式分别与第一方面以及第一方面的任意一种实现方式相对应。第二方面以及第二方面的任意一种实现方式所对应的技术效果可参见上述第一方面以及第一方面的任意一种实现方式所对应的技术效果,此处不再赘述。The second aspect and any implementation manner of the second aspect respectively correspond to the first aspect and any implementation manner of the first aspect. The technical effects corresponding to the second aspect and any implementation manner of the second aspect may be referred to the technical effects corresponding to the above-mentioned first aspect and any implementation manner of the first aspect, which will not be described again here.
第三方面,本申请实施例提供一种电子设备,包括:处理器和收发器;存储器,用于存储一个或多个程序;当所述一个或多个程序被所述一个或多个处理器执行,使得所述一个或多个处理器实现如第一方面或第一方面的任一种可能的实现方式中的方法。In a third aspect, embodiments of the present application provide an electronic device, including: a processor and a transceiver; a memory for storing one or more programs; when the one or more programs are processed by the one or more processors Execution causes the one or more processors to implement the method in the first aspect or any possible implementation manner of the first aspect.
第四方面,本申请实施例提供一种计算机可读存储介质,包括计算机程序,其特征在于,当所述计算机程序在计算机系统上运行时,使得所述计算机系统执行如第一方面或第一方面的任一种可能的实现方式中的方法。In a fourth aspect, embodiments of the present application provide a computer-readable storage medium, including a computer program, which is characterized in that when the computer program is run on a computer system, the computer system is caused to execute the first aspect or the first aspect. method in any possible implementation of the aspect.
第五方面,本申请实施例提供一种芯片,包括一个或多个接口电路和一个或多个处理器;所述接口电路用于从电子设备的存储器接收信号,并向所述处理器发送所述信号,所述信号包括存储器中存储的计算机指令;当所述处理器执行所述计算机指令时,使得所述电子设备执行如第二至三方面或第二至三方面的任一种可能的实现方式中的方法。In a fifth aspect, embodiments of the present application provide a chip, including one or more interface circuits and one or more processors; the interface circuit is used to receive signals from a memory of an electronic device and send the data to the processor. The signal includes a computer instruction stored in a memory; when the processor executes the computer instruction, the electronic device is caused to perform any of the possible tasks of the second to third aspects or the second to third aspects. Methods in the implementation.
第六方面,本申请实施例提供一种计算机程序,该计算机程序包括用于执行第一方面或第一方面的任意可能的实现方式中的方法的指令。In a sixth aspect, embodiments of the present application provide a computer program, which includes instructions for executing the method in the first aspect or any possible implementation of the first aspect.
附图说明Description of drawings
图1为示例性示出的一种微内核架构的结构示意图;Figure 1 is a schematic structural diagram of an exemplary microkernel architecture;
图2为示例性示出的多种缺页异常处理服务的示意图;Figure 2 is a schematic diagram of multiple page fault exception handling services exemplarily shown;
图3为示例性示出的一种内存访问方法的流程示意图;Figure 3 is a schematic flow chart of an exemplary memory access method;
图4为示例性示出的一种缺页异常处理方法的处理场景示意图;Figure 4 is a schematic diagram of a processing scenario illustrating an exemplary page missing exception processing method;
图5为示例性示出的一种缺页异常处理架构的结构图;Figure 5 is a structural diagram of an exemplary page fault exception handling architecture;
图6为示例性示出的一种缺页异常处理架构的结构图;Figure 6 is a structural diagram of an exemplary page fault exception handling architecture;
图7为本申请实施例提供的电子设备600的一个示例性的结构图;Figure 7 is an exemplary structural diagram of the electronic device 600 provided by the embodiment of the present application;
图8为本申请实施例提供的添加异常处理组件标签的一个示例性的流程示意图;Figure 8 is an exemplary flow chart of adding an exception handling component label provided by the embodiment of the present application;
图9为本申请实施例提供的异常处理组件标签的添加场景的一个示例性的示意图;Figure 9 is an exemplary schematic diagram of a scenario for adding an exception handling component label provided by an embodiment of the present application;
图10a为示例性示出的已建立映射时页表的一种结构图;Figure 10a is an exemplary structural diagram of a page table when mapping has been established;
图10b为示例性示出的已建立映射时页表的另一种结构图;Figure 10b is an exemplary structural diagram of the page table when mapping has been established;
图10c为本申请实施例提供的记录标签的页表的一种结构图;Figure 10c is a structural diagram of a page table for recording tags provided by an embodiment of the present application;
图10d为本申请实施例提供的记录标签的页表的另一种结构图;Figure 10d is another structural diagram of a page table for recording tags provided by an embodiment of the present application;
图11为示例性示出的一种缺页异常处理架构的结构图;Figure 11 is a structural diagram of an exemplary page fault exception handling architecture;
图12为本申请实施例提供的内存访问方法的一个示例性的流程示意图;Figure 12 is an exemplary flow chart of the memory access method provided by the embodiment of the present application;
图13为示例性示出的一种缺页异常处理表的结构图;Figure 13 is an exemplary structural diagram of a page fault exception handling table;
图14a为示例性示出的一种缺页异常处理架构的结构图;Figure 14a is a structural diagram of an exemplary page fault exception handling architecture;
图14b为示例性示出的一种缺页异常处理架构的结构图;Figure 14b is a structural diagram of an exemplary page fault exception handling architecture;
图15为示例性示出的一种缺页异常处理方法的处理场景示意图; Figure 15 is a schematic diagram of a processing scenario illustrating an exemplary page fault exception handling method;
图16为本申请实施例提供的一种装置1600的一个示例性的示意性框图。Figure 16 is an exemplary schematic block diagram of a device 1600 provided by an embodiment of the present application.
具体实施方式Detailed ways
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by those of ordinary skill in the art without creative efforts fall within the scope of protection of this application.
本文中术语“和/或”,仅仅是一种描述关联对象的关联关系,表示可以存在三种关系,例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B这三种情况。The term "and/or" in this article is just an association relationship that describes related objects, indicating that three relationships can exist. For example, A and/or B can mean: A exists alone, A and B exist simultaneously, and they exist alone. B these three situations.
本申请实施例的说明书和权利要求书中的术语“第一”和“第二”等是用于区别不同的对象,而不是用于描述对象的特定顺序。例如,第一目标对象和第二目标对象等是用于区别不同的目标对象,而不是用于描述目标对象的特定顺序。The terms “first” and “second” in the description and claims of the embodiments of this application are used to distinguish different objects, rather than to describe a specific order of objects. For example, the first target object, the second target object, etc. are used to distinguish different target objects, rather than to describe a specific order of the target objects.
在本申请实施例中,“示例性的”或者“例如”等词用于表示作例子、例证或说明。本申请实施例中被描述为“示例性的”或者“例如”的任何实施例或设计方案不应被解释为比其它实施例或设计方案更优选或更具优势。确切而言,使用“示例性的”或者“例如”等词旨在以具体方式呈现相关概念。In the embodiments of this application, words such as "exemplary" or "for example" are used to represent examples, illustrations or explanations. Any embodiment or design described as "exemplary" or "such as" in the embodiments of the present application is not to be construed as preferred or advantageous over other embodiments or designs. Rather, use of the words "exemplary" or "such as" is intended to present the concept in a concrete manner.
在本申请实施例的描述中,除非另有说明,“多个”的含义是指两个或两个以上。例如,多个处理单元是指两个或两个以上的处理单元;多个系统是指两个或两个以上的系统。In the description of the embodiments of this application, unless otherwise specified, the meaning of “plurality” refers to two or more. For example, multiple processing units refer to two or more processing units; multiple systems refer to two or more systems.
在本申请实施例的描述中,除非另有说明,“多个”的含义是指两个或两个以上。例如,多个处理单元是指两个或两个以上的处理单元;多个系统是指两个或两个以上的系统。In the description of the embodiments of this application, unless otherwise specified, the meaning of “plurality” refers to two or more. For example, multiple processing units refer to two or more processing units; multiple systems refer to two or more systems.
图1为示例性示出的一种微内核架构的结构示意图。如图1所示,该微内核架构包括:系统服务层和内核层,采用延时处理机制进行内存访问。当微内核进行内存访问时,触发延时处理机制的缺页异常,缺页异常指所请求访问的虚拟地址空间不存在相应的物理地址空间。该微内核架构对缺页异常的处理包括如下步骤:Figure 1 is a schematic structural diagram of an exemplary microkernel architecture. As shown in Figure 1, the microkernel architecture includes: system service layer and kernel layer, which uses a delay processing mechanism for memory access. When the microkernel performs memory access, it triggers a page missing exception of the delay processing mechanism. The page missing exception means that the virtual address space requested to be accessed does not have a corresponding physical address space. The microkernel architecture's handling of page missing exceptions includes the following steps:
S101,微内核发送缺页信息至内存管理服务。S101, the microkernel sends page fault information to the memory management service.
该内存管理服务指运行在内核态的内存管理服务。示例性的,缺页信息可以包括:触发缺页异常的内存访问所请求访问的虚拟地址空间也就是虚拟内存,访问请求标识等内存管理服务进行物理地址空间分配所依据的信息。其中,虚拟地址空间是指:操作系统为每个进程单独设置的地址空间,以保证进程的隔离性。虚拟地址空间也可以称为虚拟内存,是一种逻辑概念上的内存。The memory management service refers to the memory management service running in the kernel state. For example, the page fault information may include: the virtual address space requested by the memory access that triggers the page fault exception, that is, the virtual memory, the access request identifier and other information based on which the memory management service allocates the physical address space. Among them, the virtual address space refers to the address space set separately by the operating system for each process to ensure the isolation of the process. Virtual address space can also be called virtual memory, which is a logical concept of memory.
与虚拟地址空间对应的是物理地址空间,也可以称为物理内存。物理地址空间是指实际的内存资源。操作系统将虚拟地址空间和物理地址空间进行关联,以实现对内存资源的实际访问,从而通过虚拟地址空间这一逻辑概念上的内存,实现对实际内存更加灵活地访问和管理。Corresponding to the virtual address space is the physical address space, which can also be called physical memory. Physical address space refers to the actual memory resources. The operating system associates the virtual address space with the physical address space to achieve actual access to memory resources, thereby achieving more flexible access and management of actual memory through the logical concept of virtual address space.
S102,内存管理服务转发缺页信息至缺页异常处理服务。S102. The memory management service forwards the page fault information to the page fault exception handling service.
该内存管理服务运行在内核态,可以作为特定缺页异常处理者。该内存管理服务可以根据缺页信息,确定缺页异常处理者,从而转发缺页信息至缺页异常处理服务。微内核架构中通常将不同的系统服务(如内存管理服务,文件管理服务,驱动管理服务等),分别以组件的形式分布在相互独立的服务进程中。其中,针对不同系统服务的访问请求访问不同的虚拟地址空间。This memory management service runs in kernel mode and can serve as a specific page fault exception handler. The memory management service can determine the page missing exception handler based on the page missing information, thereby forwarding the page missing information to the page missing exception handling service. In the microkernel architecture, different system services (such as memory management services, file management services, driver management services, etc.) are usually distributed in the form of components in independent service processes. Among them, access requests for different system services access different virtual address spaces.
示例性的,图2为示例性示出的多种缺页异常处理服务的示意图。如图2所示,操作系统可以对虚拟地址空间进行不固定的划分:匿名内存,IO内存,文件内存和IO内存等。不固定的划分可以得到对应有两个不同虚拟地址空间范围的IO内存。该不固定的划分可以依据对虚拟地址空间的使用需求进行,可以根据使用需求灵活变化。Exemplarily, FIG. 2 is a schematic diagram illustrating multiple page fault exception handling services. As shown in Figure 2, the operating system can divide the virtual address space into unfixed divisions: anonymous memory, IO memory, file memory and IO memory, etc. Unfixed partitioning can result in IO memory corresponding to two different virtual address space ranges. The non-fixed division can be carried out according to the usage requirements of the virtual address space, and can be flexibly changed according to the usage requirements.
继续参见图2,访存请求者访问上述虚拟地址空间之一,即可触发缺页异常并产生缺页信息。从而微内核可以捕捉到该缺页异常以及缺页信息,内存管理服务可以根据微内核转发的缺页信息,确定用于应对不同地址空间的缺页异常的异常处理服务也就是异常处理者。例如,针对匿名内存的匿名内存缺页异常处理服务(如内核态或用户态的内存管理服务),针对文件内存的文件内存缺页异常处理服务(如文件管理服务),针对IO内存缺页异常处理服务(如驱动管理服务)。可见,这样的内存访问存在进程间通信(Inter-process communication,IPC)。例如,内存管理服务与文件管理服务之间的进程间通信。内存访问对效率存在一定需求,属于性能敏感路径,而IPC对性能敏感路径有较大的负面影响,导致内存访问效率下降。 Continuing to refer to Figure 2, when a memory access requester accesses one of the above virtual address spaces, a page fault exception is triggered and page fault information is generated. Therefore, the microkernel can capture the page fault exception and the page fault information, and the memory management service can determine the exception handling service, that is, the exception handler, to handle the page fault exception in different address spaces based on the page fault information forwarded by the microkernel. For example, anonymous memory page fault exception processing services for anonymous memory (such as kernel mode or user mode memory management services), file memory page fault exception processing services for file memory (such as file management services), IO memory page fault exception processing services Processing services (such as driver management services). It can be seen that there is inter-process communication (IPC) for such memory access. For example, inter-process communication between memory management services and file management services. Memory access has certain requirements for efficiency and is a performance-sensitive path. IPC has a large negative impact on performance-sensitive paths, resulting in a decrease in memory access efficiency.
示例性的,图3为示例性示出的一种内存访问方法的流程示意图。如图3所示,应用于图1所示的微内核架构进行的内存访问,可以包括如下步骤:Exemplarily, FIG. 3 is a schematic flow chart of a memory access method. As shown in Figure 3, memory access applied to the microkernel architecture shown in Figure 1 can include the following steps:
S301,内存管理服务分配虚拟地址空间。S301, the memory management service allocates a virtual address space.
示例性的,内存管理服务可以在接收到微内核发送的内存分配指令时,分配虚拟地址空间。其中,内存分配指令为微内核获取(如检测、接收)到访存请求者(如访存请求组件)的内存访问请求时生成并发送至内存管理服务。内存分配指令中可以包含访问请求的标识、请求访问的目标对象的信息等等。For example, the memory management service can allocate a virtual address space when receiving a memory allocation instruction sent by the microkernel. Among them, the memory allocation instruction is generated when the microkernel obtains (such as detects and receives) a memory access request from a memory access requester (such as a memory access request component) and sends it to the memory management service. The memory allocation instruction may include the identification of the access request, information about the target object requested to be accessed, etc.
S302,微内核检测到虚拟地址空间的缺页异常。S302, the microkernel detects a page fault exception in the virtual address space.
在内存管理分配虚拟地址空间后,访存请求者访问该虚拟地址空间。此时,按照延迟加载机制,微内核捕捉到访存请求者对该虚拟地址空间的访问所导致的缺页异常,也就是检测到虚拟地址空间的缺页异常。After the memory management allocates the virtual address space, the memory requester accesses the virtual address space. At this time, according to the delayed loading mechanism, the microkernel captures the page fault exception caused by the memory requester's access to the virtual address space, that is, it detects the page fault exception in the virtual address space.
S303,微内核发送缺页信息至内存管理服务。S303, the microkernel sends page fault information to the memory management service.
微内核在检测到虚拟地址空间的缺页异常时,发送缺页信息至内存管理服务。When the microkernel detects a page missing exception in the virtual address space, it sends page missing information to the memory management service.
S304,内存管理服务发送缺页信息至缺页异常处理服务。S304. The memory management service sends the page fault information to the page fault exception handling service.
图3实施例中的S303至S304,与上述图1实施例中的S101至S102为相同步骤,详见上述图1实施例的描述,此处不再赘述。S303 to S304 in the embodiment of FIG. 3 are the same steps as S101 to S102 in the embodiment of FIG. 1. For details, please refer to the description of the embodiment of FIG. 1 and will not be described again here.
S305,缺页异常处理服务基于缺页信息,分配物理地址空间。S305: The page fault exception handling service allocates a physical address space based on the page fault information.
缺页异常处理服务接收到内存管理服务发送的缺页信息后,可以基于缺页信息,分配物理地址空间。示例性的,缺页异常处理服务可以根据缺页信息,从划分物理存储空间(如内存)得到的多个物理页中选择一个物理页,确定为所分配的物理地址空间。或者,缺页异常处理服务可以根据缺页信息,通过文件管理模块和驱动模块,将物理存储空间(如磁盘)上的数据复制到内存的某一个物理页,然后将该物理页确定为所分配的物理地址空间为。具体的物理地址空间分配方式可以参见相关已有技术,此处不再赘述。After the page fault exception handling service receives the page fault information sent by the memory management service, it can allocate the physical address space based on the page fault information. For example, the page fault exception handling service can select one physical page from multiple physical pages obtained by dividing the physical storage space (such as memory) according to the page fault information, and determine it as the allocated physical address space. Alternatively, the page missing exception handling service can copy the data on the physical storage space (such as a disk) to a certain physical page in the memory through the file management module and the driver module based on the page missing information, and then determine the physical page as the allocated The physical address space is. For specific physical address space allocation methods, please refer to relevant existing technologies and will not be described again here.
S306,缺页异常处理服务基于分配结果,创建记录虚拟地址空间与物理地址空间的映射关系的页表。S306: The page fault exception handling service creates a page table that records the mapping relationship between the virtual address space and the physical address space based on the allocation result.
缺页异常处理服务在分配物理地址空间后,可以基于分配结果也就是所分配的物理地址空间,创建记录虚拟地址空间与物理地址空间的映射关系的页表。页表是一种数据结构,记录的映射关系可以实现对虚拟地址空间和物理地址空间的关联。After the page fault exception handling service allocates the physical address space, it can create a page table that records the mapping relationship between the virtual address space and the physical address space based on the allocation result, that is, the allocated physical address space. The page table is a data structure, and the recorded mapping relationship can realize the association between the virtual address space and the physical address space.
S307,缺页异常处理服务对页表进行存储。S307: The page fault exception handling service stores the page table.
缺页异常处理服务在创建了页表后,可以将页表存储至微内核能够访问的存储空间中,例如,存储至内存中。After the page fault exception handling service creates the page table, it can store the page table in a storage space that the microkernel can access, for example, in memory.
S308,缺页异常处理服务发送异常处理反馈至微内核。S308: The page fault exception handling service sends exception handling feedback to the microkernel.
在一种情况中,缺页异常处理服务存储了页表后,可以发送异常处理反馈至微内核,以告知微内核缺页异常处理完成。在另一种情况中,缺页异常处理服务可以不告知微内核缺页异常处理完成,也就无需发送异常处理反馈至微内核。缺页异常处理服务对缺页异常处理完成,可以包括:缺页异常处理服务为发生缺页异常的虚拟地址空间分配物理地址空间。这样,访存请求者可以根据页表,进行虚拟地址空间的访问。示例性的,访存请求者根据页表,进行虚拟地址空间的访问,具体可以包括:访存请求者按照页表记录的映射关系,确定与虚拟地址空间对应的目标物理地址空间,访问目标物理地址空间。可以理解的是,访存请求者对目标物理地址空间的访问方式可以根据目标访问请求确定,具体可以包括:读取目标物理地址空间中的目标资源,或者,将目标资源写入目标物理地址空间。目标访问请求指上述虚拟地址空间对应的访问请求,目标资源可以根据目标访问请求表明的资源标识等信息确定。In one case, after the page fault exception handling service stores the page table, it can send exception handling feedback to the microkernel to inform the microkernel that the page fault exception processing is completed. In another case, the page fault exception handling service does not need to inform the microkernel that the page fault exception processing is completed, and there is no need to send exception handling feedback to the microkernel. The page fault exception handling service completes the page fault exception processing, which may include: the page fault exception processing service allocates a physical address space to the virtual address space where the page fault exception occurs. In this way, the memory access requester can access the virtual address space according to the page table. For example, the memory access requester accesses the virtual address space according to the page table, which may include: the memory access requester determines the target physical address space corresponding to the virtual address space according to the mapping relationship recorded in the page table, and accesses the target physical address space. address space. It can be understood that the access method of the memory access requester to the target physical address space can be determined according to the target access request, which may specifically include: reading the target resource in the target physical address space, or writing the target resource into the target physical address space. . The target access request refers to the access request corresponding to the above-mentioned virtual address space, and the target resource can be determined based on the resource identifier and other information indicated by the target access request.
以上微内核对缺页异常的检测,缺页异常处理服务完成缺页异常处理后,访存请求者对内存访问的具体方式,均为示例性描述,具体可以参见相关已有技术,本申请对此不作限制。The above microkernel's detection of page missing exceptions, and the specific ways in which the memory access requester accesses the memory after the page missing exception handling service completes the page missing exception processing are all exemplary descriptions. For details, please refer to the relevant prior art. This application describes This is not a limitation.
图4为示例性示出的一种缺页异常处理方法的处理场景示意图。如图4所示,操作系统对虚拟地址空间进行固定划分,得到的匿名内存,文件内存和IO内存分别对应唯一的虚拟地址空间范围。例如,参见图2,图2的不固定划分下IO内存可以对应有两个不同的虚拟地址空间范围,而图4的固定划分 下IO内存对应唯一的虚拟地址空间范围。不同的虚拟地址空间范围对应不同的缺页异常处理服务。例如,匿名内存的虚拟地址空间范围对应匿名内存缺页异常处理服务,文件内存的虚拟地址空间范围对应文件内存缺页异常处理服务,IO内存的虚拟地址空间范围对应IO内存缺页异常处理服务。当发生缺页异常时,微内核可以根据该缺页异常对应的虚拟地址空间所述虚拟地址空间范围,直接确定缺页异常处理服务。这样,微内核可以与缺页异常处理者直接交互,无需通过内存管理服务进行,减少了进程间通信。FIG. 4 is a schematic diagram of a processing scenario illustrating an exemplary page fault exception processing method. As shown in Figure 4, the operating system performs a fixed division of the virtual address space, and the resulting anonymous memory, file memory and IO memory respectively correspond to unique virtual address space ranges. For example, see Figure 2. The IO memory under the unfixed division in Figure 2 can correspond to two different virtual address space ranges, while the fixed division in Figure 4 The lower IO memory corresponds to a unique virtual address space range. Different virtual address space ranges correspond to different page fault exception handling services. For example, the virtual address space range of anonymous memory corresponds to the anonymous memory page missing exception handling service, the virtual address space range of file memory corresponds to the file memory page missing exception handling service, and the virtual address space range of IO memory corresponds to the IO memory page missing exception handling service. When a page missing exception occurs, the microkernel can directly determine the page missing exception handling service based on the virtual address space range of the virtual address space corresponding to the page missing exception. In this way, the microkernel can interact directly with the page fault exception handler without going through the memory management service, reducing inter-process communication.
但是,图4实施例中固定划分虚拟地址空间,导致无法按照使用需求灵活划分。这样的固定限制也容易导致适用场景受限。示例性的,可移植操作系统接口(Portable Operating System Interface of UNIX,POSIX,是IEEE为要在各种UNIX操作系统上运行的软件,而定义API的一系列互相关联的标准的总称)不对匿名内存,文件内存和IO内存的虚拟地址范围做限制,导致图4实施例与POSIX不兼容。However, in the embodiment of Figure 4, the virtual address space is fixedly divided, resulting in the inability to flexibly divide it according to usage requirements. Such fixed restrictions can also easily lead to limited applicable scenarios. Exemplarily, the Portable Operating System Interface of UNIX (POSIX, which is the general name of a series of interrelated standards defined by IEEE for software to run on various UNIX operating systems) does not apply to anonymous memory. , the virtual address ranges of file memory and IO memory are limited, causing the embodiment in Figure 4 to be incompatible with POSIX.
本申请实施例提供一种内存访问方法。该方法中,微内核在检测到访问请求对应的虚拟地址空间的缺页异常时,可以基于该虚拟地址空间的异常处理组件标签,直接确定缺页异常处理服务,从而直接与缺页异常处理服务交互,实现内存访问。这样,可以避免特定异常处理者与缺页异常处理者间的进程间交互,从而提高内存访问的效率。其中,根据虚拟地址空间的内存类型添加的处理组件标签,可以直接指示该内存类型的缺页异常处理组件,与按照内存类型固定划分的虚拟地址空间范围相比,可以保证对虚拟地址空间的灵活使用,避免固定划分虚拟地址空间范围导致的应用场景不兼容的问题。The embodiment of this application provides a memory access method. In this method, when the microkernel detects a page fault exception in the virtual address space corresponding to the access request, it can directly determine the page fault exception processing service based on the exception handling component label of the virtual address space, thereby directly communicating with the page fault exception processing service Interaction to achieve memory access. In this way, the inter-process interaction between the specific exception handler and the page fault exception handler can be avoided, thereby improving the efficiency of memory access. Among them, the processing component tag added according to the memory type of the virtual address space can directly indicate the page fault exception processing component of the memory type. Compared with the fixed division of the virtual address space range according to the memory type, the flexibility of the virtual address space can be guaranteed. Use to avoid incompatibility problems in application scenarios caused by fixed division of virtual address space ranges.
为了方便描述,后续本申请实施例以微内核为例进行说明,本申请中的内存访问方法同样适用于无线射频拉远单元(Remote Radio Unit,RRU)、智能电视、膝上型计算机、桌上型计算机、掌上型计算机(如平板电脑、智能手机等)、智能穿戴设备(如智能手环、智能手表、智能戒指等)等电子设备。For the convenience of description, the following embodiments of the present application will be described using a microkernel as an example. The memory access method in this application is also applicable to wireless radio frequency remote units (RRUs), smart TVs, laptop computers, and desktop computers. Electronic devices such as small computers, handheld computers (such as tablet computers, smart phones, etc.), smart wearable devices (such as smart bracelets, smart watches, smart rings, etc.).
本申请实施例可以应用于电子设备的内核。示例性的,图5为示例性示出的一种缺页异常处理架构的结构图。如图5所示,电子设备可以包括具有微内核架构的操作系统,具体可以包括系统服务层和内核层。本申请实施例中,通过内核层的微内核以及系统服务层的缺页异常处理服务进行缺页异常处理,以实现内存访问。The embodiments of the present application can be applied to the core of electronic equipment. Exemplarily, FIG. 5 is a structural diagram of an exemplary page fault exception handling architecture. As shown in Figure 5, the electronic device may include an operating system with a microkernel architecture, which specifically may include a system service layer and a kernel layer. In the embodiment of the present application, page fault exception processing is performed through the microkernel of the kernel layer and the page fault exception processing service of the system service layer to implement memory access.
可以理解的是,本申请实施例示意的结构并不构成对上述电子设备的具体限定。在本申请另一些实施例中,上述电子设备可以包括比图示更多或更少的部件,或者组合某些部件,或者拆分某些部件,或者不同的部件布置。图示的部件可以以硬件,软件或软件和硬件的组合实现。It can be understood that the structures illustrated in the embodiments of the present application do not constitute specific limitations to the above-mentioned electronic devices. In other embodiments of the present application, the above-mentioned electronic device may include more or fewer components than shown in the figures, or some components may be combined, some components may be separated, or some components may be arranged differently. The components illustrated may be implemented in hardware, software, or a combination of software and hardware.
在一种示例中,图6为示例性示出的一种缺页异常处理架构的结构图。如图6所示,上述电子设备中的操作系统可以为包括存在多个运行域的微内核架构。图6所示架构与图5类似,区别在于运行域(domain)的数量为n个,n大于1。例如,运行域D1,运行域D2,……,和运行域Dn。每个运行域用于运行属于不同进程的系统服务。例如,缺页异常处理服务可以包括运行在运行域D1至运行域Dn的多个进程,也就是说,每个运行域中可以运行有缺页异常处理服务,不同运行域之间相互独立。微内核对每个运行域进行相同的处理与交互。本实施例提供的多个运行域的操作系统一般用于存在资源隔离需求的场景。例如,车载OS(Operating System)场景下控制子系统和娱乐子系统有隔离性需求,该车载OS可以为图6所示的架构。In an example, FIG. 6 is a structural diagram illustrating a page fault exception handling architecture. As shown in FIG. 6 , the operating system in the above-mentioned electronic device may include a microkernel architecture with multiple operating domains. The architecture shown in Figure 6 is similar to Figure 5, except that the number of operating domains is n, and n is greater than 1. For example, running domain D1, running domain D2,..., and running domain Dn. Each runtime domain is used to run system services belonging to different processes. For example, the page fault exception handling service may include multiple processes running in the running domain D1 to the running domain Dn. That is to say, the page missing exception handling service may run in each running domain, and different running domains are independent of each other. The microkernel performs the same processing and interaction on each operating domain. The operating systems of multiple operating domains provided in this embodiment are generally used in scenarios where resource isolation is required. For example, in a car OS (Operating System) scenario, the control subsystem and entertainment subsystem have isolation requirements. The car OS can have the architecture shown in Figure 6.
在另一种示例中,上述电子设备可以为另一种结构,该结构同样适用于智能手机等电子设备。图7为本申请实施例提供的电子设备600的一个示例性的结构图,如图7所示,电子设备600可以为图5或者图6所示架构所属的电子设备。In another example, the above-mentioned electronic device may have another structure, which structure is also applicable to electronic devices such as smartphones. FIG. 7 is an exemplary structural diagram of an electronic device 600 provided by an embodiment of the present application. As shown in FIG. 7 , the electronic device 600 may be an electronic device belonging to the architecture shown in FIG. 5 or FIG. 6 .
应该理解的是,图7所示电子设备600仅是一个范例,并且电子设备600可以具有比图中所示的更多的或者更少的部件,可以组合两个或多个的部件,或者可以具有不同的部件配置。图7中所示出的各种部件可以在包括一个或多个信号处理和/或专用集成电路在内的硬件、软件、或硬件和软件的组合中实现。It should be understood that the electronic device 600 shown in FIG. 7 is only an example, and the electronic device 600 may have more or fewer components than shown in the figure, may combine two or more components, or may Available in different component configurations. The various components shown in Figure 7 may be implemented in hardware, software, or a combination of hardware and software including one or more signal processing and/or application specific integrated circuits.
电子设备600可以包括:处理器610,外部存储器接口620,内部存储器621,通用串行总线(universal serial bus,USB)接口630,充电管理模块640,电源管理模块641,电池642,天线1,天线2,移动通信模块650,无线通信模块660,音频模块670,扬声器670A,受话器670B,麦克风670C,耳机接 口670D,传感器模块680,按键690,马达691,指示器692,摄像头693,显示屏694,以及用户标识模块(subscriber identification module,SIM)卡接口695等。其中传感器模块680可以包括压力传感器680A,陀螺仪传感器680B,气压传感器680C,磁传感器680D,加速度传感器680E,距离传感器680F,接近光传感器680G,指纹传感器680H,温度传感器680J,触摸传感器680K,环境光传感器680L,骨传导传感器680M等。The electronic device 600 may include: a processor 610, an external memory interface 620, an internal memory 621, a universal serial bus (USB) interface 630, a charging management module 640, a power management module 641, a battery 642, an antenna 1, an antenna 2. Mobile communication module 650, wireless communication module 660, audio module 670, speaker 670A, receiver 670B, microphone 670C, headphone connector Port 670D, sensor module 680, button 690, motor 691, indicator 692, camera 693, display screen 694, and subscriber identification module (subscriber identification module, SIM) card interface 695, etc. The sensor module 680 may include a pressure sensor 680A, a gyro sensor 680B, an air pressure sensor 680C, a magnetic sensor 680D, an acceleration sensor 680E, a distance sensor 680F, a proximity light sensor 680G, a fingerprint sensor 680H, a temperature sensor 680J, a touch sensor 680K, and ambient light. Sensor 680L, bone conduction sensor 680M, etc.
处理器610可以包括一个或多个处理单元,例如:处理器610可以包括应用处理器(application processor,AP),调制解调处理器,图形处理器(graphics processing unit,GPU),图像信号处理器(image signal processor,ISP),控制器,存储器,视频编解码器,数字信号处理器(digital signal processor,DSP),基带处理器,和/或神经网络处理器(neural-network processing unit,NPU)等。其中,不同的处理单元可以是独立的器件,也可以集成在一个或多个处理器中。The processor 610 may include one or more processing units. For example, the processor 610 may include an application processor (application processor, AP), a modem processor, a graphics processing unit (GPU), and an image signal processor. (image signal processor, ISP), controller, memory, video codec, digital signal processor (digital signal processor, DSP), baseband processor, and/or neural-network processing unit (NPU) wait. Among them, different processing units can be independent devices or integrated in one or more processors.
其中,控制器可以是电子设备600的神经中枢和指挥中心。控制器可以根据指令操作码和时序信号,产生操作控制信号,完成取指令和执行指令的控制。The controller may be the nerve center and command center of the electronic device 600 . The controller can generate operation control signals based on the instruction operation code and timing signals to complete the control of fetching and executing instructions.
处理器610中还可以设置存储器,用于存储指令和数据。在一些实施例中,处理器610中的存储器为高速缓冲存储器。该存储器可以保存处理器610刚用过或循环使用的指令或数据。如果处理器610需要再次使用该指令或数据,可从所述存储器中直接调用。避免了重复存取,减少了处理器610的等待时间,因而提高了系统的效率。The processor 610 may also be provided with a memory for storing instructions and data. In some embodiments, the memory in processor 610 is cache memory. This memory may hold instructions or data that have been recently used or recycled by processor 610 . If processor 610 needs to use the instructions or data again, it can be called directly from the memory. Repeated access is avoided and the waiting time of the processor 610 is reduced, thus improving the efficiency of the system.
在一些实施例中,处理器610可以包括一个或多个接口。接口可以包括集成电路(inter-integrated circuit,I2C)接口,集成电路内置音频(inter-integrated circuit sound,I2S)接口,脉冲编码调制(pulse code modulation,PCM)接口,通用异步收发传输器(universal asynchronous receiver/transmitter,UART)接口,移动产业处理器接口(mobile industry processor interface,MIPI),通用输入输出(general-purpose input/output,GPIO)接口,用户标识模块(subscriber identity module,SIM)接口,和/或通用串行总线(universal serial bus,USB)接口等。In some embodiments, processor 610 may include one or more interfaces. Interfaces may include integrated circuit (inter-integrated circuit, I2C) interface, integrated circuit built-in audio (inter-integrated circuit sound, I2S) interface, pulse code modulation (pulse code modulation, PCM) interface, universal asynchronous receiver and transmitter (universal asynchronous receiver/transmitter (UART) interface, mobile industry processor interface (MIPI), general-purpose input/output (GPIO) interface, subscriber identity module (SIM) interface, and /or universal serial bus (USB) interface, etc.
I2C接口是一种双向同步串行总线,包括一根串行数据线(serial data line,SDA)和一根串行时钟线(derail clock line,SCL)。在一些实施例中,处理器610可以包含多组I2C总线。处理器610可以通过不同的I2C总线接口分别耦合触摸传感器680K,充电器,闪光灯,摄像头693等。例如:处理器610可以通过I2C接口耦合触摸传感器580K,使处理器610与触摸传感器680K通过I2C总线接口通信,实现电子设备600的触摸功能。The I2C interface is a bidirectional synchronous serial bus, including a serial data line (SDA) and a serial clock line (derail clock line, SCL). In some embodiments, processor 610 may include multiple sets of I2C buses. The processor 610 can separately couple the touch sensor 680K, charger, flash, camera 693, etc. through different I2C bus interfaces. For example, the processor 610 can be coupled to the touch sensor 580K through an I2C interface, so that the processor 610 and the touch sensor 680K communicate through the I2C bus interface to implement the touch function of the electronic device 600 .
I2S接口可以用于音频通信。在一些实施例中,处理器610可以包含多组I2S总线。处理器610可以通过I2S总线与音频模块670耦合,实现处理器610与音频模块670之间的通信。在一些实施例中,音频模块670可以通过I2S接口向无线通信模块660传递音频信号,实现通过蓝牙耳机接听电话的功能。The I2S interface can be used for audio communication. In some embodiments, processor 610 may include multiple sets of I2S buses. The processor 610 can be coupled with the audio module 670 through the I2S bus to implement communication between the processor 610 and the audio module 670. In some embodiments, the audio module 670 can transmit audio signals to the wireless communication module 660 through the I2S interface to implement the function of answering calls through a Bluetooth headset.
PCM接口也可以用于音频通信,将模拟信号抽样,量化和编码。在一些实施例中,音频模块670与无线通信模块660可以通过PCM总线接口耦合。在一些实施例中,音频模块670也可以通过PCM接口向无线通信模块660传递音频信号,实现通过蓝牙耳机接听电话的功能。所述I2S接口和所述PCM接口都可以用于音频通信。The PCM interface can also be used for audio communications to sample, quantize and encode analog signals. In some embodiments, the audio module 670 and the wireless communication module 660 may be coupled through a PCM bus interface. In some embodiments, the audio module 670 can also transmit audio signals to the wireless communication module 660 through the PCM interface to implement the function of answering calls through a Bluetooth headset. Both the I2S interface and the PCM interface can be used for audio communication.
UART接口是一种通用串行数据总线,用于异步通信。该总线可以为双向通信总线。它将要传输的数据在串行通信与并行通信之间转换。在一些实施例中,UART接口通常被用于连接处理器610与无线通信模块660。例如:处理器610通过UART接口与无线通信模块660中的蓝牙模块通信,实现蓝牙功能。在一些实施例中,音频模块670可以通过UART接口向无线通信模块660传递音频信号,实现通过蓝牙耳机播放音乐的功能。The UART interface is a universal serial data bus used for asynchronous communication. The bus can be a bidirectional communication bus. It converts the data to be transmitted between serial communication and parallel communication. In some embodiments, a UART interface is typically used to connect the processor 610 and the wireless communication module 660 . For example, the processor 610 communicates with the Bluetooth module in the wireless communication module 660 through the UART interface to implement the Bluetooth function. In some embodiments, the audio module 670 can transmit audio signals to the wireless communication module 660 through the UART interface to implement the function of playing music through the Bluetooth headset.
MIPI接口可以被用于连接处理器610与显示屏694,摄像头693等外围器件。MIPI接口包括摄像头串行接口(camera serial interface,CSI),显示屏串行接口(display serial interface,DSI)等。在一些实施例中,处理器610和摄像头693通过CSI接口通信,实现电子设备600的拍摄功能。处理器610和显示屏694通过DSI接口通信,实现电子设备600的显示功能。The MIPI interface can be used to connect the processor 610 with peripheral devices such as the display screen 694 and the camera 693 . MIPI interfaces include camera serial interface (CSI), display serial interface (DSI), etc. In some embodiments, the processor 610 and the camera 693 communicate through the CSI interface to implement the shooting function of the electronic device 600 . The processor 610 and the display screen 694 communicate through the DSI interface to implement the display function of the electronic device 600 .
GPIO接口可以通过软件配置。GPIO接口可以被配置为控制信号,也可被配置为数据信号。在一些实施例中,GPIO接口可以用于连接处理器610与摄像头693,显示屏694,无线通信模块660,音频模块670,传感器模块680等。GPIO接口还可以被配置为I2C接口,I2S接口,UART接口,MIPI 接口等。The GPIO interface can be configured through software. The GPIO interface can be configured as a control signal or as a data signal. In some embodiments, the GPIO interface can be used to connect the processor 610 with the camera 693, display screen 694, wireless communication module 660, audio module 670, sensor module 680, etc. The GPIO interface can also be configured as an I2C interface, I2S interface, UART interface, MIPI Interface etc.
USB接口630是符合USB标准规范的接口,具体可以是Mini USB接口,Micro USB接口,USB Type C接口等。USB接口530可以用于连接充电器为电子设备600充电,也可以用于电子设备600与外围设备之间传输数据。也可以用于连接耳机,通过耳机播放音频。该接口还可以用于连接其他电子设备,例如AR设备等。The USB interface 630 is an interface that complies with the USB standard specifications. Specifically, it can be a Mini USB interface, a Micro USB interface, a USB Type C interface, etc. The USB interface 530 can be used to connect a charger to charge the electronic device 600, and can also be used to transmit data between the electronic device 600 and peripheral devices. It can also be used to connect headphones to play audio through them. This interface can also be used to connect other electronic devices, such as AR devices, etc.
应该理解的是,本申请实施例示意的各模块间的接口连接关系,只是示意性说明,并不构成对电子设备600的结构限定。在本申请另一些实施例中,电子设备600也可以采用上述实施例中不同的接口连接方式,或多种接口连接方式的组合。It should be understood that the interface connection relationship between the modules illustrated in the embodiment of the present application is only a schematic illustration and does not constitute a structural limitation of the electronic device 600 . In other embodiments of the present application, the electronic device 600 may also adopt different interface connection methods in the above embodiments, or a combination of multiple interface connection methods.
充电管理模块640用于从充电器接收充电输入。其中,充电器可以是无线充电器,也可以是有线充电器。在一些有线充电的实施例中,充电管理模块640可以通过USB接口630接收有线充电器的充电输入。在一些无线充电的实施例中,充电管理模块640可以通过电子设备600的无线充电线圈接收无线充电输入。充电管理模块640为电池642充电的同时,还可以通过电源管理模块641为电子设备供电。The charge management module 640 is used to receive charging input from the charger. Among them, the charger can be a wireless charger or a wired charger. In some wired charging embodiments, the charging management module 640 may receive charging input from the wired charger through the USB interface 630 . In some wireless charging embodiments, the charging management module 640 may receive wireless charging input through the wireless charging coil of the electronic device 600 . While charging the battery 642, the charging management module 640 can also provide power to the electronic device through the power management module 641.
电源管理模块641用于连接电池642,充电管理模块640与处理器610。电源管理模块641接收电池642和/或充电管理模块640的输入,为处理器610,内部存储器621,外部存储器,显示屏694,摄像头693,和无线通信模块660等供电。电源管理模块641还可以用于检测电池容量,电池循环次数,电池健康状态(漏电,阻抗)等参数。在其他一些实施例中,电源管理模块641也可以设置于处理器610中。在另一些实施例中,电源管理模块641和充电管理模块640也可以设置于同一个器件中。The power management module 641 is used to connect the battery 642, the charging management module 640 and the processor 610. The power management module 641 receives input from the battery 642 and/or the charging management module 640, and supplies power to the processor 610, internal memory 621, external memory, display screen 694, camera 693, wireless communication module 660, etc. The power management module 641 can also be used to detect battery capacity, battery cycle times, battery health status (leakage, impedance) and other parameters. In some other embodiments, the power management module 641 may also be provided in the processor 610. In other embodiments, the power management module 641 and the charging management module 640 can also be provided in the same device.
电子设备600的无线通信功能可以通过天线1,天线2,移动通信模块650,无线通信模块660,调制解调处理器以及基带处理器等实现。The wireless communication function of the electronic device 600 can be implemented through the antenna 1, the antenna 2, the mobile communication module 650, the wireless communication module 660, the modem processor and the baseband processor.
天线1和天线2用于发射和接收电磁波信号。电子设备600中的每个天线可用于覆盖单个或多个通信频带。不同的天线还可以复用,以提高天线的利用率。例如:可以将天线1复用为无线局域网的分集天线。在另外一些实施例中,天线可以和调谐开关结合使用。Antenna 1 and Antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in electronic device 600 may be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve antenna utilization. For example: Antenna 1 can be reused as a diversity antenna for a wireless LAN. In other embodiments, antennas may be used in conjunction with tuning switches.
移动通信模块650可以提供应用在电子设备600上的包括2G/3G/4G/5G等无线通信的解决方案。移动通信模块650可以包括至少一个滤波器,开关,功率放大器,低噪声放大器(low noise amplifier,LNA)等。移动通信模块650可以由天线1接收电磁波,并对接收的电磁波进行滤波,放大等处理,传送至调制解调处理器进行解调。移动通信模块650还可以对经调制解调处理器调制后的信号放大,经天线1转为电磁波辐射出去。在一些实施例中,移动通信模块650的至少部分功能模块可以被设置于处理器610中。在一些实施例中,移动通信模块650的至少部分功能模块可以与处理器610的至少部分模块被设置在同一个器件中。The mobile communication module 650 can provide wireless communication solutions including 2G/3G/4G/5G applied to the electronic device 600 . The mobile communication module 650 may include at least one filter, switch, power amplifier, low noise amplifier (LNA), etc. The mobile communication module 650 can receive electromagnetic waves through the antenna 1, perform filtering, amplification and other processing on the received electromagnetic waves, and transmit them to the modem processor for demodulation. The mobile communication module 650 can also amplify the signal modulated by the modem processor and convert it into electromagnetic waves through the antenna 1 for radiation. In some embodiments, at least part of the functional modules of the mobile communication module 650 may be disposed in the processor 610 . In some embodiments, at least part of the functional modules of the mobile communication module 650 and at least part of the modules of the processor 610 may be provided in the same device.
调制解调处理器可以包括调制器和解调器。其中,调制器用于将待发送的低频基带信号调制成中高频信号。解调器用于将接收的电磁波信号解调为低频基带信号。随后解调器将解调得到的低频基带信号传送至基带处理器处理。低频基带信号经基带处理器处理后,被传递给应用处理器。应用处理器通过音频设备(不限于扬声器670A,受话器670B等)输出声音信号,或通过显示屏694显示图像或视频。在一些实施例中,调制解调处理器可以是独立的器件。在另一些实施例中,调制解调处理器可以独立于处理器610,与移动通信模块650或其他功能模块设置在同一个器件中。A modem processor may include a modulator and a demodulator. Among them, the modulator is used to modulate the low-frequency baseband signal to be sent into a medium-high frequency signal. The demodulator is used to demodulate the received electromagnetic wave signal into a low-frequency baseband signal. The demodulator then transmits the demodulated low-frequency baseband signal to the baseband processor for processing. After the low-frequency baseband signal is processed by the baseband processor, it is passed to the application processor. The application processor outputs sound signals through audio devices (not limited to speaker 670A, receiver 670B, etc.), or displays images or videos through display screen 694. In some embodiments, the modem processor may be a stand-alone device. In other embodiments, the modem processor may be independent of the processor 610 and may be provided in the same device as the mobile communication module 650 or other functional modules.
无线通信模块660可以提供应用在电子设备600上的包括无线局域网(wireless local area networks,WLAN)(如无线保真(wireless fidelity,Wi-Fi)网络),蓝牙(bluetooth,BT),全球导航卫星系统(global navigation satellite system,GNSS),调频(frequency modulation,FM),近距离无线通信技术(near field communication,NFC),红外技术(infrared,IR)等无线通信的解决方案。无线通信模块660可以是集成至少一个通信处理模块的一个或多个器件。无线通信模块660经由天线2接收电磁波,将电磁波信号调频以及滤波处理,将处理后的信号发送到处理器610。无线通信模块660还可以从处理器610接收待发送的信号,对其进行调频,放大,经天线2转为电磁波辐射出去。The wireless communication module 660 can provide applications on the electronic device 600 including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) network), Bluetooth (bluetooth, BT), and global navigation satellites. System (global navigation satellite system, GNSS), frequency modulation (frequency modulation, FM), near field communication technology (near field communication, NFC), infrared technology (infrared, IR) and other wireless communication solutions. The wireless communication module 660 may be one or more devices integrating at least one communication processing module. The wireless communication module 660 receives electromagnetic waves through the antenna 2, frequency modulates and filters the electromagnetic wave signals, and sends the processed signals to the processor 610. The wireless communication module 660 can also receive the signal to be sent from the processor 610, frequency modulate it, amplify it, and convert it into electromagnetic waves through the antenna 2 for radiation.
在一些实施例中,电子设备600的天线1和移动通信模块650耦合,天线2和无线通信模块660耦合,使得电子设备600可以通过无线通信技术与网络以及其他设备通信。所述无线通信技术可以包括全球移动通讯系统(global system for mobile communications,GSM),通用分组无线服务(general packet radio service,GPRS),码分多址接入(code division multiple access,CDMA),宽带码分多址 (wideband code division multiple access,WCDMA),时分码分多址(time-division code division multiple access,TD-SCDMA),长期演进(long term evolution,LTE),BT,GNSS,WLAN,NFC,FM,和/或IR技术等。所述GNSS可以包括全球卫星定位系统(global positioning system,GPS),全球导航卫星系统(global navigation satellite system,GLONASS),北斗卫星导航系统(beidou navigation satellite system,BDS),准天顶卫星系统(quasi-zenith satellite system,QZSS)和/或星基增强系统(satellite based augmentation systems,SBAS)。In some embodiments, the antenna 1 of the electronic device 600 is coupled to the mobile communication module 650, and the antenna 2 is coupled to the wireless communication module 660, so that the electronic device 600 can communicate with the network and other devices through wireless communication technology. The wireless communication technology may include global system for mobile communications (GSM), general packet radio service (GPRS), code division multiple access (CDMA), broadband code division multiple access (wideband code division multiple access, WCDMA), time-division code division multiple access (TD-SCDMA), long term evolution (LTE), BT, GNSS, WLAN, NFC, FM, and /or IR technology, etc. The GNSS may include global positioning system (GPS), global navigation satellite system (GLONASS), Beidou navigation satellite system (BDS), quasi-zenith satellite system (quasi -zenith satellite system (QZSS) and/or satellite based augmentation systems (SBAS).
电子设备600通过GPU,显示屏694,以及应用处理器等实现显示功能。GPU为图像处理的微处理器,连接显示屏694和应用处理器。GPU用于执行数学和几何计算,用于图形渲染。处理器610可包括一个或多个GPU,其执行程序指令以生成或改变显示信息。The electronic device 600 implements display functions through a GPU, a display screen 694, an application processor, and the like. The GPU is an image processing microprocessor and is connected to the display screen 694 and the application processor. GPUs are used to perform mathematical and geometric calculations for graphics rendering. Processor 610 may include one or more GPUs that execute program instructions to generate or alter display information.
显示屏694用于显示图像,视频等。显示屏694包括显示面板。显示面板可以采用液晶显示屏(liquid crystal display,LCD),有机发光二极管(organic light-emitting diode,OLED),有源矩阵有机发光二极体或主动矩阵有机发光二极体(active-matrix organic light emitting diode的,AMOLED),柔性发光二极管(flex light-emitting diode,FLED),Miniled,MicroLed,Micro-oLed,量子点发光二极管(quantum dot light emitting diodes,QLED)等。在一些实施例中,电子设备600可以包括1个或N个显示屏694,N为大于1的正整数。The display screen 694 is used to display images, videos, etc. Display 694 includes a display panel. The display panel can use a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active matrix organic light emitting diode or an active matrix organic light emitting diode (active-matrix organic light emitting diode). emitting diode (AMOLED), flexible light-emitting diode (FLED), Miniled, MicroLed, Micro-oLed, quantum dot light emitting diode (QLED), etc. In some embodiments, the electronic device 600 may include 1 or N display screens 694, where N is a positive integer greater than 1.
电子设备600可以通过ISP,摄像头693,视频编解码器,GPU,显示屏694以及应用处理器等实现拍摄功能。The electronic device 600 can implement the shooting function through an ISP, a camera 693, a video codec, a GPU, a display screen 694, and an application processor.
ISP用于处理摄像头693反馈的数据。例如,拍照时,打开快门,光线通过镜头被传递到摄像头感光元件上,光信号转换为电信号,摄像头感光元件将所述电信号传递给ISP处理,转化为肉眼可见的图像。ISP还可以对图像的噪点,亮度,肤色进行算法优化。ISP还可以对拍摄场景的曝光,色温等参数优化。在一些实施例中,ISP可以设置在摄像头693中。The ISP is used to process the data fed back by the camera 693. For example, when taking a photo, the shutter is opened, the light is transmitted to the camera sensor through the lens, the optical signal is converted into an electrical signal, and the camera sensor passes the electrical signal to the ISP for processing, and converts it into an image visible to the naked eye. ISP can also perform algorithm optimization on image noise, brightness, and skin color. ISP can also optimize the exposure, color temperature and other parameters of the shooting scene. In some embodiments, the ISP may be provided in camera 693.
摄像头693用于捕获静态图像或视频。物体通过镜头生成光学图像投射到感光元件。感光元件可以是电荷耦合器件(charge coupled device,CCD)或互补金属氧化物半导体(complementary metal-oxide-semiconductor,CMOS)光电晶体管。感光元件把光信号转换成电信号,之后将电信号传递给ISP转换成数字图像信号。ISP将数字图像信号输出到DSP加工处理。DSP将数字图像信号转换成标准的RGB,YUV等格式的图像信号。在一些实施例中,电子设备600可以包括1个或N个摄像头693,N为大于1的正整数。Camera 693 is used to capture still images or video. The object passes through the lens to produce an optical image that is projected onto the photosensitive element. The photosensitive element can be a charge coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. The photosensitive element converts the optical signal into an electrical signal, and then passes the electrical signal to the ISP to convert it into a digital image signal. ISP outputs digital image signals to DSP for processing. DSP converts digital image signals into standard RGB, YUV and other format image signals. In some embodiments, the electronic device 600 may include 1 or N cameras 693, where N is a positive integer greater than 1.
数字信号处理器用于处理数字信号,除了可以处理数字图像信号,还可以处理其他数字信号。例如,当电子设备600在频点选择时,数字信号处理器用于对频点能量进行傅里叶变换等。Digital signal processors are used to process digital signals. In addition to digital image signals, they can also process other digital signals. For example, when the electronic device 600 selects a frequency point, the digital signal processor is used to perform Fourier transform on the frequency point energy.
视频编解码器用于对数字视频压缩或解压缩。电子设备600可以支持一种或多种视频编解码器。这样,电子设备600可以播放或录制多种编码格式的视频,例如:动态图像专家组(moving picture experts group,MPEG)1,MPEG2,MPEG3,MPEG4等。Video codecs are used to compress or decompress digital video. Electronic device 600 may support one or more video codecs. In this way, the electronic device 600 can play or record videos in multiple encoding formats, such as: moving picture experts group (MPEG) 1, MPEG2, MPEG3, MPEG4, etc.
NPU为神经网络(neural-network,NN)计算处理器,通过借鉴生物神经网络结构,例如借鉴人脑神经元之间传递模式,对输入信息快速处理,还可以不断的自学习。通过NPU可以实现电子设备600的智能认知等应用,例如:图像识别,人脸识别,语音识别,文本理解等。NPU is a neural network (NN) computing processor. By drawing on the structure of biological neural networks, such as the transmission mode between neurons in the human brain, it can quickly process input information and can continuously learn by itself. Intelligent cognitive applications of the electronic device 600 can be implemented through the NPU, such as image recognition, face recognition, speech recognition, text understanding, etc.
外部存储器接口620可以用于连接外部存储卡,例如Micro SD卡,实现扩展电子设备600的存储能力。外部存储卡通过外部存储器接口620与处理器610通信,实现数据存储功能。例如将音乐,视频等文件保存在外部存储卡中。The external memory interface 620 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 600. The external memory card communicates with the processor 610 through the external memory interface 620 to implement the data storage function. Such as saving music, videos, etc. files in external memory card.
内部存储器621可以用于存储计算机可执行程序代码,所述可执行程序代码包括指令。处理器610通过运行存储在内部存储器621的指令,从而执行电子设备600的各种功能应用以及数据处理。内部存储器621可以包括存储程序区和存储数据区。其中,存储程序区可存储操作系统,至少一个功能所需的应用程序(比如声音播放功能,图像播放功能等)等。存储数据区可存储电子设备600使用过程中所创建的数据(比如音频数据,电话本等)等。此外,内部存储器621可以包括高速随机存取存储器,还可以包括非易失性存储器,例如至少一个磁盘存储器件,闪存器件,通用闪存存储器(universal flash storage,UFS)等。Internal memory 621 may be used to store computer executable program code, which includes instructions. The processor 610 executes instructions stored in the internal memory 621 to execute various functional applications and data processing of the electronic device 600 . The internal memory 621 may include a program storage area and a data storage area. Among them, the stored program area can store an operating system, at least one application program required for a function (such as a sound playback function, an image playback function, etc.). The storage data area may store data created during use of the electronic device 600 (such as audio data, phone book, etc.). In addition, the internal memory 621 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, universal flash storage (UFS), etc.
电子设备600可以通过音频模块670,扬声器670A,受话器670B,麦克风670C,耳机接口670D,以及应用处理器等实现音频功能。例如音乐播放,录音等。 The electronic device 600 can implement audio functions through the audio module 670, the speaker 670A, the receiver 670B, the microphone 670C, the headphone interface 670D, and the application processor. Such as music playback, recording, etc.
音频模块670用于将数字音频信息转换成模拟音频信号输出,也用于将模拟音频输入转换为数字音频信号。音频模块670还可以用于对音频信号编码和解码。在一些实施例中,音频模块670可以设置于处理器610中,或将音频模块670的部分功能模块设置于处理器610中。The audio module 670 is used to convert digital audio information into analog audio signal output, and is also used to convert analog audio input into digital audio signals. Audio module 670 may also be used to encode and decode audio signals. In some embodiments, the audio module 670 may be disposed in the processor 610, or some functional modules of the audio module 670 may be disposed in the processor 610.
下面结合图5,和图8至图11对本申请实施例提供的内存访问方法进行具体介绍。The following is a detailed introduction to the memory access method provided by the embodiment of the present application in conjunction with Figure 5 and Figures 8 to 11.
示例性的,图8为本申请实施例提供的添加异常处理组件标签的一个示例性的流程示意图。预先通过该流程为虚拟地址空间添加异常处理组件标签,以用于在后续内存访问中应对缺页异常,实现内存访问。如图8所示,该流程可以应用于电子设备的内存管理服务,具体可以包括但不限于以下步骤:Exemplarily, FIG. 8 is a schematic flowchart of adding an exception handling component label according to an embodiment of the present application. Through this process, an exception handling component label is added to the virtual address space in advance to respond to page missing exceptions in subsequent memory accesses and implement memory access. As shown in Figure 8, this process can be applied to memory management services of electronic devices, which may include but is not limited to the following steps:
S801,分配虚拟地址空间。S801, allocate virtual address space.
上述S801与本申请图3实施例中的S301为相似步骤,对于相同部分在此不再赘述,详见上述S301的描述。对于不同部分下面结合图9进行具体说明。图9为本申请实施例提供的异常处理组件标签的添加场景的一个示例性的示意图。如图9所示,本实施例中内存管理服务可以包括但不限于虚拟内存分配模块(如Virtual memory allocator),标签生成模块(如fault handler label gen)和标签添加模块(如PTE marker)。内存管理服务调用虚拟内存分配模块执行S901,申请虚拟地址空间,以实现分配虚拟地址空间的效果。例如,整体虚拟地址空间中包括虚拟地址空间0和虚拟地址空间1,内存管理服务调用虚拟内存分配模块向操作系统申请到虚拟地址空间1,从而将该虚拟地址空间分配给目标访问请求。其中,目标访问请求即触发虚拟地址空间分配的访问请求,也就是本申请所进行的内存访问的访问请求。The above-mentioned S801 is a similar step to the S301 in the embodiment of FIG. 3 of the present application, and the same parts will not be described again. For details, please refer to the description of the above-mentioned S301. The different parts will be described in detail below in conjunction with Figure 9. Figure 9 is an exemplary schematic diagram of a scenario of adding an exception handling component label provided by an embodiment of the present application. As shown in Figure 9, the memory management service in this embodiment may include but is not limited to a virtual memory allocation module (such as Virtual memory allocator), a label generation module (such as fault handler label gen), and a label addition module (such as PTE marker). The memory management service calls the virtual memory allocation module to execute S901 and apply for a virtual address space to achieve the effect of allocating the virtual address space. For example, the overall virtual address space includes virtual address space 0 and virtual address space 1. The memory management service calls the virtual memory allocation module to apply for virtual address space 1 from the operating system, thereby allocating the virtual address space to the target access request. Among them, the target access request is the access request that triggers the virtual address space allocation, that is, the access request for the memory access performed by this application.
仍参见图9,在一种可选的实施方式中,内存管理服务在申请到虚拟地址空间后,调用标签生成模块执行S902,生成标签,进而调用标签添加模块执行S903,添加标签。例如,内存管理服务调用标签生成模块生成的标签为标签2,可以将该标签2添加至用于记录异常处理者标签(如标签“PTE”)的数据结构中,该数据结构例如可以是表,该表记录的异常处理者标签例如是标签1。可以理解的是,S902与S901的执行步骤可以不作限定,S902也可以在S901之前执行,或者S902可以和S901同时执行。S902和S901在S903之前执行即可。Still referring to Figure 9, in an optional implementation, after applying for the virtual address space, the memory management service calls the label generation module to perform S902 to generate a label, and then calls the label adding module to perform S903 to add the label. For example, the label generated by the memory management service calling the label generation module is label 2. This label 2 can be added to the data structure used to record the exception handler label (such as the label "PTE"). The data structure can be, for example, a table. The exception handler label recorded in this table is label 1, for example. It can be understood that the execution steps of S902 and S901 are not limited, and S902 can also be executed before S901, or S902 can be executed at the same time as S901. S902 and S901 can be executed before S903.
对于标签生成,在一种可选的实施方式中,标签生成模块生成异常处理者标签的方式可以包括:标签生成模块获取缺页异常处理组件的组件标识也就是进程标识(如service id),基于该标识,确定异常处理者标签,以生成格式统一的缺页异常处理者标签,便于管理。当电子设备为单个运行域的架构时,标签生成模块可以将组件标识确定为异常处理者标签,例如,异常处理者标签可以为标签“文件异常处理组件标签(file fault handler label)”也就是。当电子设备为多个运行域的架构时,例如本申请图6所示的架构时,标签生成模块还可以获取目标访问请求所针对的运行域的域标识(如domain id),将域标识和上述组件标识进行融合,例如进行拼接,得到异常处理者标签,例如,异常处理者标签可以为标签“运行域D1文件异常处理组件标签(D1 file fault handler label)”,或者标签“运行域D1文件异常处理组件标签(domain1 file fault handler label)”。For label generation, in an optional implementation, the way in which the label generation module generates the exception handler label may include: the label generation module obtains the component identification of the page missing exception handling component, which is the process identification (such as service id), based on This identifier determines the exception handler label to generate a page missing exception handler label with a uniform format for easy management. When the electronic device is a single running domain architecture, the label generation module may determine the component identifier as the exception handler label. For example, the exception handler label may be the label "file fault handler label". When the electronic device has an architecture of multiple operating domains, such as the architecture shown in Figure 6 of this application, the label generation module can also obtain the domain identification (such as domain id) of the operating domain targeted by the target access request, and combine the domain identification and The above component identifiers are fused, for example, spliced, to obtain the exception handler label. For example, the exception handler label can be the label "Running domain D1 file fault handler label (D1 file fault handler label)", or the label "Running domain D1 file fault handler label" Exception handling component label (domain1 file fault handler label)".
在一种可选的实施方式中,上述缺页异常处理者标签除了可以用于确定缺页异常处理服务,还可以用于进行权限校验,该权限指建立虚拟地址空间与物理地址空间的映射关系的权限。例如,IO内存缺页异常处理服务(IO manager)发起建立无权限的映射关系:建立内存类型为文件内存的虚拟地址空间与相应的物理地址空间的映射关系时,访存请求者可以根据页表中该虚拟地址空间对应的缺页异常处理者标签,拒绝IO内存缺页异常处理服务的建立请求。这样,可以提高操作系统运行的稳定性。In an optional implementation, the above page fault exception handler tag can be used not only to determine the page fault exception handling service, but also to perform permission verification. The permission refers to establishing a mapping between the virtual address space and the physical address space. relationship permissions. For example, the IO memory page fault exception handling service (IO manager) initiates the establishment of an unauthorized mapping relationship: when establishing a mapping relationship between a virtual address space whose memory type is file memory and the corresponding physical address space, the memory access requester can use the page table to The page fault exception handler label corresponding to the virtual address space in the virtual address space rejects the establishment request of the IO memory page fault exception handling service. In this way, the stability of the operating system can be improved.
对于标签添加,内存管理服务调用标签添加模块执行包括但不限于如下步骤:For label addition, the memory management service calls the label addition module to perform steps including but not limited to the following:
S802,基于分配结果,创建记录虚拟地址空间与物理地址空间的映射关系的页表。S802: Based on the allocation result, create a page table that records the mapping relationship between the virtual address space and the physical address space.
内存管理服务在调用标签生成模块生成异常处理者标签后,调用标签添加模块基于分配结果,创建记录虚拟地址空间与物理地址空间的映射关系的页表。页表在图1所示的操作系统中用于记录虚拟地址空间与物理地址空间的映射关系,在未建立该映射关系的情况下,例如在未分配物理地址空间时,页表存在空缺也就是未使用的页表项。例如,一行页表项包括记录虚拟地址空间信息(如索引)的页表项,和记录物理地址空间信息(如索引)的页表项,未使用的页表项即:未分配物理地址空间的虚拟地址空间所在行中,记录物理地址空间信息(如索引)的页表项。基于此,本申请的内存管理服务在分配虚拟地址空间后,基于分配结果,创建记录虚拟地址空间与 物理地址空间的映射关系的页表,以将缺页异常处理者标签写入到未使用的页表项中。这样,本申请可以直接利用微内核已有数据结构:页表,进行缺页异常处理者标签的存户,从而无需在微内核中引入新的复杂数据结构,在提高内存访问效率的同时,可以保持微内核足够简单的特性。After the memory management service calls the label generation module to generate the exception handler label, it calls the label adding module to create a page table that records the mapping relationship between the virtual address space and the physical address space based on the allocation result. The page table is used in the operating system shown in Figure 1 to record the mapping relationship between the virtual address space and the physical address space. When the mapping relationship is not established, for example, when the physical address space is not allocated, there is a vacancy in the page table. Unused page table entries. For example, a row of page table entries includes page table entries that record virtual address space information (such as indexes), and page table entries that record physical address space information (such as indexes). Unused page table entries are: unallocated physical address space In the row of the virtual address space, the page table entry records the physical address space information (such as index). Based on this, after the memory management service of this application allocates the virtual address space, based on the allocation result, it creates a record of the virtual address space and The page table of the physical address space mapping relationship to write page fault exception handler tags to unused page table entries. In this way, this application can directly use the existing data structure of the microkernel: the page table to store the page missing exception handler label, thereby eliminating the need to introduce new complex data structures into the microkernel. While improving memory access efficiency, it can maintain Microkernel is simple enough.
示例性的,图10a为示例性示出的已建立映射时页表的一种结构图。如图10a所示,一级页表Level0 Page Table的每一行可以包括两个页表项:基地址L0 Addr Base和映射入口Entry0。基地址L0 Addr Base用于记录虚拟地址空间VA的信息,映射入口Entry0用于记录物理地址空间PA的信息。微内核可以获取虚拟地址空间VA中的指定位例如VA[47:39]作为索引,并按照该索引查找一级页表中的基地址L0 Addr Base,从而得到相应的物理地址空间PA[47:39]。图10b为示例性示出的已建立映射时页表的另一种结构图。如图10b所示,在通过多级页表例如三级页表以提高内存访问效率的场景中,页表可以包括:一级页表Level0 Page Table,二级页表Level1 Page Table,三级页表Level2 Page Table和四级页表Level3 Page Table。每级页表与图10a中的一级页表类似,区别在于Level0 Page Table至Level2 Page Table的页表项:映射入口Entry0至映射入口Entry2中,记录的可能为用于对下一级页表进行查找的首地址,而非最终的查找结果物理地址空间的信息。例如,微内核可以执行如下步骤以查找到最终的物理地址空间:Exemplarily, FIG. 10a is an exemplary structural diagram of a page table when mapping has been established. As shown in Figure 10a, each row of the Level0 Page Table can include two page table entries: the base address L0 Addr Base and the mapping entry Entry0. The base address L0 Addr Base is used to record the information of the virtual address space VA, and the mapping entry Entry0 is used to record the information of the physical address space PA. The microkernel can obtain the specified bits in the virtual address space VA, such as VA[47:39], as an index, and search for the base address L0 Addr Base in the first-level page table according to the index, thereby obtaining the corresponding physical address space PA[47: 39]. FIG. 10b is an exemplary structural diagram of the page table when mapping has been established. As shown in Figure 10b, in a scenario where multi-level page tables, such as three-level page tables, are used to improve memory access efficiency, the page tables can include: one-level page table Level0 Page Table, two-level page table Level1 Page Table, three-level page table Table Level2 Page Table and four-level page table Level3 Page Table. Each level page table is similar to the first-level page table in Figure 10a. The difference is that the page table entries from Level0 Page Table to Level2 Page Table: mapping entry Entry0 to mapping entry Entry2, the records may be used for the next level page table. The first address for the search, rather than the physical address space information of the final search result. For example, a microkernel can perform the following steps to find the final physical address space:
微内核获取虚拟地址空间VA中的指定位例如VA[47:39]作为索引,并按照该索引查找一级页表中的基地址L0 Addr Base,得到相应的二级页表Level1 Page Table首地址。微内核从二级页表Level1 Page Table首地址中获取VA[38:30]作为索引,按照该索引查找二级页表中的基地址L1 Addr Base,得到相应的三级页表Level2 Page Table首地址。微内核从三级页表Level2 Page Table首地址中获取VA[29:21]作为索引,按照该索引查找三级页表中的基地址L2 Addr Base,得到相应的四级页表Level3 Page Table首地址。微内核从四级页表Level3 Page Table首地址中获取VA[20:12]作为索引,按照该索引查找四级页表中的基地址L3 Addr Base,得到物理地址空间PA[47:12]。The microkernel obtains the specified bit in the virtual address space VA, such as VA[47:39], as an index, and searches the base address L0 Addr Base in the first-level page table according to the index, and obtains the corresponding first address of the second-level page table Level1 Page Table. . The microkernel obtains VA[38:30] from the first address of the second-level page table Level1 Page Table as an index, searches the base address L1 Addr Base in the second-level page table according to this index, and obtains the corresponding first address of the third-level page table Level2 Page Table. address. The microkernel obtains VA[29:21] from the first address of the third-level page table Level2 Page Table as an index, searches the base address L2 Addr Base in the third-level page table according to this index, and obtains the corresponding first address of the fourth-level page table Level3 Page Table. address. The microkernel obtains VA[20:12] from the first address of the fourth-level page table Level3 Page Table as an index, searches the base address L3 Addr Base in the fourth-level page table according to this index, and obtains the physical address space PA[47:12].
本申请实施例通过S802建立的页表与图10a和图10b中所示的页表类似,区别在于通过S802建立的页表中记录映射入口的页表项为空闲页表项,也就是未使用的页表项。对于相同部分在此不再赘述,详见对图10a和图10b的描述。The page table established through S802 in the embodiment of the present application is similar to the page table shown in Figure 10a and Figure 10b. The difference is that the page table entry recording the mapping entry in the page table established through S802 is a free page table entry, that is, it is not used. page table entry. The same parts will not be described again here. For details, please refer to the description of Figure 10a and Figure 10b.
可以理解的是,结合图3可知,图1所示电子设备在处理缺页异常时创建页表,而本申请在处理缺页异常之前,例如在分配了虚拟内存空间时即创建页表。这样,本申请可以将页表用于记录异常处理者标签,从而将异常处理者标签用于进行缺页异常的处理。It can be understood from Figure 3 that the electronic device shown in Figure 1 creates a page table when handling a page missing exception, but this application creates a page table before handling a page missing exception, for example when virtual memory space is allocated. In this way, this application can use the page table to record the exception handler label, thereby using the exception handler label to handle page missing exceptions.
S803,在页表的物理地址空间信息的页表项中,添加相应虚拟地址空间的处理者标签。S803: Add the handler label of the corresponding virtual address space to the page table entry of the physical address space information of the page table.
内存管理服务调用标签添加模块创建上述存在未使用的页表项的页表后,继续调用标签添加模块在页表的物理地址空间信息的页表项中,添加相应虚拟地址空间的处理者标签。其中,页表的物理地址空间信息的页表项即页表中未使用的页表项,例如图10b中多级页表中最后一级页表中未使用的页表项:映射入口Entry3。示例性的,图10c为本申请实施例提供的记录标签的页表的一种结构图。如图10c所示,内存管理模块可以调用标签添加模块在一级页表Level0的映射入口Entry0中添加异常处理者标签。例如,内存管理模块获取所分配虚拟地址空间VA的VA[47:39]作为索引,按照该索引将异常处理者标签Lablem至一级页表中。图10d为本申请实施例提供记录标签的页表的另一种结构图。如图10d所示,内存管理模块可以调用标签添加模块在多级页表Level3的映射入口Entry3中添加异常处理者标签。例如,内存管理模块获取所分配虚拟地址空间VA的VA[47:39]作为索引,按照该索引,逐级找到四级页表Level3 Page Table中的映射入口Entry3,从而将异常处理者标签Lablem至四级页表Level3 Page Table中。对多级页表中页表项的查找过程可以参见上述图10b的描述,此处不再赘述。After the memory management service calls the label adding module to create the above page table with unused page table entries, it continues to call the label adding module to add the processor label of the corresponding virtual address space in the page table entry of the physical address space information of the page table. Among them, the page table entries of the physical address space information of the page table are unused page table entries in the page table, for example, the unused page table entries in the last level page table in the multi-level page table in Figure 10b: mapping entry Entry3. For example, FIG. 10c is a structural diagram of a page table for recording tags provided by an embodiment of the present application. As shown in Figure 10c, the memory management module can call the label adding module to add the exception handler label in the mapping entry Entry0 of the first-level page table Level0. For example, the memory management module obtains VA[47:39] of the allocated virtual address space VA as an index, and adds the exception handler label Lablem to the first-level page table according to the index. Figure 10d is another structural diagram of a page table for recording tags according to an embodiment of the present application. As shown in Figure 10d, the memory management module can call the label adding module to add the exception handler label in the mapping entry Entry3 of the multi-level page table Level3. For example, the memory management module obtains VA[47:39] of the allocated virtual address space VA as an index. According to this index, it finds the mapping entry Entry3 in the four-level page table Level3 Page Table step by step, thereby changing the exception handler label Lablem to Level 3 Page Table. The search process for page table entries in the multi-level page table can be referred to the description in Figure 10b above, and will not be described again here.
内存管理服务在页表中添加缺页异常处理者标签后存储该页表,即实现为虚拟地址空间添加缺页异常处理者标签的目的。缺页异常处理者标签可以按照虚拟地址空间的类型分为多种,每种 缺页异常处理者标签的数量可以为多个。例如,当内存类型为文件内存的虚拟地址空间的数量为多个时,每个虚拟地址空间对应有一个file fault handler label,也就是说,file fault handler label的数量为多个。The memory management service adds a page-fault exception handler label to the page table and stores the page table, thereby achieving the purpose of adding a page-fault exception handler label to the virtual address space. Page fault exception handler labels can be divided into multiple types according to the type of virtual address space. Each The number of page fault exception handler tags can be multiple. For example, when the memory type is file memory and there are multiple virtual address spaces, each virtual address space corresponds to one file fault handler label. That is to say, the number of file fault handler labels is multiple.
示例性的,图11为示例性示出的一种缺页异常处理架构的结构图。如图11所示,缺页异常处理架构也就是电子设备的架构中包括:系统服务层的用户态内存管理服务中的标签生成模块和标签添加模块,这两个模块与图9实施例中名称相同的模块为相同模块,以实现本申请图8所示的缺页异常处理者标签添加流程和图9所示的标签生成场景的实施例。相应地,S1101包括:用户态内存管理服务调用标签添加模块将标签生成模块生成的异常处理者标签添加至记录异常处理者标签的数据结构中。该系统服务层还可以包括线程管理服务,IO管理服务和文件管理服务等用于处理缺页异常的服务。Exemplarily, FIG. 11 is a structural diagram of an exemplary page fault exception handling architecture. As shown in Figure 11, the page fault exception processing architecture, which is the architecture of the electronic device, includes: a label generation module and a label adding module in the user-mode memory management service of the system service layer. These two modules are the same as those in the embodiment of Figure 9. The same modules are the same modules to implement the page missing exception handler label adding process shown in Figure 8 of this application and the embodiment of the label generation scenario shown in Figure 9 . Correspondingly, S1101 includes: the user-mode memory management service calls the label adding module to add the exception handler label generated by the label generation module to the data structure recording the exception handler label. The system service layer may also include thread management services, IO management services, file management services and other services for handling page missing exceptions.
基于图8实施例添加的异常处理组件标签,示例性的,图12为本申请实施例提供的内存访问方法的一个示例性的流程示意图。如图12所示,该内存访问方法可以包括但不限于以下步骤:Based on the exception handling component tag added in the embodiment of Figure 8, Figure 12 is an exemplary flow chart of the memory access method provided by the embodiment of the present application. As shown in Figure 12, the memory access method may include but is not limited to the following steps:
S1201,微内核检测到虚拟地址空间的缺页异常。S1201, the microkernel detects a page fault exception in the virtual address space.
上述S1201与本申请图3实施例中的S302为相同步骤,在此不再赘述,详见上述S302的描述。The above-mentioned S1201 is the same step as the S302 in the embodiment of FIG. 3 of this application, and will not be described again. For details, please refer to the description of the above-mentioned S302.
S1202,微内核基于虚拟地址空间的处理者标签,确定缺页异常处理服务。S1202, the microkernel determines the page fault exception handling service based on the handler label of the virtual address space.
微内核在检测到虚拟地址空间的缺页异常后,可以基于虚拟地址空间的处理者标签,确定缺页异常处理服务。其中,虚拟地址空间的处理者标签包括:预先根据虚拟地址空间的内存类型,为该虚拟地址空间添加的异常处理组件标签。例如,预先通过上述图8实施例提供的方法添加的异常处理组件标签。每种异常处理组件标签用于指示一种内存类型的虚拟地址空间对应的缺页异常处理服务也就是异常处理组件。例如,对于内存类型为文件类型的虚拟地址空间,也就是说该虚拟地址空间对应的内存为图2所示的文件内存,那么该虚拟地址空间的异常处理组件标签为文件内存缺页异常处理服务标签(如file fault handler label)。After detecting a page missing exception in the virtual address space, the microkernel can determine the page missing exception handling service based on the handler label of the virtual address space. Among them, the handler label of the virtual address space includes: an exception handling component label added to the virtual address space in advance according to the memory type of the virtual address space. For example, the exception handling component tag is added in advance through the method provided in the embodiment of FIG. 8 . Each exception handling component label is used to indicate the page fault exception handling service corresponding to the virtual address space of a memory type, that is, the exception handling component. For example, for a virtual address space whose memory type is a file type, that is to say, the memory corresponding to the virtual address space is the file memory shown in Figure 2, then the exception handling component label of the virtual address space is file memory page fault exception handling service. Label (such as file fault handler label).
在此基础上,微内核基于虚拟地址空间的处理者标签,确定缺页异常处理服务,具体可以包括:微内核从预存的页表中查找存在缺页异常的虚拟地址空间的缺页异常处理者标签,从预先建立的标签与处理服务信息的对应关系中,确定所查找到的标签对应的处理服务信息,根据该处理服务信息确定缺页异常处理服务。微内核查找缺页异常处理者标签的具体方式与图10a和图10b实施例中查找物理地址空间的过程类似,均为遍历页表,区别在于查找结果不同。对于相同部分此处不再赘述,详见上述图10a和图10b实施例的描述。On this basis, the microkernel determines the page fault exception handling service based on the handler label of the virtual address space. Specifically, the microkernel searches for the page fault exception handler of the virtual address space where the page fault exception exists from the pre-stored page table. Tag, determine the processing service information corresponding to the found tag from the pre-established correspondence relationship between tags and processing service information, and determine the page missing exception processing service based on the processing service information. The specific way in which the microkernel searches for the page fault exception handler label is similar to the process of searching the physical address space in the embodiments of Figure 10a and Figure 10b. Both of them traverse the page table. The difference is that the search results are different. The same parts will not be described again here. For details, please refer to the description of the embodiment in Figure 10a and Figure 10b.
在一种可选的实施方式中,图11所示电子设备的内核层中可以包括异常处理注册模块,以建立用户态内存管理服务生成的缺页异常处理者标签与缺页异常处理者的信息(如交互入口,或调用接口等)间的对应关系。其中,内核态内存管理服务属于微内核,该微内核中还可以包括可信计算基础(Trusted Computing Base,TCB)模块和交互通信模块(如IPC模块)。可以理解的是,TCB模块和IPC模块仅为对微内核中模块的示例,具体的功能和调用方式均可参见操作系统中可信计算和进程间通信的已有技术,此处不再赘述。In an optional implementation, the kernel layer of the electronic device shown in Figure 11 may include an exception handling registration module to establish the page missing exception handler label and page missing exception handler information generated by the user mode memory management service. (such as interaction portals, or calling interfaces, etc.). Among them, the kernel-state memory management service belongs to the microkernel, which can also include a Trusted Computing Base (TCB) module and an interactive communication module (such as an IPC module). It can be understood that the TCB module and the IPC module are only examples of modules in the microkernel. For specific functions and calling methods, please refer to the existing technologies of trusted computing and inter-process communication in the operating system, and will not be described again here.
继续参见图11,用户态内存管理服务可以调用标签添加模块执行步骤S1102,发送注册请求至异常处理注册模块,以建立缺页异常处理者标签与缺页异常处理入口(fault handler entry)间的对应关系,也就是注册缺页异常处理入口。示例性的,图13为示例性示出的一种缺页异常处理表的结构图。如图13所示,缺页异常处理者标签与缺页异常处理入口间的对应关系可以为缺页异常处理表(fault handler table)。缺页异常处理表的结构可以为key-value键值对。在一种可选的实施方式中,缺页异常处理表中可以包含一个默认缺页异常处理表项(图中未示出)和若干个具体异常处理者标签对应的缺页异常处理表项。Continuing to refer to Figure 11, the user-mode memory management service can call the label adding module to perform step S1102 and send a registration request to the exception handling registration module to establish the correspondence between the page missing exception handler label and the page missing exception handling entry (fault handler entry). Relationship, that is, registering the page missing exception handling entry. Exemplarily, FIG. 13 is an exemplary structural diagram of a page fault exception handling table. As shown in Figure 13, the corresponding relationship between the page fault exception handler label and the page fault exception processing entry can be a page fault exception handling table (fault handler table). The structure of the page fault exception handling table can be key-value pairs. In an optional implementation, the page-fault exception handling table may include a default page-fault exception handling entry (not shown in the figure) and several page-fault exception handling entries corresponding to specific exception handler tags.
示例性的,继续参见图13。在一种可选的实施方式中,缺页异常处理表的建立遵守以下2个约束:第一个约束为:缺页异常处理表项中的内容不能为空,即作为键的表项default label和作为值的表项default fault handler entry中必须有内容。第二约束为:作为键的不同表项中内容也就是异常处理者标签default label不同,并且每个default label对应一个异常处理入口default fault handler entry。例如,标签label1对应入口fault handler entry1,标签label2对应入口fault handler entry2,……,标签labelm对应入口fault handler entrym。 For example, continue to refer to Figure 13. In an optional implementation, the establishment of the page-fault exception handling table complies with the following two constraints: The first constraint is: the content in the page-fault exception handling table entry cannot be empty, that is, the entry default label as the key There must be content in the table entry default fault handler entry as the value. The second constraint is: the contents of different table entries as keys, that is, the default labels of exception handlers, are different, and each default label corresponds to an exception handling entry, default fault handler entry. For example, label label1 corresponds to the entry fault handler entry1, label label2 corresponds to the entry fault handler entry2,..., label labelm corresponds to the entry fault handler entrym.
在一种可选的实施方式中,基于缺页异常处理表,异常处理注册模块可以抽象出四个原语:fault_handler_table_init,fault_handler_table_register,fault_handler_table_dispatcher,和fault_handler_table_unregister。其中,原语是指由若干条指令组成的程序段,用于实现某个特定功能,在执行过程中不可被中断。下面介绍异常处理注册模块抽象出的每个原语的含义:In an optional implementation, based on the page fault exception handling table, the exception handling registration module can abstract four primitives: fault_handler_table_init, fault_handler_table_register, fault_handler_table_dispatcher, and fault_handler_table_unregister. Among them, a primitive refers to a program segment composed of several instructions, which is used to implement a specific function and cannot be interrupted during execution. The following introduces the meaning of each primitive abstracted by the exception handling registration module:
fault_handler_table_init:初始化缺页异常处理表fault handler table,并指定表项default label和表项default fault handler entry。fault_handler_table_init: Initialize the page fault exception handling table fault handler table, and specify the table item default label and table item default fault handler entry.
fault_handler_table_register:接收标签添加模块发送的缺页异常处理者标签label和fault handler entry键值对,寻找缺页异常处理表中的空闲表项也就是未使用的表项填入该键值对。fault_handler_table_register: Receive the page fault exception handler label label and fault handler entry key-value pair sent by the label adding module, find the free entry in the page fault exception handling table, that is, the unused entry, and fill in the key-value pair.
fault_handler_table_dispatcher:根据输入的label寻找对应表项,返回表项中的入口fault handler entry。可以理解的是,该原语用于确定缺页异常处理者。fault_handler_table_dispatcher: Find the corresponding table entry based on the input label and return the entry fault handler entry in the table entry. It can be understood that this primitive is used to determine the page fault exception handler.
fault_handler_table_unregister:根据输入的label寻找对应表项,并移除对应表项。fault_handler_table_unregister: Find the corresponding table entry based on the input label and remove the corresponding table entry.
微内核中的内核态内存管理服务在确定了缺页异常处理者标签后,调用异常处理注册模块查找上述缺页异常处理表,得到缺页异常处理者的入口fault handler entry。After determining the page-fault exception handler label, the kernel-mode memory management service in the microkernel calls the exception handling registration module to search the above-mentioned page-fault exception handling table and obtains the entry fault handler entry of the page-fault exception handler.
在一种可选的实施方式中,可以设置默认的缺页异常处理者,以在确定缺页异常处理者失败时,将默认的缺页异常处理者作为所确定的缺页异常处理者。确定缺页异常处理者失败可以包括但不限于:遍历页表没有查找到有效也就是符合预设条件的缺页异常处理者标签。例如,访问请求是对虚拟地址空间的进行写的操作,但缺乏写权限会触发缺页异常,该缺页异常可以由缺页异常处理服务进行写权限的补入或者反馈无写权限等缺页异常处理。此时,物理地址空间已分配,可以建立物理地址空间与虚拟地址空间的映射,该虚拟地址空间对应的缺页异常处理者标签就会被覆盖为该物理地址空间,也就是说,被覆盖为物理地址空间和虚拟地址空间的映射关系,而非有效的缺页异常处理者标签,那么微内核可以将缺页异常信息发送给默认的缺页异常处理者,由默认的缺页异常处理者处理该类缺页异常。其中,默认的缺页异常处理者例如可以是匿名内存缺页处理服务。这样,可以适用于不存在有效的缺页异常处理者标签的场景,扩展了本申请的适用范围。In an optional implementation, a default page-fault exception handler can be set, so that when determining that the page-fault exception handler fails, the default page-fault exception handler is used as the determined page-fault exception handler. Determining that the page fault exception handler failed may include but is not limited to: traversing the page table and failing to find a valid page fault exception handler label that meets the preset conditions. For example, the access request is a write operation to the virtual address space, but the lack of write permission will trigger a page missing exception. The page missing exception can be filled in by the page missing exception processing service or feedback the page missing such as no write permission. Exception handling. At this point, the physical address space has been allocated, and the mapping between the physical address space and the virtual address space can be established. The page fault exception handler label corresponding to the virtual address space will be overwritten by the physical address space, that is, it will be overwritten as The mapping relationship between the physical address space and the virtual address space instead of the valid page fault exception handler label, then the microkernel can send the page fault exception information to the default page fault exception handler, which will handle it This type of page fault exception occurs. The default page fault exception handler may be, for example, an anonymous memory page fault processing service. In this way, it can be applied to the scenario where there is no valid page fault exception handler label, which expands the scope of application of the present application.
图14a为示例性示出的一种缺页异常处理架构的结构图。如图14a所示,在图11所示架构的基础上,电子设备还可以包括硬件层,该硬件层具体可以包括CPU,内存,网卡,磁盘等部件。图14b为示例性示出的一种缺页异常处理架构的结构图。如图14b所示,对于多个运行域的电子设备,每个运行域可以包括图12所示的模块,各模块的功能可以参见图11的描述,此处不再赘述。例如,运行域D1包括线程管理服务,IO管理服务,文件管理服务和用户态内存管理服务,用户态内存管理服务中新增有标签生成模块和标签添加模块。运行域D2包括线程管理服务,IO管理服务,文件管理服务和用户态内存管理服务,用户态内存管理服务中新增有标签生成模块和标签添加模块。在一种示例中,图14b所示的架构中还可以包括硬件层,具体可以参见图14a所示的硬件层。Figure 14a is a structural diagram illustrating an exemplary page fault exception handling architecture. As shown in Figure 14a, based on the architecture shown in Figure 11, the electronic device can also include a hardware layer. The hardware layer can specifically include components such as CPU, memory, network card, disk, etc. Figure 14b is a structural diagram illustrating an exemplary page fault exception handling architecture. As shown in Figure 14b, for an electronic device with multiple operating domains, each operating domain may include the modules shown in Figure 12. The functions of each module can be seen in the description of Figure 11, and will not be described again here. For example, running domain D1 includes thread management service, IO management service, file management service and user-mode memory management service. The user-mode memory management service has a new label generation module and a label addition module. Running domain D2 includes thread management service, IO management service, file management service and user-mode memory management service. The user-mode memory management service has a new label generation module and label addition module. In an example, the architecture shown in Figure 14b may also include a hardware layer. For details, please refer to the hardware layer shown in Figure 14a.
可以理解的是,上述图11,图14a和图14b描述的架构,均为对实现图8和图9实施例的电子设备的架构的示例性描述,该电子设备可以包括比图示更多或更少的部件,或者组合某些部件,或者拆分某些部件,或者不同的部件布置。图示的部件可以以硬件,软件或软件和硬件的组合实现。It can be understood that the architectures described in Figure 11, Figure 14a and Figure 14b are all exemplary descriptions of the architecture of the electronic device that implements the embodiments of Figures 8 and 9. The electronic device may include more or Fewer parts, or combining some parts, or splitting some parts, or different parts arrangement. The components illustrated may be implemented in hardware, software, or a combination of software and hardware.
本实施例中,异常处理组件标签可以按照虚拟地址空间的内存类型添加,与按照虚拟地址空间的内存类型固定划分的虚拟地址空间范围相比,可以保证对虚拟地址空间灵活使用,避免固定划分导致的适用场景不兼容问题。In this embodiment, the exception handling component label can be added according to the memory type of the virtual address space. Compared with the fixed division of the virtual address space range according to the memory type of the virtual address space, the flexible use of the virtual address space can be ensured and the fixed division can be avoided. Incompatibility issues in applicable scenarios.
S1203,微内核发送缺页信息至所确定的缺页异常处理服务。S1203. The microkernel sends page fault information to the determined page fault exception handling service.
微内核在确定了异常处理者标签后,可以发送缺页信息至所确定的缺页异常处理服务。示例性的,如图11所示,电子设备中还可以在内核态内存管理服务中新增异常处理调用模块。基于此,微内核中的内核态内存管理服务可以调用异常处理调用模块执行S1103,从异常处理注册模块中查找异常处理入口,异常处理调用模块执行S1204,发送缺页信息至所查找的异常处理入口所指示的缺页异常处理服务(如文件管理服务)。如图14a所示,在图11所示架构的基础上,电子设备还可以包括硬件层,该硬件层具体可以包括CPU,内存,网卡,磁盘等部件。图14b为示例性示出的一种缺页异常处理架构的结构图。如图14b所示,对于多个运行域的电子设备,每个运行域可以包括图11 所示的模块,各模块的功能可以参见图11的描述,此处不再赘述。After the microkernel determines the exception handler label, it can send page fault information to the determined page fault exception handling service. For example, as shown in Figure 11, an exception handling calling module can also be added to the kernel-mode memory management service in the electronic device. Based on this, the kernel-mode memory management service in the microkernel can call the exception handling calling module to execute S1103, find the exception handling entry from the exception handling registration module, and the exception handling calling module executes S1204, and send the page fault information to the found exception handling entry. The indicated page fault exception handling service (such as file management service). As shown in Figure 14a, based on the architecture shown in Figure 11, the electronic device can also include a hardware layer. The hardware layer can specifically include components such as CPU, memory, network card, disk, etc. Figure 14b is a structural diagram illustrating an exemplary page fault exception handling architecture. As shown in Figure 14b, for an electronic device with multiple operating domains, each operating domain may include Figure 11 For the modules shown, the functions of each module can be found in the description in Figure 11 and will not be described again here.
为了便于理解本申请实施例提供的缺页异常的处理流程涉及的不同服务间的交互,参见图5中的以下步骤:In order to facilitate understanding of the interactions between different services involved in the page fault exception processing flow provided by the embodiment of this application, please refer to the following steps in Figure 5:
S501,微内核查找标签。S501, microkernel search tag.
S502,微内核发送缺页信息至标签对应的缺页异常处理服务。S502: The microkernel sends the page fault information to the page fault exception handling service corresponding to the tag.
上述S501至S502与图12中的S1202至S1203为相同步骤,此处不再赘述,详见上述图12实施例中对S1202至S1203的描述。结合图5中S501至S502涉及的服务,可见本申请的内存访问中处理缺页异常避免了系统服务层中的内存管理服务与缺页异常处理服务间的进程间通信,不同服务间的交互发生在内核层与系统服务层之间,系统服务层中不存在为了处理缺页异常进行的进程间通信。The above-mentioned S501 to S502 are the same steps as the S1202 to S1203 in FIG. 12 and will not be described again here. For details, please refer to the description of S1202 to S1203 in the above-mentioned embodiment of FIG. 12 . Combined with the services involved in S501 to S502 in Figure 5, it can be seen that the processing of page missing exceptions in the memory access of this application avoids the inter-process communication between the memory management service and the page missing exception handling service in the system service layer, and the interaction between different services occurs. Between the kernel layer and the system service layer, there is no inter-process communication in the system service layer to handle page fault exceptions.
S1204,缺页异常处理服务基于缺页信息,分配物理地址空间。S1204, the page fault exception handling service allocates the physical address space based on the page fault information.
S1204与图3实施例中的S305为相同步骤,此处不再赘述,详见上述图3实施例对S305的描述。S1204 is the same step as S305 in the embodiment of FIG. 3 and will not be described again here. For details, please refer to the description of S305 in the embodiment of FIG. 3 .
S1205,缺页异常处理服务基于虚拟地址空间与物理地址空间的映射关系,更新物理地址空间信息的页表项。S1205. The page fault exception handling service updates the page table entry of the physical address space information based on the mapping relationship between the virtual address space and the physical address space.
S1205与图3实施例中的S307为相似步骤,对于相同部分此处不再赘述,详见上述图3实施例对S307的描述。区别在于,缺页异常处理服务执行S1205时,存在用于记录缺页异常处理者标签的预存的页表可以直接使用。缺页异常处理服务可以基于虚拟地址空间与物理地址空间的映射关系,更新物理地址空间信息的页表项,也就是将分配的物理地址空间,按照该物理地址空间与虚拟地址空间之间的映射关系,更新至该预存的页表中。例如,预存的页表可以为图10d所示的页表,分配的物理地址空间为物理地址空间PA[47:12],缺页异常处理服务可以按照该物理地址空间与虚拟地址空间VA的映射关系,也就是可以按照图10d查找异常处理者标签Lablem的索引关系,将映射入口Entry3中的异常处理者标签Lablem更新为物理地址空间PA[47:12],得到更新的页表如图10b所示的页表。也就是说,更新前的页表记录虚拟地址空间与异常处理者标签间的映射关系,更新后的页表记录虚拟地址空与所分配的物理地址空间之间的映射关系。S1205 is a similar step to S307 in the embodiment of FIG. 3, and the same parts will not be described again here. For details, please refer to the description of S307 in the embodiment of FIG. 3. The difference is that when the page missing exception handling service executes S1205, there is a pre-stored page table for recording the page missing exception handler label that can be used directly. The page fault exception handling service can update the page table entries of the physical address space information based on the mapping relationship between the virtual address space and the physical address space, that is, the allocated physical address space will be allocated according to the mapping between the physical address space and the virtual address space. relationship, updated to the pre-stored page table. For example, the pre-stored page table can be the page table shown in Figure 10d, and the allocated physical address space is the physical address space PA[47:12]. The page fault exception handling service can be based on the mapping between the physical address space and the virtual address space VA. relationship, that is, you can find the index relationship of the exception handler label Lablem according to Figure 10d, update the exception handler label Lablem in the mapping entry Entry3 to the physical address space PA[47:12], and obtain the updated page table as shown in Figure 10b page table shown. That is to say, the page table before updating records the mapping relationship between the virtual address space and the exception handler tag, and the updated page table records the mapping relationship between the virtual address space and the allocated physical address space.
S1206,缺页异常处理服务发送异常处理反馈至微内核。S1206, the page fault exception handling service sends exception handling feedback to the microkernel.
S1206与图3实施例中的S308为相同步骤,此处不再赘述,详见上述图3实施例对S308的描述。S1206 is the same step as S308 in the embodiment of FIG. 3 and will not be described again here. For details, please refer to the description of S308 in the embodiment of FIG. 3 .
这样,访存请求者可以根据更新的页表,进行虚拟地址空间的访问。访存请求者对虚拟地址空间的具体访问与图3实施例中访存请求者对虚拟地址空间的访问相似,对于相同部分此处不再赘述,详见上述图3实施例的相关描述。区别在于,图12实施例中访存请求者利用的是更新的页表,而非缺页异常处理服务在分配物理地址空间后创建的页表。In this way, the memory access requester can access the virtual address space based on the updated page table. The specific access of the memory access requester to the virtual address space is similar to the access of the memory access requester to the virtual address space in the embodiment of Figure 3. The same parts will not be described again here. For details, see the relevant description of the embodiment of Figure 3. The difference is that in the embodiment of FIG. 12, the memory access requester uses the updated page table instead of the page table created by the page fault exception handling service after allocating the physical address space.
本申请实施例中,微内核在检测到访问请求对应的虚拟地址空间的缺页异常时,可以基于该虚拟地址空间的异常处理组件标签,直接确定缺页异常处理服务,从而直接与缺页异常处理服务交互,实现内存访问。这样,可以避免特定异常处理者与缺页异常处理者间的进程间交互,从而提高内存访问的效率。其中,根据虚拟地址空间的内存类型添加的处理组件标签,可以直接指示该内存类型的缺页异常处理组件,与按照内存类型固定划分的虚拟地址空间范围相比,可以保证对虚拟地址空间的灵活使用,避免固定划分虚拟地址空间范围导致的应用场景不兼容的问题。In the embodiment of the present application, when the microkernel detects a page missing exception in the virtual address space corresponding to the access request, it can directly determine the page missing exception processing service based on the exception handling component label of the virtual address space, thereby directly communicating with the page missing exception. Handle service interactions and implement memory access. In this way, the inter-process interaction between the specific exception handler and the page fault exception handler can be avoided, thereby improving the efficiency of memory access. Among them, the processing component tag added according to the memory type of the virtual address space can directly indicate the page fault exception processing component of the memory type. Compared with the fixed division of the virtual address space range according to the memory type, the flexibility of the virtual address space can be guaranteed. Use to avoid incompatibility problems in application scenarios caused by fixed division of virtual address space ranges.
在一种示例中,在电子设备的启动阶段,内核态的内存管理服务可以调用异常处理注册模块提供的fault_handler_table_init接口初始化预存的缺页异常处理表。在一种可选的实施方式中,当图9中的S902在S901之前执行或者和S901同时执行时,S902可以作为启动阶段的步骤,以生成缺页异常处理者标签。在一种可选的实施方式中,S1102也可以作为启动阶段的步骤,以实现缺页异常处理者入口的注册。In one example, during the startup phase of the electronic device, the kernel-mode memory management service can call the fault_handler_table_init interface provided by the exception handling registration module to initialize the pre-stored page fault exception handling table. In an optional implementation, when S902 in FIG. 9 is executed before S901 or simultaneously with S901, S902 can be used as a step in the startup phase to generate a page missing exception handler label. In an optional implementation, S1102 can also be used as a step in the startup phase to realize the registration of the page missing exception handler entry.
在一种示例中,虚存分配阶段,也就是电子设备的用户态内存管理服务分配虚拟地址空间的阶段,可以包括:用户态内存管理服务分配虚拟地址空间,创建页表,和根据该虚拟地址空间的内存类型确定相应的缺页异常标签,并将缺页异常标签添加至该页表种。In one example, the virtual memory allocation phase, that is, the phase in which the user-mode memory management service of the electronic device allocates the virtual address space, may include: the user-mode memory management service allocates the virtual address space, creates a page table, and based on the virtual address The memory type of the space determines the corresponding page fault exception tag, and the page fault exception tag is added to the page table type.
在一种示例中,缺页异常处理阶段可以包括:微内核通过遍历页表的方式获取发生缺页异常的虚拟地址空间对应的缺页异常标签,微内核中的内核态内存管理服务通过调用异常处理注册模块模块提供的fault_handler_table_dispatcher接口找到缺页异常标签对应的缺页异常处理入口,微内核中的内核态内存管理服务调用异常处理调用模块根据缺页异常处理入口,将缺页异常信息发送给对应的系统服 务处理。In one example, the page fault exception processing stage may include: the microkernel obtains the page fault exception label corresponding to the virtual address space where the page fault exception occurs by traversing the page table, and the kernel mode memory management service in the microkernel obtains the page fault exception label by calling the exception. The fault_handler_table_dispatcher interface provided by the processing registration module module finds the page fault exception processing entry corresponding to the page fault exception tag. The kernel state memory management service in the microkernel calls the exception processing calling module and sends the page fault exception information to the corresponding page fault exception processing entry according to the page fault exception processing entry. system server business processing.
在缺页异常处理阶段之后,可以进入内存访问阶段,具体可以参见上述实施例中对访存请求者访问虚拟地址空间的描述。After the page fault exception processing stage, the memory access stage can be entered. For details, please refer to the description of the memory access requester's access to the virtual address space in the above embodiment.
为了便于理解,下面以不同的缺页异常处理组件为例,对本申请实施例提供的内存访问方法中,缺页异常的处理进行说明。For ease of understanding, the following uses different page-fault exception handling components as examples to describe the processing of page-fault exceptions in the memory access method provided by embodiments of the present application.
示例性的,图15为示例性示出的一种缺页异常处理方法的处理场景示意图。如图15所示,已分配的虚拟地址空间的内存类型,可能为匿名内存,IO内存或者文件内存。下面介绍访问不同内存类型的虚拟地址空间时,所触发的缺页异常的处理过程:Exemplarily, FIG. 15 is a schematic diagram of a processing scenario of a method for handling a page missing exception. As shown in Figure 15, the memory type of the allocated virtual address space may be anonymous memory, IO memory or file memory. The following describes the handling process of page fault exceptions triggered when accessing virtual address spaces of different memory types:
处理IO内存或者文件内存类型的虚拟地址空间对应的缺页异常:Handle page fault exceptions corresponding to virtual address spaces of IO memory or file memory types:
以访问IO内存类型的虚拟地址地址空间触发缺页异常为例。在内核层,缺页异常发生后微内核以遍历(page walk)页表的方式确定该虚拟地址空间对应的页表项,得到缺页异常处理者标签例如IO类型标签“IO异常处理者标签(io fault handler label)”。微内核中的内核态内存管理服务调用异常处理注册模块根据IO类型标签从缺页异常处理表中查找异常处理入口(如异常处理入口1(fault handler entry1))。微内核中的内核态内存管理服务调用异常处理调用模块的fault_handler_table_dispatche接口,将缺页异常分发给系统服务层的IO内存缺页异常处理服务(IO manager)进行处理。Take the page fault exception triggered by accessing the virtual address space of the IO memory type as an example. At the kernel layer, after a page missing exception occurs, the microkernel determines the page table entry corresponding to the virtual address space by traversing the page table (page walk), and obtains the page missing exception handler label, such as the IO type label "IO exception handler label ( io fault handler label)". The kernel-mode memory management service in the microkernel calls the exception handling registration module to find the exception handling entry (such as exception handling entry 1 (fault handler entry1)) from the page fault exception handling table according to the IO type label. The kernel-mode memory management service in the microkernel calls the fault_handler_table_dispatche interface of the exception handling calling module, and distributes the page missing exception to the IO memory page missing exception handling service (IO manager) of the system service layer for processing.
处理文件内存类型的虚拟地址空间对应的缺页异常的过程,与IO内存类型的类似,区别在于具体的异常处理者标签和异常处理服务分别为文件类型标签,文件内存缺页异常处理服务。对于相同部分此处不再赘述,详见上述对IO内存类型的描述。The process of handling the page missing exception corresponding to the virtual address space of the file memory type is similar to that of the IO memory type. The difference is that the specific exception handler label and exception handling service are respectively the file type label and the file memory page missing exception handling service. The same parts will not be repeated here. For details, see the above description of IO memory types.
处理匿名内存类型的虚拟地址空间对应的缺页异常:Handle page fault exceptions corresponding to virtual address spaces of anonymous memory types:
匿名内存类型的虚拟地址空间对应的缺页异常,与IO内存类型的类似,区别在于具体的异常处理者标签和异常处理服务分别为匿名类型标签,匿名内存缺页异常处理服务。对于相同部分此处不再赘述,详见上述对IO内存类型的描述。在一种可选的实施方式中,匿名内存类型的虚拟地址空间往往占比较大,对此,用户态的内存管理服务可以在匿名内存类型的虚拟地址空间对应的物理地址空间页表项中不添加缺页异常处理标签。例如,该物理地址空间页表项可以为空,或者可以为图15中的“无标签”,以精简缺页异常处理流程和降低存储空间成本,从而进一步提高内存访问的效率。此时,可以将匿名内存缺页处理服务作为默认的缺页异常处理服务,这样,在标签缺失的情况下,微内核会把缺页异常信息转发给默认的缺页异常处理者。The page missing exception corresponding to the virtual address space of the anonymous memory type is similar to that of the IO memory type. The difference is that the specific exception handler label and exception handling service are anonymous type label and anonymous memory page missing exception handling service respectively. The same parts will not be repeated here. For details, see the above description of IO memory types. In an optional implementation, the virtual address space of the anonymous memory type often occupies a relatively large area. For this reason, the user-mode memory management service may not be included in the physical address space page table entry corresponding to the virtual address space of the anonymous memory type. Add page missing exception handling label. For example, the physical address space page table entry can be empty, or can be "unlabeled" as shown in Figure 15, to streamline the page fault exception handling process and reduce storage space costs, thereby further improving the efficiency of memory access. At this time, the anonymous memory page fault processing service can be used as the default page fault exception handling service. In this way, when the tag is missing, the microkernel will forward the page fault exception information to the default page fault exception handler.
本申请上述实施例中的缺页异常处理是指映射属性维度也就是内存类型维度的缺页异常处理。可以理解的是,缺页异常处理可以是另一个维度的,此时,存在两种缺页异常:①主缺页中断(Major Page Fault)也称为硬缺页中断(Hard Page Fault),指需要访问的内存不在虚拟地址空间,也不在物理地址空间中,需要从慢速设备载入。慢速设备是指存储区域网络(Storage Area Network,SAN)网络中的一个状态异常的端设备(主机或存储),状态异常表现为端设备(主机或存储)无法正常快速响应。②次缺页中断(Minor Page Fault)也称为软缺页中断(Soft Page Fault),指需要访问的内存不在虚拟地址空间,但是在物理地址空间中,只需要内存管理服务建立物理地址空间和虚拟地址空间的映射关系即可。The page missing exception handling in the above embodiments of the present application refers to the page missing exception handling in the mapping attribute dimension, that is, the memory type dimension. It is understandable that page fault exception processing can be from another dimension. At this time, there are two page fault exceptions: ①Major Page Fault (Major Page Fault) is also called Hard Page Fault (Hard Page Fault), which refers to The memory that needs to be accessed is not in the virtual address space, nor in the physical address space, and needs to be loaded from a slow device. A slow device refers to an abnormal status end device (host or storage) in the Storage Area Network (SAN) network. The abnormal status is manifested in the fact that the end device (host or storage) cannot respond normally and quickly. ② Minor page fault (Minor Page Fault) is also called soft page fault (Soft Page Fault). It means that the memory that needs to be accessed is not in the virtual address space, but in the physical address space. Only the memory management service is required to establish the physical address space and The mapping relationship of the virtual address space is enough.
对于上述①和②中的缺页异常,可以采用与本申请实施例类似的方法,以提高内存访问的效率。区别在于,在上述①和②中的缺页异常处理场景中,缺页异常处理者标签可以按照①和②的差异划分,相应地,缺页异常处理者标签对应的缺页异常处理入口为①和②中的缺页异常的处理单元。具体的处理单元可以参见相关已有技术,此处不再赘述。For the page missing exceptions in the above ① and ②, a method similar to the embodiment of the present application can be adopted to improve the efficiency of memory access. The difference is that in the above page missing exception handling scenarios in ① and ②, the page missing exception handler label can be divided according to the difference between ① and ②. Correspondingly, the page missing exception handling entry corresponding to the page missing exception handler label is ① And the page fault exception processing unit in ②. For specific processing units, please refer to relevant prior art and will not be described again here.
应当理解的是,电子设备为了实现上述功能,其包含了执行各个功能相应的硬件和/或软件模块。结合本文中所公开的实施例描述的各示例的算法步骤,本申请实施例能够以硬件或硬件和计算机软件的结合形式来实现。某个功能究竟以硬件还是计算机软件驱动硬件的方式来执行,取决于技术方案的特定应用和设计约束条件。本领域技术人员可以结合实施例对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请实施例的范围。It should be understood that in order to implement the above functions, the electronic device includes corresponding hardware and/or software modules that perform each function. In conjunction with the algorithm steps of each example described in the embodiments disclosed herein, the embodiments of the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a function is performed by hardware or computer software driving the hardware depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions in conjunction with the embodiments for each specific application, but such implementation should not be considered to be beyond the scope of the embodiments of the present application.
本实施例可以根据上述方法示例对电子设备进行功能模块的划分,例如,可以对应各个功能划分各个功能模块,也可以将两个或两个以上的功能集成在一个处理模块中。上述集成的模块可以采用硬 件的形式实现。需要说明的是,本实施例中对模块的划分是示意性的,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式。This embodiment can divide the electronic device into functional modules according to the above method examples. For example, each functional module can be divided corresponding to each function, or two or more functions can be integrated into one processing module. The above integrated modules can be hard Implemented in the form of software. It should be noted that the division of modules in this embodiment is schematic and is only a logical function division. In actual implementation, there may be other division methods.
一个示例中,图16为本申请实施例提供的一种装置1600的一个示例性的示意性框图,如图16所示,装置1600可包括:处理器1601和收发器/收发管脚1602,可选地,还包括存储器1603。In an example, FIG. 16 is an exemplary schematic block diagram of a device 1600 provided by an embodiment of the present application. As shown in FIG. 16, the device 1600 may include: a processor 1601 and a transceiver/transceiver pin 1602. Optionally, memory 1603 is also included.
装置1600的各个组件通过总线1604耦合在一起,其中总线1604除包括数据总线之外,还包括电源总线、控制总线和状态信号总线。但是为了清楚说明起见,在图中将各种总线都称为总线1604。The various components of device 1600 are coupled together by bus 1604, which includes a power bus, a control bus, and a status signal bus in addition to a data bus. However, for the sake of clarity, various buses are referred to as bus 1604 in the figure.
可选地,存储器1603可以用于前述方法实施例中的指令。该处理器1601可用于执行存储器1603中的指令,并控制接收管脚接收信号,以及控制发送管脚发送信号。Optionally, the memory 1603 may be used for instructions in the foregoing method embodiments. The processor 1601 can be used to execute instructions in the memory 1603, and control the receiving pin to receive signals, and control the transmitting pin to send signals.
装置1600可以是上述方法实施例中的电子设备或电子设备的芯片。The device 1600 may be the electronic device or a chip of the electronic device in the above method embodiment.
其中,上述方法实施例涉及的各步骤的所有相关内容均可以援引到对应功能模块的功能描述,在此不再赘述。All relevant content of each step involved in the above method embodiments can be quoted from the functional description of the corresponding functional module, and will not be described again here.
本实施例还提供一种计算机存储介质,该计算机存储介质中存储有计算机指令,当该计算机指令在电子设备上运行时,使得电子设备执行上述相关方法步骤实现上述实施例中的大屏业务的跨设备流转操控方法。This embodiment also provides a computer storage medium. Computer instructions are stored in the computer storage medium. When the computer instructions are run on an electronic device, the electronic device causes the electronic device to execute the above related method steps to implement the large screen service in the above embodiment. Cross-device transfer control methods.
本实施例还提供了一种计算机程序产品,当该计算机程序产品在计算机上运行时,使得计算机执行上述相关步骤,以实现上述实施例中的大屏业务的跨设备流转操控方法。This embodiment also provides a computer program product. When the computer program product is run on a computer, it causes the computer to perform the above related steps to implement the cross-device flow control method of large-screen services in the above embodiment.
另外,本申请实施例的实施例还提供一种装置,这个装置具体可以是芯片,组件或模块,该装置可包括相连的处理器和存储器;其中,存储器用于存储计算机执行指令,当装置运行时,处理器可执行存储器存储的计算机执行指令,以使芯片执行上述各方法实施例中的大屏业务的跨设备流转操控方法。In addition, the embodiments of the present application also provide a device. This device may be a chip, a component or a module. The device may include a connected processor and a memory; where the memory is used to store computer execution instructions. When the device runs At this time, the processor can execute the computer execution instructions stored in the memory, so that the chip executes the cross-device flow control method of large-screen services in the above method embodiments.
其中,本实施例提供的电子设备、计算机存储介质、计算机程序产品或芯片均用于执行上文所提供的对应的方法,因此,其所能达到的有益效果可参考上文所提供的对应的方法中的有益效果,此处不再赘述。Among them, the electronic equipment, computer storage media, computer program products or chips provided in this embodiment are all used to execute the corresponding methods provided above. Therefore, the beneficial effects they can achieve can be referred to the corresponding methods provided above. The beneficial effects of the method will not be repeated here.
通过以上实施方式的描述,所属领域的技术人员可以了解到,为描述的方便和简洁,仅以上述各功能模块的划分进行举例说明,实际应用中,可以根据需要而将上述功能分配由不同的功能模块完成,即将装置的内部结构划分成不同的功能模块,以完成以上描述的全部或者部分功能。Through the description of the above embodiments, those skilled in the art can understand that for the convenience and simplicity of description, only the division of the above functional modules is used as an example. In practical applications, the above functions can be allocated to different modules according to needs. The functional module is completed, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above.
在本申请实施例所提供的几个实施例中,应该理解到,所揭露的装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,模块或单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个装置,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。In the several embodiments provided in the embodiments of this application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only illustrative. For example, the division of modules or units is only a logical function division. In actual implementation, there may be other division methods, for example, multiple units or components may be combined or can be integrated into another device, or some features can be ignored, or not implemented. On the other hand, the coupling or direct coupling or communication connection between each other shown or discussed may be through some interfaces, and the indirect coupling or communication connection of the devices or units may be in electrical, mechanical or other forms.
作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是一个物理单元或多个物理单元,即可以位于一个地方,或者也可以分布到多个不同地方。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。A unit described as a separate component may or may not be physically separate. A component shown as a unit may be one physical unit or multiple physical units, that is, it may be located in one place, or it may be distributed to multiple different places. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
另外,在本申请实施例各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。In addition, each functional unit in each embodiment of the present application can be integrated into one processing unit, or each unit can exist physically alone, or two or more units can be integrated into one unit. The above integrated units can be implemented in the form of hardware or software functional units.
本申请实施例各个实施例的任意内容,以及同一实施例的任意内容,均可以自由组合。对上述内容的任意组合均在本申请实施例的范围之内。Any contents of various embodiments of the embodiments of this application, as well as any contents of the same embodiment, can be freely combined. Any combination of the above contents is within the scope of the embodiments of the present application.
集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个可读取存储介质中。基于这样的理解,本申请实施例的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该软件产品存储在一个存储介质中,包括若干指令用以使得一个设备(可以是单片机,芯片等)或处理器(processor)执行本申请实施例各个实施例方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(read only memory,ROM)、随机存取存储器(random access memory,RAM)、磁碟或者光盘等各种可以存储程序代码的介质。Integrated units may be stored in a readable storage medium if they are implemented in the form of software functional units and sold or used as independent products. Based on this understanding, the technical solutions of the embodiments of the present application are essentially or contribute to the existing technology, or all or part of the technical solution can be embodied in the form of a software product, and the software product is stored in a storage medium , including several instructions to cause a device (which can be a microcontroller, a chip, etc.) or a processor to execute all or part of the steps of the methods of various embodiments of the embodiments of this application. The aforementioned storage media include: U disk, mobile hard disk, read only memory (ROM), random access memory (RAM), magnetic disk or optical disk and other media that can store program code.
上面结合附图对本申请实施例的实施例进行了描述,但是本申请实施例并不局限于上述的具体实 施方式,上述的具体实施方式仅仅是示意性的,而不是限制性的,本领域的普通技术人员在本申请实施例的启示下,在不脱离本申请实施例宗旨和权利要求所保护的范围情况下,还可做出很多形式,均属于本申请实施例的保护之内。 The embodiments of the present application have been described above in conjunction with the accompanying drawings, but the embodiments of the present application are not limited to the above specific implementations. The above-mentioned specific implementations are only illustrative and not restrictive. Those of ordinary skill in the art, inspired by the embodiments of the present application, can do so without departing from the spirit of the embodiments of the present application and the scope protected by the claims. Under the circumstances, many forms can also be made, all of which fall within the protection of the embodiments of this application.

Claims (18)

  1. 一种内存访问方法,其特征在于,所述方法包括:A memory access method, characterized in that the method includes:
    获取第一访问请求,所述第一访问请求用于指示访问第一虚拟地址空间;Obtain a first access request, the first access request is used to indicate access to the first virtual address space;
    若检测到对应于所述第一虚拟地址空间的第一缺页异常,获取所述第一虚拟地址空间的处理组件标签;其中,所述第一虚拟地址空间的处理组件标签用于标识对应于所述第一虚拟地址空间的第一处理组件;If a first page fault exception corresponding to the first virtual address space is detected, obtain a processing component label of the first virtual address space; wherein, the processing component label of the first virtual address space is used to identify the processing component label corresponding to the first virtual address space. the first processing component of the first virtual address space;
    基于所述第一虚拟地址空间的处理组件标签,指示所述第一处理组件对所述第一缺页异常进行异常处理。Based on the processing component label of the first virtual address space, the first processing component is instructed to perform exception processing on the first page fault exception.
  2. 根据权利要求1所述的方法,其特征在于,所述获取所述第一虚拟地址空间的处理组件标签,包括:The method according to claim 1, characterized in that said obtaining the processing component label of the first virtual address space includes:
    根据所述第一虚拟地址空间,从页表中查找所述处理组件标签;其中,所述处理组件标签包含在所述第一虚拟地址空间的页表的目标页表项中;所述页表为在预先分配所述第一虚拟地址空间时建立;所述目标页表项为所述页表中用于记录所述第一虚拟地址空间对应的物理地址空间信息的页表项。According to the first virtual address space, the processing component label is searched from a page table; wherein the processing component label is included in the target page table entry of the page table of the first virtual address space; the page table It is established when the first virtual address space is pre-allocated; the target page table entry is a page table entry in the page table used to record the physical address space information corresponding to the first virtual address space.
  3. 根据权利要求1或2所述的方法,其特征在于,所述处理组件标签为根据所述第一虚拟地址空间的内存类型,和所述内存类型对应的处理组件的组件标识生成。The method according to claim 1 or 2, characterized in that the processing component label is generated according to the memory type of the first virtual address space and the component identification of the processing component corresponding to the memory type.
  4. 根据权利要求2或3所述的方法,其特征在于,所述基于所述第一虚拟地址空间的处理组件标签,指示所述第一处理组件对所述第一缺页异常进行异常处理之后,所述方法还包括:The method according to claim 2 or 3, characterized in that, after the processing component tag based on the first virtual address space instructs the first processing component to perform exception processing on the first page fault exception, The method also includes:
    获取第二访问请求,所述第二访问请求用于指示访问第二虚拟地址空间;Obtain a second access request, the second access request is used to indicate access to the second virtual address space;
    若检测到对应于所述第二虚拟地址空间的第二缺页异常,获取所述第二虚拟地址空间的处理组件标签;其中,所述第二虚拟地址空间的处理组件标签用于标识对应于所述第二虚拟地址空间的第二处理组件;If a second page fault exception corresponding to the second virtual address space is detected, obtain the processing component label of the second virtual address space; wherein the processing component label of the second virtual address space is used to identify the processing component label corresponding to the second virtual address space. a second processing component of the second virtual address space;
    检测所述第二虚拟地址空间的处理组件标签是否满足预设条件;Detect whether the processing component label of the second virtual address space meets preset conditions;
    若不满足预设条件,指示指定处理组件对所述第二缺页异常进行异常处理。If the preset condition is not met, instruct the designated processing component to perform exception processing on the second page missing exception.
  5. 根据权利要求4所述的方法,其特征在于,所述指定处理组件为匿名页处理组件;相应地,若所述第一虚拟地址空间的内存类型为匿名页类型,为所述第一虚拟地址空间分配的处理组件标签为空。The method of claim 4, wherein the designated processing component is an anonymous page processing component; accordingly, if the memory type of the first virtual address space is an anonymous page type, the first virtual address The processing component label for space allocation is empty.
  6. 根据权利要求1-5中任一项所述的方法,其特征在于,所述基于所述第一虚拟地址空间的处理组件标签,指示所述第一处理组件对所述第一缺页异常进行异常处理,包括:The method according to any one of claims 1 to 5, characterized in that the processing component tag based on the first virtual address space instructs the first processing component to handle the first page fault exception. Exception handling, including:
    基于所述第一虚拟地址空间的处理组件标签和预先建立的标签与处理组件信息的对应关系,确定目标处理组件信息;Determine the target processing component information based on the processing component label of the first virtual address space and the pre-established correspondence between the label and the processing component information;
    基于所述目标处理组件信息,指示所述第一处理组件对所述第一缺页异常进行异常处理。Based on the target processing component information, the first processing component is instructed to perform exception processing on the first page fault exception.
  7. 根据权利要求6所述的方法,其特征在于,所述若检测到所述第一虚拟地址空间对应的第一缺页异常,获取所述第一虚拟地址空间的处理组件标签之前,所述方法还包括:The method according to claim 6, characterized in that if the first page fault exception corresponding to the first virtual address space is detected, before obtaining the processing component label of the first virtual address space, the method Also includes:
    响应于预先分配的至少一种处理组件标签,基于所述至少一种处理组件标签和所述至少一种处理组件标签分别对应的处理组件信息,生成键值对;In response to the pre-assigned at least one processing component label, generate a key-value pair based on the at least one processing component label and the processing component information respectively corresponding to the at least one processing component label;
    创建记录所述键值对的缺页异常处理表,得到所述预先建立的标签与处理组件信息的对应关系。Create a page fault exception handling table that records the key-value pairs, and obtain the corresponding relationship between the pre-established tags and the processing component information.
  8. 一种内存访问装置,其特征在于,所述装置包括:A memory access device, characterized in that the device includes:
    请求获取模块,被配置为获取第一访问请求,所述第一访问请求用于指示访问第一虚拟地址空间;A request acquisition module configured to acquire a first access request, where the first access request is used to indicate access to the first virtual address space;
    标签获取模块,被配置为若检测到对应于所述第一虚拟地址空间的第一缺页异常,获取所述第一虚拟地址空间的处理组件标签;其中,所述第一虚拟地址空间的处理组件标签用于标识对应于所述第一虚拟地址空间的第一处理组件;A label acquisition module configured to obtain a processing component label of the first virtual address space if a first page fault exception corresponding to the first virtual address space is detected; wherein, the processing component of the first virtual address space The component tag is used to identify the first processing component corresponding to the first virtual address space;
    异常处理模块,被配置为基于所述第一虚拟地址空间的处理组件标签,指示所述第一处理组件对所述第一缺页异常进行异常处理。The exception handling module is configured to instruct the first processing component to perform exception handling on the first page fault exception based on the processing component label of the first virtual address space.
  9. 根据权利要求8所述的装置,其特征在于,所述标签获取模块,进一步被配置为:The device according to claim 8, wherein the tag acquisition module is further configured to:
    根据所述第一虚拟地址空间,从页表中查找所述处理组件标签;其中,所述处理组件标签包含在所述第一虚拟地址空间的页表的目标页表项中;所述页表为在预先分配所述第一虚拟地址空间时建立;所述目标页表项为所述页表中用于记录所述第一虚拟地址空间对应的物理地址空间信息的页表项。 According to the first virtual address space, the processing component label is searched from a page table; wherein the processing component label is included in the target page table entry of the page table of the first virtual address space; the page table It is established when the first virtual address space is pre-allocated; the target page table entry is a page table entry in the page table used to record the physical address space information corresponding to the first virtual address space.
  10. 根据权利要求8或9所述的装置,其特征在于,所述处理组件标签为根据所述第一虚拟地址空间的内存类型,和所述内存类型对应的处理组件的组件标识生成。The device according to claim 8 or 9, characterized in that the processing component label is generated according to the memory type of the first virtual address space and the component identifier of the processing component corresponding to the memory type.
  11. 根据权利要求9-10中任一项所述的装置,其特征在于,The device according to any one of claims 9-10, characterized in that,
    所述请求获取模块,还被配置为获取第二访问请求,所述第二访问请求用于指示访问第二虚拟地址空间;The request acquisition module is also configured to acquire a second access request, where the second access request is used to indicate access to the second virtual address space;
    所述标签获取模块,还被配置为若检测到对应于所述第二虚拟地址空间的第二缺页异常,获取所述第二虚拟地址空间的处理组件标签;其中,所述第二虚拟地址空间的处理组件标签用于标识对应于所述第二虚拟地址空间的第二处理组件;检测所述第二虚拟地址空间的处理组件标签是否满足预设条件;The label acquisition module is also configured to obtain the processing component label of the second virtual address space if a second page fault exception corresponding to the second virtual address space is detected; wherein, the second virtual address The processing component label of the space is used to identify the second processing component corresponding to the second virtual address space; detect whether the processing component label of the second virtual address space meets a preset condition;
    所述异常处理模块,还被配置为若不满足预设条件,指示指定处理组件对所述第二缺页异常进行异常处理。The exception handling module is further configured to instruct a designated processing component to perform exception handling on the second page missing exception if the preset condition is not met.
  12. 根据权利要求11所述的装置,其特征在于,所述指定处理组件为匿名页处理组件;相应地,若所述第一虚拟地址空间的内存类型为匿名页类型,为所述第一虚拟地址空间分配的处理组件标签为空。The device according to claim 11, wherein the designated processing component is an anonymous page processing component; accordingly, if the memory type of the first virtual address space is an anonymous page type, the first virtual address The processing component label for space allocation is empty.
  13. 根据权利要求8-12中任一项所述的装置,其特征在于,所述异常处理模块,进一步被配置为:The device according to any one of claims 8-12, characterized in that the exception handling module is further configured to:
    基于所述第一虚拟地址空间的处理组件标签和预先建立的标签与处理组件信息的对应关系,确定目标处理组件信息;Determine the target processing component information based on the processing component label of the first virtual address space and the pre-established correspondence between the label and the processing component information;
    基于所述目标处理组件信息,指示所述第一处理组件对所述第一缺页异常进行异常处理。Based on the target processing component information, the first processing component is instructed to perform exception processing on the first page fault exception.
  14. 根据权利要求13所述的装置,其特征在于,所述装置还包括:The device according to claim 13, characterized in that the device further includes:
    注册模块,被配置为响应于预先分配的至少一种处理组件标签,基于所述至少一种处理组件标签和所述至少一种处理组件标签分别对应的处理组件信息,生成键值对;创建记录所述键值对的缺页异常处理表,得到所述预先建立的标签与处理组件信息的对应关系。a registration module, configured to respond to the pre-assigned at least one processing component tag, generate a key-value pair based on the at least one processing component tag and the processing component information respectively corresponding to the at least one processing component tag; create a record The page fault exception handling table of the key-value pair obtains the corresponding relationship between the pre-established tags and the processing component information.
  15. 一种电子设备,其特征在于,包括:An electronic device, characterized by including:
    处理器和收发器;processors and transceivers;
    存储器,用于存储一个或多个程序;Memory, used to store one or more programs;
    当所述一个或多个程序被所述一个或多个处理器执行,使得所述一个或多个处理器实现如权利要求1至7中任一项所述的方法。When the one or more programs are executed by the one or more processors, the one or more processors are caused to implement the method according to any one of claims 1 to 7.
  16. 一种计算机可读存储介质,其特征在于,包括计算机程序,其特征在于,当所述计算机程序在摄像头上运行时,使得所述摄像头执行如权利要求1至8中任意一项所述的方法。A computer-readable storage medium, characterized in that it includes a computer program, characterized in that, when the computer program is run on a camera, it causes the camera to perform the method according to any one of claims 1 to 8. .
  17. 一种芯片,其特征在于,包括一个或多个接口电路和一个或多个处理器;所述接口电路用于从电子设备的存储器接收信号,并向所述处理器发送所述信号,所述信号包括存储器中存储的计算机指令;当所述处理器执行所述计算机指令时,使得所述电子设备执行权利要求1至7中任意一项所述的方法。A chip, characterized in that it includes one or more interface circuits and one or more processors; the interface circuit is used to receive signals from a memory of an electronic device and send the signals to the processor, and the The signal includes computer instructions stored in the memory; when the processor executes the computer instructions, the electronic device is caused to perform the method of any one of claims 1 to 7.
  18. 一种计算机程序产品,其特征在于,包括计算机程序,当所述计算机程序被电子设备执行时,使得所述电子设备执行权利要求1至7中任意一项所述的方法。 A computer program product, characterized by comprising a computer program that, when executed by an electronic device, causes the electronic device to execute the method described in any one of claims 1 to 7.
PCT/CN2023/104015 2022-07-25 2023-06-29 Memory access method and apparatus WO2024021995A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202210878562.0A CN117407326A (en) 2022-07-25 2022-07-25 Memory access method and device
CN202210878562.0 2022-07-25

Publications (1)

Publication Number Publication Date
WO2024021995A1 true WO2024021995A1 (en) 2024-02-01

Family

ID=89489583

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2023/104015 WO2024021995A1 (en) 2022-07-25 2023-06-29 Memory access method and apparatus

Country Status (2)

Country Link
CN (1) CN117407326A (en)
WO (1) WO2024021995A1 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117851291A (en) * 2024-03-07 2024-04-09 北京象帝先计算技术有限公司 Memory access system, electronic component and electronic equipment

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103853665A (en) * 2012-12-03 2014-06-11 华为技术有限公司 Storage space allocation method and device
US20170123690A1 (en) * 2015-10-30 2017-05-04 International Business Machines Corporation Resolving page faults out of context for shared contexts
US20190310947A1 (en) * 2018-04-05 2019-10-10 International Business Machines Corporation Memory access based i/o operations
CN114579480A (en) * 2022-03-10 2022-06-03 苏州浪潮智能科技有限公司 Page missing processing method, device and system, electronic equipment and storage medium
CN114691391A (en) * 2022-03-14 2022-07-01 阿里巴巴(中国)有限公司 Super-calling method and device for kernel mode program of enhanced packet filter

Family Cites Families (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US4761737A (en) * 1986-01-16 1988-08-02 International Business Machines Corporation Method to automatically increase the segment size of unix files in a page segmented virtual memory data processing system
US9075735B2 (en) * 2012-06-21 2015-07-07 Breakingpoint Systems, Inc. Systems and methods for efficient memory access
CN104216837A (en) * 2013-05-31 2014-12-17 华为技术有限公司 Memory system, memory access request processing method and computer system
CN106383747A (en) * 2016-08-31 2017-02-08 华为技术有限公司 Method and device for scheduling computing resources
CN111435302B (en) * 2019-01-14 2023-06-20 阿里巴巴集团控股有限公司 Application processing method and device
CN114546897A (en) * 2020-11-26 2022-05-27 龙芯中科技术股份有限公司 Memory access method and device, electronic equipment and storage medium
CN113297265A (en) * 2021-02-22 2021-08-24 阿里巴巴集团控股有限公司 Data processing method and device
CN114661414A (en) * 2022-03-04 2022-06-24 阿里巴巴(中国)有限公司 Computing system, memory page fault processing method and storage medium

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103853665A (en) * 2012-12-03 2014-06-11 华为技术有限公司 Storage space allocation method and device
US20170123690A1 (en) * 2015-10-30 2017-05-04 International Business Machines Corporation Resolving page faults out of context for shared contexts
US20190310947A1 (en) * 2018-04-05 2019-10-10 International Business Machines Corporation Memory access based i/o operations
CN114579480A (en) * 2022-03-10 2022-06-03 苏州浪潮智能科技有限公司 Page missing processing method, device and system, electronic equipment and storage medium
CN114691391A (en) * 2022-03-14 2022-07-01 阿里巴巴(中国)有限公司 Super-calling method and device for kernel mode program of enhanced packet filter

Also Published As

Publication number Publication date
CN117407326A (en) 2024-01-16

Similar Documents

Publication Publication Date Title
WO2021036735A1 (en) User interface display method and electronic device
US9600223B2 (en) Method for sharing screen and electronic device thereof
WO2022262530A1 (en) Memory management method and electronic device
WO2021258809A1 (en) Data synchronization method, electronic device, and computer readable storage medium
KR20160008885A (en) Memory Managing Method and Electonic Device
WO2024021995A1 (en) Memory access method and apparatus
WO2021223539A1 (en) Radio frequency resource allocation method and apparatus
WO2022100221A1 (en) Retrieval processing method and apparatus, and storage medium
US20240069850A1 (en) Application Sharing Method, Electronic Device, and Storage Medium
WO2021258795A1 (en) Atomic ability invoking method and terminal device
WO2021104259A1 (en) Method and terminal for data sharing between fast application and native application
WO2021121223A1 (en) Display method of interactive system, interactive system, and electronic device
WO2023051355A1 (en) Permission check method and electronic device
WO2020077497A1 (en) Method and device for domain name resolution by sending key value to grs server
CN114116246A (en) Function calling method and device
WO2022068477A1 (en) Event processing method, and device
KR20150089393A (en) Method for controlling a battery charge and an electronic device
WO2021169379A1 (en) Permission reuse method, permission reuse-based resource access method, and related device
WO2023071441A1 (en) Method and apparatus for displaying letters in contact list, and terminal device
WO2020181505A1 (en) Input method candidate content recommendation method and electronic device
WO2022042245A1 (en) Method for determining physical address, and chip system
KR20150069155A (en) Touch indicator display method of electronic apparatus and electronic appparatus thereof
CN114461589A (en) Method for reading compressed file, file system and electronic equipment
WO2024041219A1 (en) Memory management method, electronic device, chip system, and readable storage medium
WO2023088090A1 (en) File verification method and related device

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 23845208

Country of ref document: EP

Kind code of ref document: A1