WO2015043379A1 - Memory accessing method and device - Google Patents

Memory accessing method and device Download PDF

Info

Publication number
WO2015043379A1
WO2015043379A1 PCT/CN2014/086355 CN2014086355W WO2015043379A1 WO 2015043379 A1 WO2015043379 A1 WO 2015043379A1 CN 2014086355 W CN2014086355 W CN 2014086355W WO 2015043379 A1 WO2015043379 A1 WO 2015043379A1
Authority
WO
WIPO (PCT)
Prior art keywords
address
physical address
virtual
physical
virtual address
Prior art date
Application number
PCT/CN2014/086355
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 WO2015043379A1 publication Critical patent/WO2015043379A1/en

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
    • 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/1027Address translation using associative or pseudo-associative address translation means, e.g. translation look-aside buffer [TLB]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2212/00Indexing scheme relating to accessing, addressing or allocation within memory systems or architectures
    • G06F2212/68Details of translation look-aside buffer [TLB]
    • G06F2212/684TLB miss handling

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

A memory accessing method and device are applied to the technical field of computer information. In the memory accessing method, when information corresponding to a first virtual address is missed in a TLB, in order to enable a computer system to access memory corresponding to the first virtual address, the computer system converts the first virtual address to obtain a second virtual address, calculates, according to a preset relationship between a first physical address corresponding to the first virtual address and a second physical address corresponding to the second virtual address, the first physical address, and then, accesses the memory according to the first physical address. In this way, when it is found that information corresponding to a virtual address, for example, the first virtual address is missed in the TLB, a conversion relationship between a virtual address and a physical address may not need to be obtained from a page table in memory of the computer system, but the first physical address corresponding to the first virtual address can be directly calculated, so that processing overheads for missing in the TLB are reduced.

Description

一种内存访问方法和设备Memory access method and device 技术领域Technical field
本发明涉及计算机信息技术领域,特别涉及内存访问方法和设备。The present invention relates to the field of computer information technology, and in particular, to a memory access method and device.
背景技术Background technique
计算机在执行应用程序的过程中,需要访问内存中加载的程序,计算机在访问内存时是通过被访问内存的物理地址来访问,而在计算机中对内存的管理一般采用分页内存管理,在分页内存管理条件下计算机会为内存生成虚拟地址以方便管理。In the process of executing the application, the computer needs to access the program loaded in the memory. When the computer accesses the memory, it is accessed through the physical address of the accessed memory, and the management of the memory in the computer generally adopts paging memory management in the paged memory. Under management conditions, the computer generates virtual addresses for memory for easy management.
目前在计算机中会通过旁路转换缓冲(Translation look aside buffer,TLB)来储存经常被使用的页表(即页表的一个子集),还储存物理地址对应的虚拟地址的信息,该页表中储存着内存的物理地址,计算机可以通过TLB将虚拟地址转换为物理地址,并完成内存的访问。当计算机中的TLB发生缺失时,计算机会获取TLB中缺失的页表指针等信息以访问页表,从分页内存管理下的虚拟地址及从页表中获取对应的物理地址,并替换TLB中的相应表项,使得一般对于TLB缺失处理的开销比较大。Currently, in the computer, a translation look aside buffer (TLB) is used to store a frequently used page table (ie, a subset of the page table), and also stores information of a virtual address corresponding to the physical address. The physical address of the memory is stored, and the computer can convert the virtual address into a physical address through the TLB and complete the memory access. When the TLB in the computer is missing, the computer will obtain information such as the missing page table pointer in the TLB to access the page table, obtain the corresponding physical address from the virtual address under the paging memory management and the corresponding physical address from the page table, and replace the TLB. Corresponding entries make the overhead of TLB deletion processing generally larger.
发明内容Summary of the invention
本发明实施例提供内存访问方法和设备,降低了对TLB缺失处理的开销。The embodiment of the invention provides a memory access method and device, which reduces the overhead of the TLB deletion processing.
本发明实施例第一方面提供一种内存访问方法,包括:A first aspect of the embodiments of the present invention provides a memory access method, including:
接收内存的访问请求,所述访问请求中包括待访问内存的第一虚拟地址;Receiving an access request of the memory, where the access request includes a first virtual address of the memory to be accessed;
如果所述第一虚拟地址未储存在旁路转换缓冲TLB中,将所述第一虚拟地址进行转换获取第二虚拟地址;If the first virtual address is not stored in the bypass translation buffer TLB, converting the first virtual address to obtain a second virtual address;
根据所述第二虚拟地址对应的第二物理地址与所述第一虚拟地址对应的第一物理地址之间的预置的关系计算所述第一物理地址;Calculating the first physical address according to a preset relationship between a second physical address corresponding to the second virtual address and a first physical address corresponding to the first virtual address;
根据所述第一物理地址访问所述待访问内存。Accessing the to-be-accessed memory according to the first physical address.
本发明实施例第一方面的第一种可能实现方法中,所述将所述第一虚拟地址进行转换获取第二虚拟地址具体包括:将所述第一虚拟地址转换为所述第一虚拟地址递增方向或递减方向的第n个虚拟地址作为第二虚拟地址;所述n为大于0的正整数。 In the first possible implementation method of the first aspect of the present disclosure, the converting the first virtual address to obtain the second virtual address specifically includes: converting the first virtual address into the first virtual address The nth virtual address that increments or decrements the direction as the second virtual address; the n is a positive integer greater than zero.
结合本发明实施例第一方面或第一方面的第一种可能实现方法,在本发明实施例第一方面的第二种可能实现方法中,根据所述第二虚拟地址对应的第二物理地址与所述第一虚拟地址对应的第一物理地址之间的预置的关系计算所述第一物理地址,具体包括:With reference to the first aspect of the embodiment of the present invention or the first possible implementation method of the first aspect, in a second possible implementation method of the first aspect of the embodiment, the second physical address corresponding to the second virtual address is used. Calculating the first physical address by using a preset relationship between the first physical address corresponding to the first virtual address, specifically:
如果所述第一虚拟地址和第二虚拟地址对应连续的物理地址,计算所述第二物理地址连续的物理地址得到所述第一物理地址;If the first virtual address and the second virtual address correspond to consecutive physical addresses, calculating a physical address of the second physical address to obtain the first physical address;
如果所述第二物理地址和第一物理地址非连续,且所述第二物理地址与第一物理地址对应的内存单元之间相隔为时m,若所述第一物理地址对应的内存单元是所述第二物理地址递增方向物理地址的内存单元,则计算所述第二物理地址递增方向的第m+1个物理地址得到所述第一物理地址;若所述第一物理地址对应的内存单元是所述第二物理地址递减方向物理地址的内存单元,则计算所述第二物理地址递减方向的第m+1个物理地址得到所述第一物理地址,所述m是大于0的正整数。If the second physical address and the first physical address are non-contiguous, and the memory unit corresponding to the second physical address and the first physical address is separated by m, if the memory unit corresponding to the first physical address is The second physical address is incremented by the physical unit of the physical address, and the m+1th physical address in the direction of the second physical address is calculated to obtain the first physical address; if the memory corresponding to the first physical address is The unit is a memory unit in which the second physical address decrements the physical address, and the m+1th physical address in the decreasing direction of the second physical address is calculated to obtain the first physical address, where the m is greater than 0. Integer.
在本发明实施例第一方面的第三种可能实现方法中,所述接收内存的访问请求之前,还包括:In a third possible implementation method of the first aspect of the embodiment of the present invention, before the receiving the memory access request, the method further includes:
为连续的虚拟地址分配对应的物理地址,所述物理地址部分或全部连续;Assigning a corresponding physical address to consecutive virtual addresses, the physical addresses being partially or completely continuous;
将虚拟地址和物理地址的对应关系储存到所述TLB中,并储存物理地址对应的标记位,所述标记位用于指示所述连续的虚拟地址对应物理地址之间是否连续。The corresponding relationship between the virtual address and the physical address is stored in the TLB, and the flag bit corresponding to the physical address is stored, and the flag bit is used to indicate whether the consecutive virtual addresses correspond to physical addresses.
结合本发明实施例第一方面的第三种可能实现方式,在本发明实施例第一方面的第四种可能实现方式中:With reference to the third possible implementation manner of the first aspect of the embodiment of the present invention, in a fourth possible implementation manner of the first aspect of the embodiment of the present invention:
所述将所述第一虚拟地址进行转换获取第二虚拟地址,具体包括:将所述第一虚拟地址转换为与所述第一虚拟地址连续的第二虚拟地址;The converting the first virtual address to obtain the second virtual address comprises: converting the first virtual address into a second virtual address that is consecutive to the first virtual address;
所述根据所述第二虚拟地址对应的第二物理地址与所述第一虚拟地址对应的第一物理地址之间的预置的关系计算所述第一物理地址,具体包括:如果所述第二物理地址的标志位指示所述连续的虚拟地址对应的物理地址之间连续,则计算所述第二物理地址连续的物理地址得到所述第一物理地址。Calculating the first physical address according to a preset relationship between the second physical address corresponding to the second virtual address and the first physical address corresponding to the first virtual address, specifically: if the The flag of the physical address indicates that the physical addresses corresponding to the consecutive virtual addresses are consecutive, and the physical address of the second physical address is calculated to obtain the first physical address.
结合本发明实施例第一方面的第三种可能实现方法,在本发明实施例第一方面的第五种可能实现方法中,所述方法还包括: With reference to the third possible implementation method of the first aspect of the embodiments of the present invention, in a fifth possible implementation method of the first aspect of the embodiments, the method further includes:
将所述第一虚拟地址和第一物理地址的信息储存到所述TLB中。Information of the first virtual address and the first physical address is stored in the TLB.
结合本发明实施例第一方面的第五种可能实现方法,在本发明实施例第一方面的第六种可能实现方法中,所述将所述第一虚拟地址和第一物理地址的信息储存到所述TLB中,具体包括:With reference to the fifth possible implementation method of the first aspect of the embodiments of the present invention, in a sixth possible implementation method of the first aspect of the embodiments, the information storage of the first virtual address and the first physical address is performed. To the TLB, specifically:
将所述第一虚拟地址和计算的第一物理地址的对应关系储存到所述TLB;Saving a correspondence between the first virtual address and the calculated first physical address to the TLB;
将所述第一物理地址对应的标记位从计算机系统内存的页表中传递到所述TLB中。The flag bit corresponding to the first physical address is transferred from the page table of the computer system memory to the TLB.
本发明实施例第二方面提供一种内存访问设备,包括:A second aspect of the embodiments of the present invention provides a memory access device, including:
请求接收单元,用于接收内存的访问请求,所述访问请求中包括待访问内存的第一虚拟地址;a request receiving unit, configured to receive an access request of a memory, where the access request includes a first virtual address of the memory to be accessed;
获取单元,用于如果所述请求接收单元接收的访问请求中第一虚拟地址未储存在旁路转换缓冲TLB中,将所述第一虚拟地址进行转换获取第二虚拟地址;An acquiring unit, configured to: if the first virtual address in the access request received by the request receiving unit is not stored in the bypass conversion buffer TLB, convert the first virtual address to obtain a second virtual address;
地址计算单元,用于根据所述转换单元转换的第二虚拟地址对应的第二物理地址与所述第一虚拟地址对应的第一物理地址之间的预置的关系计算所述第一物理地址;An address calculation unit, configured to calculate the first physical address according to a preset relationship between a second physical address corresponding to the second virtual address converted by the conversion unit and a first physical address corresponding to the first virtual address ;
访问单元,用于根据所述地址计算单元计算的第一物理地址访问所述待访问内存。And an access unit, configured to access the to-be-accessed memory according to the first physical address calculated by the address calculation unit.
本发明实施例第二方面的第一种可能实现方式中,所述获取单元,具体用于将所述第一虚拟地址转换为所述第一虚拟地址递增方向或递减方向的第n个虚拟地址作为第二虚拟地址;所述n为大于0的正整数。In a first possible implementation manner of the second aspect of the embodiments of the present disclosure, the acquiring unit is specifically configured to convert the first virtual address into an nth virtual address of the first virtual address increasing direction or decreasing direction As the second virtual address; the n is a positive integer greater than zero.
结合本发明实施例第二方面或第二方面的第一种可能实现方法,在本发明实施例第二方面的第二种可能实现方法中,所述地址计算单元,具体用于如果所述第一虚拟地址和第二虚拟地址对应连续的物理地址,计算所述第二物理地址连续的物理地址得到所述第一物理地址;With reference to the second aspect of the embodiment of the present invention or the first possible implementation method of the second aspect, in the second possible implementation method of the second aspect of the embodiment, the address calculation unit is specifically used if The virtual address and the second virtual address correspond to consecutive physical addresses, and the physical address of the second physical address is calculated to obtain the first physical address;
如果所述第二物理地址和第一物理地址非连续,且所述第二物理地址与第一物理地址对应的内存单元之间相隔为m时,若所述第一物理地址对应的内存单元是所述第二物理地址递增方向物理地址的内存单元,则计算所述第二物理地址递增方向的第m+1个物理地址得到所述第一物理地址;若所述第一物 理地址对应的内存单元是所述第二物理地址递减方向物理地址的内存单元,则计算所述第二物理地址递减方向的第m+1个物理地址得到所述第一物理地址,所述m是大于0的正整数。If the second physical address and the first physical address are non-contiguous, and the memory unit corresponding to the first physical address is separated by m, if the memory unit corresponding to the first physical address is And the second physical address is incremented by the physical unit of the physical address, and the m+1th physical address in the increasing direction of the second physical address is calculated to obtain the first physical address; The memory unit corresponding to the address is the memory unit of the second physical address decrement direction physical address, and the m+1th physical address of the second physical address decrement direction is calculated to obtain the first physical address, where the m Is a positive integer greater than zero.
在本发明实施例第二方面的第三种可能实现方法中,还包括:In a third possible implementation method of the second aspect of the embodiment of the present invention, the method further includes:
地址分配单元,用于为连续的虚拟地址分配对应的物理地址,所述物理地址部分或全部连续;An address allocation unit, configured to allocate a corresponding physical address to consecutive virtual addresses, where the physical addresses are partially or completely continuous;
对应储存单元,用于将虚拟地址和物理地址的对应关系储存到所述TLB中,并储存物理地址对应的标记位,所述标记位用于指示所述连续的虚拟地址对应的物理地址是否连续。Corresponding storage unit, configured to store a correspondence between the virtual address and the physical address in the TLB, and store a mark bit corresponding to the physical address, where the mark bit is used to indicate whether the physical address corresponding to the consecutive virtual address is continuous .
结合本发明实施例第二方面的第三种可能实现方式,在本发明实施例第二方面的第四种可能实现方式中:With reference to the third possible implementation manner of the second aspect of the embodiment of the present invention, in a fourth possible implementation manner of the second aspect of the embodiment of the present invention:
所述获取单元,具体用于将所述第一虚拟地址转换为与所述第一虚拟地址连续的第二虚拟地址;The obtaining unit is specifically configured to convert the first virtual address into a second virtual address that is consecutive to the first virtual address;
所述地址计算单元,具体用于如果所述第二物理地址的标志位指示所述连续的虚拟地址对应的物理地址之间连续,则计算所述第二物理地址连续的物理地址得到所述第一物理地址。The address calculation unit is configured to: if the flag bit of the second physical address indicates that the physical addresses corresponding to the consecutive virtual addresses are consecutive, calculate a physical address of the second physical address to obtain the A physical address.
结合本发明实施例第二方面的第三种可能实现方法,在本发明实施例第二方面的第五种可能实现方法中,还包括:With reference to the third possible implementation method of the second aspect of the embodiment of the present invention, the fifth possible implementation method of the second aspect of the embodiment of the present invention further includes:
信息储存单元,用于将所述第一虚拟地址和第一物理地址的信息储存到所述TLB中。And an information storage unit, configured to store information of the first virtual address and the first physical address into the TLB.
结合本发明实施例第二方面的第五种可能实现方法,在本发明实施例第二方面的第六种可能实现方法中,所述信息储存单元具体包括:With reference to the fifth possible implementation method of the second aspect of the embodiment of the present invention, in the sixth possible implementation method of the second aspect of the embodiment, the information storage unit specifically includes:
对应关系储存单元,用于将所述第一虚拟地址和计算的第一物理地址的对应关系储存到所述TLB;a correspondence relationship storage unit, configured to store a correspondence between the first virtual address and the calculated first physical address to the TLB;
传递单元,用于将所述第一物理地址对应的标记位从计算机系统内存的页表中传递到所述TLB中。And a transfer unit, configured to transfer the mark bit corresponding to the first physical address from the page table of the computer system memory to the TLB.
本实施例的内存访问方法中,当TLB中缺失第一虚拟地址对应的信息时,为了使得计算机系统可以访问该第一虚拟地址对应的内存,计算机系统会将第一虚拟地址进行转换获取第二虚拟地址,并根据第一虚拟地址对应的第一 物理地址和第二虚拟地址对应的第二物理地址之间的预置的关系计算第一物理地址,然后再根据第一物理地址访问内存。这样当发现TLB缺失某一虚拟地址比如第一虚拟地址对应的信息时,可以不需要从计算机系统内存的页表中得到虚拟地址和物理地址的转换关系,而是可以直接计算得到该第一虚拟地址对应的第一物理地址,降低了对TLB缺失处理的开销。In the memory access method of this embodiment, when the information corresponding to the first virtual address is missing in the TLB, in order to enable the computer system to access the memory corresponding to the first virtual address, the computer system converts the first virtual address to obtain the second a virtual address and corresponding to the first virtual address The preset relationship between the physical address and the second physical address corresponding to the second virtual address calculates a first physical address, and then accesses the memory according to the first physical address. When the TLB is found to be missing a virtual address, such as the information corresponding to the first virtual address, the conversion relationship between the virtual address and the physical address may not be obtained from the page table of the computer system memory, but the first virtual may be directly calculated. The first physical address corresponding to the address reduces the overhead of the TLB miss processing.
附图说明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 embodiments or the description of the prior art will be briefly described below. Obviously, the drawings in the following description are only It is a certain embodiment of the present invention, and other drawings can be obtained from those skilled in the art without any inventive labor.
图1是本发明实施例提供的一种内存访问方法的流程图;FIG. 1 is a flowchart of a memory access method according to an embodiment of the present invention;
图2是本发明实施例提供的另一种内存访问方法的流程图;2 is a flowchart of another memory access method according to an embodiment of the present invention;
图3是本发明实施例提供的另一种内存访问方法的流程图;3 is a flowchart of another memory access method according to an embodiment of the present invention;
图4是本发明实施例提供的另一种内存访问方法的流程图;4 is a flowchart of another memory access method according to an embodiment of the present invention;
图5a是本发明实施例中TLB中储存虚拟地址和物理地址的一种结构示意图;FIG. 5a is a schematic structural diagram of storing a virtual address and a physical address in a TLB according to an embodiment of the present invention; FIG.
图5b是本发明实施例中TLB中储存虚拟地址和物理地址的另一种结构示意图;FIG. 5b is another schematic structural diagram of storing a virtual address and a physical address in a TLB according to an embodiment of the present invention; FIG.
图6是本发明实施例提供的一种内存访问设备的结构示意图;FIG. 6 is a schematic structural diagram of a memory access device according to an embodiment of the present disclosure;
图7是本发明实施例提供的另一种内存访问设备的结构示意图;FIG. 7 is a schematic structural diagram of another memory access device according to an embodiment of the present disclosure;
图8是本发明实施例提供的另一种内存访问设备的结构示意图;FIG. 8 is a schematic structural diagram of another memory access device according to an embodiment of the present disclosure;
图9是本发明实施例提供的另一种内存访问设备的结构示意图。FIG. 9 is a schematic structural diagram of another memory access device according to an embodiment of the present invention.
具体实施方式detailed description
下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。The technical solutions in the embodiments of the present invention are clearly and completely described in the following with reference to the accompanying drawings in the embodiments of the present invention. It is obvious that the described embodiments are only a part of the embodiments of the present invention, but not all embodiments. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without creative efforts are within the scope of the present invention.
本发明提供一种内存访问方法,主要是应用于包括处理器、TLB和内存的计算机系统中,由处理器所执行的方法,流程图如图1所示,包括: The present invention provides a memory access method, which is mainly applied to a computer system including a processor, a TLB, and a memory, and is executed by a processor. The flowchart is as shown in FIG. 1 and includes:
步骤101,接收内存的访问请求,访问请求中包括待访问内存的第一虚拟地址。Step 101: Receive an access request of a memory, where the access request includes a first virtual address of the memory to be accessed.
步骤102,判断第一虚拟地址是否储存在旁路转换缓冲TLB,如果为储存即未命中,则该TLB可能缺失了,计算机需要执行步骤103。Step 102: Determine whether the first virtual address is stored in the bypass conversion buffer TLB. If the storage is missed, the TLB may be missing, and the computer needs to perform step 103.
可以理解,在计算机系统中是采用分页内存管理方式来管理计算机系统中的内存的,为了方便管理,计算机系统会为内存生成虚拟地址,并通过页表的形式将内存的物理地址储存在内存中,一段连续的虚拟地址可以对应一段连续的物理地址,也可以对应不连续的物理地址。这样在页表中还会储存着用于指示连续的虚拟地址对应的物理地址之间是否连续的标记位,具体地,一个物理地址对应一个标记位,该标记位用于指示两个连续的虚拟地址是否对应该物理地址与向后或向前连续的物理地址;且页表中还可以储存各个物理地址对应内存单元的其它信息,比如用户对该内存单元的使用权限信息等,这里内存单元是指计算机系统中储存数据的最小划分单元。计算机系统可以将内存中经常被使用的页表及页表中包括的物理地址对应的虚拟地址保存到TLB中,这样在进行虚拟地址和物理地址之间的转换时,查找的内容比较少,可以大大加快虚拟地址与物理地址之间的转换,从而可以加快内存的访问效率,其中TLB是位于内存和处理器之间的独立装置,从处理器发出的访问请求需要向TLB查询物理地址,之后才能送入内存中进行读写数据。It can be understood that in the computer system, the paging memory management mode is adopted to manage the memory in the computer system. For the convenience of management, the computer system generates a virtual address for the memory, and stores the physical address of the memory in the memory by the form of a page table. A continuous virtual address may correspond to a contiguous physical address or a non-contiguous physical address. Thus, in the page table, a flag bit indicating whether the physical addresses corresponding to the consecutive virtual addresses are consecutive is stored. Specifically, one physical address corresponds to one flag bit, and the flag bit is used to indicate two consecutive virtual addresses. Whether the physical address corresponds to a backward or forward physical address; and the page table can also store other information of the corresponding memory unit of each physical address, such as the user's usage authority information for the memory unit, where the memory unit refers to The smallest division of data stored in a computer system. The computer system can save the virtual address corresponding to the physical address included in the page table and the page table frequently used in the memory to the TLB, so that when the conversion between the virtual address and the physical address is performed, the content of the search is relatively small, and The efficiency of memory access is greatly accelerated by greatly speeding up the conversion between the virtual address and the physical address. The TLB is a separate device between the memory and the processor, and the access request sent from the processor needs to query the TLB for the physical address before being able to query the physical address of the TLB. It is sent to the memory for reading and writing data.
当计算机系统在执行某项功能时,需要先访问内存中加载的与该功能相关的信息,而在需要访问内存时,计算机系统会触发本实施例的方法。计算机系统的处理器在运行的过程中,会不停地执行指令(指令为应用程序的代码),当遇到访问待访问内存的指令时,处理器一般通过如下的过程来执行一条指令:取指令、对指令进行译码即解析、执行、访问内存和写回。在这个过程中,处理器中的其中一个单元在遇到访问待访问内存的指令时,会向另一个单元发送内存的访问请求,当另一单元接收到访问请求后,会根据访问请求中包括的第一虚拟地址到TLB中查找是否储存有该第一虚拟地址,如果没有储存即未命中TLB,则说明该TLB可能缺失了,在本实施例中,计算机系统可以通过下述步骤103到105来得到该第一虚拟地址对应的物理地址以进行内存访问;可以想到的是,如果第一虚拟地址命中了TLB即第一虚拟地址已经储 存在TLB中,则可以直接执行步骤106,即在TLB中查找到与第一虚拟地址对应的第一物理地址,并根据查找到的第一物理地址访问待访问内存。When the computer system is performing a certain function, it needs to first access the information related to the function loaded in the memory, and when the memory needs to be accessed, the computer system triggers the method of the embodiment. During the running process of the computer system processor, the instruction (the instruction is the code of the application) is continuously executed. When an instruction for accessing the memory to be accessed is encountered, the processor generally executes an instruction by the following process: Instructions, decoding instructions, ie parsing, executing, accessing memory, and writing back. In this process, one of the units in the processor sends an access request for memory to another unit when it encounters an instruction to access the memory to be accessed. When another unit receives the access request, it is included according to the access request. The first virtual address is searched in the TLB to find whether the first virtual address is stored. If the TLB is not stored, the TLB may be deleted. In this embodiment, the computer system may pass the following steps 103 to 105. Obtaining a physical address corresponding to the first virtual address for memory access; it is conceivable that if the first virtual address hits the TLB, the first virtual address has been stored. In the presence of the TLB, the step 106 is performed directly, that is, the first physical address corresponding to the first virtual address is found in the TLB, and the memory to be accessed is accessed according to the first physical address that is found.
步骤103,将第一虚拟地址进行转换获取第二虚拟地址。Step 103: Convert the first virtual address to obtain a second virtual address.
具体地,在获取第二虚拟地址时,计算机系统可以将第一虚拟地址转换为第一虚拟地址递增方向或递减方向的第n个虚拟地址作为第二虚拟地址,其中n为大于0的正整数。比如将第一虚拟地址转换为与第一虚拟地址连续的第二虚拟地址,一般情况下,虚拟地址是通过虚拟页号(Virtual Page Number,VPN)来表示,在转换为连续的第二虚拟地址时,计算机系统可以在第一虚拟地址的虚拟页号基础上加1或减1得到第二虚拟地址的虚拟页号,从而得到第二虚拟地址。Specifically, when acquiring the second virtual address, the computer system may convert the first virtual address into the nth virtual address in the first virtual address increment direction or the decrement direction as the second virtual address, where n is a positive integer greater than 0. . For example, the first virtual address is converted into a second virtual address that is continuous with the first virtual address. Generally, the virtual address is represented by a virtual page number (VPN), and is converted into a continuous second virtual address. The computer system may add 1 or minus 1 to the virtual page number of the first virtual address to obtain a virtual page number of the second virtual address, thereby obtaining a second virtual address.
步骤104,根据第二虚拟地址对应的第二物理地址与第一虚拟地址对应的第一物理地址之间的预置的关系计算第一物理地址。其中第一物理地址和第二物理地址之间的关系可以是用户根据实际需要预先储存到计算机系统中的。Step 104: Calculate a first physical address according to a preset relationship between a second physical address corresponding to the second virtual address and a first physical address corresponding to the first virtual address. The relationship between the first physical address and the second physical address may be pre-stored in the computer system by the user according to actual needs.
步骤105,根据步骤104中计算的第一物理地址访问待访问内存。Step 105: Access the memory to be accessed according to the first physical address calculated in step 104.
具体地,计算机系统可以先根据第二虚拟地址的虚拟页号,在TLB中找到与第二虚拟地址相对应的信息包括第二物理地址和标记位等;然后需要确定第二物理地址和第一物理地址之间的关系,比如根据第二物理地址对应的标记位可知,该第一物理地址和第二物理地址连续,则直接在第二物理地址的基础上得到与第二物理地址连续的物理地址即可得到第一物理地址;而如果第一虚拟地址和第二虚拟地址对应的物理地址之间具有一定的计算规律,则根据该计算规律计算得到第一物理地址,比如连续的各个虚拟地址对应的物理地址中,相邻物理地址的内存单元之间的间隔都是m,则第一物理地址为第二物理地址递增方向或递减方向的第m+1个内存单元的物理地址,这里m是大于0的正整数。Specifically, the computer system may first find, according to the virtual page number of the second virtual address, the information corresponding to the second virtual address in the TLB, including the second physical address, the mark bit, and the like; and then determine the second physical address and the first The relationship between the physical addresses, for example, according to the mark bits corresponding to the second physical address, the first physical address and the second physical address are consecutive, and the physical contiguous with the second physical address is directly obtained on the basis of the second physical address. The first physical address is obtained by the address; and if the physical address corresponding to the first virtual address and the second virtual address has a certain calculation rule, the first physical address is calculated according to the calculation rule, such as consecutive virtual addresses. In the corresponding physical address, the interval between the memory units of the adjacent physical addresses is m, and the first physical address is the physical address of the m+1th memory unit in the direction in which the second physical address is incremented or decremented, where m Is a positive integer greater than zero.
其中,如果在TLB中也没有储存第二虚拟地址,则计算机系统可以按照步骤103和104的方法,将第二虚拟地址进行转换获取另一虚拟地址,并根据第二虚拟地址和另一虚拟地址对应的物理地址之间的关系,通过另一虚拟地址对应的物理地址计算该第二物理地址,从而再按照上述步骤104的方法计算得 到第一物理地址。这样可以按照上述步骤103和104中所述的方法,逐个计算得到TLB中缺失的物理地址信息,并最终计算得到第一物理地址以进行内存的访问。Wherein, if the second virtual address is not stored in the TLB, the computer system may convert the second virtual address to obtain another virtual address according to the methods of steps 103 and 104, and according to the second virtual address and another virtual address. The relationship between the corresponding physical addresses is calculated by the physical address corresponding to the other virtual address, and then calculated according to the method in step 104 above. To the first physical address. In this way, the physical address information missing in the TLB can be calculated one by one according to the methods described in the above steps 103 and 104, and the first physical address is finally calculated to perform memory access.
需要说明的是,上述在TLB缺失第一虚拟地址时,通过计算得到第一虚拟地址对应的第一物理地址的方法,主要是针对连续的虚拟地址对应连续的物理地址;或针对连续的虚拟地址对应不连续的物理地址,而这些不连续的物理地址相互之间有一定的计算规律等情况而言的,这样才能根据TLB中未缺失的信息计算得到缺失的物理地址。且上述连续的物理地址指示相邻的内存单元对应的物理地址。It should be noted that, when the first virtual address is deleted in the TLB, the method for calculating the first physical address corresponding to the first virtual address is mainly for consecutive virtual addresses corresponding to consecutive virtual addresses; or for consecutive virtual addresses. Corresponding to the discontinuous physical address, and the non-contiguous physical addresses have a certain calculation law with each other, so that the missing physical address can be calculated according to the information that is not missing in the TLB. And the consecutive physical addresses indicate the physical addresses corresponding to the adjacent memory units.
可见,本实施例的内存访问方法中,当TLB中缺失第一虚拟地址对应的信息时,为了使得计算机系统可以访问该第一虚拟地址对应的内存,计算机系统会将第一虚拟地址进行转换获取到第二虚拟地址,并根据第一虚拟地址对应的第一物理地址和第二虚拟地址对应的第二物理地址之间的预置的关系计算第一物理地址,然后再根据第一物理地址访问内存。这样当发现TLB缺失某一虚拟地址比如第一虚拟地址对应的信息时,可以不需要从计算机系统内存中储存的页表中得到虚拟地址和物理地址的转换关系,而是可以直接计算得到该第一虚拟地址对应的第一物理地址,降低了对TLB缺失处理的开销。It can be seen that, in the memory access method of this embodiment, when the information corresponding to the first virtual address is missing in the TLB, in order to enable the computer system to access the memory corresponding to the first virtual address, the computer system converts the first virtual address. Go to the second virtual address, and calculate a first physical address according to a preset relationship between the first physical address corresponding to the first virtual address and the second physical address corresponding to the second virtual address, and then access according to the first physical address. RAM. When the TLB is found to be missing a virtual address, such as the information corresponding to the first virtual address, the conversion relationship between the virtual address and the physical address may not be obtained from the page table stored in the memory of the computer system, but the first calculation may be directly obtained. The first physical address corresponding to a virtual address reduces the overhead of the TLB miss processing.
在一个具体的实施例中,参考图2所示,计算机系统在执行上述步骤104时,具体可以通过如下步骤1041和1042来实现,具体地:In a specific embodiment, as shown in FIG. 2, when the computer system performs the above step 104, it may be specifically implemented by the following steps 1041 and 1042, specifically:
步骤1041,判断第一虚拟地址和第二虚拟地址是否对应连续的物理地址,如果是,则执行步骤1042;如果不连续,且第二物理地址和第一物理地址之间也没有一定的规律,则不能直接计算得到第一物理地址,需要通过访问计算机系统内存中储存的页表来得到第一虚拟地址对应的第一物理地址。Step 1041: Determine whether the first virtual address and the second virtual address correspond to consecutive physical addresses, and if yes, perform step 1042; if not, and there is no certain rule between the second physical address and the first physical address, The first physical address cannot be directly calculated, and the first physical address corresponding to the first virtual address needs to be obtained by accessing the page table stored in the memory of the computer system.
步骤1042,计算第二物理地址连续的物理地址得到第一物理地址,这里第二物理地址连续的物理地址是指与第二物理地址对应内存单元相邻的另一内存单元的物理地址。Step 1042: Calculate a physical address of the second physical address to obtain a first physical address, where the physical address of the second physical address is a physical address of another memory unit adjacent to the memory unit corresponding to the second physical address.
在本实施例中,计算机系统可以通过TLB中储存的第二虚拟地址对应的标记位,得知该第二物理地址是否与第一虚拟地址对应的第一物理地址连续,如果连续,则可以通过第二物理地址计算得到第一物理地址,即可以通过在 该第二物理地址的物理页号(Physical Frame Number,PFN)的基础上加1或减1得到第一物理地址的物理页号,进而得到第一物理地址。In this embodiment, the computer system can learn whether the second physical address is continuous with the first physical address corresponding to the first virtual address by using a flag bit corresponding to the second virtual address stored in the TLB. The second physical address is calculated to obtain the first physical address, that is, The physical page number (PFN) of the second physical address is incremented or decremented by 1 to obtain a physical page number of the first physical address, thereby obtaining a first physical address.
需要说明的是,如果通过上述步骤1041判断第二物理地址和第一物理地址非连续,但是第二物理地址与第一物理地址对应的内存单元之间相隔为m(m为大于0的正整数)时,则若第一物理地址对应的内存单元是第二物理地址递增方向物理地址的内存单元,则计算机系统会计算第二物理地址递增方向的第m+1个物理地址得到第一物理地址;若第一物理地址对应的内存单元是第二物理地址递减方向物理地址的内存单元,则计算机系统会计算第二物理地址递减方向的第m+1个物理地址得到第一物理地址,具体地,可以在第二物理地址的物理页号的基础上加m+1或减m+1得到第一物理地址的物理页号,进而得到第一物理地址。It should be noted that if the second physical address and the first physical address are discontinuous through the above step 1041, the memory units corresponding to the second physical address and the first physical address are separated by m (m is a positive integer greater than 0) When the memory unit corresponding to the first physical address is the memory unit of the second physical address increment direction physical address, the computer system calculates the m+1th physical address of the second physical address increment direction to obtain the first physical address. If the memory unit corresponding to the first physical address is a memory unit with the physical address of the second physical address decreasing direction, the computer system calculates the m+1 physical address of the second physical address decreasing direction to obtain the first physical address, specifically The physical page number of the first physical address may be obtained by adding m+1 or minus m+1 to the physical page number of the second physical address, thereby obtaining the first physical address.
需要说明的是,上述步骤101到106是在TLB中已经储存了经常被使用的页表后计算机系统所执行的内存访问方法,在另一个具体的实施例中,计算机系统还可以执行如下的步骤来实现TLB中页表的储存,流程图如图3所示,包括:It should be noted that the above steps 101 to 106 are memory access methods executed by the computer system after the page table that is frequently used has been stored in the TLB. In another specific embodiment, the computer system may further perform the following steps. To implement the storage of the page table in the TLB, the flow chart is shown in Figure 3, including:
步骤201,为连续的虚拟地址分配对应的物理地址,这些物理地址部分或全部连续。Step 201: Assign consecutive physical addresses to consecutive virtual addresses, and these physical addresses are partially or completely continuous.
步骤202,根据步骤201中的分配,将虚拟地址和物理地址的对应关系储存到TLB中,并储存物理地址对应的标记位,该标记位用于指示连续的虚拟地址对应的物理地址之间是否连续。Step 202: Store the correspondence between the virtual address and the physical address in the TLB according to the allocation in step 201, and store the flag bit corresponding to the physical address, where the flag bit is used to indicate whether the physical address corresponding to the consecutive virtual address is between continuous.
这样通过上述步骤201和202,将虚拟地址和物理地址的对应关系储存在TLB中,并储存物理地址对应的标记位,可以方便在TLB缺失时,根据该标记位确定连续的虚拟地址对应的物理地址之间的关系,并直接计算缺失的物理地址以进行内存访问。In this manner, the corresponding relationship between the virtual address and the physical address is stored in the TLB through the foregoing steps 201 and 202, and the tag bit corresponding to the physical address is stored, so that when the TLB is missing, the physical area corresponding to the continuous virtual address is determined according to the tag bit. The relationship between addresses and directly calculate the missing physical address for memory access.
在这种情况下,计算机系统在执行上述步骤103时,是将第一虚拟地址转换为与第一虚拟地址连续的第二虚拟地址;而在执行上述步骤104时,计算机系统会先在TLB中找到第二物理地址对应的标记位,如果第二物理地址的标志位指示连续的虚拟地址对应的物理地址之间连续,则计算第二物理地址连续的物理地址得到第一物理地址。 In this case, when the computer system performs the above step 103, the first virtual address is converted into a second virtual address that is continuous with the first virtual address; and when the above step 104 is performed, the computer system is first in the TLB. The flag bit corresponding to the second physical address is found. If the flag bit of the second physical address indicates that the physical addresses corresponding to the consecutive virtual addresses are consecutive, the physical address of the second physical address is calculated to obtain the first physical address.
另外,需要说明的是,在其它具体的实施例中,当计算机系统通过上述步骤101到106可以计算得到第一物理地址后,即可实现内存的访问,但是TLB中缺失的物理地址对应的一些信息还是需要从内存中页表中传递到TLB中的,比如物理地址的权限信息等属性信息和标记位等。则计算机系统具体可以通过如下的步骤来实现将第一虚拟地址和第一物理地址的信息储存到TLB中,流程图如图4所示,包括:In addition, it should be noted that, in other specific embodiments, when the computer system can calculate the first physical address through the foregoing steps 101 to 106, the memory access can be realized, but some physical addresses that are missing in the TLB are corresponding. Information still needs to be passed from the in-memory page table to the TLB, such as attribute information such as physical address information and tag bits. The computer system may be configured to store the information of the first virtual address and the first physical address into the TLB by using the following steps. The flowchart is as shown in FIG. 4, and includes:
步骤301,将第一虚拟地址和计算的第一物理地址的对应关系储存到TLB。Step 301: Store the correspondence between the first virtual address and the calculated first physical address to the TLB.
步骤302,将第一物理地址对应的其它信息比如标记位从计算机系统内存的页表中传递到TLB中,即执行页表传递(Page Table Walk)的步骤。其中第一物理地址对应的其它信息还可以包括用户对该第一物理地址的使用权限信息等。Step 302: The other information corresponding to the first physical address, such as a flag bit, is transferred from the page table of the computer system memory to the TLB, that is, the step of performing a Page Table Walk. The other information corresponding to the first physical address may further include usage permission information of the user for the first physical address, and the like.
上述步骤301和302之间并没有绝对的顺序关系,且步骤301和302与步骤105之间也没有绝对的顺序关系,可以同时执行也可以顺序执行,图4中所示的只是一种具体的实现方式。There is no absolute order relationship between the above steps 301 and 302, and there is no absolute order relationship between steps 301 and 302 and step 105. They can be executed simultaneously or sequentially. The specific one shown in FIG. 4 is only a specific one. Method to realize.
以下以一个具体的实施例来说明本发明实施例提供的内存访问方法,在本实施例中,以连续的地址是递增的地址为例说明,在其它实施例中,连续的地址还可以是递减的地址,在此不进行赘述。In the following, a memory access method provided by an embodiment of the present invention is described in a specific embodiment. In this embodiment, an example in which consecutive addresses are incremented addresses is used as an example. In other embodiments, consecutive addresses may also be decremented. The address is not described here.
(1)参考图5a所示,在一种情况下,计算机系统将虚拟内存(Virtual Memory)中的连续的虚拟地址11000、12000、13000和14000分别映射到物理内存(Physical Memory)中的物理地址1000、2000、3000和5000,则将连续的虚拟地址映射到3个连续的物理地址,和2个非连续的物理地址中。(1) Referring to FIG. 5a, in one case, the computer system maps consecutive virtual addresses 11000, 12000, 13000, and 14000 in virtual memory to physical addresses in physical memory, respectively. 1000, 2000, 3000, and 5000 map consecutive virtual addresses to 3 consecutive physical addresses and 2 non-contiguous physical addresses.
在本实施例中,计算机系统将内存的物理地址以页表的形式进行储存在内存中,并记录每个物理地址对应的标记位,如果标记位的值为“1”,则指示某一物理地址及其向后连续的另一物理地址分别对应连续的虚拟地址;如果标记位的值为“0”,则指示某一物理地址向后连续的另一物理地址并没有映射与该某一物理地址对应虚拟地址连续的另一虚拟地址。且计算机系统会将经常用到的部分页表信息及页表中物理地址对应的虚拟地址储存到TLB中,一项TLB对应储存一个虚拟地址对应的所有信息包括物理地址和标记位等信息,且每一项TLB通过寄存器标识(ASID)来标识。且在TLB中储存的虚拟 地址和物理地址分别使用虚拟页号和物理页号来标记,比如虚拟地址11000的虚拟页号为11,物理地址1000的物理页号为1。In this embodiment, the computer system stores the physical address of the memory in the form of a page table in the memory, and records the tag bit corresponding to each physical address. If the value of the tag bit is "1", it indicates a certain physics. The address and its subsequent consecutive physical address respectively correspond to consecutive virtual addresses; if the value of the flag bit is "0", another physical address indicating that a physical address is consecutive backwards is not mapped to the physical entity The address corresponds to another virtual address in which the virtual address is continuous. The computer system stores the partial page table information that is frequently used and the virtual address corresponding to the physical address in the page table in the TLB. A TLB stores all information corresponding to a virtual address, including physical addresses and tag bits, and Each TLB is identified by a register identifier (ASID). And the virtual stored in the TLB The address and the physical address are respectively marked by a virtual page number and a physical page number, for example, the virtual page number of the virtual address 11000 is 11, and the physical page number of the physical address 1000 is 1.
假设整个页表在内存中的物理地址为a,给定某个虚拟地址b,通过一定的计算方法比如a+b得到另一个物理地址c,此时物理地址c对应的内存中储存着虚拟地址b对应的物理地址,这个过程称为页表索引,通过页表索引的过程,计算机可以找到虚拟地址对应的物理地址,然后将物理地址和虚拟地址的对应关系储存到TLB中。Assume that the physical address of the entire page table in memory is a, given a virtual address b, another physical address c is obtained by a certain calculation method such as a+b, and the virtual address is stored in the memory corresponding to the physical address c. The physical address corresponding to b, this process is called page table index. Through the process of page table indexing, the computer can find the physical address corresponding to the virtual address, and then store the correspondence between the physical address and the virtual address in the TLB.
当计算机系统需要访问虚拟地址12000对应的内存,而该虚拟地址对应的信息在TLB中缺失时,计算机系统会将该虚拟地址转换为与该虚拟地址连续的虚拟地址11000;根据虚拟地址11000对应的标记位1,得知该虚拟地址11000对应物理地址向后连续的物理地址映射了与该虚拟地址11000连续的虚拟地址12000,则根据转换为的虚拟地址11000对应的物理地址1000计算得到虚拟地址12000对应的物理地址为2000;最后计算机系统就会根据该物理地址2000来访问内存。When the computer system needs to access the memory corresponding to the virtual address 12000, and the information corresponding to the virtual address is missing in the TLB, the computer system converts the virtual address into a virtual address 11000 consecutive to the virtual address; corresponding to the virtual address 11000. When the virtual address 11000 is mapped to the physical address of the virtual address 11000, the virtual address 12000 is mapped to the virtual address 11000. The virtual address 12000 is calculated according to the physical address 1000 corresponding to the converted virtual address 11000. The corresponding physical address is 2000; finally, the computer system accesses the memory according to the physical address 2000.
(2)参考图5b所示,在另一种情况下,计算机系统将虚拟内存中的连续的虚拟地址11000、12000和13000和14000分别映射到物理内存中的物理地址1000、3000和5000,则将连续的虚拟地址映射非连续的物理地址,但是这些非连续的物理地址中,相邻的物理地址之间的间隔都是一样的,是具有一定的规律性的。(2) Referring to FIG. 5b, in another case, the computer system maps consecutive virtual addresses 11000, 12000, and 13000 and 14000 in virtual memory to physical addresses 1000, 3000, and 5000 in physical memory, respectively. The consecutive virtual addresses are mapped to non-contiguous physical addresses, but among these non-contiguous physical addresses, the intervals between adjacent physical addresses are the same, and have certain regularity.
在本实施例中,当计算机系统需要访问虚拟地址12000对应的内存,而该虚拟地址对应的信息在TLB中缺失时,计算机系统会将该虚拟地址转换为与该虚拟地址连续的虚拟地址11000;根据虚拟地址11000和12000之间对应的物理地址的对应关系,即系统中预置的11000到13000这段连续的虚拟地址对应的物理地址中,相邻的物理地址对应的内存之间间隔一个内存单元,则根据转换为的虚拟地址11000对应的物理地址1000,计算该物理地址向后两个内存单元的物理地址3000即得到了虚拟地址12000对应的物理地址;最后计算机系统就会根据该物理地址3000来访问内存。In this embodiment, when the computer system needs to access the memory corresponding to the virtual address 12000, and the information corresponding to the virtual address is missing in the TLB, the computer system converts the virtual address into a virtual address 11000 consecutive to the virtual address; According to the correspondence between the physical addresses corresponding to the virtual addresses 11000 and 12000, that is, the physical addresses corresponding to the consecutive virtual addresses of 11000 to 13000 preset in the system, the memory corresponding to the adjacent physical addresses is separated by a memory. The unit calculates the physical address of the virtual memory address 12000 according to the physical address 1000 corresponding to the virtual address 11000 converted to the physical address, and obtains the physical address corresponding to the virtual address 12000; finally, the computer system according to the physical address 3000 to access the memory.
本发明实施例还提供一种内存访问设备即上述的计算机系统,其结构示意图如图6所示,包括: The embodiment of the present invention further provides a memory access device, that is, the above computer system, and a schematic structural diagram thereof is shown in FIG. 6 and includes:
请求接收单元10,用于接收内存的访问请求,所述访问请求中包括待访问内存的第一虚拟地址。The request receiving unit 10 is configured to receive an access request of a memory, where the access request includes a first virtual address of the memory to be accessed.
获取单元11,用于如果所述请求接收单元10接收的访问请求中第一虚拟地址未储存在旁路转换缓冲TLB中,将所述第一虚拟地址进行转换获取第二虚拟地址。具体地,获取单元11可以将第一虚拟地址转换为第一虚拟地址递增方向或递减方向的第n个虚拟地址作为第二虚拟地址;所述n为大于0的正整数,比如获取单元11在第一虚拟地址的虚拟页号基础上加1或减1得到第二虚拟地址的虚拟页号,进而得到第二虚拟地址。The obtaining unit 11 is configured to: if the first virtual address in the access request received by the request receiving unit 10 is not stored in the bypass translation buffer TLB, convert the first virtual address to obtain a second virtual address. Specifically, the obtaining unit 11 may convert the first virtual address into the nth virtual address of the first virtual address increment direction or the decrement direction as the second virtual address; the n is a positive integer greater than 0, for example, the obtaining unit 11 is The virtual page number of the first virtual address is incremented or decremented by 1 to obtain the virtual page number of the second virtual address, thereby obtaining the second virtual address.
地址计算单元12,用于根据所述获取单元11转换的第二虚拟地址对应的第二物理地址与所述第一虚拟地址对应的第一物理地址之间的预置的关系计算所述第一物理地址。The address calculation unit 12 is configured to calculate the first relationship according to a preset relationship between a second physical address corresponding to the second virtual address converted by the acquiring unit 11 and a first physical address corresponding to the first virtual address. Physical address.
具体地,地址计算单元12,具体用于如果所述第一虚拟地址和第二虚拟地址对应连续的物理地址,计算所述第二物理地址连续的物理地址得到所述第一物理地址。而如果第一虚拟地址和第二虚拟地址对应的物理地址之间具有一定的计算规律,则地址计算单元12会根据该计算规律计算得到第一物理地址,比如第二物理地址和第一物理地址非连续,且第二物理地址与第一物理地址对应的内存单元之间相隔为m时,若第一物理地址对应的内存单元是第二物理地址递增方向物理地址的内存单元,则地址计算单元12计算第二物理地址递增方向的第m+1个物理地址得到所述第一物理地址;若所述第一物理地址对应的内存单元是所述第二物理地址递减方向物理地址的内存单元,则地址计算单元12计算第二物理地址递减方向的第m+1个物理地址得到第一物理地址,其中m是大于0的正整数。Specifically, the address calculation unit 12 is specifically configured to calculate the physical address of the second physical address to obtain the first physical address if the first virtual address and the second virtual address correspond to consecutive physical addresses. If the physical address corresponding to the first virtual address and the second virtual address have a certain calculation rule, the address calculation unit 12 calculates the first physical address, such as the second physical address and the first physical address, according to the calculation rule. If the memory unit corresponding to the first physical address is a memory unit that is in the direction of the physical address of the second physical address, the address calculation unit is non-contiguous, and the memory unit corresponding to the first physical address is separated by m. The first physical address is obtained by calculating the m+1th physical address in the direction of the second physical address incrementing; if the memory unit corresponding to the first physical address is the memory unit in the physical address of the second physical address decreasing direction, Then, the address calculation unit 12 calculates the m+1th physical address of the second physical address decrement direction to obtain the first physical address, where m is a positive integer greater than 0.
访问单元13,用于根据所述地址计算单元12计算的第一物理地址访问所述待访问内存。The access unit 13 is configured to access the to-be-accessed memory according to the first physical address calculated by the address calculation unit 12.
本实施例的内存访问设备中,当TLB中缺失第一虚拟地址对应的信息时,为了使得内存访问设备可以访问该第一虚拟地址对应的内存,获取单元11会将第一虚拟地址进行转换获取第二虚拟地址,并由地址计算单元12根据第一虚拟地址对应的第一物理地址和第二虚拟地址对应的第二物理地址之间的预置的关系计算第一物理地址,然后访问单元13再根据第一物理地址访问内存。 这样当发现TLB缺失某一虚拟地址比如第一虚拟地址对应的信息时,可以不需要从计算机系统内存中储存的页表中得到虚拟地址和物理地址的转换关系,而是可以直接计算得到该第一虚拟地址对应的第一物理地址,降低了对TLB缺失处理的开销。In the memory access device of this embodiment, when the information corresponding to the first virtual address is missing in the TLB, in order to enable the memory access device to access the memory corresponding to the first virtual address, the obtaining unit 11 converts the first virtual address. a second virtual address, and the first physical address is calculated by the address calculating unit 12 according to a preset relationship between the first physical address corresponding to the first virtual address and the second physical address corresponding to the second virtual address, and then the access unit 13 Then access the memory according to the first physical address. When the TLB is found to be missing a virtual address, such as the information corresponding to the first virtual address, the conversion relationship between the virtual address and the physical address may not be obtained from the page table stored in the memory of the computer system, but the first calculation may be directly obtained. The first physical address corresponding to a virtual address reduces the overhead of the TLB miss processing.
参考图7所示,在一个具体的实施例中,内存方法设备除了可以包括如图6所示的结构外,还可以包括地址分配单元14、对应储存单元15和查询访问单元16,其中:Referring to FIG. 7, in a specific embodiment, the memory method device may include an address allocation unit 14, a corresponding storage unit 15, and a query access unit 16, in addition to the structure shown in FIG. 6, wherein:
地址分配单元14,用于为连续的虚拟地址分配对应的物理地址,所述物理地址部分或全部连续;An address allocation unit 14 is configured to allocate a corresponding physical address to consecutive virtual addresses, where the physical addresses are partially or completely continuous;
对应储存单元15,用于根据地址分配单元14的分配,将虚拟地址和物理地址的对应关系储存到所述TLB中,并储存物理地址对应的标记位,所述标记位用于指示所述连续的虚拟地址对应的物理地址是否连续。 Corresponding storage unit 15 is configured to store the correspondence between the virtual address and the physical address in the TLB according to the allocation of the address allocation unit 14, and store the label bit corresponding to the physical address, where the flag bit is used to indicate the continuous Whether the physical address corresponding to the virtual address is continuous.
查询访问单元16,用于如果所述请求接收单元10接收的访问请求中第一虚拟地址命中旁路转换缓冲TLB,在所述TLB中查询与所述第一虚拟地址对应的第一物理地址,并根据所述第一物理地址访问所述待访问内存。The query access unit 16 is configured to: if the first virtual address hits the bypass translation buffer TLB in the access request received by the request receiving unit 10, query the first physical address corresponding to the first virtual address in the TLB, And accessing the to-be-accessed memory according to the first physical address.
本实施例中,可以通过地址分配单元14和对应储存单元15将虚拟地址和物理地址的对应关系储存在TLB中,并储存物理地址对应的标记位,可以方便在TLB缺失时,获取单元11根据该标记位确定连续的虚拟地址对应的物理地址之间的关系,并直接计算缺失的物理地址以进行内存访问。当TLB未缺失时,则通过查询访问单元16访问待访问内存。具体地,获取单元11具体将所述第一虚拟地址转换为与所述第一虚拟地址连续的第二虚拟地址;而地址计算单元12,具体在所述第二物理地址的标志位指示所述连续的虚拟地址对应的物理地址之间连续,则计算所述第二物理地址连续的物理地址得到所述第一物理地址。In this embodiment, the correspondence between the virtual address and the physical address may be stored in the TLB through the address allocation unit 14 and the corresponding storage unit 15, and the tag bit corresponding to the physical address may be stored, so that when the TLB is missing, the obtaining unit 11 may The flag bit determines the relationship between physical addresses corresponding to consecutive virtual addresses and directly calculates the missing physical address for memory access. When the TLB is not missing, the memory to be accessed is accessed through the query access unit 16. Specifically, the acquiring unit 11 specifically converts the first virtual address into a second virtual address that is continuous with the first virtual address, and the address calculating unit 12, specifically, the flag bit of the second physical address indicates the The physical addresses corresponding to the consecutive virtual addresses are consecutive, and the physical addresses consecutive to the second physical address are calculated to obtain the first physical address.
参考图8所示,在一个具体的实施例中,内存方法设备除了可以包括如图6所示的结构外,还可以包括信息储存单元17,用于将所述第一虚拟地址和第一物理地址的信息储存到所述TLB中。在具体的实施例中,信息储存单元17可以通过对应关系储存单元170和传递单元171来实现,具体地:Referring to FIG. 8, in a specific embodiment, the memory method device may include, in addition to the structure shown in FIG. 6, an information storage unit 17 for using the first virtual address and the first physics. The information of the address is stored in the TLB. In a specific embodiment, the information storage unit 17 can be implemented by the correspondence relationship storage unit 170 and the delivery unit 171, specifically:
对应关系储存单元170,用于将所述第一虚拟地址和计算的第一物理地址 的对应关系储存到所述TLB;Correspondence relationship storage unit 170, configured to use the first virtual address and the calculated first physical address Corresponding relationship is stored to the TLB;
传递单元171,用于将所述第一物理地址对应的其它信息比如标记位从计算机系统内存的页表中传递到所述TLB中,即执行页表传递(Page Table Walk)的过程。且第一物理地址对应的其它信息还可以包括用户对该第一物理地址的使用权限信息等。The delivery unit 171 is configured to transfer other information corresponding to the first physical address, such as a flag bit, from a page table in a computer system memory to the TLB, that is, a process of performing a Page Table Walk. The other information corresponding to the first physical address may further include usage authority information of the user to the first physical address, and the like.
本发明实施例还提供另一种内存访问设备,结构示意图如图9所示,包括分别连接到总线上的存储器20、处理器21、输入装置23和输出装置24,其中:Another embodiment of the present invention further provides a memory access device. The structure is as shown in FIG. 9. The memory 20, the processor 21, the input device 23, and the output device 24 are respectively connected to the bus, where:
存储器20中用来储存从输入装置23输入的数据,且还可以储存处理器21处理数据的必要文件等信息,本实施例中存储器21包括内存和TLB;输入装置23和输出装置24是内存访问设备与其他设备通信的端口,还可以包括内存访问设备外接的设备比如显示器、键盘、鼠标和打印机等。The memory 20 is used to store data input from the input device 23, and may also store information such as necessary files for processing the data by the processor 21. In the present embodiment, the memory 21 includes a memory and a TLB; the input device 23 and the output device 24 are memory accesses. The port through which the device communicates with other devices may also include devices external to the memory access device such as a display, a keyboard, a mouse, and a printer.
处理器21,用于接收内存的访问请求,所述访问请求中包括待访问内存的第一虚拟地址;如果所述第一虚拟地址未储存在旁路转换缓冲TLB中,将所述第一虚拟地址进行转换获取第二虚拟地址;根据所述第二虚拟地址对应的第二物理地址与所述第一虚拟地址对应的第一物理地址之间的预置的关系计算所述第一物理地址;并根据所述地址计算单元计算的第一物理地址访问所述待访问内存。可以想到的是,如果所述第一虚拟地址已经储存在旁路转换缓冲TLB,处理器21还用于在所述TLB中查询与所述第一虚拟地址对应的第一物理地址,并根据所述第一物理地址访问所述待访问内存。The processor 21 is configured to receive an access request of the memory, where the access request includes a first virtual address of the memory to be accessed; if the first virtual address is not stored in the bypass translation buffer TLB, the first virtual The address is converted to obtain the second virtual address; the first physical address is calculated according to a preset relationship between the second physical address corresponding to the second virtual address and the first physical address corresponding to the first virtual address; And accessing the to-be-accessed memory according to the first physical address calculated by the address calculation unit. It is conceivable that if the first virtual address is already stored in the bypass translation buffer TLB, the processor 21 is further configured to query the TLB for the first physical address corresponding to the first virtual address, and according to the The first physical address accesses the to-be-accessed memory.
具体地,处理器21在获取第二虚拟地址时,将所述第一虚拟地址转换为所述第一虚拟地址递增方向或递减方向的第n个虚拟地址作为第二虚拟地址;所述n为大于0的正整数。比如在第一虚拟地址的虚拟页号基础上加1或减1得到第二虚拟地址的虚拟页号,进而得到第二虚拟地址。处理器21在计算第一物理地址时,如果所述第一虚拟地址和第二虚拟地址对应连续的物理地址,处理器21会计算所述第二物理地址连续的物理地址得到所述第一物理地址。而如果第一虚拟地址和第二虚拟地址对应的物理地址之间具有一定的计算规律,则处理器21会根据该计算规律计算得到第一物理地址,比如如果所述第二物理地址和第一物理地址非连续,且所述第二物理地址与第一物理地址对应的内存单元之间相隔为m时,若所述第一物理地址对应的内存单元是所述第 二物理地址递增方向物理地址的内存单元,则计算所述第二物理地址递增方向的第m+1个物理地址得到所述第一物理地址;若所述第一物理地址对应的内存单元是所述第二物理地址递减方向物理地址的内存单元,则计算所述第二物理地址递减方向的第m+1个物理地址得到所述第一物理地址,所述m是大于0的正整数。Specifically, when acquiring the second virtual address, the processor 21 converts the first virtual address into an nth virtual address in the first virtual address increment direction or a decrement direction as a second virtual address; A positive integer greater than zero. For example, adding or subtracting 1 from the virtual page number of the first virtual address to obtain a virtual page number of the second virtual address, thereby obtaining a second virtual address. When the processor 21 calculates the first physical address, if the first virtual address and the second virtual address correspond to consecutive physical addresses, the processor 21 calculates a continuous physical address of the second physical address to obtain the first physical address. If the physical address corresponding to the first virtual address and the second virtual address have a certain calculation rule, the processor 21 calculates the first physical address according to the calculation rule, for example, if the second physical address and the first If the physical address is not continuous, and the memory unit corresponding to the first physical address is separated by m, if the memory unit corresponding to the first physical address is the If the physical unit of the physical address is incremented by the physical address, the m+1 physical address in the direction of the second physical address is calculated to obtain the first physical address; if the memory unit corresponding to the first physical address is The memory unit of the second physical address decrement direction physical address calculates the m+1th physical address of the second physical address decrement direction to obtain the first physical address, where m is a positive integer greater than 0.
进一步地,处理器21还可以用于为连续的虚拟地址分配对应的物理地址,所述物理地址部分或全部连续;并将虚拟地址和物理地址的对应关系储存到所述TLB中,并储存物理地址对应的标记位,所述标记位用于指示所述连续的虚拟地址对应的物理地址之间是否连续。这样将虚拟地址和物理地址的对应关系储存在TLB中,并储存物理地址对应的标记位,可以方便在TLB缺失时,转换单元11根据该标记位确定连续的虚拟地址对应的物理地址之间的关系,并直接计算缺失的物理地址以进行内存访问。Further, the processor 21 may be further configured to allocate a corresponding physical address to the consecutive virtual addresses, where the physical addresses are partially or completely continuous; and store the correspondence between the virtual address and the physical address in the TLB, and store the physical A flag bit corresponding to the address, the flag bit is used to indicate whether the physical addresses corresponding to the consecutive virtual addresses are consecutive. In this way, the correspondence between the virtual address and the physical address is stored in the TLB, and the tag bit corresponding to the physical address is stored, so that when the TLB is missing, the converting unit 11 determines the physical address corresponding to the consecutive virtual addresses according to the flag bit. Relationships and directly calculate missing physical addresses for memory access.
进一步地,当处理器21在计算了第一物理地址后,还可以用于将所述第一虚拟地址和第一物理地址的信息储存到所述TLB中。具体地,将所述第一虚拟地址和计算的第一物理地址的对应关系储存到所述TLB;并将所述第一物理地址对应的其它信息比如标记位从计算机系统内存的页表中传递到所述TLB中,即执行页表传递(Page Table Walk)的过程。且第一物理地址对应的其它信息还可以包括用户对该第一物理地址的使用权限信息等。Further, after the processor 21 calculates the first physical address, the processor 21 may further be configured to store information of the first virtual address and the first physical address into the TLB. Specifically, storing a correspondence between the first virtual address and the calculated first physical address to the TLB; and transmitting other information corresponding to the first physical address, such as a flag bit, from a page table in a computer system memory To the TLB, the process of performing a Page Table Walk. The other information corresponding to the first physical address may further include usage authority information of the user to the first physical address, and the like.
本领域普通技术人员可以理解上述实施例的各种方法中的全部或部分步骤是可以通过程序来指令相关的硬件来完成,该程序可以存储于一计算机可读存储介质中,存储介质可以包括:只读存储器(ROM)、随机存取存储器(RAM)、磁盘或光盘等。A person skilled in the art may understand that all or part of the various steps of the foregoing embodiments may be performed by a program to instruct related hardware. The program may be stored in a computer readable storage medium, and the storage medium may include: Read only memory (ROM), random access memory (RAM), magnetic or optical disk, and the like.
以上对本发明实施例所提供的内存访问方法和设备进行了详细介绍,本文中应用了具体个例对本发明的原理及实施方式进行了阐述,以上实施例的说明只是用于帮助理解本发明的方法及其核心思想;同时,对于本领域的一般技术人员,依据本发明的思想,在具体实施方式及应用范围上均会有改变之处,综上所述,本说明书内容不应理解为对本发明的限制。 The memory access method and device provided by the embodiments of the present invention are described in detail above. The principles and implementation manners of the present invention are described in the specific examples. The description of the above embodiments is only used to help understand the method of the present invention. And the core idea of the present invention; at the same time, those skilled in the art, according to the idea of the present invention, there will be changes in the specific embodiments and application scope. In summary, the content of the present specification should not be construed as the present invention. limits.

Claims (14)

  1. 一种内存访问方法,其特征在于,包括:A memory access method, comprising:
    接收内存的访问请求,所述访问请求中包括待访问内存的第一虚拟地址;Receiving an access request of the memory, where the access request includes a first virtual address of the memory to be accessed;
    如果所述第一虚拟地址未储存在旁路转换缓冲TLB中,将所述第一虚拟地址进行转换获取第二虚拟地址;If the first virtual address is not stored in the bypass translation buffer TLB, converting the first virtual address to obtain a second virtual address;
    根据所述第二虚拟地址对应的第二物理地址与所述第一虚拟地址对应的第一物理地址之间的预置的关系计算所述第一物理地址;Calculating the first physical address according to a preset relationship between a second physical address corresponding to the second virtual address and a first physical address corresponding to the first virtual address;
    根据所述第一物理地址访问所述待访问内存。Accessing the to-be-accessed memory according to the first physical address.
  2. 如权利要求1所述的方法,其特征在于,所述将所述第一虚拟地址进行转换获取第二虚拟地址具体包括:将所述第一虚拟地址转换为所述第一虚拟地址递增方向或递减方向的第n个虚拟地址作为第二虚拟地址;所述n为大于0的正整数。The method of claim 1, wherein the converting the first virtual address to obtain the second virtual address comprises: converting the first virtual address into the first virtual address increment direction or The nth virtual address in the decrement direction is taken as the second virtual address; the n is a positive integer greater than 0.
  3. 如权利要求1或2所述的方法,其特征在于,根据所述第二虚拟地址对应的第二物理地址与所述第一虚拟地址对应的第一物理地址之间的预置的关系计算所述第一物理地址,具体包括:The method according to claim 1 or 2, wherein the calculation is performed according to a preset relationship between the second physical address corresponding to the second virtual address and the first physical address corresponding to the first virtual address. The first physical address includes:
    如果所述第一虚拟地址和第二虚拟地址对应连续的物理地址,计算所述第二物理地址连续的物理地址得到所述第一物理地址;If the first virtual address and the second virtual address correspond to consecutive physical addresses, calculating a physical address of the second physical address to obtain the first physical address;
    如果所述第二物理地址和第一物理地址非连续,且所述第二物理地址与第一物理地址对应的内存单元之间相隔为m时,若所述第一物理地址对应的内存单元是所述第二物理地址递增方向物理地址的内存单元,则计算所述第二物理地址递增方向的第m+1个物理地址得到所述第一物理地址;若所述第一物理地址对应的内存单元是所述第二物理地址递减方向物理地址的内存单元,则计算所述第二物理地址递减方向的第m+1个物理地址得到所述第一物理地址,所述m是大于0的正整数。If the second physical address and the first physical address are non-contiguous, and the memory unit corresponding to the first physical address is separated by m, if the memory unit corresponding to the first physical address is The second physical address is incremented by the physical unit of the physical address, and the m+1th physical address in the direction of the second physical address is calculated to obtain the first physical address; if the memory corresponding to the first physical address is The unit is a memory unit in which the second physical address decrements the physical address, and the m+1th physical address in the decreasing direction of the second physical address is calculated to obtain the first physical address, where the m is greater than 0. Integer.
  4. 如权利要求1所述的方法,其特征在于,所述接收内存的访问请求之前,还包括:The method of claim 1, wherein before receiving the access request for the memory, the method further comprises:
    为连续的虚拟地址分配对应的物理地址,所述物理地址部分或全部连续;Assigning a corresponding physical address to consecutive virtual addresses, the physical addresses being partially or completely continuous;
    将虚拟地址和物理地址的对应关系储存到所述TLB中,并储存物理地址对 应的标记位,所述标记位用于指示所述连续的虚拟地址对应的物理地址之间是否连续。Storing the correspondence between the virtual address and the physical address in the TLB, and storing the physical address pair A flag bit that is used to indicate whether the physical addresses corresponding to the consecutive virtual addresses are consecutive.
  5. 如权利要求4所述的方法,其特征在于,所述将所述第一虚拟地址进行转换获取第二虚拟地址,具体包括:将所述第一虚拟地址转换为与所述第一虚拟地址连续的第二虚拟地址;The method of claim 4, wherein the converting the first virtual address to obtain the second virtual address comprises: converting the first virtual address to be continuous with the first virtual address Second virtual address;
    所述根据所述第二虚拟地址对应的第二物理地址与所述第一虚拟地址对应的第一物理地址之间的预置的关系计算所述第一物理地址,具体包括:如果所述第二物理地址的标志位指示所述连续的虚拟地址对应的物理地址之间连续,则计算所述第二物理地址连续的物理地址得到所述第一物理地址。Calculating the first physical address according to a preset relationship between the second physical address corresponding to the second virtual address and the first physical address corresponding to the first virtual address, specifically: if the The flag of the physical address indicates that the physical addresses corresponding to the consecutive virtual addresses are consecutive, and the physical address of the second physical address is calculated to obtain the first physical address.
  6. 如权利要求4所述的方法,其特征在于,所述方法还包括:The method of claim 4, wherein the method further comprises:
    将所述第一虚拟地址和第一物理地址的信息储存到所述TLB中。Information of the first virtual address and the first physical address is stored in the TLB.
  7. 如权利要求6所述的方法,其特征在于,所述将所述第一虚拟地址和第一物理地址的信息储存到所述TLB中,具体包括:The method of claim 6, wherein the storing the information of the first virtual address and the first physical address into the TLB comprises:
    将所述第一虚拟地址和计算的第一物理地址的对应关系储存到所述TLB;Saving a correspondence between the first virtual address and the calculated first physical address to the TLB;
    将所述第一物理地址对应的标记位从计算机系统内存的页表中传递到所述TLB中。The flag bit corresponding to the first physical address is transferred from the page table of the computer system memory to the TLB.
  8. 一种内存访问设备,其特征在于,包括:A memory access device, comprising:
    请求接收单元,用于接收内存的访问请求,所述访问请求中包括待访问内存的第一虚拟地址;a request receiving unit, configured to receive an access request of a memory, where the access request includes a first virtual address of the memory to be accessed;
    获取单元,用于如果所述请求接收单元接收的访问请求中第一虚拟地址未储存在旁路转换缓冲TLB中,将所述第一虚拟地址进行转换获取第二虚拟地址;An acquiring unit, configured to: if the first virtual address in the access request received by the request receiving unit is not stored in the bypass conversion buffer TLB, convert the first virtual address to obtain a second virtual address;
    地址计算单元,用于根据所述转换单元转换的第二虚拟地址对应的第二物理地址与所述第一虚拟地址对应的第一物理地址之间的预置的关系计算所述第一物理地址;An address calculation unit, configured to calculate the first physical address according to a preset relationship between a second physical address corresponding to the second virtual address converted by the conversion unit and a first physical address corresponding to the first virtual address ;
    访问单元,用于根据所述地址计算单元计算的第一物理地址访问所述待访问内存。And an access unit, configured to access the to-be-accessed memory according to the first physical address calculated by the address calculation unit.
  9. 如权利要求8所述的设备,其特征在于,所述获取单元,具体用于将所述第一虚拟地址转换为所述第一虚拟地址递增方向或递减方向的第n个虚 拟地址作为第二虚拟地址;所述n为大于0的正整数。The device according to claim 8, wherein the obtaining unit is specifically configured to convert the first virtual address into an nth virtual state in which the first virtual address is incremented or decremented The intended address is the second virtual address; the n is a positive integer greater than zero.
  10. 如权利要求8或9所述的设备,其特征在于,所述地址计算单元,具体用于如果所述第一虚拟地址和第二虚拟地址对应连续的物理地址,计算所述第二物理地址连续的物理地址得到所述第一物理地址;The device according to claim 8 or 9, wherein the address calculation unit is configured to calculate the second physical address continuously if the first virtual address and the second virtual address correspond to consecutive physical addresses. Physical address of the first physical address;
    如果所述第二物理地址和第一物理地址非连续,且所述第二物理地址与第一物理地址对应的内存单元之间相隔为m时,若所述第一物理地址对应的内存单元是所述第二物理地址递增方向物理地址的内存单元,则计算所述第二物理地址递增方向的第m+1个物理地址得到所述第一物理地址;若所述第一物理地址对应的内存单元是所述第二物理地址递减方向物理地址的内存单元,则计算所述第二物理地址递减方向的第m+1个物理地址得到所述第一物理地址,所述m是大于0的正整数。If the second physical address and the first physical address are non-contiguous, and the memory unit corresponding to the first physical address is separated by m, if the memory unit corresponding to the first physical address is The second physical address is incremented by the physical unit of the physical address, and the m+1th physical address in the direction of the second physical address is calculated to obtain the first physical address; if the memory corresponding to the first physical address is The unit is a memory unit in which the second physical address decrements the physical address, and the m+1th physical address in the decreasing direction of the second physical address is calculated to obtain the first physical address, where the m is greater than 0. Integer.
  11. 如权利要求7所述的设备,其特征在于,还包括:The device of claim 7 further comprising:
    地址分配单元,用于为连续的虚拟地址分配对应的物理地址,所述物理地址部分或全部连续;An address allocation unit, configured to allocate a corresponding physical address to consecutive virtual addresses, where the physical addresses are partially or completely continuous;
    对应储存单元,用于将虚拟地址和物理地址的对应关系储存到所述TLB中,并储存物理地址对应的标记位,所述标记位用于指示所述连续的虚拟地址对应的物理地址是否连续。Corresponding storage unit, configured to store a correspondence between the virtual address and the physical address in the TLB, and store a mark bit corresponding to the physical address, where the mark bit is used to indicate whether the physical address corresponding to the consecutive virtual address is continuous .
  12. 如权利要求11所述的设备,其特征在于,所述获取单元,具体用于将所述第一虚拟地址转换为与所述第一虚拟地址连续的第二虚拟地址;The device according to claim 11, wherein the obtaining unit is specifically configured to convert the first virtual address into a second virtual address that is continuous with the first virtual address;
    所述地址计算单元,具体用于如果所述第二物理地址的标志位指示所述连续的虚拟地址对应的物理地址之间连续,则计算所述第二物理地址连续的物理地址得到所述第一物理地址。The address calculation unit is configured to: if the flag bit of the second physical address indicates that the physical addresses corresponding to the consecutive virtual addresses are consecutive, calculate a physical address of the second physical address to obtain the A physical address.
  13. 如权利要求11所述的设备,其特征在于,还包括:The device of claim 11 further comprising:
    信息储存单元,用于将所述第一虚拟地址和第一物理地址的信息储存到所述TLB中。And an information storage unit, configured to store information of the first virtual address and the first physical address into the TLB.
  14. 如权利要求13所述的设备,其特征在于,所述信息储存单元具体包括:The device of claim 13, wherein the information storage unit comprises:
    对应关系储存单元,用于将所述第一虚拟地址和计算的第一物理地址的对应关系储存到所述TLB; a correspondence relationship storage unit, configured to store a correspondence between the first virtual address and the calculated first physical address to the TLB;
    传递单元,用于将所述第一物理地址对应的标记位从计算机系统内存的页表中传递到所述TLB中。 And a transfer unit, configured to transfer the mark bit corresponding to the first physical address from the page table of the computer system memory to the TLB.
PCT/CN2014/086355 2013-09-29 2014-09-12 Memory accessing method and device WO2015043379A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201310456953.4 2013-09-29
CN201310456953.4A CN104516822B (en) 2013-09-29 2013-09-29 A kind of memory pool access method and equipment

Publications (1)

Publication Number Publication Date
WO2015043379A1 true WO2015043379A1 (en) 2015-04-02

Family

ID=52742021

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2014/086355 WO2015043379A1 (en) 2013-09-29 2014-09-12 Memory accessing method and device

Country Status (2)

Country Link
CN (1) CN104516822B (en)
WO (1) WO2015043379A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112000592A (en) * 2020-07-27 2020-11-27 瑞芯微电子股份有限公司 Method and device for data interaction between modules

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108140216B (en) * 2015-09-30 2021-10-15 丹佛斯有限公司 Mobile application communication with utility meter
CN107391394A (en) * 2017-08-03 2017-11-24 郑州云海信息技术有限公司 A kind of method and device for handling more NameSpace LBA
CN111552653B (en) * 2020-05-14 2021-01-29 上海燧原科技有限公司 Page table reading method, device and equipment and computer storage medium
CN114116541A (en) * 2020-08-27 2022-03-01 华为技术有限公司 Method for determining physical address and chip system
CN112965921B (en) * 2021-02-07 2024-04-02 中国人民解放军军事科学院国防科技创新研究院 TLB management method and system in multi-task GPU
CN114817081A (en) * 2022-03-02 2022-07-29 阿里巴巴(中国)有限公司 Memory access method and device and input/output memory management unit

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6715057B1 (en) * 2000-08-31 2004-03-30 Hewlett-Packard Development Company, L.P. Efficient translation lookaside buffer miss processing in computer systems with a large range of page sizes
CN1928839A (en) * 2005-09-09 2007-03-14 中国科学院计算技术研究所 Long-distance inner server and its implementing method
US20100332786A1 (en) * 2009-06-29 2010-12-30 Grohoski Gregory F System and Method to Invalidate Obsolete Address Translations
CN102124525A (en) * 2008-02-27 2011-07-13 密克罗奇普技术公司 Virtual memory interface
CN103116556A (en) * 2013-03-11 2013-05-22 无锡江南计算技术研究所 Internal storage static state partition and virtualization method

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2008009926A (en) * 2006-06-30 2008-01-17 Toshiba Corp Information processing device, information processing system, and address conversion method
JP5664347B2 (en) * 2011-03-04 2015-02-04 ソニー株式会社 Virtual memory system, virtual memory control method, and program

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6715057B1 (en) * 2000-08-31 2004-03-30 Hewlett-Packard Development Company, L.P. Efficient translation lookaside buffer miss processing in computer systems with a large range of page sizes
CN1928839A (en) * 2005-09-09 2007-03-14 中国科学院计算技术研究所 Long-distance inner server and its implementing method
CN102124525A (en) * 2008-02-27 2011-07-13 密克罗奇普技术公司 Virtual memory interface
US20100332786A1 (en) * 2009-06-29 2010-12-30 Grohoski Gregory F System and Method to Invalidate Obsolete Address Translations
CN103116556A (en) * 2013-03-11 2013-05-22 无锡江南计算技术研究所 Internal storage static state partition and virtualization method

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112000592A (en) * 2020-07-27 2020-11-27 瑞芯微电子股份有限公司 Method and device for data interaction between modules
CN112000592B (en) * 2020-07-27 2023-08-22 瑞芯微电子股份有限公司 Method and device for data interaction between modules

Also Published As

Publication number Publication date
CN104516822A (en) 2015-04-15
CN104516822B (en) 2018-01-23

Similar Documents

Publication Publication Date Title
WO2015043379A1 (en) Memory accessing method and device
US20200057729A1 (en) Memory access method and computer system
TWI549060B (en) Access methods and devices for virtual machine data
US10198363B2 (en) Reducing data I/O using in-memory data structures
KR101814577B1 (en) Method and apparatus for processing instructions using processing-in-memory
CN104866497B (en) The metadata updates method, apparatus of distributed file system column storage, host
US20190073372A1 (en) Creating Snapshots Of A Storage Volume In A Distributed Storage System
JP6067928B2 (en) Multi-core page table set for attribute fields
WO2016082191A1 (en) File access method and apparatus
TW201539187A (en) Flash memory compression
WO2017107414A1 (en) File operation method and device
JP2018504694A5 (en)
WO2018027839A1 (en) Method for accessing table entry in translation lookaside buffer (tlb) and processing chip
JPS5898893A (en) Information processing device
US9063860B2 (en) Method and system for optimizing prefetching of cache memory lines
CN109240944B (en) Data reading and writing method based on variable-length cache line
WO2015180493A1 (en) Method, apparatus, and system for processing data storage
CN105159616A (en) Disk space management method and device
WO2015043376A1 (en) Page access method and page access device, and server
WO2015043445A1 (en) Method and device for correlating virtual large page and physical large page
CN114637700A (en) Address translation method for target virtual address, processor and electronic equipment
TWI744111B (en) Method for establishing look-up table and inquiring memory address, method for establishing host memory address look-up table, and method for inquiring host memory address
CN107273443B (en) Mixed indexing method based on metadata of big data model
TWI489279B (en) Virtual-to-physical address translation system and management method thereof
US10102116B2 (en) Multi-level page data structure

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: 14847217

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 14847217

Country of ref document: EP

Kind code of ref document: A1