Skip to contentSkip to conversation

dyngen_code in 16 bit

Qemu-devel Clemens Kolbitsch 2 participants 2 messages Apr 14, 2008

lore
Share & tools
lore
#0 lore raw

Hi!
For a research project I extended Qemu to include some extra code inside the op_XXX instructions that increased the generated TB-code's size to quite some extend...

Now I have a problem when having block chaining enabled (that I don't want to disable for performance reasons :-/): The code_gen_buffer sometimes contains code areas that span more than 0xffff bytes, however, dyngen and all functions related to it use 16 bit pointers, etc. Therefore, e.g. the dyngen_code function uses the 16 bit pointers to overwrite certain params and of course destroys the TB-code.

When working with x86 hosts and guests (both 32 bit), is there a specific reason for all these pointers to be 16 bits or has it just been a safe assumption up to now?? I have tried rewriting the code to use 32 bit, but keep getting segfaults... however, of course, I might have missed some code still.

Any help is - as always - greatly appreciated!!

Cheers,
Clemens

#1 lore raw
Quoted 4 lines · Clemens Kolbitsch

Hi!
For a research project I extended Qemu to include some extra code inside the op_XXX instructions that increased the generated TB-code's size to quite some extend...

Don't do that. Put it in a helper function. The performance overhead will be minimal.

Most likely the segfaults are because you're overrunning a buffer. qemu has static limits on the maximum size of an guest instruction.

Paul