Message ID | 20230523163600.83391-2-philmd@linaro.org |
---|---|
State | New |
Headers | show |
Series | hw/virtio: Build various target-agnostic objects just once | expand |
On 23/05/2023 18.35, Philippe Mathieu-Daudé wrote: > Since TARGET_PAGE_MASK and TARGET_PAGE_ALIGN are poisoned in > target-agnostic code, introduce the qemu_target_page_mask() > and qemu_target_page_align() helpers to get these values from > target-agnostic code at runtime. > > Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> > --- > include/exec/target_page.h | 2 ++ > softmmu/physmem.c | 10 ++++++++++ > 2 files changed, 12 insertions(+) Reviewed-by: Thomas Huth <thuth@redhat.com>
On 5/23/23 09:35, Philippe Mathieu-Daudé wrote:
> +unsigned qemu_target_page_mask(void);
Should be signed int, so that it sign-extends to whatever needed width.
r~
diff --git a/include/exec/target_page.h b/include/exec/target_page.h index bbf37aea17..660416920b 100644 --- a/include/exec/target_page.h +++ b/include/exec/target_page.h @@ -15,6 +15,8 @@ #define EXEC_TARGET_PAGE_H size_t qemu_target_page_size(void); +unsigned qemu_target_page_mask(void); +uint64_t qemu_target_page_align(uint64_t value); int qemu_target_page_bits(void); int qemu_target_page_bits_min(void); diff --git a/softmmu/physmem.c b/softmmu/physmem.c index efaed36773..14fcba4fb2 100644 --- a/softmmu/physmem.c +++ b/softmmu/physmem.c @@ -3347,6 +3347,16 @@ size_t qemu_target_page_size(void) return TARGET_PAGE_SIZE; } +unsigned qemu_target_page_mask(void) +{ + return TARGET_PAGE_MASK; +} + +uint64_t qemu_target_page_align(uint64_t value) +{ + return TARGET_PAGE_ALIGN(value); +} + int qemu_target_page_bits(void) { return TARGET_PAGE_BITS;
Since TARGET_PAGE_MASK and TARGET_PAGE_ALIGN are poisoned in target-agnostic code, introduce the qemu_target_page_mask() and qemu_target_page_align() helpers to get these values from target-agnostic code at runtime. Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> --- include/exec/target_page.h | 2 ++ softmmu/physmem.c | 10 ++++++++++ 2 files changed, 12 insertions(+)