JP5246014B2 - Virtualization program, virtualization processing method and apparatus - Google Patents
Virtualization program, virtualization processing method and apparatus Download PDFInfo
- Publication number
- JP5246014B2 JP5246014B2 JP2009104022A JP2009104022A JP5246014B2 JP 5246014 B2 JP5246014 B2 JP 5246014B2 JP 2009104022 A JP2009104022 A JP 2009104022A JP 2009104022 A JP2009104022 A JP 2009104022A JP 5246014 B2 JP5246014 B2 JP 5246014B2
- Authority
- JP
- Japan
- Prior art keywords
- address
- guest
- page
- virtual page
- guest virtual
- 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.)
- Active
Links
Images
Landscapes
- Memory System Of A Hierarchy Structure (AREA)
Description
本技術は、動的バイナリ変換を伴う仮想化技術に関する。 The present technology relates to a virtualization technology involving dynamic binary conversion.
現在のコンピュータの多くは動的アドレス変換(DAT:Dynamic Address Translation。仮想メモリとも呼ぶ。) を適用して動作しており、実用的な仮想マシンは、ホストマシン上で仮想的に構成されたコンピュータであるゲストマシン上でDAT機能をサポートする必要がある。 Many of today's computers operate by applying Dynamic Address Translation (DAT), and practical virtual machines are computers virtually configured on a host machine. It is necessary to support the DAT function on the guest machine.
また、仮想マシンで動的バイナリ変換(仮想マシンがゲストマシンをエミュレーションするにあたって、ゲストマシンにおける機械語をホストマシンにおける機械語に動的にコンパイルする技術。これはJIT(Just In Time)コンパイリング(compiling)とも呼ばれる。)を適用する場合、ゲストマシン上のDAT機能が問題になる。これは、ゲストマシン上のDAT機能によって、物理メモリ以上の広いメモリ空間を使えるため、動的バイナリ変換の対象となるメモリ空間がゲストマシンの動作状態によって動的に変動してしまうことによって生じる。 Also, dynamic binary conversion in a virtual machine (a technology that dynamically compiles machine language in the guest machine into machine language in the host machine when the virtual machine emulates the guest machine. This is JIT (Just In Time) compiling ( Compiling) is also a problem when using the DAT function on the guest machine. This occurs because a memory space larger than the physical memory can be used by the DAT function on the guest machine, so that the memory space to be subjected to dynamic binary conversion dynamically varies depending on the operating state of the guest machine.
またDATテーブルの書き替えによって、ゲストマシンにおける仮想ページであるゲスト仮想ページと、ゲストマシンにおける物理ページであるゲスト物理ページとの写像関係が動的に変更される。この変更によって、動的バイナリ変換の結果である変換コードが不正となることがあるため、変換コードを無効化、削除する必要が生じる。そのためDATと変換コード管理の連動が必要となる。 Further, by rewriting the DAT table, the mapping relationship between the guest virtual page, which is a virtual page in the guest machine, and the guest physical page, which is a physical page in the guest machine, is dynamically changed. Because of this change, the conversion code that is the result of the dynamic binary conversion may become invalid, and it becomes necessary to invalidate and delete the conversion code. Therefore, it is necessary to link DAT and conversion code management.
通常、ゲストマシンはDATを有効にして動作しており、実用的な仮想マシンはDAT機能を有効にしたゲストマシンをエミュレーションする必要がある。この際に、シャドウページ方式が用いられることが多い。 Normally, a guest machine operates with DAT enabled, and a practical virtual machine needs to emulate a guest machine with the DAT function enabled. At this time, the shadow page method is often used.
シャドウページ方式は、ゲストマシンのDATテーブルと同期したシャドウ・ページ・テーブルを仮想マシンが動的に作成する方式である。シャドウページ方式では、以下のような管理が行われる。
(1)最初に、シャドウ・ページ・テーブルは空である。
(2)仮想マシンがゲストマシンのTLB(Translation Lookaside Buffer)フォルトを検出すると、DATをエミュレートする。その結果をシャドウ・ページ・テーブルに登録する。
(3)ゲストマシンのDATテーブルが更新された場合やTLBの削除操作(例えば、IBM社のSystem/370のINVALIDATE PAGE TABLE ENTRY(IPTE)命令やPURGE TLB(PTLB)命令などがあげられる。)が行われた場合には、シャドウ・ページ・テーブルの該当部分を削除する。
The shadow page method is a method in which a virtual machine dynamically creates a shadow page table synchronized with a DAT table of a guest machine. In the shadow page method, the following management is performed.
(1) Initially, the shadow page table is empty.
(2) When the virtual machine detects a TLB (Translation Lookaside Buffer) fault in the guest machine, it emulates DAT. The result is registered in the shadow page table.
(3) When the DAT table of the guest machine is updated or when the TLB is deleted (for example, IBM System / 370 INVALIDATE PAGE TABLE ENTRY (IPTE) instruction, PURGE TLB (PTLB) instruction, etc.). If so, delete that part of the shadow page table.
また、動的バイナリ変換は、ゲスト仮想ページに対して変換コードを作成する方式とゲスト物理ページに対して変換コードを作成する方式の2種類があるが、前者の方が主流である。前者の方式の場合、DATテーブルが更新を受けたりTLB操作が行われた場合にはゲスト仮想ページが削除されるので、そのゲスト仮想ページを基にして翻訳された変換コードもまた削除する必要がある。そのためシャドウページ方式を用いた場合、このシャドウ・ページ・テーブルと連動して変換コードを管理する必要がある。 There are two types of dynamic binary conversion: a method for creating a conversion code for a guest virtual page and a method for creating a conversion code for a guest physical page. The former is the mainstream. In the case of the former method, when the DAT table is updated or a TLB operation is performed, the guest virtual page is deleted. Therefore, it is also necessary to delete the translation code translated based on the guest virtual page. is there. Therefore, when the shadow page method is used, it is necessary to manage the conversion code in conjunction with this shadow page table.
図1は、シャドウページ方式で動的バイナリ変換された変換コードを管理する様子を模式的に表している。シャドウテーブルには、ホスト仮想ページアドレスと、このホスト仮想ページアドレスに係るコードが格納されているホスト物理ページへのポインタと、このようなコードのコード変換の結果である変換コードが格納されているホスト物理ページへのポインタとが登録されている。ゲスト仮想ページは仮想マシン内でホスト仮想ページに変換される(ステップ(101))。このホスト仮想ページのアドレスをキーにしてシャドウテーブル内の検索が行われ(ステップ(102))、該当するエントリのポインタにより、DATが写像すべきホスト物理ページ1001と翻訳を行った変換コード1002に到達することができる。シャドウテーブルはDATに従い動的にサイズが変わっていく。図1ではシャドウテーブルを線形的なテーブルで表しているが、実際には階層テーブルやハッシュテーブルであることもある。またホスト仮想ページアドレスとホスト物理ページ、ホスト仮想ページアドレスと変換コードの管理表は分れている場合もある。
FIG. 1 schematically shows a state in which conversion codes that have been subjected to dynamic binary conversion by the shadow page method are managed. The shadow table stores a host virtual page address, a pointer to a host physical page in which a code related to the host virtual page address is stored, and a conversion code as a result of code conversion of such code. A pointer to the host physical page is registered. The guest virtual page is converted into a host virtual page in the virtual machine (step (101)). A search in the shadow table is performed by using the address of the host virtual page as a key (step (102)), and the host physical page 1001 to be mapped by the DAT is converted into the
シャドウページ方式において、ゲスト仮想ページからゲスト物理ページへの写像関係は多対1になるため、シャドウ・ページ・テーブルのサイズは固定的には決まらない。このため、実行に先立ってシャドウ・ページ・テーブルを静的に割り付けることができないという問題がある。 In the shadow page method, since the mapping relationship from the guest virtual page to the guest physical page is many-to-one, the size of the shadow page table is not fixed. Therefore, there is a problem that the shadow page table cannot be statically allocated prior to execution.
また、DATテーブルの書き替えによって動的バイナリ変換によって生成した変換コードの内容が不正になったり、変換コードが使用されなくなって不要になることがある。このようなタイミングはゲストマシン上のプログラムに明示的に示されることが少ないため、変換コードを破棄するタイミングの判定が困難で、またシャドウ・ページ・テーブルのメンテナンスも難しい。 In addition, the contents of the conversion code generated by dynamic binary conversion due to rewriting of the DAT table may become invalid, or the conversion code may not be used and may become unnecessary. Since such timing is not explicitly shown in the program on the guest machine, it is difficult to determine the timing for discarding the conversion code, and it is also difficult to maintain the shadow page table.
すなわち、シャドウ・ページ・テーブルの利用は、仮想マシンにおいて動的バイナリ変換を適用する上で必ずしも効率的ではない。 That is, the use of the shadow page table is not always efficient in applying dynamic binary conversion in the virtual machine.
よって、本技術の目的は、仮想マシンにおいて動的バイナリ変換を適用する上で効率的なメモリ管理技術を提供することである。 Therefore, an object of the present technology is to provide a memory management technology that is efficient in applying dynamic binary conversion in a virtual machine.
本仮想化処理方法は、ホストマシンに、仮想的なコンピュータであるゲストマシンを実行させるための方法である。そして、特定のゲスト仮想ページへのアクセスの際に、特定のゲスト仮想ページのアドレスに対応するゲスト物理ページアドレスを特定するステップと、ゲスト物理ページの数分エントリを有しており且つ各ゲスト物理ページアドレスにゲスト仮想ページアドレスと対応するホスト物理ページへのポインタと当該ホスト物理ページに格納されているコードをホストマシン向けに変換したコードである変換コードへのポインタとを格納するための変換テーブルから、特定されたゲスト物理ページアドレスについてのエントリを読み出し、変換コードへのポインタが含まれているか判断するステップと、変換コードへのポインタが含まれている場合には、読み出されたエントリに含まれるゲスト仮想ページアドレスと特定のゲスト仮想ページのアドレスとを比較する比較ステップと、読み出されたエントリに含まれるゲスト仮想ページアドレスと特定のゲスト仮想ページのアドレスとが一致する場合には、読み出されたエントリに含まれる変換コードへのポインタにより当該変換コードを読み出して実行するステップとを含む。 This virtualization processing method is a method for causing a host machine to execute a guest machine which is a virtual computer. When accessing a specific guest virtual page, the guest physical page address corresponding to the address of the specific guest virtual page is specified, and there are as many entries as there are guest physical pages, and each guest physical page A conversion table for storing a pointer to a host physical page corresponding to the guest virtual page address and a pointer to a conversion code that is a code obtained by converting the code stored in the host physical page for the host machine in the page address To read the entry for the specified guest physical page address and determine whether or not a pointer to the conversion code is included, and if the pointer to the conversion code is included, Included guest virtual page addresses and specific guest virtual page addresses If the comparison step for comparing the address and the guest virtual page address included in the read entry matches the address of the specific guest virtual page, a pointer to the conversion code included in the read entry And reading and executing the conversion code.
仮想マシンにおいて動的バイナリ変換を適用する上で効率的なメモリ管理が可能となる。 Efficient memory management is possible when applying dynamic binary conversion in a virtual machine.
[実施の形態の概要]
ホストマシンのCPU(Central Processing Unit)が以下で述べるCPUエミュレータを実行することで、ゲストマシンのCPUを仮想的にエミュレートする。このCPUエミュレータが動作するホストマシンにおける仮想及び物理メモリ空間の配置と、CPUエミュレータが仮想的に実行するゲストマシンにおける仮想メモリ空間と物理メモリ空間との対応関係を図2に示す。
[Outline of the embodiment]
The CPU (Central Processing Unit) of the host machine virtually emulates the CPU of the guest machine by executing a CPU emulator described below. FIG. 2 shows the arrangement of the virtual and physical memory spaces in the host machine on which the CPU emulator operates and the correspondence between the virtual memory space and the physical memory space in the guest machine that is virtually executed by the CPU emulator.
図2の左側がエミュレーションされるゲストマシンにおけるメモリアクセスを模式的に示しており、図2の右側がこのメモリアクセスをホストマシン上でエミュレートした様子を模式的に示す。 The left side of FIG. 2 schematically shows the memory access in the guest machine to be emulated, and the right side of FIG. 2 schematically shows the memory access emulated on the host machine.
まず、ゲストマシン起動時に、ホスト物理空間上に当該ゲストマシンの物理メモリ用の領域Aを確保する。CPUエミュレータは、ホスト仮想空間上で動作しており、ホスト仮想空間上には、ゲストマシンのゲスト仮想空間に対応する窓(すなわち、ゲスト仮想メモリアクセス領域B)を設けるものとする。 First, when the guest machine is activated, an area A for physical memory of the guest machine is secured on the host physical space. The CPU emulator operates in the host virtual space, and a window (that is, a guest virtual memory access area B) corresponding to the guest virtual space of the guest machine is provided on the host virtual space.
また、ゲストマシン起動時には、ホスト物理空間に、確保されたゲスト物理メモリ用の領域Aに含まれるページ数分のエントリを固定的に有するαテーブルの領域も確保され、CPUエミュレータにより、各エントリには各ページへのポインタが設定される。さらに、ホスト物理空間には、ゲスト物理メモリ用の領域Aに格納されているコードをホストマシン用にコード変換(翻訳とも呼ぶ)した結果である変換コードを格納する変換コード管理領域も含まれる。 In addition, when the guest machine is started, an α table area having a fixed number of entries corresponding to the number of pages included in the area A for reserved guest physical memory is also secured in the host physical space. Is set to a pointer to each page. Further, the host physical space also includes a conversion code management area for storing a conversion code that is a result of code conversion (also referred to as translation) of a code stored in the area A for guest physical memory for the host machine.
このような状況において、ゲスト仮想ページPage1がゲスト物理ページPage2に写像されるものとする(図2のゲストDAT)。この動作をエミュレートするため、CPUエミュレータはゲスト仮想メモリアクセス領域B上で、Page1に対応するホスト仮想ページPage4にアクセスする。そして、ホストマシンのDATでホスト仮想ページPage4をホスト物理ページPage3に写像できれば、ゲストマシンのメモリアクセスをホストマシンがエミュレートしたことになる。本実施の形態では、ゲストDATとホストDATとの整合性については、従来技術によって担保することとし、これ以上述べないこととする。 In such a situation, it is assumed that the guest virtual page Page1 is mapped to the guest physical page Page2 (guest DAT in FIG. 2). In order to emulate this operation, the CPU emulator accesses the host virtual page Page4 corresponding to Page1 on the guest virtual memory access area B. If the host virtual page Page4 can be mapped to the host physical page Page3 by the DAT of the host machine, the host machine emulates the memory access of the guest machine. In the present embodiment, the consistency between the guest DAT and the host DAT is secured by the conventional technology, and will not be described further.
本実施の形態では、上で述べたαテーブルを導入することによって、例えばゲスト仮想ページPage1にアクセスする際に、対応するホスト物理ページPage3に効率的にアクセスできるようにすると共に、対応するホスト物理ページPage3に格納されているコードのコード変換の結果である変換コードに効率的にアクセスできるようにする。 In this embodiment, by introducing the α table described above, for example, when accessing the guest virtual page Page1, it is possible to efficiently access the corresponding host physical page Page3, and the corresponding host physical page The conversion code that is the result of the code conversion of the code stored in the page Page3 can be efficiently accessed.
図3に、αテーブルを用いたメモリアクセスを模式的に示す。αテーブルは、ゲスト物理ページ数分のエントリを固定的に有するテーブルであり、ゲスト物理ページ番号順にエントリは並べられている。このαテーブルは、ゲスト仮想ページアドレスの列Xと、対応するホスト物理ページへのポインタの列Yと、対応するホスト物理ページに格納されているコードのコード変換の結果である変換コードへのポインタの列Zとを有する。 FIG. 3 schematically shows memory access using the α table. The α table is a table having fixed entries for the number of guest physical pages, and entries are arranged in the order of guest physical page numbers. The α table includes a guest virtual page address column X, a pointer Y to a corresponding host physical page, and a pointer to a conversion code that is a result of code conversion of the code stored in the corresponding host physical page. Column Z.
ゲスト仮想ページアドレスの列Xには、ゲスト物理ページに格納されているコードに対して動的バイナリ変換を実施した時のゲスト仮想ページのアドレス値が格納される。すなわち、変換コードの列Zのアドレスに格納されている変換コードが有効であるゲスト仮想ページアドレスが登録されている。また、エントリの位置とホスト物理ページへのポインタへの列Yとで、ゲスト物理ページとホスト物理ページの対応関係を表している。 The guest virtual page address column X stores the address value of the guest virtual page when dynamic binary conversion is performed on the code stored in the guest physical page. That is, a guest virtual page address in which the conversion code stored in the address of the conversion code column Z is valid is registered. The entry position and the column Y to the pointer to the host physical page represent the correspondence between the guest physical page and the host physical page.
このようなαテーブルを用いてゲスト仮想ページアドレスからホストマシン用に翻訳されている変換コードを検索する場合、まずゲスト仮想ページアドレスをDATを用いてゲスト物理ページアドレスへ変換する。但し、この変換にはシャドウ・ページ・テーブル等の他の手法を用いても良い。 When a conversion code translated for the host machine is searched from the guest virtual page address using such an α table, the guest virtual page address is first converted to a guest physical page address using DAT. However, other methods such as a shadow page table may be used for this conversion.
そして、ゲスト物理ページアドレスをキーにしてαテーブルを検索し、当該αテーブルから該当するエントリを特定する。αテーブルはゲスト物理ページ番号順に並んでいるので、この検索は単純な一次変換となる。この検索によって特定されたエントリにより、ホスト物理ページへのポインタ及び変換コードへのポインタが得られ、それらに容易にアクセスすることができる。しかしながら、シャドウページ方式と異なり、ゲスト仮想ページとゲスト物理ページが多対一となってしまっている場合には、同一のエントリに重複してヒットしてしまう。そのため、あるゲスト仮想ページアドレスからαテーブルで辿って変換コードを特定できても、この変換コードが検索元のゲスト仮想ページを翻訳したものとは限らない。このため検索元となるゲスト仮想ページのアドレスとαテーブル内のゲスト仮想ページアドレスの列Xのアドレス値とを比較することでチェックを行う。これが一致する場合には、変換コードは有効であり実行可能である。不一致の場合には変換コードは無効であり、削除する必要がある。同様に、αテーブルにおける該当エントリに含まれるポインタも破棄すべきである。 Then, the α table is searched using the guest physical page address as a key, and the corresponding entry is specified from the α table. Since the α tables are arranged in the order of guest physical page numbers, this search is a simple primary conversion. The entry specified by this search provides a pointer to the host physical page and a pointer to the conversion code, which can be easily accessed. However, unlike the shadow page method, when the guest virtual page and the guest physical page are many-to-one, the same entry is hit twice. Therefore, even if the conversion code can be identified by tracing the α table from a certain guest virtual page address, the conversion code is not necessarily translated from the guest virtual page of the search source. Therefore, the check is performed by comparing the address of the guest virtual page as the search source with the address value in the column X of the guest virtual page address in the α table. If they match, the conversion code is valid and executable. If they do not match, the conversion code is invalid and must be deleted. Similarly, the pointer included in the corresponding entry in the α table should be discarded.
例えば図4に示すように、最初に、ゲスト仮想ページアドレスaaaがαテーブルの列Xに登録されてものとする。そうすると、ゲスト仮想ページアドレスaaaにアクセスした際、DAT等によりゲスト物理ページアドレスAAAを得て、当該ゲスト物理ページアドレスAAAで、αテーブルにアクセスすると、ゲスト仮想ページアドレスの列Xにはゲスト仮想ページアドレスaaaが登録されているので、列Zに変換コードへのポインタが登録されていれば、変換コードを得ることができる。 For example, as shown in FIG. 4, it is assumed that the guest virtual page address aaa is first registered in the column X of the α table. Then, when the guest virtual page address aaa is accessed, the guest physical page address AAA is obtained by DAT or the like, and when the α table is accessed with the guest physical page address AAA, the guest virtual page address column X includes a guest virtual page Since the address aaa is registered, if the pointer to the conversion code is registered in the column Z, the conversion code can be obtained.
しかし、その後DATテーブル等が書き換えられ、図5に示すように、ゲスト仮想ページアドレスaaaがDAT等によりゲスト物理ページアドレスBBBに写像され、ゲスト仮想ページアドレスbbbがDAT等によりゲスト物理ページアドレスAAAに写像されるようになったとする。 However, after that, the DAT table or the like is rewritten, and as shown in FIG. 5, the guest virtual page address aaa is mapped to the guest physical page address BBB by DAT or the like, and the guest virtual page address bbb is changed to the guest physical page address AAA by DAT or the like. Suppose that it comes to be mapped.
このとき、DATテーブル等が書き換えられた後に別途変換コードを削除するような処理を実施しなければ、図5に示すように、ゲスト物理ページアドレスAAAのエントリの列Xには、ゲスト仮想ページアドレスaaaが残っており、列Zには、元の変換コードへのポインタが残ってしまっている。 At this time, if a process for deleting the conversion code is not performed after the DAT table or the like is rewritten, as shown in FIG. 5, the column X of the guest physical page address AAA entry contains a guest virtual page address. aaa remains, and in column Z, a pointer to the original conversion code remains.
そうすると、ゲスト仮想ページアドレスbbbにアクセスする際には、DAT等によりゲスト物理ページアドレスAAAが得られて、当該ゲスト物理ページアドレスAAAにアクセスしても、αテーブルの列Xのアドレス値aaaと一致しないので、列Zに格納されている変換コードへのポインタ及び変換コード自体無効である。従って、このタイミングで変換コードを削除し、αテーブルの列Zの変換コードへのポインタも削除する。 Then, when accessing the guest virtual page address bbb, the guest physical page address AAA is obtained by DAT or the like, and even if the guest physical page address AAA is accessed, it matches the address value aaa in the column X of the α table. Therefore, the pointer to the conversion code stored in the column Z and the conversion code itself are invalid. Therefore, the conversion code is deleted at this timing, and the pointer to the conversion code in the column Z of the α table is also deleted.
一方、ゲスト仮想ページアドレスaaaにアクセスする際には、DAT等によりゲスト物理ページアドレスBBBが得られてゲスト物理ページアドレスBBBにアクセスしても、αテーブルの列Xには初期値が登録されているだけで、列Zには変換コードへのポインタも登録されていない状態である。 On the other hand, when accessing the guest virtual page address aaa, even if the guest physical page address BBB is obtained by DAT or the like and the guest physical page address BBB is accessed, the initial value is registered in the column X of the α table. In this case, the pointer to the conversion code is not registered in the column Z.
図4の場合も図5の場合も、ここでαテーブルの列Yに格納されているホスト物理ページアドレスにアクセスして、格納されているコードに対してコード変換処理を実施し、新たに変換コードを生成する。そして、αテーブルの列Zに、当該変換コードのアドレスを登録すると共に、αテーブルの列Xに、今回有効となったゲスト仮想ページアドレスを登録する。このようにすれば、同じゲスト仮想ページにアクセスする際今後適正な変換コードの実行速度を速くすることができる。 In both the case of FIG. 4 and FIG. 5, the host physical page address stored in the column Y of the α table is accessed here, the code conversion processing is performed on the stored code, and a new conversion is performed. Generate code. Then, the address of the conversion code is registered in the column Z of the α table, and the guest virtual page address that is valid this time is registered in the column X of the α table. In this way, it is possible to increase the execution speed of an appropriate conversion code in the future when accessing the same guest virtual page.
以下、本実施の形態で導入されたαテーブルを用いてどのように処理を実施するのかについて具体的に述べる。 Hereinafter, a specific description will be given of how processing is performed using the α table introduced in the present embodiment.
[本実施の形態の具体的内容]
図6に、本実施の形態のαテーブルに関わるシステム構成を示す。ホストマシン1のホストCPUがCPUエミュレータ100を実行することで、ゲストマシンのCPUを仮想的にエミュレートする。CPUエミュレータ100は、命令インタプリタ101と、変換コード検索部103と、動的バイナリ変換部105とを有する。また、ホストマシン1のホスト主記憶200には、ゲスト主記憶領域201と、αテーブル203と、変換コード管理領域205とが設けられている。ゲスト主記憶領域201には、ゲストマシンのプログラムであるゲストプログラム2011が格納されており、αテーブル203には、ゲスト仮想ページ数分のエントリ2031が含まれており、変換コード管理領域205にはゲストプログラム2011のコード変換の結果である変換コード2051が格納されている。上で述べたように、エントリ2031は、変換コード2051を指し示している場合がある。
[Specific contents of this embodiment]
FIG. 6 shows a system configuration related to the α table of the present embodiment. When the host CPU of the
CPUエミュレータ100は、最初命令インタプリタ101を用いて、ゲスト主記憶領域201上のゲストプログラム2011の実行を行う(図6(1))。これはゲスト主記憶領域201上に格納されているゲストマシン命令の逐語解釈実行となる。しかし命令インタプリタ101の実行速度は遅い。その性能を改善するために、動的バイナリ変換部105により、ゲストマシンの命令列をホストマシン1用のコードに変換することによって変換コード2051を生成し、変換コード管理領域205に登録する。さらに、αテーブル203の該当エントリ2031の更新も行う(図6(6))。変換コード2051の登録後に、CPUエミュレータ100の変換コード検索部103は、本実施の形態の概要の欄で述べたように、αテーブル203の検索を実施し(図6(4))、適正な変換コード2051が変換コード管理領域205に格納されていることが分かれば、CPUエミュレータ100は、ゲストプログラム2011の逐語解釈実行ではなく変換コード2051を実行する(図6(5))。これによって処理の高速化が図られる。
The
また、命令インタプリタ101がDATテーブルの一部を無効化するゲストマシン命令(例えばIPTE命令等)を逐語解釈実行する場合には、変換コード管理領域205に格納されている該当変換コード2051を削除する(図6(2))。また、図4及び図5で説明したように、αテーブル203の検索を行った結果、無効な変換コード2051を検出した場合には、変換コード検索部103が、αテーブル203の該当エントリ2031における変換コード2051へのポインタを削除すると共に、変換コード管理領域205に格納されている該当変換コード2051を削除する(図6(3))。
When the
なお、命令インタプリタ101が、TLBをフラッシュするゲストマシン命令(例えばIBM社のSystem/370のPTLB命令など)を逐語解釈実行する場合や、DATテーブルの無効化命令なしでDATテーブルを書き換えた場合、αテーブル203に登録されている仮想ページ−物理ページの写像関係と実際のDATテーブルとの間の一貫性が崩れることになる。これは図4及び図5で述べたような処理にて検出可能なため、TLBフラッシュ操作やDATテーブルの書き替え操作のタイミングではαテーブル203の更新は行わない。これによって、メモリ管理に必要な処理の効率化が図られる。
When the
次に、図7乃至図12を用いて、図6のシステムの処理内容について詳細に説明する。まず、命令インタプリタ101が特定のゲスト仮想ページへのアクセスを行う際には、命令インタプリタ101は、変換コード検索部103にアクセス先のゲスト仮想ページのアドレスを出力し、変換コード検索部103は、DATテーブル等により当該特定のゲスト仮想ページアドレスからゲスト物理ページアドレスを特定する(図7:ステップS1)。そして、変換コード検索部103は、特定されたゲスト物理ページアドレスによるαテーブル検索処理を実施する(ステップS3)。このαテーブル検索処理については、図8を用いて説明する。
Next, the processing contents of the system of FIG. 6 will be described in detail with reference to FIGS. First, when the
まず、変換コード検索部103は、特定されたゲスト物理ページアドレスでαテーブル203を検索し、当該ゲスト物理ページアドレスのエントリを読み出す(ステップS21)。そして、変換コード検索部103は、読み出したエントリに変換コードへのポインタが登録済みであるか判断する(ステップS23)。読み出したエントリに変換コードへのポインタが登録されていない場合には、そのまま元の処理に戻る。
First, the conversion
一方、読み出したエントリに変換コードへのポインタが登録されていれば、変換コード検索部103は、特定のゲスト仮想ページアドレスと、当該エントリに含まれているゲスト仮想ページアドレスとが一致するか判断する(ステップS25)。一致しない場合には、変換コード検索部103は、読み出したエントリに含まれる変換コードへのポインタで指し示されている変換コードを削除し(ステップS29)、当該エントリにおける変換コードへのポインタを削除する(ステップS30)。そして、元の処理に戻る。
On the other hand, if a pointer to the conversion code is registered in the read entry, the conversion
一方、特定のゲスト仮想ページアドレスと、当該エントリに含まれているゲスト仮想ページアドレスとが一致する場合には、有効な変換コードが得られることを意味するので、変換コード検索部103は、読み出されたエントリにおける変換コードへのポインタを特定し、保持する(ステップS27)。そして元の処理に戻る。 On the other hand, if the specific guest virtual page address matches the guest virtual page address included in the entry, it means that a valid conversion code is obtained. A pointer to the conversion code in the issued entry is specified and held (step S27). Then, the process returns to the original process.
このように2つの条件を満たしていれば有効な変換コードを用いることができ、2つの条件のうち少なくともいずれかを満たさない場合には、有効な変換コードを用いることができない。 Thus, an effective conversion code can be used if the two conditions are satisfied, and an effective conversion code cannot be used if at least one of the two conditions is not satisfied.
図7の処理の説明に戻って、変換コード検索部103は、ステップS3の結果、変換コードへのポインタを特定して保持しているか判断する(ステップS5)。変換コードへのポインタを特定して保持している場合には、CPUエミュレータ100は、変換コードへのポインタで変換コード管理領域205から該当する変換コードを読み出して、実行する(ステップS11)。
Returning to the description of the processing in FIG. 7, the conversion
一方、変換コードへのポインタを特定していない場合には、変換コード検索部103は、動的バイナリ変換部105に、αテーブル203において該当するエントリに含まれるホスト物理ページへのポインタと、ゲスト仮想ページアドレス及びゲスト物理ページアドレスとを出力し、動的バイナリ変換部105は、当該ポインタで指し示されるホスト物理ぺージに格納されているコードに対して周知のコード変換処理を実施し、生成された変換コードを変換コード管理領域205に格納する(ステップS7)。そして、動的バイナリ変換部105は、αテーブル203への登録処理を実施する(ステップS9)。本登録処理については図9を用いて説明する。
On the other hand, when the pointer to the conversion code is not specified, the conversion
動的バイナリ変換部105は、変換コード検索部103から受け取ったゲスト物理ページアドレスでαテーブル203の該当エントリを特定する(ステップS31)。そして、当該エントリに、ゲスト仮想ページアドレスを上書き保存すると共に、今回生成した変換コードへのポインタも登録する(ステップS33)。これによって、正しいデータが、αテーブル203の該当エントリに登録されるようになって、当該エントリのデータを利用することで、ゲストプログラム2011が高速に実行されるようになる。そして元の処理に戻る。
The dynamic
図7の処理の説明に戻って、ステップS9の後には、CPUエミュレータ100は、動的バイナリ変換部105が保持する変換コードへのポインタで新たに生成した変換コードを取得して、変換コードを実行する(ステップS11)。
Returning to the description of the processing in FIG. 7, after step S <b> 9, the
以上のような処理を、処理終了まで繰り返し(ステップS13)、動的バイナリ変換を利用して高速な実行が可能な仮想マシンが実現される。 The above processing is repeated until the processing is completed (step S13), and a virtual machine capable of executing at high speed using dynamic binary conversion is realized.
なお、ステップS7及びS9の代わりに、より高速にするために動的バイナリ変換を非同期に別プロセッサに任せ、未だ変換されていない場合は変換コードではなくインタプリタで実行する方式を採用する場合もある。 Instead of steps S7 and S9, there is a case in which dynamic binary conversion is asynchronously left to another processor for higher speed, and if conversion is not yet performed, a method of executing with an interpreter instead of conversion code may be adopted. .
なお、上で述べた処理を実施することにより、αテーブル203の各エントリはゲスト仮想ページと一対一の写像関係を持つという一貫性を維持することが可能である。 By executing the processing described above, it is possible to maintain the consistency that each entry of the α table 203 has a one-to-one mapping relationship with the guest virtual page.
但し、共有メモリに対しても同様の処理を行うと、変換コードの削除が頻発し性能低下が問題になる可能性がある。共有メモリとは一般的なOS(Operating System)で使用される技術で、図10に示すように複数の仮想アドレス空間1乃至3から同一の物理アドレス空間への写像を許す技術である。特に一般的なOSはカーネルに関するコードを共有メモリに配置することが多いため、これまで述べたαテーブル方式をそのまま適用すると、OSカーネルに対する動的バイナリ変換で性能が向上しない。
However, if the same processing is performed on the shared memory, the conversion code is frequently deleted, and there is a possibility that the performance degradation becomes a problem. The shared memory is a technique used in a general OS (Operating System), and is a technique that allows mapping from a plurality of
このため、共有メモリに関しては、ゲスト物理ページに対して複数のゲスト仮想ページを対応させることを許すように構成する。具体的には、図11に示すように、αテーブル203のゲスト仮想ページアドレスの列Xを、ページ共有の判定ビット、仮想空間を区別する空間識別子及びページアドレスに細分化する。そして、アクセス先のページが仮想空間間で共有されているかどうかはページ共有判定ビットで区別する。アクセス先のページが非共有ページの場合は、空間識別子とページアドレスの両方を用いて、図8のステップS25の判断を実施する。一方、共有メモリの場合には空間識別子を無視してページアドレスのみを比較すればよい。 Therefore, the shared memory is configured to allow a plurality of guest virtual pages to correspond to the guest physical page. Specifically, as shown in FIG. 11, the guest virtual page address column X of the α table 203 is subdivided into a page sharing determination bit, a space identifier for distinguishing the virtual space, and a page address. Whether or not the access destination page is shared between virtual spaces is distinguished by a page sharing determination bit. If the access destination page is a non-shared page, the determination in step S25 in FIG. 8 is performed using both the space identifier and the page address. On the other hand, in the case of a shared memory, only the page address may be compared while ignoring the space identifier.
一般に、あるページが共有メモリとして使用されているか否かは、ゲストマシンのハードウェア特性(例えばIBM社のSystem/370におけるcommon segment bit、Intel 386のPTEにおけるglobal bitなど)やゲストOSの特性(i386/Linuxの場合、各仮想アドレス空間4GBの後半1GBがカーネルの使用と決まっている)から定まる。従って、このような情報を基に用意される動的バイナリ変換部105は、変換対象となったページが共有メモリかどうかの情報をαテーブルエントリの登録時にページ共有判定ビットに反映させる。
In general, whether or not a page is used as a shared memory depends on the guest machine hardware characteristics (for example, common segment bit in IBM System / 370, global bit in Intel 386 PTE, etc.) and guest OS characteristics ( In the case of i386 / Linux, the
具体的には、図8の代わりに、図12のαテーブル検索処理を実施する。 Specifically, the α table search process of FIG. 12 is performed instead of FIG.
まず、変換コード検索部103は、特定されたゲスト物理ページアドレスでαテーブル203を検索し、当該ゲスト物理ページアドレスのエントリを読み出す(ステップS41)。そして、変換コード検索部103は、読み出したエントリに変換コードへのポインタが登録済みであるか判断する(ステップS43)。読み出したエントリに変換コードへのポインタが登録されていない場合には、そのまま元の処理に戻る。
First, the conversion
一方、読み出したエントリに変換コードへのポインタが登録されていれば、変換コード検索部103は、読み出したエントリに含まれるページ共有判定ビットがオンであるか判断する(ステップS45)。ページ共有判定ビットがオンであれば、共有ページであるから、変換コード検索部103は、命令インタプリタ101から受け取ったゲスト仮想ページアドレスのページアドレス部分と、読み出したエントリにおけるゲスト仮想ページアドレスのページアドレス部分とが一致するか判断する(ステップS47)。すなわち、空間識別子部分を除外して比較する。一致する場合には、変換コード検索部103は、読み出したエントリにおける変換コードへのポインタを特定し、保持する(ステップS49)。そして元の処理に戻る。一方、一致しない場合には、変換コード検索部103は、変換コード検索部103は、読み出したエントリに含まれる変換コードへのポインタで指し示されている変換コードを削除し(ステップS53)、当該エントリにおける変換コードへのポインタを削除する(ステップS55)。そして、元の処理に戻る。
On the other hand, if a pointer to the conversion code is registered in the read entry, the conversion
また、読み出したエントリにおけるページ共有判定ビットがオフであれば、非共有ページであるから、変換コード検索部103は、命令インタプリタ101から受け取ったゲスト仮想ページアドレスと、読み出したエントリにおける空間識別子とページアドレスを含むゲスト仮想ページアドレスとが一致するか判断する(ステップS51)。非共有メモリについては空間識別子をも含めて一致するか判断する。一致する場合には、変換コード検索部103は、ステップS49に移行する。一方、不一致の場合には、ステップS53に移行する。
If the page sharing determination bit in the read entry is off, the page is a non-shared page. Therefore, the conversion
以上のような処理を実施すれば、共有メモリが存在する場合においても、αテーブルを問題なく活用することができるようになる。 If the processing as described above is performed, the α table can be utilized without any problem even when the shared memory exists.
以上本技術の実施の形態を説明したが、本技術はこれに限定されるものではない。例えば、上で述べた具体的な命令名は、一例であって、他のOSにおける実質的に同一の機能を果たす命令であれば該当する。さらに、上でも述べたが、動的バイナリ変換部105を別のCPUなどに設けて、ゲストプログラム2011に対して別スレッドで変換処理を実施して、変換完了ページについて随時変換コードへのポインタをαテーブル203に登録するようにしても良い。このような場合には、図7のステップS7及びS9の代わりに、命令インタプリタ101により、αテーブル203から得られたホスト物理ページへのポインタで得られるコードを逐次実行する。後に同一のゲスト仮想ページアドレスにアクセスする際に、変換コードが生成済みであれば、ステップS11に移行して変換コードを得て実行することができる。
Although the embodiment of the present technology has been described above, the present technology is not limited to this. For example, the specific instruction names described above are examples, and correspond to any instruction that performs substantially the same function in another OS. Furthermore, as described above, the dynamic
また、処理フローについても一例であって、同一の機能を果たすことができれば、順番を入れ替えたり、並列実行される場合もある。 Further, the processing flow is also an example, and if the same function can be achieved, the order may be changed or may be executed in parallel.
なお、上で述べたホストマシン1は、コンピュータ装置であって、図13に示すように、メモリ2501とCPU2503とハードディスク・ドライブ(HDD)2505と表示装置2509に接続される表示制御部2507とリムーバブル・ディスク2511用のドライブ装置2513と入力装置2515とネットワークに接続するための通信制御部2517とがバス2519で接続されている。オペレーティング・システム(OS:Operating System)及び本実施例における処理を実施するためのアプリケーション・プログラムは、HDD2505に格納されており、CPU2503により実行される際にはHDD2505からメモリ2501に読み出される。必要に応じてCPU2503は、表示制御部2507、通信制御部2517、ドライブ装置2513を制御して、必要な動作を行わせる。また、処理途中のデータについては、メモリ2501に格納され、必要があればHDD2505に格納される。本技術の実施例では、上で述べた処理を実施するためのアプリケーション・プログラムはコンピュータ読み取り可能なリムーバブル・ディスク2511に格納されて頒布され、ドライブ装置2513からHDD2505にインストールされる。インターネットなどのネットワーク及び通信制御部2517を経由して、HDD2505にインストールされる場合もある。このようなコンピュータ装置は、上で述べたCPU2503、メモリ2501などのハードウエアとOS及び必要なアプリケーション・プログラムとが有機的に協働することにより、上で述べたような各種機能を実現する。
The
以上本実施の形態をまとめると以下のようになる。 The present embodiment can be summarized as follows.
本仮想化処理方法は、ホストマシンに、仮想的なコンピュータであるゲストマシンを実行させるための方法である。そして、特定のゲスト仮想ページへのアクセスの際に、特定のゲスト仮想ページのアドレスに対応するゲスト物理ページアドレスを特定するステップと、ゲスト物理ページの数分エントリを有しており且つ各ゲスト物理ページアドレスにゲスト仮想ページアドレスと対応するホスト物理ページへのポインタと当該ホスト物理ページに格納されているコードをホストマシン向けに変換したコードである変換コードへのポインタとを格納するための変換テーブルから、特定されたゲスト物理ページアドレスについてのエントリを読み出し、変換コードへのポインタが含まれているか判断するステップと、変換コードへのポインタが含まれている場合には、読み出されたエントリに含まれるゲスト仮想ページアドレスと特定のゲスト仮想ページのアドレスとを比較する比較ステップと、読み出されたエントリに含まれるゲスト仮想ページアドレスと特定のゲスト仮想ページのアドレスとが一致する場合には、読み出されたエントリに含まれる変換コードへのポインタにより当該変換コードを読み出して実行するステップとを含む。 This virtualization processing method is a method for causing a host machine to execute a guest machine which is a virtual computer. When accessing a specific guest virtual page, the guest physical page address corresponding to the address of the specific guest virtual page is specified, and there are as many entries as there are guest physical pages, and each guest physical page A conversion table for storing a pointer to a host physical page corresponding to the guest virtual page address and a pointer to a conversion code that is a code obtained by converting the code stored in the host physical page for the host machine in the page address To read the entry for the specified guest physical page address and determine whether or not a pointer to the conversion code is included, and if the pointer to the conversion code is included, Included guest virtual page addresses and specific guest virtual page addresses If the comparison step for comparing the address and the guest virtual page address included in the read entry matches the address of the specific guest virtual page, a pointer to the conversion code included in the read entry And reading and executing the conversion code.
上で述べたような変換テーブルを用いることによって、変換テーブルのエントリ数をホスト物理ページ数に限定でき、メンテナンスも容易で、仮想マシンにおいて動的バイナリ変換を効率的に行うことができるようになる。 By using a conversion table as described above, the number of entries in the conversion table can be limited to the number of host physical pages, maintenance is easy, and dynamic binary conversion can be performed efficiently in a virtual machine. .
また、本仮想化処理方法では、読み出されたエントリに含まれるゲスト仮想ページアドレスと特定のゲスト仮想ページのアドレスとが不一致である場合には、読み出されたエントリに含まれる変換コードへのポインタを削除すると共に、当該ポインタで指定されたページに格納されている当該変換コードを削除するステップをさらに含むようにしても良い。上で述べたような条件が成立すれば、動的アドレス変換(DAT)テーブルの書き換えやTLB(Translation Lookaside Buffer)のフラッシュが発生したことが分かるので、不要な変換コードを破棄することができるようになる。なお、DATテーブルの一部を無効化するゲストマシン命令を実行することが分かれば、この際にも該当する変換コードを削除して、変換テーブルにおける該当エントリの変換コードへのポインタを破棄すればよい。 Also, in this virtualization processing method, when the guest virtual page address included in the read entry does not match the address of the specific guest virtual page, the conversion code included in the read entry is converted to the conversion code. A step of deleting the conversion code stored in the page specified by the pointer may be further included. If the conditions described above are satisfied, it can be seen that dynamic address translation (DAT) table rewriting or TLB (Translation Lookaside Buffer) flush has occurred, so that unnecessary translation codes can be discarded. become. If it is known that a guest machine instruction that invalidates a part of the DAT table is executed, the corresponding conversion code is also deleted at this time, and the pointer to the conversion code of the corresponding entry in the conversion table is discarded. Good.
また、本仮想化処理方法では、読み出されたエントリに含まれるゲスト仮想ページアドレスと特定のゲスト仮想ページのアドレスが不一致である場合又は読み出されたエントリに変換コードへのポインタが含まれていない場合、読み出されたエントリに含まれるホスト物理ページへのポインタにより当該ホスト物理ページに格納されているコードを読み出して、コード変換処理を実施するステップと、特定されたゲスト物理ページアドレスについてのエントリに、特定のゲスト仮想ページのアドレスとコード変換処理によって生成された変換コードが格納されているホスト物理ページのアドレスを格納するステップと、コード変換処理によって生成された変換コードを実行するステップとをさらに含むようにしても良い。このように直ぐに変換コードを実行できない場合においても、変換テーブルの該当エントリから、コード変換処理を実施すべきコードの格納場所が特定できるので、コード変換処理をスムーズに実行することができる。 In this virtualization processing method, the guest virtual page address included in the read entry does not match the address of the specific guest virtual page, or the read entry includes a pointer to the conversion code. If not, the code stored in the host physical page is read by the pointer to the host physical page included in the read entry and the code conversion process is performed, and the specified guest physical page address is Storing the address of a specific guest virtual page and the address of a host physical page in which the conversion code generated by the code conversion process is stored in the entry; executing the conversion code generated by the code conversion process; May be further included. Even when the conversion code cannot be executed immediately in this way, the storage location of the code to be subjected to the code conversion process can be identified from the corresponding entry of the conversion table, so that the code conversion process can be executed smoothly.
さらに、変換テーブルにおける有効なゲスト仮想ページアドレスが、ページ共有判定ビットと空間識別子とページアドレスとを含むようにしてもよい。この場合、上で述べた比較ステップにおいて、ページ共有判定ビットがセットされている場合には、読み出されたエントリに含まれるゲスト仮想ページアドレスのうちページアドレスと、特定のゲスト仮想ページのアドレスのうち空間識別子以外の部分とを比較し、ページ共有判定ビットがセットされていない場合には、読み出されたエントリに含まれる有効なゲスト仮想ページアドレスのうち空間識別子及びページアドレスと特定のゲスト仮想ページのアドレスとを比較するようにしてもよい。例えば、複数のゲストマシンで共有するメモリ領域以外の部分については、上で述べたような構成にてゲスト仮想ページアドレスとホスト物理アドレスとの一対一関係を表すことができる。しかしながら、複数のゲストマシンで共有するメモリ領域については、多対一の写像関係を有効に表す必要があるので、上で述べたような構成を採用すれば、変換コードを効率よく利用できるようになる。 Further, a valid guest virtual page address in the conversion table may include a page sharing determination bit, a space identifier, and a page address. In this case, in the comparison step described above, when the page sharing determination bit is set, the page address of the guest virtual page address included in the read entry and the address of the specific guest virtual page If the page sharing decision bit is not set, the space identifier and page address of a valid guest virtual page address included in the read entry and a specific guest virtual are compared. You may make it compare with the address of a page. For example, for a portion other than a memory area shared by a plurality of guest machines, a one-to-one relationship between a guest virtual page address and a host physical address can be expressed with the configuration described above. However, for the memory area shared by multiple guest machines, it is necessary to effectively represent the many-to-one mapping relationship, so that the conversion code can be used efficiently by adopting the configuration as described above. Become.
なお、上で述べたような処理をホストマシンに実施させるためのプログラムを作成することができ、当該プログラムは、例えばフレキシブル・ディスク、CD−ROM、光磁気ディスク、半導体メモリ、ハードディスク等のコンピュータ読み取り可能な記憶媒体又は記憶装置に格納される。なお、処理途中のデータについては、コンピュータのメモリ等の記憶装置に一時保管される。 It is possible to create a program for causing the host machine to perform the processing described above, and the program can be read by a computer such as a flexible disk, a CD-ROM, a magneto-optical disk, a semiconductor memory, and a hard disk. It is stored in a possible storage medium or storage device. Note that data being processed is temporarily stored in a storage device such as a computer memory.
以上の実施例を含む実施形態に関し、さらに以下の付記を開示する。 The following supplementary notes are further disclosed with respect to the embodiments including the above examples.
(付記1)
ホストマシンに、仮想的なコンピュータであるゲストマシンを実行させるための仮想化プログラムであって、
特定のゲスト仮想ページへのアクセスの際に、前記特定のゲスト仮想ページのアドレスに対応するゲスト物理ページアドレスを特定するステップと、
ゲスト物理ページの数分エントリを有しており且つ各ゲスト物理ページアドレスにゲスト仮想ページアドレスと対応するホスト物理ページへのポインタと当該ホスト物理ページに格納されているコードを前記ホストマシン向けに変換したコードである変換コードへのポインタとを格納するための変換テーブルから、特定された前記ゲスト物理ページアドレスについてのエントリを読み出し、前記変換コードへのポインタが含まれているか判断するステップと、
前記変換コードへのポインタが含まれている場合には、読み出された前記エントリに含まれるゲスト仮想ページアドレスと前記特定のゲスト仮想ページのアドレスとを比較する比較ステップと、
読み出された前記エントリに含まれるゲスト仮想ページアドレスと前記特定のゲスト仮想ページのアドレスとが一致する場合には、読み出された前記エントリに含まれる前記変換コードへのポインタにより当該変換コードを読み出して実行するステップと、
を実行させるための仮想化プログラム。
(Appendix 1)
A virtualization program for causing a host machine to execute a guest machine that is a virtual computer,
Identifying a guest physical page address corresponding to the address of the specific guest virtual page when accessing the specific guest virtual page;
The number of guest physical pages is equal to the number of guest physical pages, and the guest virtual page address and the corresponding host physical page pointer corresponding to the guest virtual page address and the code stored in the host physical page are converted for the host machine. A step of reading an entry for the specified guest physical page address from a conversion table for storing a pointer to a conversion code that is a generated code, and determining whether a pointer to the conversion code is included;
If the pointer to the conversion code is included, a comparison step of comparing the guest virtual page address included in the read entry with the address of the specific guest virtual page;
When the guest virtual page address included in the read entry matches the address of the specific guest virtual page, the conversion code is set by a pointer to the conversion code included in the read entry. Steps to read and execute;
Virtualization program for running
(付記2)
読み出された前記エントリに含まれるゲスト仮想ページアドレスと前記特定のゲスト仮想ページのアドレスとが不一致である場合には、読み出された前記エントリに含まれる前記変換コードへのポインタを削除すると共に、当該ポインタで指定されたページに格納されている当該変換コードを削除するステップ
をさらに含む付記1記載の仮想化プログラム。
(Appendix 2)
If the guest virtual page address included in the read entry and the address of the specific guest virtual page do not match, the pointer to the conversion code included in the read entry is deleted. The virtualization program according to
(付記3)
読み出された前記エントリに含まれるゲスト仮想ページアドレスと前記特定のゲスト仮想ページのアドレスが不一致である場合又は読み出された前記エントリに前記変換コードへのポインタが含まれていない場合、読み出された前記エントリに含まれる前記ホスト物理ページへのポインタにより当該ホスト物理ページに格納されているコードを読み出して、コード変換処理を実施するステップと、
特定された前記ゲスト物理ページアドレスについてのエントリに、前記特定のゲスト仮想ページのアドレスと前記コード変換処理によって生成された変換コードが格納されているホスト物理ページのアドレスを格納するステップと、
前記コード変換処理によって生成された変換コードを実行するステップと、
をさらに実行させるための付記1又は2記載の仮想化プログラム。
(Appendix 3)
If the guest virtual page address included in the read entry does not match the address of the specific guest virtual page, or if the read entry does not include a pointer to the conversion code, read Reading a code stored in the host physical page by a pointer to the host physical page included in the entry, and performing a code conversion process;
Storing the address of the specified guest virtual page and the address of the host physical page in which the conversion code generated by the code conversion process is stored in the entry for the specified guest physical page address;
Executing the conversion code generated by the code conversion process;
The virtualization program according to
(付記4)
前記変換テーブルにおける前記有効なゲスト仮想ページアドレスが、ページ共有判定ビットと空間識別子とページアドレスとを含み、
前記比較ステップにおいて、
前記ページ共有判定ビットがセットされている場合には、読み出された前記エントリに含まれる前記ゲスト仮想ページアドレスのうち前記ページアドレスと、前記特定のゲスト仮想ページのアドレスのうち前記空間識別子以外の部分とを比較し、
前記ページ共有判定ビットがセットされていない場合には、読み出された前記エントリに含まれる前記ゲスト仮想ページアドレスのうち前記空間識別子及び前記ページアドレスと前記特定のゲスト仮想ページのアドレスとを比較する
付記1乃至3のいずれか1つ記載の仮想化プログラム。
(Appendix 4)
The valid guest virtual page address in the translation table includes a page sharing determination bit, a space identifier, and a page address;
In the comparison step,
When the page sharing determination bit is set, the page address of the guest virtual page address included in the read entry and the address other than the space identifier of the address of the specific guest virtual page Compare the part with
When the page sharing determination bit is not set, the space identifier and the page address of the guest virtual page address included in the read entry are compared with the address of the specific guest virtual page. The virtualization program according to any one of
(付記5)
ホストマシンに、仮想的なコンピュータであるゲストマシンを実行させる仮想化処理方法であって、
特定のゲスト仮想ページへのアクセスの際に、前記特定のゲスト仮想ページのアドレスに対応するゲスト物理ページアドレスを特定するステップと、
ゲスト物理ページの数分エントリを有しており且つ各ゲスト物理ページアドレスにゲスト仮想ページアドレスと対応するホスト物理ページへのポインタと当該ホスト物理ページに格納されているコードを前記ホストマシン向けに変換したコードである変換コードへのポインタとを格納するための変換テーブルから、特定された前記ゲスト物理ページアドレスについてのエントリを読み出し、前記変換コードへのポインタが含まれているか判断するステップと、
前記変換コードへのポインタが含まれている場合には、読み出された前記エントリに含まれるゲスト仮想ページアドレスと前記特定のゲスト仮想ページのアドレスとを比較する比較ステップと、
読み出された前記エントリに含まれるゲスト仮想ページアドレスと前記特定のゲスト仮想ページのアドレスとが一致する場合には、読み出された前記エントリに含まれる前記変換コードへのポインタにより当該変換コードを読み出して実行するステップと、
を含む仮想化処理方法。
(Appendix 5)
A virtualization processing method for causing a host machine to execute a guest machine which is a virtual computer,
Identifying a guest physical page address corresponding to the address of the specific guest virtual page when accessing the specific guest virtual page;
The number of guest physical pages is equal to the number of guest physical pages, and the guest virtual page address and the corresponding host physical page pointer corresponding to the guest virtual page address and the code stored in the host physical page are converted for the host machine. A step of reading an entry for the specified guest physical page address from a conversion table for storing a pointer to a conversion code that is a generated code, and determining whether a pointer to the conversion code is included;
If the pointer to the conversion code is included, a comparison step of comparing the guest virtual page address included in the read entry with the address of the specific guest virtual page;
When the guest virtual page address included in the read entry matches the address of the specific guest virtual page, the conversion code is set by a pointer to the conversion code included in the read entry. Steps to read and execute;
A virtualization processing method including:
(付記6)
仮想的なコンピュータであるゲストマシンを実行させるホストマシンであって、
特定のゲスト仮想ページへのアクセスの際に、前記特定のゲスト仮想ページのアドレスに対応するゲスト物理ページアドレスを特定する手段と、
ゲスト物理ページの数分エントリを有しており且つ各ゲスト物理ページアドレスにゲスト仮想ページアドレスと対応するホスト物理ページへのポインタと当該ホスト物理ページに格納されているコードを前記ホストマシン向けに変換したコードである変換コードへのポインタとを格納するための変換テーブルを格納するメモリと、
前記変換テーブルから、特定された前記ゲスト物理ページアドレスについてのエントリを読み出し、前記変換コードへのポインタが含まれているか判断し、前記変換コードへのポインタが含まれている場合には、読み出された前記エントリに含まれるゲスト仮想ページアドレスと前記特定のゲスト仮想ページのアドレスとを比較し、読み出された前記エントリに含まれるゲスト仮想ページアドレスと前記特定のゲスト仮想ページのアドレスとが一致する場合には、読み出された前記エントリに含まれる前記変換コードへのポインタにより当該変換コードを読み出して実行する手段と、
を有するホストマシン。
(Appendix 6)
A host machine that runs a guest machine that is a virtual computer,
Means for identifying a guest physical page address corresponding to an address of the specific guest virtual page when accessing the specific guest virtual page;
The number of guest physical pages is equal to the number of guest physical pages, and the guest virtual page address and the corresponding host physical page pointer corresponding to the guest virtual page address and the code stored in the host physical page are converted for the host machine. A memory for storing a conversion table for storing a pointer to the conversion code that is the generated code;
An entry for the specified guest physical page address is read from the conversion table, a determination is made as to whether a pointer to the conversion code is included, and if a pointer to the conversion code is included, a read is performed. The guest virtual page address included in the read entry is compared with the address of the specific guest virtual page, and the guest virtual page address included in the read entry matches the address of the specific guest virtual page A means for reading and executing the conversion code by a pointer to the conversion code included in the read entry;
Having a host machine.
1 ホストマシン 100 CPUエミュレータ
200 ホスト主記憶
101 命令インタプリタ 103 変換コード検索部
105 動的バイナリ変換部
201 ゲスト主記憶領域 203 αテーブル
205 変換コード管理領域
2011 ゲストプログラム
2051 変換コード
DESCRIPTION OF
Claims (6)
特定のゲスト仮想ページへのアクセスの際に、前記特定のゲスト仮想ページのアドレスに対応するゲスト物理ページアドレスを特定するステップと、
ゲスト物理ページの数分エントリを有しており且つ各ゲスト物理ページアドレスにゲスト仮想ページアドレスと対応するホスト物理ページへのポインタと当該ホスト物理ページに格納されているコードを前記ホストマシン向けに変換したコードである変換コードへのポインタとを格納するための変換テーブルから、特定された前記ゲスト物理ページアドレスについてのエントリを読み出し、前記変換コードへのポインタが含まれているか判断するステップと、
前記変換コードへのポインタが含まれている場合には、読み出された前記エントリに含まれるゲスト仮想ページアドレスと前記特定のゲスト仮想ページのアドレスとを比較する比較ステップと、
読み出された前記エントリに含まれるゲスト仮想ページアドレスと前記特定のゲスト仮想ページのアドレスとが一致する場合には、読み出された前記エントリに含まれる前記変換コードへのポインタにより当該変換コードを読み出して実行するステップと、
を実行させるための仮想化プログラム。 A virtualization program for causing a host machine to execute a guest machine that is a virtual computer,
Identifying a guest physical page address corresponding to the address of the specific guest virtual page when accessing the specific guest virtual page;
The number of guest physical pages is equal to the number of guest physical pages, and the guest virtual page address and the corresponding host physical page pointer corresponding to the guest virtual page address and the code stored in the host physical page are converted for the host machine. A step of reading an entry for the specified guest physical page address from a conversion table for storing a pointer to a conversion code that is a generated code, and determining whether a pointer to the conversion code is included;
If the pointer to the conversion code is included, a comparison step of comparing the guest virtual page address included in the read entry with the address of the specific guest virtual page;
When the guest virtual page address included in the read entry matches the address of the specific guest virtual page, the conversion code is set by a pointer to the conversion code included in the read entry. Steps to read and execute;
Virtualization program for running
をさらに含む請求項1記載の仮想化プログラム。 If the guest virtual page address included in the read entry and the address of the specific guest virtual page do not match, the pointer to the conversion code included in the read entry is deleted. The virtualization program according to claim 1, further comprising: deleting the conversion code stored in the page specified by the pointer.
特定された前記ゲスト物理ページアドレスについてのエントリに、前記特定のゲスト仮想ページのアドレスと前記コード変換処理によって生成された変換コードが格納されているホスト物理ページのアドレスを格納するステップと、
前記コード変換処理によって生成された変換コードを実行するステップと、
をさらに実行させるための請求項1又は2記載の仮想化プログラム。 If the guest virtual page address included in the read entry does not match the address of the specific guest virtual page, or if the read entry does not include a pointer to the conversion code, read Reading a code stored in the host physical page by a pointer to the host physical page included in the entry, and performing a code conversion process;
Storing the address of the specified guest virtual page and the address of the host physical page in which the conversion code generated by the code conversion process is stored in the entry for the specified guest physical page address;
Executing the conversion code generated by the code conversion process;
The virtualization program according to claim 1 or 2, wherein the virtualization program is further executed.
前記比較ステップにおいて、
前記ページ共有判定ビットがセットされている場合には、読み出された前記エントリに含まれる前記ゲスト仮想ページアドレスのうち前記ページアドレスと、前記特定のゲスト仮想ページのアドレスのうち前記空間識別子以外の部分とを比較し、
前記ページ共有判定ビットがセットされていない場合には、読み出された前記エントリに含まれる前記ゲスト仮想ページアドレスのうち前記空間識別子及び前記ページアドレスと前記特定のゲスト仮想ページのアドレスとを比較する
請求項1乃至3のいずれか1つ記載の仮想化プログラム。 The valid guest virtual page address in the translation table includes a page sharing determination bit, a space identifier, and a page address;
In the comparison step,
When the page sharing determination bit is set, the page address of the guest virtual page address included in the read entry and the address other than the space identifier of the address of the specific guest virtual page Compare the part with
When the page sharing determination bit is not set, the space identifier and the page address of the guest virtual page address included in the read entry are compared with the address of the specific guest virtual page. The virtualization program according to any one of claims 1 to 3.
特定のゲスト仮想ページへのアクセスの際に、前記特定のゲスト仮想ページのアドレスに対応するゲスト物理ページアドレスを特定するステップと、
ゲスト物理ページの数分エントリを有しており且つ各ゲスト物理ページアドレスにゲスト仮想ページアドレスと対応するホスト物理ページへのポインタと当該ホスト物理ページに格納されているコードを前記ホストマシン向けに変換したコードである変換コードへのポインタとを格納するための変換テーブルから、特定された前記ゲスト物理ページアドレスについてのエントリを読み出し、前記変換コードへのポインタが含まれているか判断するステップと、
前記変換コードへのポインタが含まれている場合には、読み出された前記エントリに含まれるゲスト仮想ページアドレスと前記特定のゲスト仮想ページのアドレスとを比較する比較ステップと、
読み出された前記エントリに含まれるゲスト仮想ページアドレスと前記特定のゲスト仮想ページのアドレスとが一致する場合には、読み出された前記エントリに含まれる前記変換コードへのポインタにより当該変換コードを読み出して実行するステップと、
を含む仮想化処理方法。 A virtualization processing method for causing a host machine to execute a guest machine which is a virtual computer,
Identifying a guest physical page address corresponding to the address of the specific guest virtual page when accessing the specific guest virtual page;
The number of guest physical pages is equal to the number of guest physical pages, and the guest virtual page address and the corresponding host physical page pointer corresponding to the guest virtual page address and the code stored in the host physical page are converted for the host machine. A step of reading an entry for the specified guest physical page address from a conversion table for storing a pointer to a conversion code that is a generated code, and determining whether a pointer to the conversion code is included;
If the pointer to the conversion code is included, a comparison step of comparing the guest virtual page address included in the read entry with the address of the specific guest virtual page;
When the guest virtual page address included in the read entry matches the address of the specific guest virtual page, the conversion code is set by a pointer to the conversion code included in the read entry. Steps to read and execute;
A virtualization processing method including:
特定のゲスト仮想ページへのアクセスの際に、前記特定のゲスト仮想ページのアドレスに対応するゲスト物理ページアドレスを特定する手段と、
ゲスト物理ページの数分エントリを有しており且つ各ゲスト物理ページアドレスにゲスト仮想ページアドレスと対応するホスト物理ページへのポインタと当該ホスト物理ページに格納されているコードを前記ホストマシン向けに変換したコードである変換コードへのポインタとを格納するための変換テーブルを格納するメモリと、
前記変換テーブルから、特定された前記ゲスト物理ページアドレスについてのエントリを読み出し、前記変換コードへのポインタが含まれているか判断し、前記変換コードへのポインタが含まれている場合には、読み出された前記エントリに含まれるゲスト仮想ページアドレスと前記特定のゲスト仮想ページのアドレスとを比較し、読み出された前記エントリに含まれるゲスト仮想ページアドレスと前記特定のゲスト仮想ページのアドレスとが一致する場合には、読み出された前記エントリに含まれる前記変換コードへのポインタにより当該変換コードを読み出して実行する手段と、
を有するホストマシン。 A host machine that runs a guest machine that is a virtual computer,
Means for identifying a guest physical page address corresponding to an address of the specific guest virtual page when accessing the specific guest virtual page;
The number of guest physical pages is equal to the number of guest physical pages, and the guest virtual page address and the corresponding host physical page pointer corresponding to the guest virtual page address and the code stored in the host physical page are converted for the host machine. A memory for storing a conversion table for storing a pointer to the conversion code that is the generated code;
An entry for the specified guest physical page address is read from the conversion table, a determination is made as to whether a pointer to the conversion code is included, and if a pointer to the conversion code is included, a read is performed. The guest virtual page address included in the read entry is compared with the address of the specific guest virtual page, and the guest virtual page address included in the read entry matches the address of the specific guest virtual page A means for reading and executing the conversion code by a pointer to the conversion code included in the read entry;
Having a host machine.
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP2009104022A JP5246014B2 (en) | 2009-04-22 | 2009-04-22 | Virtualization program, virtualization processing method and apparatus |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP2009104022A JP5246014B2 (en) | 2009-04-22 | 2009-04-22 | Virtualization program, virtualization processing method and apparatus |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| JP2010257049A JP2010257049A (en) | 2010-11-11 |
| JP5246014B2 true JP5246014B2 (en) | 2013-07-24 |
Family
ID=43317918
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| JP2009104022A Active JP5246014B2 (en) | 2009-04-22 | 2009-04-22 | Virtualization program, virtualization processing method and apparatus |
Country Status (1)
| Country | Link |
|---|---|
| JP (1) | JP5246014B2 (en) |
Families Citing this family (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| JP5941868B2 (en) * | 2013-04-18 | 2016-06-29 | 株式会社日立製作所 | Virtual computer system and method for implementing I/O in a virtual computer |
Family Cites Families (6)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| JPS5858752B2 (en) * | 1977-08-24 | 1983-12-27 | 株式会社日立製作所 | address translation device |
| JPS61206057A (en) * | 1985-03-11 | 1986-09-12 | Hitachi Ltd | address translation device |
| JPH05225064A (en) * | 1992-02-10 | 1993-09-03 | Hitachi Ltd | Address translator and buffer storage controller |
| US6363336B1 (en) * | 1999-10-13 | 2002-03-26 | Transmeta Corporation | Fine grain translation discrimination |
| US7953588B2 (en) * | 2002-09-17 | 2011-05-31 | International Business Machines Corporation | Method and system for efficient emulation of multiprocessor address translation on a multiprocessor host |
| US7334076B2 (en) * | 2005-03-08 | 2008-02-19 | Microsoft Corporation | Method and system for a guest physical address virtualization in a virtual machine environment |
-
2009
- 2009-04-22 JP JP2009104022A patent/JP5246014B2/en active Active
Also Published As
| Publication number | Publication date |
|---|---|
| JP2010257049A (en) | 2010-11-11 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| US8171255B1 (en) | Optimization of paging cache protection in virtual environment | |
| US8095771B2 (en) | Method and system for caching address translations from multiple address spaces in virtual machines | |
| US9104594B2 (en) | Operational efficiency of virtual TLBs | |
| JP5091655B2 (en) | Computer virtualization apparatus, program thereof, and method thereof | |
| JP5214670B2 (en) | Method and apparatus for supporting address translation in a multiprocessor virtual machine environment | |
| US10318322B2 (en) | Binary translator with precise exception synchronization mechanism | |
| US6820255B2 (en) | Method for fast execution of translated binary code utilizing database cache for low-level code correspondence | |
| CN1993683B (en) | Maintain Processor Resources During Architectural Events | |
| US10474369B2 (en) | Mapping guest pages to disk blocks to improve virtual machine management processes | |
| CN109074316B (en) | page error solution | |
| US7856542B1 (en) | Paging cache optimization for virtual machine | |
| CN100458687C (en) | Shared code cache method and device for program code conversion | |
| JP2007531075A (en) | Method and apparatus for shared code caching for translating program code | |
| WO2006081582A2 (en) | A method and apparatus for supporting address translation in a virtual machine environment | |
| CN1125338A (en) | Method and apparatus for dynamically controlling address space allocation | |
| US8589143B2 (en) | Virtualization apparatus and processing method thereof | |
| CN119621608B (en) | Hardware-assisted page table management system, method, medium, program product and terminal | |
| US12086084B2 (en) | IOMMU-based direct memory access (DMA) tracking for enabling live migration of virtual machines (VMS) using passthrough physical devices | |
| US7506096B1 (en) | Memory segment emulation model for virtual machine | |
| CN120353469B (en) | Binary translation method, translator, electronic device and readable storage medium | |
| JP5246014B2 (en) | Virtualization program, virtualization processing method and apparatus | |
| CN120295933A (en) | A memory management method for operating system compatible with multi-processor architecture | |
| JPS588073B2 (en) | address translation device |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| A621 | Written request for application examination |
Free format text: JAPANESE INTERMEDIATE CODE: A621 Effective date: 20111205 |
|
| A977 | Report on retrieval |
Free format text: JAPANESE INTERMEDIATE CODE: A971007 Effective date: 20130215 |
|
| TRDD | Decision of grant or rejection written | ||
| A01 | Written decision to grant a patent or to grant a registration (utility model) |
Free format text: JAPANESE INTERMEDIATE CODE: A01 Effective date: 20130312 |
|
| A61 | First payment of annual fees (during grant procedure) |
Free format text: JAPANESE INTERMEDIATE CODE: A61 Effective date: 20130325 |
|
| R150 | Certificate of patent or registration of utility model |
Ref document number: 5246014 Country of ref document: JP Free format text: JAPANESE INTERMEDIATE CODE: R150 Free format text: JAPANESE INTERMEDIATE CODE: R150 |
|
| FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20160419 Year of fee payment: 3 |