From 7fb66275fbd91b722b0ca7f47b624027ce0c4e3a Mon Sep 17 00:00:00 2001 From: mrg Date: Sun, 17 Jul 2011 12:49:17 +0000 Subject: - try to enable big-endian mips support (from matt@) - add sh kernel-address-in-user-mode exception support (seems to work for me, but XXX: some sh person should really look at this.) --- emulators/gxemul/distinfo | 5 ++++- emulators/gxemul/patches/patch-ad | 40 +++++++++++++++++++++++++++++++++++++++ emulators/gxemul/patches/patch-ae | 32 +++++++++++++++++++++++++++++++ emulators/gxemul/patches/patch-af | 26 +++++++++++++++++++++++++ 4 files changed, 102 insertions(+), 1 deletion(-) create mode 100644 emulators/gxemul/patches/patch-ad create mode 100644 emulators/gxemul/patches/patch-ae create mode 100644 emulators/gxemul/patches/patch-af (limited to 'emulators/gxemul') diff --git a/emulators/gxemul/distinfo b/emulators/gxemul/distinfo index 5dd93c43172..eb5da206220 100644 --- a/emulators/gxemul/distinfo +++ b/emulators/gxemul/distinfo @@ -1,6 +1,9 @@ -$NetBSD: distinfo,v 1.31 2010/07/02 14:41:50 joerg Exp $ +$NetBSD: distinfo,v 1.32 2011/07/17 12:49:17 mrg Exp $ SHA1 (gxemul-0.6.0.tar.gz) = aa37ad5f200eee045b1da2b1d3f651401cf474af RMD160 (gxemul-0.6.0.tar.gz) = ac6291a5f8bc9c0d1988d3ce39750339fe90a8ce Size (gxemul-0.6.0.tar.gz) = 3598795 bytes SHA1 (patch-aa) = 6f2c0dc94606ba213bcc73527ea4bef997c89c45 +SHA1 (patch-ad) = a8757e7397ec3cc301d02bdf93654f55d558d29f +SHA1 (patch-ae) = 19ef822c16f0f6dd50aea719e0bc797c39d1f9c0 +SHA1 (patch-af) = 8304ff5d8f779ac60f8d416d27e0a183e0e47d94 diff --git a/emulators/gxemul/patches/patch-ad b/emulators/gxemul/patches/patch-ad new file mode 100644 index 00000000000..94c894aeb39 --- /dev/null +++ b/emulators/gxemul/patches/patch-ad @@ -0,0 +1,40 @@ +$NetBSD: patch-ad,v 1.1 2011/07/17 12:49:17 mrg Exp $ + +patch to fix big-endian mips support from matt@netbsd.org + + +diff -rup src/cpus/cpu_mips_coproc.cc src/cpus/cpu_mips_coproc.cc +--- src/cpus/cpu_mips_coproc.cc 2009-06-21 09:03:48.000000000 -0700 ++++ src/cpus/cpu_mips_coproc.cc 2009-11-12 12:22:12.000000000 -0800 +@@ -1987,6 +1987,13 @@ void coproc_function(struct cpu *cpu, st + + if (cpnr < 2 && (((function & 0x03e007f8) == (COPz_MTCz << 21)) + || ((function & 0x03e007f8) == (COPz_DMTCz << 21)))) { ++ tmpvalue = cpu->cd.mips.gpr[rt]; ++ if (copz == COPz_MTCz) { ++ /* Sign-extend: */ ++ tmpvalue &= 0xffffffffULL; ++ if (tmpvalue & 0x80000000ULL) ++ tmpvalue |= 0xffffffff00000000ULL; ++ } + if (unassemble_only) { + debug("%s%i\t%s,", copz==COPz_DMTCz? "dmtc" : "mtc", + cpnr, regnames[rt]); +@@ -1996,16 +2003,10 @@ void coproc_function(struct cpu *cpu, st + debug("r%i", rd); + if (function & 7) + debug(",%i", (int)(function & 7)); ++ debug(" [%016llx]", (long long)tmpvalue); + debug("\n"); + return; + } +- tmpvalue = cpu->cd.mips.gpr[rt]; +- if (copz == COPz_MTCz) { +- /* Sign-extend: */ +- tmpvalue &= 0xffffffffULL; +- if (tmpvalue & 0x80000000ULL) +- tmpvalue |= 0xffffffff00000000ULL; +- } + coproc_register_write(cpu, cpu->cd.mips.coproc[cpnr], rd, + &tmpvalue, copz == COPz_DMTCz, function & 7); + return; diff --git a/emulators/gxemul/patches/patch-ae b/emulators/gxemul/patches/patch-ae new file mode 100644 index 00000000000..624ce3e8fd5 --- /dev/null +++ b/emulators/gxemul/patches/patch-ae @@ -0,0 +1,32 @@ +$NetBSD: patch-ae,v 1.1 2011/07/17 12:49:17 mrg Exp $ + +patch to enable big-endian mips support from matt@netbsd.org + + +diff -rup src/devices/dev_gt.cc src/devices/dev_gt.cc +--- src/devices/dev_gt.cc 2009-06-21 09:03:48.000000000 -0700 ++++ src/devices/dev_gt.cc 2009-11-12 11:55:32.000000000 -0800 +@@ -172,19 +172,23 @@ DEVICE_ACCESS(gt) + break; + + case GT_PCI0_CFG_ADDR: ++#if 0 + if (cpu->byte_order != EMUL_LITTLE_ENDIAN) { + fatal("[ gt: TODO: big endian PCI access ]\n"); + exit(1); + } ++#endif + bus_pci_decompose_1(idata, &bus, &dev, &func, ®); + bus_pci_setaddr(cpu, d->pci_data, bus, dev, func, reg); + break; + + case GT_PCI0_CFG_DATA: ++#if 0 + if (cpu->byte_order != EMUL_LITTLE_ENDIAN) { + fatal("[ gt: TODO: big endian PCI access ]\n"); + exit(1); + } ++#endif + bus_pci_data_access(cpu, d->pci_data, writeflag == MEM_READ? + &odata : &idata, len, writeflag); + break; diff --git a/emulators/gxemul/patches/patch-af b/emulators/gxemul/patches/patch-af new file mode 100644 index 00000000000..8a52564efa2 --- /dev/null +++ b/emulators/gxemul/patches/patch-af @@ -0,0 +1,26 @@ +$NetBSD: patch-af,v 1.1 2011/07/17 12:49:17 mrg Exp $ + +--- src/cpus/memory_sh.cc.orig 2010-02-14 01:33:54.000000000 -0800 ++++ src/cpus/memory_sh.cc 2011-07-15 01:12:18.000000000 -0700 +@@ -273,15 +273,17 @@ + } + + if (user) { ++ int expevt; ++ int wf = flags & FLAG_WRITEFLAG; ++ + if (flags & FLAG_NOEXCEPTIONS) { + *return_paddr = 0; + return 2; + } + +- fatal("Userspace tried to access non-user space memory." +- " TODO: cause exception! (vaddr=0x%08"PRIx32"\n", +- (uint32_t) vaddr); +- exit(1); ++ expevt = wf? EXPEVT_TLB_PROT_ST : EXPEVT_TLB_PROT_LD; ++ sh_exception(cpu, expevt, 0, (uint32_t)vaddr); ++ return 0; + } + + /* P1,P2: Direct-mapped physical memory. */ -- cgit v1.2.3