CN114238174A - Page table generation method, device and system and related equipment - Google Patents

Page table generation method, device and system and related equipment Download PDF

Info

Publication number
CN114238174A
CN114238174A CN202111525577.0A CN202111525577A CN114238174A CN 114238174 A CN114238174 A CN 114238174A CN 202111525577 A CN202111525577 A CN 202111525577A CN 114238174 A CN114238174 A CN 114238174A
Authority
CN
China
Prior art keywords
page table
address
description information
constraint
level
Prior art date
Legal status (The legal status 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 status listed.)
Pending
Application number
CN202111525577.0A
Other languages
Chinese (zh)
Inventor
喻文星
荣雪宇
李卫婷
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Haiguang Information Technology Co Ltd
Original Assignee
Haiguang Information Technology Co Ltd
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 Haiguang Information Technology Co Ltd filed Critical Haiguang Information Technology Co Ltd
Priority to CN202111525577.0A priority Critical patent/CN114238174A/en
Publication of CN114238174A publication Critical patent/CN114238174A/en
Pending legal-status Critical Current

Links

Images

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/1009Address translation using page tables, e.g. page table structures
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F30/00Computer-aided design [CAD]
    • G06F30/30Circuit design
    • G06F30/32Circuit design at the digital level
    • G06F30/33Design verification, e.g. functional simulation or model checking

Abstract

The embodiment of the invention provides a page table generation method, a page table generation device, a page table generation system and related equipment, wherein the page table generation method comprises the following steps: acquiring user constraint for generating a page table, wherein the user constraint is constraint information acquired based on request parameters of a user; based on the user constraints, determining page table description information for generating a page table and an initial page table structure conforming to the page table description information; obtaining fixed constraint used for generating a page table, wherein the fixed constraint is constraint information preset in a page table generator; updating the page table description information and the initial page table structure based on the fixed constraints; according to the page table description information, in the initial page table structure, page table pointing relations of corresponding page tables at all levels are built step by step from high to low to form a target page table, so that verification requirements of different verification scenes in a verification process can be met.

Description

Page table generation method, device and system and related equipment
Technical Field
The embodiment of the invention relates to the technical field of chips, in particular to a page table generation method, a page table generation device, a page table generation system and related equipment.
Background
Logic verification is a key step in the digital chip front-end design process, and is usually implemented by using a verification platform. Specifically, the verification platform can simulate the actual operation environment of the chip design and verify the correctness of the chip design function.
When performing logic verification in terms of memory management, verification of corresponding processes such as address translation, memory reading and the like is generally required based on an existing page table, and the page table is generally generated by a page table generator based on internal inherent constraints. With the application of technologies such as multi-level page-type substitution and virtualization, a page table generated by the existing page table generation method cannot meet the verification requirements of different verification scenes in the verification process.
Therefore, how to generate a page table satisfying the requirement of verification becomes an urgent problem to be solved by those skilled in the art.
Disclosure of Invention
In view of this, embodiments of the present invention provide a page table generating method, apparatus, system and related device, which can meet verification requirements of different verification scenarios in a verification process.
In order to achieve the above object, the embodiments of the present invention provide the following technical solutions.
The embodiment of the invention provides a page table generation method, which comprises the following steps:
acquiring user constraint for generating a page table, wherein the user constraint is constraint information acquired based on request parameters of a user;
based on the user constraints, determining page table description information for generating a page table and an initial page table structure conforming to the page table description information;
obtaining fixed constraint used for generating a page table, wherein the fixed constraint is constraint information preset in a page table generator;
updating the page table description information and the initial page table structure based on the fixed constraints;
according to the page table description information, in the initial page table structure, the page table pointing relationship of the corresponding page tables of each level is built step by step from high to low to form a target page table.
Optionally, the obtaining the user constraint for generating the page table includes:
obtaining a page table generation request of a user, wherein the page table generation request comprises request parameters for generating a page table;
and determining user constraints according to the request parameters.
Optionally, the step of constructing page table pointing relationships corresponding to page tables of different levels in the initial page table structure from high to low step by step according to the page table description information to form a target page table includes:
configuring a control and status register of the initial page table structure such that the control and status register points to a highest level page table of the initial page table structure;
acquiring a virtual address based on the page table description information;
and according to the page table description information, constructing a page table pointing relation of the virtual address corresponding to the page table at the current level from the highest level page table of the initial page table structure until the lowest level page table of the initial page table structure.
Optionally, the constructing a page table pointing relationship of the virtual address corresponding to the current-level page table includes:
inquiring whether a page table entry corresponding to the virtual address exists in a page table at the current level;
if not, creating a page table entry corresponding to the virtual address, and writing the page table entry into a preset storage position.
Optionally, the constructing a page table pointing relationship of the virtual address corresponding to the current-level page table further includes:
if the page table entry corresponding to the virtual address exists in the page table of the current level, updating the page table entry corresponding to the virtual address according to a preset updating strategy;
wherein the update policy is: and updating the existing page table entries, or executing the step of creating the page table entries corresponding to the virtual addresses and writing the page table entries into a preset storage position to update the page table entries.
Optionally, after obtaining the virtual address based on the page table description information, before constructing a page table pointing relationship of the current-level page table corresponding to the virtual address from the highest-level page table of the initial page table structure according to the page table description information, the method further includes:
determining whether there is an address conflict for the virtual address;
if address conflict exists, executing the step of obtaining the virtual address based on the page table description information again;
and if the address table does not exist, executing the step of constructing the page table pointing relationship of the virtual address corresponding to the page table at the current level from the highest level page table of the initial page table structure according to the page table description information.
Optionally, after obtaining the virtual address based on the page table description information, before constructing a page table pointing relationship of the current-level page table corresponding to the virtual address from the highest-level page table of the initial page table structure according to the page table description information, the method further includes:
determining whether the virtual address itself and its additional attributes meet constraints in page table description information;
if not, executing the step of obtaining the virtual address based on the page table description information again;
and if so, executing the step of constructing the page table pointing relationship of the virtual address corresponding to the page table at the current level from the highest level page table of the initial page table structure according to the page table description information.
Optionally, the current-level page table is a lowest-level page table, and in the step of creating the page table entry corresponding to the virtual address, specifically, the physical address pointed by the page table entry is determined, and the page table entry is created based on information of the physical address.
Optionally, in the step of constructing the page table pointing relationship of the virtual address corresponding to the current-level page table, if the page table description information includes exception test information and the exception test information indicates that the current-level page table generates an exception, after the page table entry corresponding to the virtual address is created, before the page table entry is written into a preset storage location, the method further includes:
and modifying the page table entry according to the exception type in the exception test information so as to inject the exception.
Optionally, in the step of constructing, according to the page table description information, a page table pointing relationship of the virtual address corresponding to the current-level page table from the highest-level page table of the initial page table structure until the lowest-level page table of the initial page table structure, after creating a page table entry corresponding to the virtual address and writing the page table entry into a preset storage location, the method further includes:
judging whether the page table at the current level is the page table at the lowest level;
if not, entering a next-stage page table, and executing the step of inquiring whether a page table entry corresponding to the virtual address exists in the current-stage page table, and if so, returning the created target page table to the user.
Optionally, after the creating the page table entry corresponding to the virtual address and writing the page table entry into a preset storage location, the method further includes:
generating a host page table, wherein a page table entry in the host page table is used for constructing a pointing relationship of the virtual machine physical address to a system physical address.
Optionally, the initial page table structure includes at least a highest level page table of the target page tables.
Optionally, in the step of determining an initial page table structure that conforms to the page table description information, the method includes: the data in the initial page table structure is randomized within the limits defined by the page table descriptive information.
Optionally, in the step of updating the initial page table structure, the method includes: the data in the initial page table structure is randomized within the limits defined by the updated page table description information.
Optionally, the user constraints include one or more of the following:
attribute constraints for determining attributes of memory pages pointed to by physical addresses in a page table;
an address conflict constraint to determine whether an address conflict exists for an address in the page table;
an address range constraint for specifying an address range in the page table to be within a preset range;
an address size constraint to specify an address size;
space type constraints of the same address, which are used for specifying whether the address space type of the same address is allowed to be changed or not;
a fault constraint to determine if a page fault exists in the page table.
An embodiment of the present invention further provides a page table generating device, including:
the user constraint obtaining module is used for obtaining user constraints used for generating the page table, and the user constraints are constraint information obtained based on request parameters of a user;
an initial processing module, configured to determine, based on the user constraint, page table description information used for generating a page table and an initial page table structure conforming to the page table description information;
the fixed constraint obtaining module is used for obtaining fixed constraints used for generating the page table, and the fixed constraints are constraint information preset in the page table generator;
an update processing module to update the page table description information and the initial page table structure based on the fixed constraints;
and the pointing relationship construction module is used for constructing the page table pointing relationship of the corresponding page tables of each level step by step from high to low in the initial page table structure according to the page table description information to form a target page table.
The embodiment of the invention also provides a page table generator, and the page table generator is configured to execute the page table generating method provided by the embodiment of the invention.
The embodiment of the invention also provides a chip verification system, which is configured to execute the page table generation method provided by the embodiment of the invention.
An embodiment of the present invention further provides a computer device, including: at least one memory and at least one processor; the memory stores one or more computer-executable instructions that are called by the processor to perform the page table generation method provided by the embodiments of the present invention.
The embodiment of the present invention further provides a storage medium, where the storage medium stores one or more computer-executable instructions, and the one or more computer-executable instructions are used to execute the page table generation method provided in the embodiment of the present invention.
The embodiment of the invention provides a page table generation method, a page table generation device, a page table generation system and related equipment, wherein the page table generation method comprises the following steps: acquiring user constraint for generating a page table, wherein the user constraint is constraint information acquired based on request parameters of a user; based on the user constraints, determining page table description information for generating a page table and an initial page table structure conforming to the page table description information; obtaining fixed constraint used for generating a page table, wherein the fixed constraint is constraint information preset in a page table generator; updating the page table description information and the initial page table structure based on the fixed constraints; according to the page table description information, in the initial page table structure, the page table pointing relationship of the corresponding page tables of each level is built step by step from high to low to form a target page table.
Therefore, the page table generation method in the embodiment of the invention forms the page table description information and the initial page table structure based on the user constraint and the fixed constraint, and further constructs the target page table based on the page table description information and the initial page table structure, so that the user can provide different user requests based on different verification requirements, further different user constraints are formed, the corresponding target page table is constructed, and the verification requirements under different verification scenes in the verification process are met.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the provided drawings without creative efforts.
Fig. 1 is a schematic diagram of a multi-level page table structure for converting a virtual address to a physical address of a memory page according to an embodiment of the present invention;
FIG. 2 is a block diagram of an alternative structure of a page table generator provided by an embodiment of the present invention;
FIG. 3 is an alternative flow diagram of a page table generation method provided by an embodiment of the present invention;
fig. 4 is an alternative flowchart of step S10 provided by the embodiment of the present invention;
fig. 5 is an alternative flowchart of step S14 provided by the embodiment of the present invention;
fig. 6 is an alternative flowchart of step S142 provided in the embodiment of the present invention;
fig. 7 is an alternative block diagram of a page table generating apparatus according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Based on the background, when performing logic verification in memory management, it is usually necessary to perform verification of corresponding processes such as address translation, memory read, and the like based on an existing page table, and the page table is usually generated by a page table generator based on internal inherent logic.
However, with the application of technologies such as multi-level page-based translation and virtualization, logic verification in memory management is based on different requirements, and a page table meeting the corresponding requirements needs to be implemented in a matching manner. For example, attributes of the physical address pointed to by the page table are matched to validation requirements, or address conflicts are set in the page table, etc. However, the page table generated by the existing inherent constraint is only a fixed system, and obviously, the verification requirements under different verification scenes in the verification process cannot be met.
Based on this, the embodiment of the present invention provides a page table generation method, apparatus, system and related device, where the method includes: acquiring user constraint for generating a page table, wherein the user constraint is constraint information acquired based on request parameters of a user; based on the user constraints, determining page table description information for generating a page table and an initial page table structure conforming to the page table description information; obtaining fixed constraint used for generating a page table, wherein the fixed constraint is constraint information preset in a page table generator; updating the page table description information and the initial page table structure based on the fixed constraints; according to the page table description information, in the initial page table structure, the page table pointing relationship of the corresponding page tables of each level is built step by step from high to low to form a target page table.
Therefore, the page table generation method in the embodiment of the invention forms the page table description information and the initial page table structure based on the user constraint and the fixed constraint, and further constructs the target page table based on the page table description information and the initial page table structure, so that the user can provide different user requests based on different verification requirements, further different user constraints are formed, the corresponding target page table is constructed, and the verification requirements under different verification scenes in the verification process are met.
In an alternative example, to solve the structure of the multi-level page table and the corresponding address translation method, fig. 1 shows a schematic diagram of a multi-level page table structure for translating a virtual address into a physical address of a memory page.
The virtual address can be understood as an address used for translation, the physical address can be understood as a real address of a memory page, and the page table is used for storing an address pointing relationship from the virtual address to the physical address so as to realize the translation from the virtual address to the physical address. The page table may be a multi-level page table, and taking fig. 1 as an example, the page table includes a first-level page table and a plurality of second-level page tables, the first-level page table is used as a highest-level page table and includes a plurality of page table entries, where one page table entry corresponds to a next-level page table (i.e., the second-level page table in this example).
In this example, the physical address of the memory page is described by a 32-bit address, and a CSR (Control and Status Register) can be used to record a page address of a highest-level page table (i.e. a first-level page table in this example), so that the highest-level page table is found by the page address;
taking 20-31 bits of a given virtual address as an offset, and finding a page table entry pointed by the offset in a primary page table, wherein the page table entry is used for indicating a page address of a corresponding secondary page table, so that the secondary page table corresponding to the page table entry is determined according to the page address;
taking 12-19 bits of the virtual address as an offset, and finding a page table entry pointed by the virtual address in a secondary page table, wherein the page table entry is used for indicating 12-31 bits of a corresponding physical address;
and taking 0-12 bits of the virtual address as 0-12 bits of the physical address to obtain the complete physical address.
However, when performing logic verification in memory management, and performing verification of corresponding processes such as address translation and memory reading based on the existing page table, the page table generated by the page table generator based on the internal fixed constraint thereof cannot be flexibly set for different test scenarios.
In an embodiment of the present invention, a method, an apparatus, a system and a related device for generating a page table are provided, so as to correspondingly generate a multi-level page table meeting verification requirements based on different verification requirements.
In an alternative example, referring to an alternative block diagram of the page table generator shown in fig. 2, as shown in fig. 2, the page table generator may include:
an initial page table structure; the initial page table structure may be a guest multi-level page table structure, a host multi-level page table structure, or a normal multi-level page table structure. The initial page table structure is used for storing all page table entries in the process of converting a virtual address into a physical address, wherein the page table entry in each level of page table is used for pointing to a next level of page table.
A CSR configuration information table; the CSR configuration information table is used for recording the address of the highest page table in the multi-level page tables. Depending on the CSR configuration, it may also be determined whether simultaneous multithreading is enabled or whether hardware-assisted memory virtualization is supported. When simultaneous multithreading is started, a plurality of target page tables need to be generated, and when hardware-assisted memory virtualization is supported, two matched target page tables, namely a guest page table and a host page table, need to be generated simultaneously, and the two target page tables are matched with each other. It should be noted that the value of the CSR may be determined when the page table generator creates the object, may be provided randomly, or may be provided by the user.
A virtual address table, a virtual machine physical address table and a system physical address table; these address tables are used to hold the addresses of the target page table generation process applications. The virtual machine physical address table is used for recording virtual machine physical addresses, the virtual machine physical addresses are applied to a memory virtualization process, the mapping relation between the virtual addresses and the virtual machine physical addresses is used for recording in a client page table, and the mapping relation between the virtual machine physical addresses and system physical addresses is used for recording in a host page table.
And the address mapping table is used for recording the address mapping relation in the page table generation process. Each entry in the address mapping table may include a virtual address and a physical address of a memory page, and the address mapping table may further record accessory information corresponding to the address mapping relationship, for example, attribute information of the memory page table and constraint information satisfied by the attribute information.
And the fixed constraint information table is used for recording a fixed constraint preset in the page table generator, and the fixed constraint can be specified during initialization of the page table generator.
It should be noted that the page table generator may be in a singleton mode, which is used to indicate that it has only one instance in the system, so as to ensure the uniform management of global system resources, including the physical address space, the relevant CSR, and so on. Of course, the page table generator is not limited to a single instance mode, as long as the data structure of the page table generator is guaranteed to be unique throughout the verification environment.
Based on the above page table generator, fig. 3 exemplarily shows an alternative flow chart of the page table generating method provided by the embodiment of the present invention. As shown in fig. 3, the page table generating method may include:
step S10: obtaining user constraints for generating a page table;
wherein the user may be understood as a verifier. It will be appreciated that there are different validation requirements for the page table based on different validation scenarios. Based on this, the verifier can describe the corresponding verification requirement in the form of a request parameter, and further can determine a corresponding user constraint based on the request parameter, and accordingly, the generated page table meeting the user constraint is the page table meeting the corresponding verification requirement.
The user constraint is constraint information obtained based on request parameters of the user, and is used for enabling the generated page table to meet the constraint information in the subsequent page table building process.
Step S11: based on the user constraints, determining page table description information for generating a page table and an initial page table structure conforming to the page table description information;
the page table description information may be understood as a condition that needs to be satisfied in the page table generation process. When different constraint information is given in multiple aspects, such as user constraint, fixed constraint and the like, the constraint information given in different aspects can be integrated by updating the page table description information. It can be understood that, in the generation process of the page table, the requirement of the page table description information needs to be satisfied.
The user constraints describe the user's needs for the page table so that page table description information can be determined based on the user constraints. Furthermore, the user constraint may include a constraint on the page table structure or a constraint on a page table entry in the page table, and therefore, the initial page table structure that conforms to the page table description information may be determined based on the constraint on the page table structure in the user constraint.
The initial page table structure may be a frame structure of a page table only, for example, when a multi-level page table needs to be formed, the initial page table structure may be a multi-level page table structure, and correspondingly, the initial page table structure may include a plurality of page tables of different levels, where a page table entry in a page table of the highest level is used to point to a page table of the next level, a page table entry in a page table of the next level is used to point to a page table of the next level, and a page table entry in a page table of the lowest level is used to point to an address range of a specific physical address. It should be noted that the physical address may be an actual host physical address or a client physical address, and the present invention is not limited in this respect.
It is understood that the initial page table structure may include only the initial architecture of the page table, or may include both the initial architecture of the page table and some/all of the page table entry information, depending on the page table description information determined by the user constraints. For example, when there is a corresponding virtual address range in the user constraint, then page table entries in the highest level page table of the initial page table structure may be formed based on that virtual address range (i.e., have the corresponding virtual address range correspond to page table entries), and when there is a corresponding physical address range in the user constraint, then page table entries in the lowest level page table of the initial page table structure may be formed based on that physical address range (i.e., have page table entries correspond to the corresponding physical address range). In an alternative implementation, the initial page table structure includes at least a highest level page table of the target page tables used for generation.
It should be noted that, when determining the initial page table structure conforming to the page table descriptor, the data in the initial page table structure may be randomized within the range defined by the page table descriptor (i.e., the user constraint in this step), so as to improve the randomness of the generated target page table. The randomization may be performed once or multiple times, thereby further improving the randomness of the target page table.
Wherein, in the randomization process, the randomization of the address can be performed based on the address information in the plurality of address tables in the page table generator. In addition, in the randomization process, parameter data corresponding to the initial page table structure, such as CSR configuration information, may be determined based on the constraint on the page table structure in the page table description information, and the CSR configuration information may be stored in a CSR configuration information table of the page table generator.
Step S12: obtaining fixed constraint used for generating a page table, wherein the fixed constraint is constraint information preset in a page table generator;
in the process of generating the target page table, fixed constraints can be preset in the page table generator, and the fixed constraints can be constraints which are inevitably generated based on internal settings of a device, can also be constraints which are inevitably required based on preset page table generation rules, and can also be constraints with universality which are predefined based on preset scenes for a user. For example, a physical address range constraint for defining an optional physical address range, where the constraint may define a maximum physical address range of the device as the optional physical address range, and correspondingly, in the user constraint, may constrain a sub-range within the maximum physical address range as a physical address range constraint based on a specific verification requirement; or, restricting the uniqueness of a virtual or physical address, restricting the attributes of the same address (i.e., whether the same physical address attributes are allowed to differ); alternatively, when a series of target page tables with the same characteristics need to be generated for the same verification scenario, the corresponding same characteristics may be predefined in the page table generator as fixed constraints, for example, whether to allow generating a page fault or not.
It will be appreciated that the fixed constraints serve as constraints preset within the page table generator to define the underlying conditions for page table generation, whereas the user constraints serve as information reflecting different validation requirements to define the specific conditions for page table generation. The page table with a fixed system as described in the background art can be generated only based on fixed constraints, and the page table generated by additional user constraints is a target page table meeting corresponding verification requirements.
Step S13: updating the page table description information and the initial page table structure based on the fixed constraints;
and updating the page table description information based on the acquired fixed constraint so as to integrate the user constraint and the fixed constraint.
Specifically, the updating of the page table descriptor is used to further reduce the constraint of generating the page table, for example, in the page table descriptor, if the original virtual address range is greater than the virtual address range in the fixed constraint, the virtual address range is updated to the virtual address range in the fixed constraint, and correspondingly, if the original virtual address range is smaller than the virtual address range in the fixed constraint, the virtual address range is updated to the original virtual address range.
It is understood that the page table description information updated based on the fixed constraint may include various attributes of each level of page table entry after user specification or randomization, so that generation of the target page table is realized based on the page table description information.
Similarly, the initial page table structure should be updated at the same time as the page table description information is updated. When the initial page table structure which conforms to the page table description information is updated, data in the initial page table structure can be randomized within the range defined by the updated page table description information, and therefore the randomness of the generated target page table is improved.
Step S14: according to the page table description information, in the initial page table structure, page table pointing relations of corresponding page tables of all levels are built step by step from high to low to form a target page table;
after determining the page table description information and the initial page table structure, the page table pointing relationship corresponding to each level of page table can be built step by step from high to low in the initial page table structure, so as to determine the pointing relationship of the page table entries in each level of page table, and form the target page table.
The target page table generated according to the page table description information can be understood as a page table meeting the verification requirement. Similarly, when the page table pointing relationship of each level of page table is constructed, the data should be randomized within the constraint range of the page table description information, so as to improve the randomness of the generated target page table.
Therefore, the page table generation method in the embodiment of the invention forms the page table description information and the initial page table structure based on the user constraint and the fixed constraint, and further constructs the target page table based on the page table description information and the initial page table structure, so that the user can provide different user requests based on different verification requirements, further different user constraints are formed, further the corresponding target page table is constructed, and further the verification requirements under different verification scenes in the verification process are met.
In an alternative implementation, the user constraint in step S10 may be obtained based on the user' S page table generation request. Specifically, fig. 4 exemplarily shows an optional flowchart of step S10 provided in the embodiment of the present invention, and step S10 may include:
step S101: obtaining a page table generation request of a user, wherein the page table generation request comprises request parameters for generating a page table;
the page table generation request may be a user-issued request for generating a page table. The page table generation request may include a request parameter for generating a page table, where the request parameter may be a parameter input by a user and used for describing a corresponding verification requirement.
Step S102: and determining user constraints according to the request parameters.
After obtaining the page table generation request, specific user constraints may be determined based on request parameters in the page table generation request. Specifically, the corresponding user constraint may be determined by parsing the request parameter.
In an alternative example, the user constraints may include one or more of the following:
attribute constraints for determining attributes of memory pages pointed to by physical addresses in a page table;
an address conflict constraint to determine whether an address conflict exists for an address in the page table; (in an alternative example, the address conflict constraint may contain different configurations, e.g., address conflict allowed, address conflict not allowed, or only allowed within the same thread)
An address range constraint for specifying an address range in the page table to be within a preset range;
an address size constraint to specify an address size;
space type constraints of the same address, which are used for specifying whether the address space type (such as peripheral space and main memory space) of the same address is allowed to be changed or not;
fault constraints for determining whether there is a page fault (e.g., a missing page fault, a reserved bit fault (normally, the reserved bit should be 0)) in the page table.
The attributes of the memory page may include:
the memory type to which the page belongs, e.g., whether it is cached, whether it is order-preserved (i.e., whether a number of instructions accessing the page must be executed in order in the software program);
access rights of the memory page, e.g. whether read/write/execute is allowed;
whether a memory page exists;
the address space type of the memory page, such as peripheral space, main memory space;
whether a memory page contains a fault;
the size of the memory page.
It will be appreciated that the request parameters may be some or all of the address or attribute values in the page table entries, and that further user constraints based on the request parameters may result in an initial page table structure with higher randomness after one or more randomisation passes.
In an optional example, based on the user constraint on the fault or conflict, the page table description information may further include exception test information, where the exception test information may mark a page table level at which an exception needs to occur, and an exception type. In the process of generating the target page table, based on the exception test information, when the page table entry of the corresponding level is created or updated, the information in the page table entry is modified according to the exception type, so that exception generation or injection is completed.
In an alternative implementation, the page table pointing relationship in the multi-level page table may be constructed from high to low levels in step S14 based on the virtual address in the page table description information. Specifically, fig. 5 exemplarily shows an optional flowchart of step S14 provided in the embodiment of the present invention, and step S14 may include:
step S140: configuring the CSR of the initial page table structure to enable the control and status register to point to a highest level page table of the initial page table structure;
it will be appreciated that the CSR is used to point to the page address of the highest level page table of the initial page table structure, so that the subsequent page table entry pointing relationship construction process starts with the highest level page table of the initial page table structure.
Step S141: acquiring a virtual address based on the page table description information;
the page table description information includes a virtual address range corresponding to the page table. The virtual address may be randomly extracted from a virtual address range corresponding to the page table, sequentially extracted from the virtual address range corresponding to the page table, or a virtual address given by a user may be obtained.
After the virtual address is obtained, it is required to determine whether an address conflict exists in the virtual address, specifically, a virtual address table may be queried, and whether the obtained virtual address already exists is checked, if so, an address conflict exists, step S141 is executed again, a new virtual address is obtained, and if not, an address conflict does not exist, and step S142 is executed;
in an optional example, it may also be determined whether the virtual address itself and the additional attribute thereof meet the constraint in the page table description information, if yes, step S142 is executed, and if not, step S141 is executed again to obtain a new virtual address.
Step S142: and according to the page table description information, constructing a page table pointing relation of the virtual address corresponding to the page table at the current level from the highest level page table of the initial page table structure until the lowest level page table of the initial page table structure.
After the virtual address is determined, the page table entry may be constructed from the highest-level page table pointed to by the virtual address, and after the construction is completed, the page table entry may be further constructed for the next-level page table pointed to by the page table entry until the lowest-level page table of the initial page table structure, thereby forming a final target page table.
It should be noted that, in the process of constructing the page table pointing relationship, the process is executed according to the page table description information, so that the target page table obtained by construction conforms to the constraint information in the page table description information.
In an optional example, referring to the optional flowchart of step S142 shown in fig. 6, the process of constructing the page table pointing relationship of the virtual address corresponding to the current-level page table in a certain level of page table in step S142 may specifically include:
step S21: inquiring whether a page table entry corresponding to the virtual address exists in a page table at the current level;
note that the page table entry corresponding to the virtual address refers to a page table entry of the current-level page table determined based on the pointing relationship of the virtual address in the current-level page table. When the current-level page table is the highest-level page table, the page table entry corresponding to the virtual address is the page table entry pointed to by the virtual address; when the page table of the current level is the page table of the other level, the page table entry corresponding to the virtual address is the page table entry of the upper page table determined based on the virtual address and the page table entry pointed by the address information of the virtual address.
In the initial page table structure determined based on the page table description information, there may be a corresponding page table entry or there may not be a corresponding page table entry, so in this step, a query of the page table entries in the current-level page table is performed to determine whether there is a page table entry corresponding to the virtual address. When there is no corresponding page table entry, step S22 is executed; when there is a corresponding page table entry, step S23 is executed.
Step S22: and creating a page table entry corresponding to the virtual address, and writing the page table entry into a preset storage position.
Specifically, the creation of the page table entry may be performed based on a constraint on the page table entry in the page table description information.
In an optional example, the page table entry may be created based on information of a next page table, when the next page table exists, the corresponding next page table may be determined as the next page table to which the page table entry points based on corresponding constraints, and when the next page table does not exist, the next page table may be created based on corresponding constraints, and the next page table may be used as the next page table to which the page table entry points.
It will be appreciated that the page table entries created should conform to a pre-set page table entry format.
In another alternative example, when the current level page table is the lowest level page table, the physical address pointed to by the page table entry is determined, and the page table entry is created based on the information of the physical address. Wherein the physical address pointed to by the page table entry may be determined based on constraint information in the page table description information.
It should be noted that, when determining the physical address pointed by the page table entry, it may also be queried whether the physical address conflicts with the physical address pointed by the existing page table entry (for example, it is queried whether the physical address already exists through a virtual machine physical address table or a system physical address table, and if so, conflicts are found), if conflicts exist, it may be determined whether conflicts are allowed based on the page table description information, if allowed, the page table entry is created based on the information of the physical address, if not allowed, a new physical address is determined again for the page table entry, and the page table entry is created based on the information of the physical address; if not, the page table entry may be created based on the information of the physical address.
It should be further noted that, the page table description information includes exception test information indicating a case where the current-level page table generates an exception, and after the page table entry is generated, the page table entry may be modified according to an exception type in the exception test information, so as to inject an exception into the current-level page table.
Furthermore, the page table description information further records preset address information, and further writes a page table entry into a storage location corresponding to the preset address information based on the page table description information recorded with the preset address information.
It can be understood that the preset storage location is a pre-divided location for storing the target page table, and the page tables of different levels and the different page tables of the same level have preset storage locations, so that the page table entries in the page tables reflect the pointing relationship between the multi-level page tables based on the preset storage locations.
It should be noted that, the target page table for generation according to the embodiment of the present invention is applied to the verification environment, and therefore, the preset storage location in this step may be the main memory in the verification environment.
Step S23: and updating the page table entry corresponding to the virtual address according to a preset updating strategy.
When a page table entry corresponding to the virtual address exists, a corresponding update policy may be preset, so that an update to the page table entry is directed based on the update policy.
Wherein, the update policy may be: updating is performed based on the existing page table entry, or step S22 is performed to update the page table entry.
When a new page table entry needs to be created for updating, the page table entry may be created with reference to the execution process of step S22, and the created page table entry may be written into a preset storage location.
In an alternative example, with continued reference to fig. 6, after step S22 or step S23, it may be further determined whether to create a next level page table, specifically, the following steps are performed:
step S24: judging whether the page table at the current level is the page table at the lowest level;
if yes, indicating that the target page table has been created, go to step S25, otherwise, go to the next level page table, and continue to step S21 based on the virtual address.
Step S25: and returning the created target page table to the user.
In the above example, the certain level of page table may be any one of the multiple levels of page tables. When creating the page table entry to the lowest-level page table is performed, the created page table entry should correspond to the physical address in the page table description information, so that the mapping relationship between the virtual address and the physical address can be obtained based on the target page table. Further, the mapping relationship between the virtual address and the physical address may be recorded in an address mapping table of the page table generator.
It is understood that, based on different types of page tables to be generated, the physical address corresponding to the created page table entry may be a virtual machine physical address or a system physical address. The physical address corresponding to the created page table entry may be further recorded in a corresponding address table, for example, when the physical address corresponding to the created page table entry is a virtual machine physical address, the corresponding physical address is recorded in a virtual machine physical address table; and when the physical address corresponding to the created page table entry is the system physical address, recording the corresponding physical address in the system physical address table.
In the lowest-level page table, if the physical address corresponding to the created page table entry is a virtual machine physical address, the generated target page table is a guest page table, and correspondingly, a host page table matched with the guest page table should be generated. In an optional example, after step S22 or step S23, the method further includes:
step S26: generating a host page table, wherein a page table entry in the host page table is used for constructing a pointing relationship of the virtual machine physical address to a system physical address.
It can be understood that, when the page table entry is created or updated based on a preset update policy, a situation that the page table entry does not conform to the page table description information may occur, and at this time, the page table description information may be modified and returned to the user when the page table generation method flow is finished.
Therefore, the page table generation method in the embodiment of the invention forms the page table description information and the initial page table structure based on the user constraint and the fixed constraint, and further constructs the target page table based on the page table description information and the initial page table structure, so that the user can provide different user requests based on different verification requirements, further different user constraints are formed, further the corresponding target page table is constructed, and further the verification requirements under different verification scenes in the verification process can be met.
It can be understood that, the page table generation method can realize that the generation of page table entries of each level is controlled by a user, support fine-grained tests, and update the existing page table, including the attributes and injection faults of the existing page table, so as to meet the verification requirements under different verification scenarios.
In the following, the page table generating apparatus provided in the embodiment of the present invention is introduced, and the contents of the apparatus described below may be regarded as a chip verification device or a computer device, which is a functional module required to implement the page table generating method provided in the embodiment of the present invention. The device content described below may be referred to in correspondence with the method content described above.
Fig. 7 shows an alternative block diagram of a page table generating apparatus provided in an embodiment of the present invention. As shown in fig. 7, the apparatus may include:
a user constraint obtaining module 200, configured to obtain a user constraint for generating a page table, where the user constraint is constraint information obtained based on a request parameter of a user;
an initial processing module 210, configured to determine, based on the user constraint, page table description information used for generating a page table and an initial page table structure conforming to the page table description information;
a fixed constraint obtaining module 220, configured to obtain a fixed constraint used for generating a page table, where the fixed constraint is constraint information preset in a page table generator;
an update processing module 230 for updating the page table description information and the initial page table structure based on the fixed constraint;
a directing relationship establishing module 240, configured to establish, in the initial page table structure, a page table directing relationship corresponding to each level of the page table from high to low step by step according to the page table description information, so as to form a target page table.
Optionally, the user constraint obtaining module 200 is configured to obtain a user constraint for generating a page table, and includes:
obtaining a page table generation request of a user, wherein the page table generation request comprises request parameters for generating a page table;
and determining user constraints according to the request parameters.
Optionally, the directing relationship constructing module 240 is configured to construct, in the initial page table structure, a page table directing relationship corresponding to each level of the page table from high to low step by step according to the page table description information, and form a target page table, where the directing relationship includes:
configuring a control and status register of the initial page table structure such that the control and status register points to a highest level page table of the initial page table structure;
acquiring a virtual address based on the page table description information;
and according to the page table description information, constructing a page table pointing relation of the virtual address corresponding to the page table at the current level from the highest level page table of the initial page table structure until the lowest level page table of the initial page table structure.
Optionally, the pointing relationship constructing module 240 is configured to construct a page table pointing relationship between the virtual address and the current-level page table, and includes:
inquiring whether a page table entry corresponding to the virtual address exists in a page table at the current level;
if not, creating a page table entry corresponding to the virtual address, and writing the page table entry into a preset storage position.
Optionally, the pointing relationship constructing module 240 is configured to construct a page table pointing relationship between the virtual address and the current-level page table, and further includes:
if the page table entry corresponding to the virtual address exists in the page table of the current level, updating the page table entry corresponding to the virtual address according to a preset updating strategy;
wherein the update policy is: and updating the existing page table entries, or executing the step of creating the page table entries corresponding to the virtual addresses and writing the page table entries into a preset storage position to update the page table entries.
Optionally, the directional relationship building module 240 is further configured to:
determining whether there is an address conflict for the virtual address;
if address conflict exists, executing the step of obtaining the virtual address based on the page table description information again;
and if the address table does not exist, executing the step of constructing the page table pointing relationship of the virtual address corresponding to the page table at the current level from the highest level page table of the initial page table structure according to the page table description information.
Optionally, the directional relationship building module 240 is further configured to:
determining whether the virtual address itself and its additional attributes meet constraints in page table description information;
if not, executing the step of obtaining the virtual address based on the page table description information again;
and if so, executing the step of constructing the page table pointing relationship of the virtual address corresponding to the page table at the current level from the highest level page table of the initial page table structure according to the page table description information.
Optionally, the current-level page table is a lowest-level page table, and the pointing relationship building module 240 is configured to create a page table entry corresponding to the virtual address, specifically, determine a physical address pointed by the page table entry, and create the page table entry based on information of the physical address.
Optionally, the directional relationship building module 240 is further configured to:
and modifying the page table entry according to the exception type in the exception test information so as to inject the exception.
Optionally, the directional relationship building module 240 is further configured to:
judging whether the page table at the current level is the page table at the lowest level;
if not, entering a next-stage page table, and executing the step of inquiring whether a page table entry corresponding to the virtual address exists in the current-stage page table, and if so, returning the created target page table to the user.
Optionally, the physical address pointed to by the page table entry is a virtual machine physical address, and the pointing relationship building module 240 is further configured to:
generating a host page table, wherein a page table entry in the host page table is used for constructing a pointing relationship of the virtual machine physical address to a system physical address.
Optionally, the initial page table structure includes at least a highest level page table of the target page tables.
Optionally, the initial processing module 210 is configured to determine an initial page table structure that conforms to the page table description information, and includes: the data in the initial page table structure is randomized within the limits defined by the page table descriptive information.
Optionally, the update processing module 230 is configured to update the initial page table structure, and includes: the data in the initial page table structure is randomized within the limits defined by the updated page table description information.
Optionally, the user constraints include one or more of the following:
attribute constraints for determining attributes of memory pages pointed to by physical addresses in a page table;
an address conflict constraint to determine whether an address conflict exists for an address in the page table;
an address range constraint for specifying an address range in the page table to be within a preset range;
an address size constraint to specify an address size;
space type constraints of the same address, which are used for specifying whether the address space type of the same address is allowed to be changed or not;
a fault constraint to determine if a page fault exists in the page table.
Embodiments of the present invention further provide a page table generator, which may be configured to execute the page table generating method provided in the embodiments of the present invention in some embodiments.
Embodiments of the present invention further provide a chip verification system, and in some embodiments, the chip verification system may be configured to execute the page table generation method provided in the embodiments of the present invention.
An embodiment of the present invention further provides a computer device, where the computer device may include: at least one memory and at least one processor; the memory stores one or more computer-executable instructions that are invoked by the processor to perform the page table generation method provided by embodiments of the invention.
An embodiment of the present invention provides a storage medium, where the storage medium stores one or more computer-executable instructions, and the one or more computer-executable instructions are used to execute the page table generating method described above.
While various embodiments of the present invention have been described above, various alternatives described in the various embodiments can be combined and cross-referenced without conflict to extend the variety of possible embodiments that can be considered disclosed and disclosed in connection with the embodiments of the present invention.
Although the embodiments of the present invention have been disclosed, the present invention is not limited thereto. Various changes and modifications may be effected therein by one skilled in the art without departing from the spirit and scope of the invention as defined in the appended claims.

Claims (20)

1. A page table generation method applied to a page table generator includes:
acquiring user constraint for generating a page table, wherein the user constraint is constraint information acquired based on request parameters of a user;
based on the user constraints, determining page table description information for generating a page table and an initial page table structure conforming to the page table description information;
obtaining fixed constraint used for generating a page table, wherein the fixed constraint is constraint information preset in a page table generator;
updating the page table description information and the initial page table structure based on the fixed constraints;
according to the page table description information, in the initial page table structure, the page table pointing relationship of the corresponding page tables of each level is built step by step from high to low to form a target page table.
2. The method of claim 1, wherein obtaining user constraints for generating a page table comprises:
obtaining a page table generation request of a user, wherein the page table generation request comprises request parameters for generating a page table;
and determining user constraints according to the request parameters.
3. The method of claim 1, wherein the step of constructing page table pointing relationships corresponding to the page tables of each level in the initial page table structure from high to low in a stepwise manner according to the page table description information to form a target page table comprises:
configuring a control and status register of the initial page table structure such that the control and status register points to a highest level page table of the initial page table structure;
acquiring a virtual address based on the page table description information;
and according to the page table description information, constructing a page table pointing relation of the virtual address corresponding to the page table at the current level from the highest level page table of the initial page table structure until the lowest level page table of the initial page table structure.
4. The method of claim 3, wherein constructing the page table pointing relationship that the virtual address corresponds to in the current level page table comprises:
inquiring whether a page table entry corresponding to the virtual address exists in a page table at the current level;
if not, creating a page table entry corresponding to the virtual address, and writing the page table entry into a preset storage position.
5. The method of claim 4, wherein the constructing the page table pointing relationship that the virtual address corresponds to in the current level page table further comprises:
if the page table entry corresponding to the virtual address exists in the page table of the current level, updating the page table entry corresponding to the virtual address according to a preset updating strategy;
wherein the update policy is: and updating the existing page table entries, or executing the step of creating the page table entries corresponding to the virtual addresses and writing the page table entries into a preset storage position to update the page table entries.
6. The method of claim 3, wherein after obtaining the virtual address based on the page table description information, the constructing the page table pointing relationship of the virtual address corresponding to the current-level page table from the highest-level page table of the initial page table structure according to the page table description information further comprises:
determining whether there is an address conflict for the virtual address;
if address conflict exists, executing the step of obtaining the virtual address based on the page table description information again;
and if the address table does not exist, executing the step of constructing the page table pointing relationship of the virtual address corresponding to the page table at the current level from the highest level page table of the initial page table structure according to the page table description information.
7. The method of claim 3, wherein after obtaining the virtual address based on the page table description information, the constructing the page table pointing relationship of the virtual address corresponding to the current-level page table from the highest-level page table of the initial page table structure according to the page table description information further comprises:
determining whether the virtual address itself and its additional attributes meet constraints in page table description information;
if not, executing the step of obtaining the virtual address based on the page table description information again;
and if so, executing the step of constructing the page table pointing relationship of the virtual address corresponding to the page table at the current level from the highest level page table of the initial page table structure according to the page table description information.
8. The method according to claim 4 or 5, wherein the current-level page table is a lowest-level page table, and the step of creating the page table entry corresponding to the virtual address is to determine a physical address pointed to by the page table entry and create the page table entry based on information of the physical address.
9. The method according to claim 4 or 5, wherein if the page table description information includes exception test information indicating that the current-level page table generates an exception, the creating the page table entry corresponding to the virtual address before writing the page table entry to the predetermined storage location further comprises:
and modifying the page table entry according to the exception type in the exception test information so as to inject the exception.
10. The method of claim 4 or 5, wherein after creating the page table entry corresponding to the virtual address and writing the page table entry to a predetermined storage location, further comprising:
judging whether the page table at the current level is the page table at the lowest level;
if not, entering a next-stage page table, and executing the step of inquiring whether a page table entry corresponding to the virtual address exists in the current-stage page table, and if so, returning the created target page table to the user.
11. The method of claim 8, wherein the physical address pointed to by the page table entry is a virtual machine physical address, and wherein after creating the page table entry corresponding to the virtual address and writing the page table entry to a predetermined storage location, further comprising:
generating a host page table, wherein a page table entry in the host page table is used for constructing a pointing relationship of the virtual machine physical address to a system physical address.
12. The method of claim 3 wherein the initial page table structure comprises at least a highest level page table of the target page tables.
13. The method of claim 3, wherein in the step of determining an initial page table structure that conforms to the page table descriptive information, comprises: the data in the initial page table structure is randomized within the limits defined by the page table descriptive information.
14. The method of claim 3, wherein in the step of updating the initial page table structure, comprising: the data in the initial page table structure is randomized within the limits defined by the updated page table description information.
15. The method of claim 1, wherein the user constraints comprise one or more of the following:
attribute constraints for determining attributes of memory pages pointed to by physical addresses in a page table;
an address conflict constraint to determine whether an address conflict exists for an address in the page table;
an address range constraint for specifying an address range in the page table to be within a preset range;
an address size constraint to specify an address size;
space type constraints of the same address, which are used for specifying whether the address space type of the same address is allowed to be changed or not;
a fault constraint to determine if a page fault exists in the page table.
16. A page table generation apparatus, comprising:
the user constraint obtaining module is used for obtaining user constraints used for generating the page table, and the user constraints are constraint information obtained based on request parameters of a user;
an initial processing module, configured to determine, based on the user constraint, page table description information used for generating a page table and an initial page table structure conforming to the page table description information;
the fixed constraint obtaining module is used for obtaining fixed constraints used for generating the page table, and the fixed constraints are constraint information preset in the page table generator;
an update processing module to update the page table description information and the initial page table structure based on the fixed constraints;
and the pointing relationship construction module is used for constructing the page table pointing relationship of the corresponding page tables of each level step by step from high to low in the initial page table structure according to the page table description information to form a target page table.
17. A page table generator, characterized in that the page table generator is configured to perform the page table generation method of any one of claims 1 to 15.
18. A chip verification system, characterized in that the chip verification system is configured to perform the page table generation method of any one of claims 1 to 15.
19. A computer device, comprising: at least one memory and at least one processor; the memory stores one or more computer-executable instructions that are called by the processor to perform the page table generation method of any of claims 1 to 15.
20. A storage medium storing one or more computer-executable instructions for performing the page table generation method of any one of claims 1 to 15.
CN202111525577.0A 2021-12-14 2021-12-14 Page table generation method, device and system and related equipment Pending CN114238174A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111525577.0A CN114238174A (en) 2021-12-14 2021-12-14 Page table generation method, device and system and related equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111525577.0A CN114238174A (en) 2021-12-14 2021-12-14 Page table generation method, device and system and related equipment

Publications (1)

Publication Number Publication Date
CN114238174A true CN114238174A (en) 2022-03-25

Family

ID=80755682

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111525577.0A Pending CN114238174A (en) 2021-12-14 2021-12-14 Page table generation method, device and system and related equipment

Country Status (1)

Country Link
CN (1) CN114238174A (en)

Similar Documents

Publication Publication Date Title
US7949835B2 (en) Data processing apparatus and method for controlling access to memory
EP3173931B1 (en) File access method, device and storage system
US7962952B2 (en) Information processing apparatus that executes program and program control method for executing program
US10339333B2 (en) Method and apparatus for controlling application to access memory
JP7309306B2 (en) Formal verification method, system, computer equipment and readable storage medium for certificate storage smart contract
KR100619657B1 (en) Memory managing unit, code verifying device, and code decoder
KR100931706B1 (en) Method and apparatus for physical address-based security for determining target security
JP5338435B2 (en) Information processing program, information processing apparatus, and information processing method
CN110502881B (en) Method, system and storage medium for dynamically modifying read-only attribute of android system
US11500828B1 (en) Method and device for constructing database model with ID-based data indexing-enabled data accessing
CN112541166A (en) Method, system and computer readable storage medium
CN110554911A (en) Memory access and allocation method, memory controller and system
CN110659019B (en) Parameter verification method, device and server
US20100115004A1 (en) Backup system that stores boot data file of embedded system in different strorage sections and method thereof
US7814334B2 (en) Method and apparatus for changing and adding activation keys for functions of digital content without having to change and recompile the digital content
US20140025844A1 (en) Verify command for a peripheral device
CN114238174A (en) Page table generation method, device and system and related equipment
US8028142B2 (en) Controller of storage device, storage device, and control method of storage device
CN114490449B (en) Memory access method and device and processor
CN114721891A (en) Method and device for writing data in buffer area in memory management unit
CN108376227B (en) File access method and system of security chip
CN117056897B (en) Configuration information processing method for chip verification, electronic device and medium
CN112631720B (en) Memory control method, medium and equipment
CN116186046B (en) Device data modification method and device, computer device and storage medium
JP2005209069A (en) Database controller

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination