[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Inquiry About PC-Relative Code Generation in QEMU
From: |
Yip Coekjan |
Subject: |
Re: Inquiry About PC-Relative Code Generation in QEMU |
Date: |
Tue, 05 Nov 2024 15:57:35 +0800 |
Thank you for your response.
On 11/4/24 20:51:40, Richard Henderson wrote:
> User emulation does not have multiple mappings of the same physical page
> like system mode does. This is because in user emulation we have only one
> process to emulate.
To clarify, is the reason QEMU does not use `CF_PCREL` for user emulation
because it could potentially generate more opcodes, thus impacting
performance?
> No. Treating the guest code as PC as a variable instead of a constant is
> different from generating position independent host code.
I briefly went through `target/i386/tcg/translate.c` and noticed that when
`CF_PCREL` is enabled, the generated opcodes seem to resemble PIC (Position-
Independent Code). My understanding is that `CF_PCREL` was not originally
intended for generating PIC, but the host code generated does appear to be
PIC. As I'm not very familiar with QEMU, please correct me if I'm mistaken.
Best regards,
Yip Coekjan