FreeBSD Bugzilla – Attachment 188843 Details for
Bug 224350
[PATCH] powerpc64: Add handler for Facility Unavailable
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch for this bug
0001-powerpc64-Add-handler-for-Facility-Unavailable.patch (text/plain), 2.53 KB, created by
Gustavo Romero
on 2017-12-14 22:29:28 UTC
(
hide
)
Description:
Patch for this bug
Filename:
MIME Type:
Creator:
Gustavo Romero
Created:
2017-12-14 22:29:28 UTC
Size:
2.53 KB
patch
obsolete
>From c935b4a72dccd14ddb6fec2a279bef53d54df754 Mon Sep 17 00:00:00 2001 >From: Gustavo Romero <gromero@br.ibm.com> >Date: Thu, 14 Dec 2017 23:12:47 +0100 >Subject: [PATCH] powerpc64: Add handler for Facility Unavailable > >Currently Facility Unavailable is absent and once an application >tries to use or access a register from a feature disabled in the >CPU it causes a kernel panic. > >A simple test-case is: > >int main() { asm volatile ("tbegin.;"); } > >which will use TM (Hardware Transactional Memory) feature which >is not supported by the kernel and so will trigger the following >kernel panic: > >---- > >fatal user trap: > > exception = 0xf60 (unknown) > srr0 = 0x10000890 > srr1 = 0x800000000000f032 > lr = 0x100004e4 > curthread = 0x5f93000 > pid = 1021, comm = htm > >panic: unknown trap >cpuid = 40 >KDB: stack backtrace: >Uptime: 3m18s >Dumping 10 MB (3 chunks) > chunk 0: 11MB (2648 pages) ... ok > chunk 1: 1MB (24 pages) ... ok > chunk 2: 1MB (2 pages)panic: IOMMU mapping error: -4 > >cpuid = 40 >Uptime: 3m18s > >---- > >This commit fixes that state by adding a handler for Facility >Unavailable exception (0xF60), treating the instruction that >trigged the exception as an illegal instruction. >--- > sys/powerpc/include/trap.h | 3 +++ > sys/powerpc/powerpc/trap.c | 6 ++++++ > 2 files changed, 9 insertions(+) > >diff --git a/sys/powerpc/include/trap.h b/sys/powerpc/include/trap.h >index 22bb0d252be..783117c4085 100644 >--- a/sys/powerpc/include/trap.h >+++ b/sys/powerpc/include/trap.h >@@ -80,6 +80,9 @@ > #define EXC_HEA 0x0e40 /* Hypervisor Emulation Assistance */ > #define EXC_VSX 0x0f40 /* VSX Unavailable */ > >+/* Power ISA 2.07+: */ >+#define EXC_FAC_UNA 0xF60 /* Facility Unavailable */ >+ > /* The following are available on 4xx and 85xx */ > #define EXC_CRIT 0x0100 /* Critical Input Interrupt */ > #define EXC_PIT 0x1000 /* Programmable Interval Timer */ >diff --git a/sys/powerpc/powerpc/trap.c b/sys/powerpc/powerpc/trap.c >index 7c119301003..97b740cceba 100644 >--- a/sys/powerpc/powerpc/trap.c >+++ b/sys/powerpc/powerpc/trap.c >@@ -143,6 +143,7 @@ static struct powerpc_exception powerpc_exceptions[] = { > { EXC_VECAST_G4, "altivec assist" }, > { EXC_THRM, "thermal management" }, > { EXC_RUNMODETRC, "run mode/trace" }, >+ { EXC_FAC_UNA, "facility unavailable" }, > { EXC_LAST, NULL } > }; > >@@ -279,6 +280,11 @@ trap(struct trapframe *frame) > enable_fpu(td); > break; > >+ case EXC_FAC_UNA: >+ sig = SIGILL; >+ ucode = ILL_ILLOPC; >+ break; >+ > case EXC_VECAST_E: > case EXC_VECAST_G4: > case EXC_VECAST_G5: >-- >2.13.2 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 224350
: 188843