git: a637aa182bb1 - main - proccontrol: support la52 on powerpc64

From: Piotr Kubaj <pkubaj_at_FreeBSD.org>
Date: Mon, 16 Nov 2026 12:34:37 UTC
The branch main has been updated by pkubaj:

URL: https://cgit.FreeBSD.org/src/commit/?id=a637aa182bb1c1dc1e545fc5af2bceff4013affc

commit a637aa182bb1c1dc1e545fc5af2bceff4013affc
Author:     Piotr Kubaj <pkubaj@FreeBSD.org>
AuthorDate: 2026-11-15 20:57:11 +0000
Commit:     Piotr Kubaj <pkubaj@FreeBSD.org>
CommitDate: 2026-11-16 12:34:19 +0000

    proccontrol: support la52 on powerpc64
    
    powerpc64 is getting the same PROC_LA_CTL interface as amd64, but calls
    the full address space la52 instead of la57. Take the mode name and the
    constants from whichever one machine/procctl.h defines.
    
    Reviewed by:    kib
    MFC after:      3 days
    Differential Revision:  https://reviews.freebsd.org/D61331
---
 usr.bin/proccontrol/proccontrol.1 |  9 ++++++---
 usr.bin/proccontrol/proccontrol.c | 38 +++++++++++++++++++++++++++-----------
 2 files changed, 33 insertions(+), 14 deletions(-)

diff --git a/usr.bin/proccontrol/proccontrol.1 b/usr.bin/proccontrol/proccontrol.1
index 40f8d465ac27..588dfb575796 100644
--- a/usr.bin/proccontrol/proccontrol.1
+++ b/usr.bin/proccontrol/proccontrol.1
@@ -25,7 +25,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.Dd December 14, 2024
+.Dd November 9, 2026
 .Dt PROCCONTROL 1
 .Os
 .Sh NAME
@@ -77,8 +77,11 @@ Controls the write exclusive execute mode for mappings.
 .It Ar kpti
 Controls the KPTI enable, AMD64 only.
 .It Ar la48
-Control limiting usermode process address space to 48 bits of address,
-AMD64 only, on machines capable of 57-bit addressing.
+Control limiting usermode process address space to 48 bits of address.
+AMD64, on machines capable of 57-bit addressing, and powerpc64 only.
+.It Ar la52
+Control the use of the full 52-bit address space of the radix MMU,
+powerpc64 only.
 .It Ar logsigexit
 Controls the logging of exits due to a signal that would normally cause a core
 dump.
diff --git a/usr.bin/proccontrol/proccontrol.c b/usr.bin/proccontrol/proccontrol.c
index 3548ca606656..eb6516ab5a82 100644
--- a/usr.bin/proccontrol/proccontrol.c
+++ b/usr.bin/proccontrol/proccontrol.c
@@ -48,12 +48,28 @@ enum mode {
 	MODE_KPTI,
 #endif
 #ifdef PROC_LA_CTL
-	MODE_LA57,
+	MODE_LA_WIDE,
 	MODE_LA48,
 #endif
 	MODE_LOGSIGEXIT,
 };
 
+#ifdef PROC_LA_CTL
+/*
+ * The wide address space mode is la57 on amd64 and la52 on powerpc64,
+ * the procctl(2) values are the same.
+ */
+#ifdef PROC_LA_CTL_LA57_ON_EXEC
+#define	LA_WIDE_NAME			"la57"
+#define	PROC_LA_CTL_LA_WIDE_ON_EXEC	PROC_LA_CTL_LA57_ON_EXEC
+#define	PROC_LA_STATUS_LA_WIDE		PROC_LA_STATUS_LA57
+#elif defined(PROC_LA_CTL_LA52_ON_EXEC)
+#define	LA_WIDE_NAME			"la52"
+#define	PROC_LA_CTL_LA_WIDE_ON_EXEC	PROC_LA_CTL_LA52_ON_EXEC
+#define	PROC_LA_STATUS_LA_WIDE		PROC_LA_STATUS_LA52
+#endif
+#endif
+
 static const struct {
 	enum mode mode;
 	const char *name;
@@ -69,7 +85,7 @@ static const struct {
 	{ MODE_KPTI, 		"kpti" },
 #endif
 #ifdef PROC_LA_CTL
-	{ MODE_LA57,		"la57" },
+	{ MODE_LA_WIDE,		LA_WIDE_NAME },
 	{ MODE_LA48,		"la48" },
 #endif
 	{ MODE_LOGSIGEXIT,	"logsigexit" },
@@ -191,7 +207,7 @@ main(int argc, char *argv[])
 			break;
 #endif
 #ifdef PROC_LA_CTL
-		case MODE_LA57:
+		case MODE_LA_WIDE:
 		case MODE_LA48:
 			error = procctl(P_PID, pid, PROC_LA_STATUS, &arg);
 			break;
@@ -317,15 +333,15 @@ main(int argc, char *argv[])
 			break;
 #endif
 #ifdef PROC_LA_CTL
-		case MODE_LA57:
+		case MODE_LA_WIDE:
 		case MODE_LA48:
 			switch (arg & ~(PROC_LA_STATUS_LA48 |
-			    PROC_LA_STATUS_LA57)) {
+			    PROC_LA_STATUS_LA_WIDE)) {
 			case PROC_LA_CTL_LA48_ON_EXEC:
 				printf("la48 on exec");
 				break;
-			case PROC_LA_CTL_LA57_ON_EXEC:
-				printf("la57 on exec");
+			case PROC_LA_CTL_LA_WIDE_ON_EXEC:
+				printf(LA_WIDE_NAME " on exec");
 				break;
 			case PROC_LA_CTL_DEFAULT_ON_EXEC:
 				printf("default on exec");
@@ -333,8 +349,8 @@ main(int argc, char *argv[])
 			}
 			if ((arg & PROC_LA_STATUS_LA48) != 0)
 				printf(", la48 active\n");
-			else if ((arg & PROC_LA_STATUS_LA57) != 0)
-				printf(", la57 active\n");
+			else if ((arg & PROC_LA_STATUS_LA_WIDE) != 0)
+				printf(", " LA_WIDE_NAME " active\n");
 			break;
 #endif
 		case MODE_LOGSIGEXIT:
@@ -398,8 +414,8 @@ main(int argc, char *argv[])
 			break;
 #endif
 #ifdef PROC_LA_CTL
-		case MODE_LA57:
-			arg = enable ? PROC_LA_CTL_LA57_ON_EXEC :
+		case MODE_LA_WIDE:
+			arg = enable ? PROC_LA_CTL_LA_WIDE_ON_EXEC :
 			    PROC_LA_CTL_DEFAULT_ON_EXEC;
 			error = procctl(P_PID, pid, PROC_LA_CTL, &arg);
 			break;