diff mbox

[07/19] moxie: Remove ELF_MACHINE from cpu.h

Message ID 768872ab4c5c5df9922240dae3e4f853adcf5c56.1439679104.git.crosthwaite.peter@gmail.com
State New
Headers show

Commit Message

Peter Crosthwaite Aug. 15, 2015, 11:28 p.m. UTC
From: Peter Crosthwaite <crosthwaitepeter@gmail.com>

The bootloader can just pass EM_MOXIE directly, as that is architecture
specific code.

This removes another architecture specific definition from the global
namespace.

Cc: Anthony Green <green@moxielogic.com>
Signed-off-by: Peter Crosthwaite <crosthwaite.peter@gmail.com>
---
 hw/moxie/moxiesim.c | 2 +-
 target-moxie/cpu.h  | 2 --
 2 files changed, 1 insertion(+), 3 deletions(-)

Comments

Richard Henderson Aug. 17, 2015, 6:39 p.m. UTC | #1
On 08/15/2015 04:28 PM, Peter Crosthwaite wrote:
> -                           ELF_MACHINE, 0);
> +                           0xFEED /* EM_MOXIE */, 0);

Please add EM_MOXIE to include/elf.h.


r~
Peter Crosthwaite Aug. 18, 2015, 3:36 a.m. UTC | #2
On Mon, Aug 17, 2015 at 11:39 AM, Richard Henderson <rth@twiddle.net> wrote:
> On 08/15/2015 04:28 PM, Peter Crosthwaite wrote:
>> -                           ELF_MACHINE, 0);
>> +                           0xFEED /* EM_MOXIE */, 0);
>
> Please add EM_MOXIE to include/elf.h.
>

So according to this blog, Moxie actually now has a legit EM:

http://moxielogic.org/blog/ (2nd post from top)
http://www.sco.com/developers/gabi/latest/ch4.eheader.html

Should this 0xFEED be handled the same way as we do for MICROBLAZE_OLD?

#define EM_MICROBLAZE      189
#define EM_MICROBLAZE_OLD  0xBAAB

Regards,
Peter

>
> r~
Richard Henderson Aug. 18, 2015, 3:48 a.m. UTC | #3
On 08/17/2015 08:36 PM, Peter Crosthwaite wrote:
> On Mon, Aug 17, 2015 at 11:39 AM, Richard Henderson <rth@twiddle.net> wrote:
>> On 08/15/2015 04:28 PM, Peter Crosthwaite wrote:
>>> -                           ELF_MACHINE, 0);
>>> +                           0xFEED /* EM_MOXIE */, 0);
>>
>> Please add EM_MOXIE to include/elf.h.
>>
>
> So according to this blog, Moxie actually now has a legit EM:
>
> http://moxielogic.org/blog/ (2nd post from top)
> http://www.sco.com/developers/gabi/latest/ch4.eheader.html
>
> Should this 0xFEED be handled the same way as we do for MICROBLAZE_OLD?
>
> #define EM_MICROBLAZE      189
> #define EM_MICROBLAZE_OLD  0xBAAB

Yes.  It seems to have been updated in binutils on 2015-01-09.


r~
Peter Crosthwaite Aug. 23, 2015, 6:49 a.m. UTC | #4
On Mon, Aug 17, 2015 at 8:48 PM, Richard Henderson <rth@twiddle.net> wrote:
> On 08/17/2015 08:36 PM, Peter Crosthwaite wrote:
>>
>> On Mon, Aug 17, 2015 at 11:39 AM, Richard Henderson <rth@twiddle.net>
>> wrote:
>>>
>>> On 08/15/2015 04:28 PM, Peter Crosthwaite wrote:
>>>>
>>>> -                           ELF_MACHINE, 0);
>>>> +                           0xFEED /* EM_MOXIE */, 0);
>>>
>>>
>>> Please add EM_MOXIE to include/elf.h.
>>>
>>
>> So according to this blog, Moxie actually now has a legit EM:
>>
>> http://moxielogic.org/blog/ (2nd post from top)
>> http://www.sco.com/developers/gabi/latest/ch4.eheader.html
>>
>> Should this 0xFEED be handled the same way as we do for MICROBLAZE_OLD?
>>
>> #define EM_MICROBLAZE      189
>> #define EM_MICROBLAZE_OLD  0xBAAB
>
>
> Yes.  It seems to have been updated in binutils on 2015-01-09.
>

So I am comparing elf.h to the binutils common.h and there seems to be
a strong correlation but with two major differences:

1: The QEMU one has a large number of arch specific defs not in
binutils common.h
2: Binutils covers the arches that are not implemented in QEMU

I have started trying to get them a little more synced to aid
maintenance. I have got to a stage where you can do a sane diff with
binutils common.h. I have synced the whitespace and migrated qemu and
arch specifics to a new header. We could however make it like Linux
and just periodically sync the headers from binutils or linux verbatim
rather than letting QEMU drift with incremental patches?

RFC

Regards,
Peter

>
> r~
>
Peter Maydell Aug. 23, 2015, 3:43 p.m. UTC | #5
On 23 August 2015 at 07:49, Peter Crosthwaite
<crosthwaitepeter@gmail.com> wrote:
> just periodically sync the headers from binutils

Careful, binutils is GPLv3, which isn't compatible with QEMU's
overall GPLv2 license. It's OK to look at binutils to find the
information to write the relevant QEMU code, but copying it
wholesale isn't possible.

Having our headers not particularly look like the binutils
ones is a good way of demonstrating that we haven't just
copied a pile of GPLv3 code...

thanks
-- PMM
Peter Crosthwaite Aug. 29, 2015, 7:41 p.m. UTC | #6
On Mon, Aug 17, 2015 at 8:48 PM, Richard Henderson <rth@twiddle.net> wrote:
> On 08/17/2015 08:36 PM, Peter Crosthwaite wrote:
>>
>> On Mon, Aug 17, 2015 at 11:39 AM, Richard Henderson <rth@twiddle.net>
>> wrote:
>>>
>>> On 08/15/2015 04:28 PM, Peter Crosthwaite wrote:
>>>>
>>>> -                           ELF_MACHINE, 0);
>>>> +                           0xFEED /* EM_MOXIE */, 0);
>>>
>>>
>>> Please add EM_MOXIE to include/elf.h.
>>>
>>
>> So according to this blog, Moxie actually now has a legit EM:
>>
>> http://moxielogic.org/blog/ (2nd post from top)
>> http://www.sco.com/developers/gabi/latest/ch4.eheader.html
>>
>> Should this 0xFEED be handled the same way as we do for MICROBLAZE_OLD?
>>
>> #define EM_MICROBLAZE      189
>> #define EM_MICROBLAZE_OLD  0xBAAB
>
>
> Yes.  It seems to have been updated in binutils on 2015-01-09.
>

Patches on list.

Regards,
Peter

>
> r~
>
diff mbox

Patch

diff --git a/hw/moxie/moxiesim.c b/hw/moxie/moxiesim.c
index 80bcc5b..c3697c6 100644
--- a/hw/moxie/moxiesim.c
+++ b/hw/moxie/moxiesim.c
@@ -53,7 +53,7 @@  static void load_kernel(MoxieCPU *cpu, LoaderParams *loader_params)
 
     kernel_size = load_elf(loader_params->kernel_filename,  NULL, NULL,
                            &entry, &kernel_low, &kernel_high, 1,
-                           ELF_MACHINE, 0);
+                           0xFEED /* EM_MOXIE */, 0);
 
     if (kernel_size <= 0) {
         fprintf(stderr, "qemu: could not load kernel '%s'\n",
diff --git a/target-moxie/cpu.h b/target-moxie/cpu.h
index 29572aa..e27a6a3 100644
--- a/target-moxie/cpu.h
+++ b/target-moxie/cpu.h
@@ -26,8 +26,6 @@ 
 
 #define CPUArchState struct CPUMoxieState
 
-#define ELF_MACHINE     0xFEED /* EM_MOXIE */
-
 #define MOXIE_EX_DIV0        0
 #define MOXIE_EX_BAD         1
 #define MOXIE_EX_IRQ         2