git: 0b663e0cee89 - main - powerpc: Add Hypervisor Facility Unavailable handling
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 19 Mar 2025 22:35:18 UTC
The branch main has been updated by jhibbits: URL: https://cgit.FreeBSD.org/src/commit/?id=0b663e0cee89dedf5b070ff4e839d5ad95061535 commit 0b663e0cee89dedf5b070ff4e839d5ad95061535 Author: Justin Hibbits <jhibbits@FreeBSD.org> AuthorDate: 2025-03-19 22:22:32 +0000 Commit: Justin Hibbits <jhibbits@FreeBSD.org> CommitDate: 2025-03-19 22:22:32 +0000 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 --- sys/powerpc/aim/aim_machdep.c | 1 + sys/powerpc/powerpc/trap.c | 3 +++ 2 files changed, 4 insertions(+) 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;