aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Hibbits <jhibbits@FreeBSD.org>2025-03-19 22:22:32 +0000
committerJustin Hibbits <jhibbits@FreeBSD.org>2025-03-19 22:22:32 +0000
commit0b663e0cee89dedf5b070ff4e839d5ad95061535 (patch)
tree1fb795846b57a6c78d830d7d649f2024b5e6d84f
parentd9a65c5de1c9f30ae71ce0be8fb88be9d20d216d (diff)
powerpc: Add Hypervisor Facility Unavailable handling
Treat Hypervisor Facility Unavailable as an illegal instruction in user space. This way programs that use facilities like transactional memory, which will never be supported as it has been removed from the ISA, will not crash the kernel. Tested by: pkubaj MFC after: 1 week
-rw-r--r--sys/powerpc/aim/aim_machdep.c1
-rw-r--r--sys/powerpc/powerpc/trap.c3
2 files changed, 4 insertions, 0 deletions
diff --git a/sys/powerpc/aim/aim_machdep.c b/sys/powerpc/aim/aim_machdep.c
index b439905441d3..814c679ff47e 100644
--- a/sys/powerpc/aim/aim_machdep.c
+++ b/sys/powerpc/aim/aim_machdep.c
@@ -417,6 +417,7 @@ aim_cpu_init(vm_offset_t toc)
bcopy(&hypertrapcode, (void *)(EXC_HEA + trap_offset), trapsize);
bcopy(&hypertrapcode, (void *)(EXC_HMI + trap_offset), trapsize);
bcopy(&hypertrapcode, (void *)(EXC_HVI + trap_offset), trapsize);
+ bcopy(&hypertrapcode, (void *)(EXC_HFAC + trap_offset), trapsize);
bcopy(&hypertrapcode, (void *)(EXC_SOFT_PATCH + trap_offset), trapsize);
#endif
diff --git a/sys/powerpc/powerpc/trap.c b/sys/powerpc/powerpc/trap.c
index ab3e56875169..d919b7715664 100644
--- a/sys/powerpc/powerpc/trap.c
+++ b/sys/powerpc/powerpc/trap.c
@@ -138,6 +138,7 @@ static struct powerpc_exception powerpc_exceptions[] = {
{ EXC_VEC, "altivec unavailable" },
{ EXC_VSX, "vsx unavailable" },
{ EXC_FAC, "facility unavailable" },
+ { EXC_HFAC, "hypervisor facility unavailable" },
{ EXC_ITMISS, "instruction tlb miss" },
{ EXC_DLMISS, "data load tlb miss" },
{ EXC_DSMISS, "data store tlb miss" },
@@ -147,6 +148,7 @@ static struct powerpc_exception powerpc_exceptions[] = {
{ EXC_THRM, "thermal management" },
{ EXC_RUNMODETRC, "run mode/trace" },
{ EXC_SOFT_PATCH, "soft patch exception" },
+ { EXC_HVI, "hypervisor virtualization" },
{ EXC_LAST, NULL }
};
@@ -351,6 +353,7 @@ trap(struct trapframe *frame)
mtspr(SPR_FSCR, fscr & ~FSCR_IC_MASK);
break;
case EXC_HEA:
+ case EXC_HFAC:
sig = SIGILL;
ucode = ILL_ILLOPC;
break;