On 20/9/22 07:15, Philippe Mathieu-Daudé wrote:
On 20/9/22 01:17, Bernhard Beschow wrote:
The functions just access a global pointer and perform some pointer
arithmetic on top. Allow the compiler to see through this by inlining.
I thought about this while reviewing the previous patch, ...
Signed-off-by: Bernhard Beschow <shentey@xxxxxxxxx>
---
include/exec/address-spaces.h | 30 ++++++++++++++++++++++++++----
softmmu/physmem.c | 28 ----------------------------
2 files changed, 26 insertions(+), 32 deletions(-)
diff --git a/include/exec/address-spaces.h
b/include/exec/address-spaces.h
index b31bd8dcf0..182af27cad 100644
--- a/include/exec/address-spaces.h
+++ b/include/exec/address-spaces.h
@@ -23,29 +23,51 @@
#ifndef CONFIG_USER_ONLY
+#include "hw/boards.h"
... but I'm not a fan of including this header here. It is restricted to
system emulation, but still... Let see what the others think.
/**
* Get the root memory region. This is a legacy function, provided for
* compatibility. Prefer using SysBusState::system_memory directly.
*/
-MemoryRegion *get_system_memory(void);
+inline MemoryRegion *get_system_memory(void)
+{
+ assert(current_machine);
+
+ return ¤t_machine->main_system_bus.system_memory;
+}
Maybe we can simply declare them with __attribute__ ((const)) in the
previous patch?
See
https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#Common-Function-Attributes