diff options
author | peter <peter@FreeBSD.org> | 2002-08-30 04:04:37 +0000 |
---|---|---|
committer | peter <peter@FreeBSD.org> | 2002-08-30 04:04:37 +0000 |
commit | c3bdd669c3f39a9ac1166f5ca537aca7b8beff2b (patch) | |
tree | 1efd2347dcbfb7b9894853dfbf52875f12fa5e04 /sys/ia64 | |
parent | f058ad603616156ddb87113551b184875a1640e2 (diff) | |
download | FreeBSD-src-c3bdd669c3f39a9ac1166f5ca537aca7b8beff2b.zip FreeBSD-src-c3bdd669c3f39a9ac1166f5ca537aca7b8beff2b.tar.gz |
Change hw.physmem and hw.usermem to unsigned long like they used to be
in the original hardwired sysctl implementation.
The buf size calculator still overflows an integer on machines with large
KVA (eg: ia64) where the number of pages does not fit into an int. Use
'long' there.
Change Maxmem and physmem and related variables to 'long', mostly for
completeness. Machines are not likely to overflow 'int' pages in the
near term, but then again, 640K ought to be enough for anybody. This
comes for free on 32 bit machines, so why not?
Diffstat (limited to 'sys/ia64')
-rw-r--r-- | sys/ia64/ia64/machdep.c | 27 | ||||
-rw-r--r-- | sys/ia64/include/md_var.h | 2 |
2 files changed, 18 insertions, 11 deletions
diff --git a/sys/ia64/ia64/machdep.c b/sys/ia64/ia64/machdep.c index 69fb171..0c04a66 100644 --- a/sys/ia64/ia64/machdep.c +++ b/sys/ia64/ia64/machdep.c @@ -146,33 +146,40 @@ SYSINIT(cpu, SI_SUB_CPU, SI_ORDER_FIRST, cpu_startup, NULL) struct msgbuf *msgbufp=0; -int Maxmem = 0; -int physmem; /* Physical conventional memory. */ +long Maxmem = 0; +long physmem; /* Physical conventional memory. */ vm_offset_t phys_avail[100]; static int sysctl_hw_physmem(SYSCTL_HANDLER_ARGS) { - int error = sysctl_handle_int(oidp, 0, ia64_ptob(physmem), req); + int error; + unsigned long val; + + val = ia64_ptob(physmem); + error = sysctl_handle_long(oidp, &val, 0, req); return (error); } -SYSCTL_PROC(_hw, HW_PHYSMEM, physmem, CTLTYPE_INT|CTLFLAG_RD, - 0, 0, sysctl_hw_physmem, "I", ""); +SYSCTL_PROC(_hw, HW_PHYSMEM, physmem, CTLTYPE_ULONG|CTLFLAG_RD, + 0, 0, sysctl_hw_physmem, "LU", ""); static int sysctl_hw_usermem(SYSCTL_HANDLER_ARGS) { - int error = sysctl_handle_int(oidp, 0, - ia64_ptob(physmem - cnt.v_wire_count), req); + int error; + unsigned long val; + + val = ia64_ptob(physmem - cnt.v_wire_count); + error = sysctl_handle_long(oidp, &val, 0, req); return (error); } -SYSCTL_PROC(_hw, HW_USERMEM, usermem, CTLTYPE_INT|CTLFLAG_RD, - 0, 0, sysctl_hw_usermem, "I", ""); +SYSCTL_PROC(_hw, HW_USERMEM, usermem, CTLTYPE_ULONG|CTLFLAG_RD, + 0, 0, sysctl_hw_usermem, "LU", ""); -SYSCTL_INT(_hw, OID_AUTO, availpages, CTLFLAG_RD, &physmem, 0, ""); +SYSCTL_LONG(_hw, OID_AUTO, availpages, CTLFLAG_RD, &physmem, 0, ""); /* must be 2 less so 0 0 can signal end of chunks */ #define PHYS_AVAIL_ARRAY_END ((sizeof(phys_avail) / sizeof(vm_offset_t)) - 2) diff --git a/sys/ia64/include/md_var.h b/sys/ia64/include/md_var.h index 75eab8b..706294f 100644 --- a/sys/ia64/include/md_var.h +++ b/sys/ia64/include/md_var.h @@ -36,7 +36,7 @@ extern char sigcode[]; extern char esigcode[]; extern int szsigcode; -extern int Maxmem; +extern long Maxmem; struct fpreg; struct thread; |