Translation Engine
The Translation Engine (TE ) is the heart of z/Vos. TE converts native x86 code to its System z® equivalent. It is important to note that the TE generates equivalent results rather than equivalent machine code. The reason TE takes this approach is so it can leverage System z capabilities. The x86 MOV with a REP prefix is a good example. Rather than execute a move for 4 bytes 1000 times in order to move 4000 characters, z/Vos creates an MVCL (MOVE LONG) that achieves the same results. The TE performs this translation only on the first pass through the x86 code. Subsequent execution passes use the code generated during the first pass. A translated code segment may contain multiple x86 instructions.
Let’s take a simple example. Below in red you will find the x86 16 bit mode code fragment for a MOV instruction. The blue code is the TE zArch code for this MOV:
00000D1F: B8 00 10 mov ax,0x1000
07EDCC04 47000006 *** START 16 BIT INSTRUCTION CODE RX
07EDCC08 D201B0189001 MVC 000024(001,11),000001(09) SS
07EDCC0E 41909003 LA 09,0003(00,09) RX
Not rocket science is it? Well, no and yes. No because it is simply achieving the best results possible using the zArch instruction set. Yes because TE has to generate code where every line is reentrant and capable of being relocated. Add to that the fact that some of the x86 instructions are remarkably complex relative to zArch, and you will quickly gain a deep appreciation for what TE makes happen.
Once the initial translation is complete the code is executed and the fragment gets handed off to a translated code manager (TCM). The TCM is responsible for storing, aging and (eventually) discarding the segment. The TE receives a “claim check” from TCM for the translated segment. That claim check may be altered if the segment is “parked” in a different place or rescinded if the segment is discarded. All this happens asynchronously. The generated fragment can be referenced by an unlimited number of other x86 code blocks that use a similarly constructed form of the translated x86 code segment.
/&
|
|
|
|





