qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 0/2] elf+moxie: EM_MOXIE defintition
@ 2015-08-29 19:40 Peter Crosthwaite
  2015-08-29 19:40 ` [Qemu-devel] [PATCH 1/2] elf_ops: Fix coding style for EM alias case statement Peter Crosthwaite
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Peter Crosthwaite @ 2015-08-29 19:40 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Crosthwaite, rth

Hi Richard,

This adds EM_MOXIE as suggested. Patch one does some surrounding code
style cleanup and P2 fixes Moxie.

Regards,
Peter

Peter Crosthwaite (2):
  elf_ops: Fix coding style for EM alias case statement
  elf: Update EM_MOXIE definition

 hw/moxie/moxiesim.c  |  1 +
 include/elf.h        |  3 +++
 include/hw/elf_ops.h | 23 +++++++++++++++++------
 target-moxie/cpu.h   |  2 +-
 4 files changed, 22 insertions(+), 7 deletions(-)

-- 
1.9.1

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Qemu-devel] [PATCH 1/2] elf_ops: Fix coding style for EM alias case statement
  2015-08-29 19:40 [Qemu-devel] [PATCH 0/2] elf+moxie: EM_MOXIE defintition Peter Crosthwaite
@ 2015-08-29 19:40 ` Peter Crosthwaite
  2015-08-29 19:40 ` [Qemu-devel] [PATCH 2/2] elf: Update EM_MOXIE definition Peter Crosthwaite
  2015-09-01 13:31 ` [Qemu-devel] [PATCH 0/2] elf+moxie: EM_MOXIE defintition Richard Henderson
  2 siblings, 0 replies; 4+ messages in thread
From: Peter Crosthwaite @ 2015-08-29 19:40 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Crosthwaite, rth

Fix the coding style for these cases as per CODING_STYLE. Reverse the
Yoda conditions and add missing if braces.

Signed-off-by: Peter Crosthwaite <crosthwaite.peter@gmail.com>
---
 include/hw/elf_ops.h | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/include/hw/elf_ops.h b/include/hw/elf_ops.h
index bd71968..0d41f24 100644
--- a/include/hw/elf_ops.h
+++ b/include/hw/elf_ops.h
@@ -282,25 +282,28 @@ static int glue(load_elf, SZ)(const char *name, int fd,
 
     switch (elf_machine) {
         case EM_PPC64:
-            if (EM_PPC64 != ehdr.e_machine)
-                if (EM_PPC != ehdr.e_machine) {
+            if (ehdr.e_machine != EM_PPC64) {
+                if (ehdr.e_machine != EM_PPC) {
                     ret = ELF_LOAD_WRONG_ARCH;
                     goto fail;
                 }
+            }
             break;
         case EM_X86_64:
-            if (EM_X86_64 != ehdr.e_machine)
-                if (EM_386 != ehdr.e_machine) {
+            if (ehdr.e_machine != EM_X86_64) {
+                if (ehdr.e_machine != EM_386) {
                     ret = ELF_LOAD_WRONG_ARCH;
                     goto fail;
                 }
+            }
             break;
         case EM_MICROBLAZE:
-            if (EM_MICROBLAZE != ehdr.e_machine)
-                if (EM_MICROBLAZE_OLD != ehdr.e_machine) {
+            if (ehdr.e_machine != EM_MICROBLAZE) {
+                if (ehdr.e_machine != EM_MICROBLAZE_OLD) {
                     ret = ELF_LOAD_WRONG_ARCH;
                     goto fail;
                 }
+            }
             break;
         default:
             if (elf_machine != ehdr.e_machine) {
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [Qemu-devel] [PATCH 2/2] elf: Update EM_MOXIE definition
  2015-08-29 19:40 [Qemu-devel] [PATCH 0/2] elf+moxie: EM_MOXIE defintition Peter Crosthwaite
  2015-08-29 19:40 ` [Qemu-devel] [PATCH 1/2] elf_ops: Fix coding style for EM alias case statement Peter Crosthwaite
@ 2015-08-29 19:40 ` Peter Crosthwaite
  2015-09-01 13:31 ` [Qemu-devel] [PATCH 0/2] elf+moxie: EM_MOXIE defintition Richard Henderson
  2 siblings, 0 replies; 4+ messages in thread
From: Peter Crosthwaite @ 2015-08-29 19:40 UTC (permalink / raw)
  To: qemu-devel; +Cc: Anthony Green, Peter Crosthwaite, rth

EM_MOXIE now has a proper assigned elf code. Use it. Register the old
interim value as EM_MOXIE_OLD and accept either in elf loading.

Cc: Anthony Green <green@moxielogic.com>
Signed-off-by: Peter Crosthwaite <crosthwaite.peter@gmail.com>
---
 hw/moxie/moxiesim.c  | 1 +
 include/elf.h        | 3 +++
 include/hw/elf_ops.h | 8 ++++++++
 target-moxie/cpu.h   | 2 +-
 4 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/hw/moxie/moxiesim.c b/hw/moxie/moxiesim.c
index 80bcc5b..537e25e 100644
--- a/hw/moxie/moxiesim.c
+++ b/hw/moxie/moxiesim.c
@@ -34,6 +34,7 @@
 #include "hw/loader.h"
 #include "hw/char/serial.h"
 #include "exec/address-spaces.h"
+#include "elf.h"
 
 #define PHYS_MEM_BASE 0x80000000
 
diff --git a/include/elf.h b/include/elf.h
index 4afd474..295a6ea 100644
--- a/include/elf.h
+++ b/include/elf.h
@@ -133,6 +133,9 @@ typedef int64_t  Elf64_Sxword;
 
 #define EM_AARCH64  183
 
+#define EM_MOXIE           223     /* Moxie processor family */
+#define EM_MOXIE_OLD       0xFEED
+
 /* This is the info that is needed to parse the dynamic section of the file */
 #define DT_NULL		0
 #define DT_NEEDED	1
diff --git a/include/hw/elf_ops.h b/include/hw/elf_ops.h
index 0d41f24..0010c44 100644
--- a/include/hw/elf_ops.h
+++ b/include/hw/elf_ops.h
@@ -305,6 +305,14 @@ static int glue(load_elf, SZ)(const char *name, int fd,
                 }
             }
             break;
+        case EM_MOXIE:
+            if (ehdr.e_machine != EM_MOXIE) {
+                if (ehdr.e_machine != EM_MOXIE_OLD) {
+                    ret = ELF_LOAD_WRONG_ARCH;
+                    goto fail;
+                }
+            }
+            break;
         default:
             if (elf_machine != ehdr.e_machine) {
                 ret = ELF_LOAD_WRONG_ARCH;
diff --git a/target-moxie/cpu.h b/target-moxie/cpu.h
index 29572aa..7bb1ed9 100644
--- a/target-moxie/cpu.h
+++ b/target-moxie/cpu.h
@@ -26,7 +26,7 @@
 
 #define CPUArchState struct CPUMoxieState
 
-#define ELF_MACHINE     0xFEED /* EM_MOXIE */
+#define ELF_MACHINE     EM_MOXIE
 
 #define MOXIE_EX_DIV0        0
 #define MOXIE_EX_BAD         1
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH 0/2] elf+moxie: EM_MOXIE defintition
  2015-08-29 19:40 [Qemu-devel] [PATCH 0/2] elf+moxie: EM_MOXIE defintition Peter Crosthwaite
  2015-08-29 19:40 ` [Qemu-devel] [PATCH 1/2] elf_ops: Fix coding style for EM alias case statement Peter Crosthwaite
  2015-08-29 19:40 ` [Qemu-devel] [PATCH 2/2] elf: Update EM_MOXIE definition Peter Crosthwaite
@ 2015-09-01 13:31 ` Richard Henderson
  2 siblings, 0 replies; 4+ messages in thread
From: Richard Henderson @ 2015-09-01 13:31 UTC (permalink / raw)
  To: Peter Crosthwaite, qemu-devel; +Cc: Peter Crosthwaite

On 08/29/2015 12:40 PM, Peter Crosthwaite wrote:
> Hi Richard,
>
> This adds EM_MOXIE as suggested. Patch one does some surrounding code
> style cleanup and P2 fixes Moxie.
>
> Regards,
> Peter
>
> Peter Crosthwaite (2):
>    elf_ops: Fix coding style for EM alias case statement
>    elf: Update EM_MOXIE definition

Reviewed-by: Richard Henderson <rth@twiddle.net>


r~

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-09-01 13:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-29 19:40 [Qemu-devel] [PATCH 0/2] elf+moxie: EM_MOXIE defintition Peter Crosthwaite
2015-08-29 19:40 ` [Qemu-devel] [PATCH 1/2] elf_ops: Fix coding style for EM alias case statement Peter Crosthwaite
2015-08-29 19:40 ` [Qemu-devel] [PATCH 2/2] elf: Update EM_MOXIE definition Peter Crosthwaite
2015-09-01 13:31 ` [Qemu-devel] [PATCH 0/2] elf+moxie: EM_MOXIE defintition Richard Henderson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).