On 26 September 2013 23:50, Fabien Chouteau <chout...@adacore.com> wrote: > On 09/26/2013 02:05 AM, Peter Maydell wrote: >> On 26 September 2013 01:29, Fabien Chouteau <chout...@adacore.com> wrote: >>> I think that's what I did. I think the problem was to include >>> 'monitor.h' in 'target-*/cpu.c'. >> >> Why doesn't that work? > > The problem is use of 'target_long' in 'monitor.h'.
Oh, right, the problem isn't including monitor.h from cpu.c, it's that some target-independent source files include monitor.h so you can't put target-dependent types like target_long in it. There are two fixes for this that spring to mind: (1) lazy approach, wrap the MonitorDef structure definition in #ifdef NEED_CPU_H/#endif. (2) the "remove target-specificisms from what should be generic code" approach: * make MonitorDef use uint64_t rather than target_long for the getter function return type * propagate that type change into functions like get_monitor_def and its callsite in expr_unary * make the types recognized by get_monitor_def be MD_I32 or MD_I64, and not MD_TLONG * make the per-target MonitorDef array entries which currently implicitly use MD_TLONG instead either (a) use MD_I32 or MD_I64 if they're targets which really only have one width or (b) use a locally #defined MD_TLONG if they're accessing CPU struct fields which really are target_long and the CPU comes in both 32 and 64 bit variants. -- PMM