On Jun 24, 2013, at 12:15 PM, Peter Maydell wrote: >> >> +#if defined(TARGET_MIPS) >> + >> +/* Compare to sys/mips/mips/trap.c */ >> + >> +void cpu_loop(CPUMIPSState *env) > > I suspect you'd do better in the long term to restructure > to pull cpu_loop out into a per-architecture source file > and avoid the ifdefs. (This is something I'd like to do to > the linux-user/ code, which is currently even more ifdef-ridden > than bsd-user/.)
Yes, the cpu_loop()'s and the cpu initialization code is actually separated out in the arm arch patch for all the arch's. > >> --- a/target-mips/mips-defs.h >> +++ b/target-mips/mips-defs.h >> @@ -10,8 +10,17 @@ >> >> #if defined(TARGET_MIPS64) >> #define TARGET_LONG_BITS 64 >> -#define TARGET_PHYS_ADDR_SPACE_BITS 36 >> -#define TARGET_VIRT_ADDR_SPACE_BITS 42 >> +# if defined(CONFIG_BSD) && defined(CONFIG_USER_ONLY) >> +# define TARGET_PHYS_ADDR_SPACE_BITS 59 >> +# ifdef TARGET_ABI32 >> +# define TARGET_VIRT_ADDR_SPACE_BITS 32 >> +# else >> +# define TARGET_VIRT_ADDR_SPACE_BITS 62 >> +# endif >> +# else >> +# define TARGET_PHYS_ADDR_SPACE_BITS 36 >> +# define TARGET_VIRT_ADDR_SPACE_BITS 42 >> +# endif >> #else >> #define TARGET_LONG_BITS 32 >> #define TARGET_PHYS_ADDR_SPACE_BITS 36 > > This looks a little fishy -- could you give some rationale? > Why does only BSD need to do this? Why do you need to > change the TARGET_PHYS_ADDR_SPACE_BITS for a -user target? > Where do the numbers come from? If I remember correctly these: >> +# if defined(CONFIG_BSD) && defined(CONFIG_USER_ONLY) >> +# define TARGET_PHYS_ADDR_SPACE_BITS 59 >> +# ifdef TARGET_ABI32 >> +# define TARGET_VIRT_ADDR_SPACE_BITS 32 >> +# else >> +# define TARGET_VIRT_ADDR_SPACE_BITS 62 >> +# endif come from the See Mips Run book. The reason they were changed for the bsd-user is FreeBSD puts the text segment in something like 0x12000000 (plus or minus a zero) and the stack at 0x8000000000 (- minus a page or two) for mips64 which didn't work as defined originally. -stacey.