diff mbox

[RFC,v2,06/34] cpu-common: Define tb_page_addr_t for everyone

Message ID 4b6acf1900df20165fa4c269f071248e4d5f8fec.1433052532.git.crosthwaite.peter@gmail.com
State New
Headers show

Commit Message

Peter Crosthwaite May 31, 2015, 6:11 a.m. UTC
In system mode emulation (at least) this definition has no architecture
specific dependencies. Move it to common code such that common code can
use it (primarily for defining function prototypes).

Signed-off-by: Peter Crosthwaite <crosthwaite.peter@gmail.com>
---
 include/exec/cpu-common.h | 4 ++++
 include/exec/exec-all.h   | 2 --
 include/qom/cpu.h         | 1 +
 3 files changed, 5 insertions(+), 2 deletions(-)

Comments

Paolo Bonzini June 1, 2015, 7:51 a.m. UTC | #1
On 31/05/2015 08:11, Peter Crosthwaite wrote:
> In system mode emulation (at least) this definition has no architecture
> specific dependencies. Move it to common code such that common code can
> use it (primarily for defining function prototypes).
> 
> Signed-off-by: Peter Crosthwaite <crosthwaite.peter@gmail.com>

I suspect you can instead make a header that is included by arch-obj
files, and move a lot of stuff there from include/exec/exec-all.h (for
example all the prototypes that use tb_page_addr_t).

Paolo
Peter Crosthwaite June 7, 2015, 11:06 p.m. UTC | #2
On Mon, Jun 1, 2015 at 12:51 AM, Paolo Bonzini <pbonzini@redhat.com> wrote:
>
>
> On 31/05/2015 08:11, Peter Crosthwaite wrote:
>> In system mode emulation (at least) this definition has no architecture
>> specific dependencies. Move it to common code such that common code can
>> use it (primarily for defining function prototypes).
>>
>> Signed-off-by: Peter Crosthwaite <crosthwaite.peter@gmail.com>
>
> I suspect you can instead make a header that is included by arch-obj
> files, and move a lot of stuff there from include/exec/exec-all.h (for
> example all the prototypes that use tb_page_addr_t).
>

So the problem was I needed this from cpu-qom which is a common-obj
which is why I went for super-global on this one.

Regards,
Peter

> Paolo
>
diff mbox

Patch

diff --git a/include/exec/cpu-common.h b/include/exec/cpu-common.h
index 43428bd..ad27ad7 100644
--- a/include/exec/cpu-common.h
+++ b/include/exec/cpu-common.h
@@ -51,6 +51,10 @@  typedef uintptr_t ram_addr_t;
 #  define RAM_ADDR_FMT "%" PRIxPTR
 #endif
 
+#ifndef CONFIG_USER_ONLY
+typedef ram_addr_t tb_page_addr_t;
+#endif
+
 extern ram_addr_t ram_size;
 ram_addr_t get_current_ram_size(void);
 
diff --git a/include/exec/exec-all.h b/include/exec/exec-all.h
index 078f517..680d8bc 100644
--- a/include/exec/exec-all.h
+++ b/include/exec/exec-all.h
@@ -30,8 +30,6 @@ 
    type.  */
 #if defined(CONFIG_USER_ONLY)
 typedef abi_ulong tb_page_addr_t;
-#else
-typedef ram_addr_t tb_page_addr_t;
 #endif
 
 /* is_jmp field values */
diff --git a/include/qom/cpu.h b/include/qom/cpu.h
index 363c928..4508c56 100644
--- a/include/qom/cpu.h
+++ b/include/qom/cpu.h
@@ -24,6 +24,7 @@ 
 #include <setjmp.h>
 #include "hw/qdev-core.h"
 #include "disas/bfd.h"
+#include "exec/cpu-common.h"
 #include "exec/hwaddr.h"
 #include "exec/memattrs.h"
 #include "qemu/queue.h"