Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/amiga/stand/bootblock Simplify relocation rules.
details: https://anonhg.NetBSD.org/src/rev/2ffd5c83b18b
branches: trunk
changeset: 365858:2ffd5c83b18b
user: rin <rin%NetBSD.org@localhost>
date: Fri Apr 29 07:12:41 2022 +0000
description:
Simplify relocation rules.
Now, both single- and triple-byte encodings in relocation table
represent addrdiff (instead of absolute file offset for the latter).
Shave off one insn for boot.amiga. Also, for elf2bb(1), relocation
overflow is mitigated and detectable at least even if inevitable
(it seems unlikely to happen although).
diffstat:
sys/arch/amiga/stand/bootblock/boot/bbstart.s | 3 +--
sys/arch/amiga/stand/bootblock/elf2bb/elf2bb.c | 11 ++++++-----
2 files changed, 7 insertions(+), 7 deletions(-)
diffs (47 lines):
diff -r 02952e1b8665 -r 2ffd5c83b18b sys/arch/amiga/stand/bootblock/boot/bbstart.s
--- a/sys/arch/amiga/stand/bootblock/boot/bbstart.s Fri Apr 29 07:02:40 2022 +0000
+++ b/sys/arch/amiga/stand/bootblock/boot/bbstart.s Fri Apr 29 07:12:41 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: bbstart.s,v 1.14 2022/04/29 06:42:58 rin Exp $ */
+/* $NetBSD: bbstart.s,v 1.15 2022/04/29 07:12:41 rin Exp $ */
/*-
* Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -159,7 +159,6 @@
Loopw:
clrw %a2@+
- movl %d1,%a0 | for a variant with relative words, erase this line
Loopb:
addl %d0,%a0
addl %d1,%a0@
diff -r 02952e1b8665 -r 2ffd5c83b18b sys/arch/amiga/stand/bootblock/elf2bb/elf2bb.c
--- a/sys/arch/amiga/stand/bootblock/elf2bb/elf2bb.c Fri Apr 29 07:02:40 2022 +0000
+++ b/sys/arch/amiga/stand/bootblock/elf2bb/elf2bb.c Fri Apr 29 07:12:41 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: elf2bb.c,v 1.29 2022/04/29 06:59:29 rin Exp $ */
+/* $NetBSD: elf2bb.c,v 1.30 2022/04/29 07:12:42 rin Exp $ */
/*-
* Copyright (c) 1996,2006 The NetBSD Foundation, Inc.
@@ -394,15 +394,16 @@
"oldaddr = 0x%08x, abort.\n", relbuf[i], oldaddr);
} else if (addrdiff > 0xff) {
*rpo = 0;
+ tmp16 = htobe16(addrdiff);
if (delta > 0) {
++rpo;
- *rpo++ = (relbuf[i] >> 8) & 0xff;
- *rpo++ = relbuf[i] & 0xff;
+ memcpy(rpo, &tmp16, sizeof(tmp16));
+ rpo += sizeof(tmp16);
dprintf(("%02x%02x%02x\n",
rpo[-3], rpo[-2], rpo[-1]));
} else {
- *--rpo = relbuf[i] & 0xff;
- *--rpo = (relbuf[i] >> 8) & 0xff;
+ rpo -= sizeof(tmp16);
+ memcpy(rpo, &tmp16, sizeof(tmp16));
--rpo;
dprintf(("%02x%02x%02x\n",
rpo[0], rpo[1], rpo[2]));
Home |
Main Index |
Thread Index |
Old Index