mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-08 10:13:56 -06:00
Replace qemu_real_host_page variables with inlined functions
Replace the global variables with inlined helper functions. getpagesize() is very likely annotated with a "const" function attribute (at least with glibc), and thus optimization should apply even better. This avoids the need for a constructor initialization too. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20220323155743.1585078-12-marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
b307e5052d
commit
8e3b0cbb72
53 changed files with 150 additions and 162 deletions
|
@ -488,14 +488,14 @@ static int alloc_code_gen_buffer(size_t tb_size, int splitwx, Error **errp)
|
|||
/* page-align the beginning and end of the buffer */
|
||||
buf = static_code_gen_buffer;
|
||||
end = static_code_gen_buffer + sizeof(static_code_gen_buffer);
|
||||
buf = QEMU_ALIGN_PTR_UP(buf, qemu_real_host_page_size);
|
||||
end = QEMU_ALIGN_PTR_DOWN(end, qemu_real_host_page_size);
|
||||
buf = QEMU_ALIGN_PTR_UP(buf, qemu_real_host_page_size());
|
||||
end = QEMU_ALIGN_PTR_DOWN(end, qemu_real_host_page_size());
|
||||
|
||||
size = end - buf;
|
||||
|
||||
/* Honor a command-line option limiting the size of the buffer. */
|
||||
if (size > tb_size) {
|
||||
size = QEMU_ALIGN_DOWN(tb_size, qemu_real_host_page_size);
|
||||
size = QEMU_ALIGN_DOWN(tb_size, qemu_real_host_page_size());
|
||||
}
|
||||
|
||||
region.start_aligned = buf;
|
||||
|
@ -729,7 +729,7 @@ static int alloc_code_gen_buffer(size_t size, int splitwx, Error **errp)
|
|||
*/
|
||||
void tcg_region_init(size_t tb_size, int splitwx, unsigned max_cpus)
|
||||
{
|
||||
const size_t page_size = qemu_real_host_page_size;
|
||||
const size_t page_size = qemu_real_host_page_size();
|
||||
size_t region_size;
|
||||
int have_prot, need_prot;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue