Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/aarch64/aarch64 swap insns for aarch64eb



details:   https://anonhg.NetBSD.org/src/rev/01e083bb55f4
branches:  trunk
changeset: 938784:01e083bb55f4
user:      ryo <ryo%NetBSD.org@localhost>
date:      Mon Sep 14 17:14:12 2020 +0000

description:
swap insns for aarch64eb

diffstat:

 sys/arch/aarch64/aarch64/kobj_machdep.c |  18 ++++++++++--------
 1 files changed, 10 insertions(+), 8 deletions(-)

diffs (67 lines):

diff -r f66840752b95 -r 01e083bb55f4 sys/arch/aarch64/aarch64/kobj_machdep.c
--- a/sys/arch/aarch64/aarch64/kobj_machdep.c   Mon Sep 14 16:59:41 2020 +0000
+++ b/sys/arch/aarch64/aarch64/kobj_machdep.c   Mon Sep 14 17:14:12 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kobj_machdep.c,v 1.4 2020/07/08 03:45:13 ryo Exp $     */
+/*     $NetBSD: kobj_machdep.c,v 1.5 2020/09/14 17:14:12 ryo Exp $     */
 
 /*
  * Copyright (c) 2018 Ryo Shimizu <ryo%nerv.org@localhost>
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kobj_machdep.c,v 1.4 2020/07/08 03:45:13 ryo Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kobj_machdep.c,v 1.5 2020/09/14 17:14:12 ryo Exp $");
 
 #define ELFSIZE                ARCH_ELFSIZE
 
@@ -184,7 +184,7 @@
        old = *where;
 #ifdef DDB
        snprintf(disasmbuf, sizeof(disasmbuf), "%08x %s",
-           *insn, strdisasm((vaddr_t)insn), 0);
+           le32toh(*insn), strdisasm((vaddr_t)insn), 0);
 #endif
 #endif /* KOBJ_MACHDEP_DEBUG */
 
@@ -247,7 +247,8 @@
                }
                val &= WIDTHMASK(12);
                val >>= shift;
-               *insn = (*insn & ~__BITS(21,10)) | (val << 10);
+               *insn = htole32(
+                   (le32toh(*insn) & ~__BITS(21,10)) | (val << 10));
                break;
 
        case R_AARCH64_ADR_PREL_PG_HI21_NC:
@@ -268,8 +269,9 @@
                }
                immlo = val & WIDTHMASK(2);
                immhi = (val >> 2) & WIDTHMASK(19);
-               *insn = (*insn & ~(__BITS(30,29) | __BITS(23,5))) |
-                   (immlo << 29) | (immhi << 5);
+               *insn = htole32((le32toh(*insn) &
+                   ~(__BITS(30,29) | __BITS(23,5))) |
+                   (immlo << 29) | (immhi << 5));
                break;
 
        case R_AARCH_JUMP26:
@@ -291,7 +293,7 @@
                        break;
                }
                val &= WIDTHMASK(26);
-               *insn = (*insn & ~__BITS(25,0)) | val;
+               *insn = htole32((le32toh(*insn) & ~__BITS(25,0)) | val);
                break;
 
        case R_AARCH64_PREL64:
@@ -348,7 +350,7 @@
 #ifdef DDB
        printf("%s:    insn %s\n", __func__, disasmbuf);
        printf("%s:      -> %08x %s\n", __func__,
-           *insn, strdisasm((vaddr_t)insn, 0));
+           le32toh(*insn), strdisasm((vaddr_t)insn, 0));
 #endif
        printf("\n");
 #endif /* KOBJ_MACHDEP_DEBUG */



Home | Main Index | Thread Index | Old Index