[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 02/23] bsd-user: add initial support for mips/mi
From: |
Stacey Son |
Subject: |
Re: [Qemu-devel] [PATCH 02/23] bsd-user: add initial support for mips/mips64 |
Date: |
Mon, 24 Jun 2013 15:09:27 -0500 |
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.
- [Qemu-devel] [PATCH 00/23] bsd-user: FreeBSD support for mips/mips64 and arm, Stacey Son, 2013/06/24
- [Qemu-devel] [PATCH 07/23] bsd-user: find target executable in path when absolute path not given, Stacey Son, 2013/06/24
- [Qemu-devel] [PATCH 05/23] bsd-user: add bsd_binprm to TaskState for core dumping emulation, Stacey Son, 2013/06/24
- [Qemu-devel] [PATCH 06/23] bsd-user: fix thread initialization and ELF addresses for mips/mips64, Stacey Son, 2013/06/24
- [Qemu-devel] [PATCH 13/23] bsd-user: add shims for signal related system calls, Stacey Son, 2013/06/24
- [Qemu-devel] [PATCH 08/23] bsd-user: initialize stack with signal trampolin code and canary, Stacey Son, 2013/06/24
- [Qemu-devel] [PATCH 02/23] bsd-user: add initial support for mips/mips64, Stacey Son, 2013/06/24
- [Qemu-devel] [PATCH 01/23] bsd-user: initial code clean up, Stacey Son, 2013/06/24
- [Qemu-devel] [PATCH 11/23] bsd-user: add shims for file related system calls, Stacey Son, 2013/06/24
- [Qemu-devel] [PATCH 10/23] bsd-user: add shims for memory management related syscalls, Stacey Son, 2013/06/24
- [Qemu-devel] [PATCH 09/23] bsd-user: refresh FreeBSD's system call numbers, Stacey Son, 2013/06/24
- [Qemu-devel] [PATCH 12/23] bsd-user: add shims for time related system calls., Stacey Son, 2013/06/24
- [Qemu-devel] [PATCH 03/23] bsd-user: additional seperation of OS and architecture dependent code, Stacey Son, 2013/06/24