Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/compat/netbsd32 Handle vm.maxaddress in compat_netbsd32(8)



details:   https://anonhg.NetBSD.org/src/rev/15442392e792
branches:  trunk
changeset: 832742:15442392e792
user:      kamil <kamil%NetBSD.org@localhost>
date:      Sat May 26 18:18:19 2018 +0000

description:
Handle vm.maxaddress in compat_netbsd32(8)

Return VM_MAXUSER_ADDRESS32 instead of the 64-bit specific address.

Use CTLTYPE_INT instead of CTLTYPE_LONG in order to retain the same integer
type between 64-bit native kernel and 32-bit emulated program.

There probably should be CTLTYPE_LONG32 available for this purpose.

On NetBSD/i386:
vm.maxaddress=bfeff000

On NetBSD/amd64:
vm.maxaddress=7fbfdfeff000

On NetBSD/amd64 running i386 program:
vm.maxaddress=fffff000

A 32-bit program on the 64-bit kernel can use larger user space, this
difference is on purpose and expected.

Sponsored by <The NetBSD Foundation>

diffstat:

 sys/compat/netbsd32/netbsd32_sysctl.c |  10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diffs (31 lines):

diff -r b38a4d36a229 -r 15442392e792 sys/compat/netbsd32/netbsd32_sysctl.c
--- a/sys/compat/netbsd32/netbsd32_sysctl.c     Sat May 26 15:32:31 2018 +0000
+++ b/sys/compat/netbsd32/netbsd32_sysctl.c     Sat May 26 18:18:19 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: netbsd32_sysctl.c,v 1.38 2017/10/31 16:10:25 kre Exp $ */
+/*     $NetBSD: netbsd32_sysctl.c,v 1.39 2018/05/26 18:18:19 kamil Exp $       */
 
 /*
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_sysctl.c,v 1.38 2017/10/31 16:10:25 kre Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_sysctl.c,v 1.39 2018/05/26 18:18:19 kamil Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_ddb.h"
@@ -147,6 +147,12 @@
                       netbsd32_sysctl_vm_loadavg, 0, NULL,
                       sizeof(struct netbsd32_loadavg),
                       CTL_VM, VM_LOADAVG, CTL_EOL);
+       sysctl_createv(&netbsd32_clog, 0, &_root, NULL,
+                      CTLFLAG_PERMANENT|CTLFLAG_IMMEDIATE,
+                      CTLTYPE_INT, "maxaddress",
+                      SYSCTL_DESCR("Maximum user address"),
+                      NULL, VM_MAXUSER_ADDRESS32, NULL, 0,
+                      CTL_VM, VM_MAXADDRESS, CTL_EOL);
 
        sysctl_createv(&netbsd32_clog, 0, &_root, NULL,
                       CTLFLAG_PERMANENT,



Home | Main Index | Thread Index | Old Index