Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch For IBM_PPC403, emulate unaligned memory access for...
details: https://anonhg.NetBSD.org/src/rev/1364d9831903
branches: trunk
changeset: 366548:1364d9831903
user: rin <rin%NetBSD.org@localhost>
date: Mon May 30 14:09:01 2022 +0000
description:
For IBM_PPC403, emulate unaligned memory access for userland process.
diffstat:
sys/arch/evbppc/conf/std.explora | 5 ++++-
sys/arch/powerpc/ibm4xx/trap.c | 37 +++++++++++++++++--------------------
2 files changed, 21 insertions(+), 21 deletions(-)
diffs (107 lines):
diff -r eea29efc7450 -r 1364d9831903 sys/arch/evbppc/conf/std.explora
--- a/sys/arch/evbppc/conf/std.explora Mon May 30 14:05:36 2022 +0000
+++ b/sys/arch/evbppc/conf/std.explora Mon May 30 14:09:01 2022 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: std.explora,v 1.9 2021/06/26 09:03:46 rin Exp $
+# $NetBSD: std.explora,v 1.10 2022/05/30 14:09:01 rin Exp $
#
# Standard/required options for NetBSD/explora.
@@ -9,6 +9,9 @@
options PPC_IBM4XX # IBM 40x family
options PPC_IBM403 # IBM 403GCX
+# 403 does not support unaligned memory access.
+options PPC_NO_UNALIGNED
+
options VMSWAP_DEFAULT_PLAINTEXT # do not encrypt swap by
# default (slow cpu)
diff -r eea29efc7450 -r 1364d9831903 sys/arch/powerpc/ibm4xx/trap.c
--- a/sys/arch/powerpc/ibm4xx/trap.c Mon May 30 14:05:36 2022 +0000
+++ b/sys/arch/powerpc/ibm4xx/trap.c Mon May 30 14:09:01 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: trap.c,v 1.86 2021/03/06 08:08:19 rin Exp $ */
+/* $NetBSD: trap.c,v 1.87 2022/05/30 14:09:01 rin Exp $ */
/*
* Copyright 2001 Wasabi Systems, Inc.
@@ -69,12 +69,13 @@
#define __UFETCHSTORE_PRIVATE
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.86 2021/03/06 08:08:19 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.87 2022/05/30 14:09:01 rin Exp $");
#ifdef _KERNEL_OPT
#include "opt_ddb.h"
#include "opt_kgdb.h"
#include "opt_ppcarch.h"
+#include "opt_ppcopts.h"
#endif
#include <sys/param.h>
@@ -116,8 +117,6 @@
#define NARGREG 8 /* 8 args are in registers */
#define MOREARGS(sp) ((void *)((int)(sp) + 8)) /* more args go here */
-static int fix_unaligned(struct lwp *l, struct trapframe *tf);
-
void trap(struct trapframe *); /* Called from locore / trap_subr */
#if 0
/* Not currently used nor exposed externally in any header file */
@@ -126,6 +125,10 @@
#endif
int ctx_setup(int, int);
+#ifndef PPC_NO_UNALIGNED
+static bool fix_unaligned(struct trapframe *, ksiginfo_t *);
+#endif
+
#ifdef DEBUG
#define TDB_ALL 0x1
int trapdebug = /* TDB_ALL */ 0;
@@ -290,14 +293,8 @@
break;
case EXC_ALI|EXC_USER:
- if (fix_unaligned(l, tf) != 0) {
- KSI_INIT_TRAP(&ksi);
- ksi.ksi_signo = SIGBUS;
- ksi.ksi_trap = EXC_ALI;
- ksi.ksi_addr = (void *)tf->tf_dear;
+ if (fix_unaligned(tf, &ksi))
trapsignal(l, &ksi);
- } else
- tf->tf_srr0 += 4;
break;
case EXC_PGM|EXC_USER:
@@ -726,18 +723,18 @@
}
#endif
-/*
- * For now, this only deals with the particular unaligned access case
- * that gcc tends to generate. Eventually it should handle all of the
- * possibilities that can happen on a 32-bit PowerPC in big-endian mode.
- */
-
-static int
-fix_unaligned(struct lwp *l, struct trapframe *tf)
+#ifndef PPC_NO_UNALIGNED
+static bool
+fix_unaligned(struct trapframe *tf, ksiginfo_t *ksi)
{
- return -1;
+ KSI_INIT_TRAP(ksi);
+ ksi->ksi_signo = SIGBUS;
+ ksi->ksi_trap = EXC_ALI;
+ ksi->ksi_addr = (void *)tf->tf_dear;
+ return true;
}
+#endif
/*
* XXX Extremely lame implementations of _ufetch_* / _ustore_*. IBM 4xx
Home |
Main Index |
Thread Index |
Old Index