From 1185babf97d13923824f0471e44915c31398972a Mon Sep 17 00:00:00 2001 From: Jordan Gordeev Date: Wed, 3 Jun 2009 18:36:37 +0300 Subject: [PATCH] amd64: Fix 'hw.availpages' sysctl. Always returning -1 was the worst possible choice - it got us into an infinite loop. --- sys/platform/pc64/amd64/machdep.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/sys/platform/pc64/amd64/machdep.c b/sys/platform/pc64/amd64/machdep.c index a85b28dda4..7a92b57155 100644 --- a/sys/platform/pc64/amd64/machdep.c +++ b/sys/platform/pc64/amd64/machdep.c @@ -202,13 +202,9 @@ SYSCTL_PROC(_hw, HW_USERMEM, usermem, CTLTYPE_INT|CTLFLAG_RD, static int sysctl_hw_availpages(SYSCTL_HANDLER_ARGS) { -#if JG int error = sysctl_handle_int(oidp, 0, - i386_btop(avail_end - avail_start), req); + amd64_btop(avail_end - avail_start), req); return (error); -#else - return -1; -#endif } SYSCTL_PROC(_hw, OID_AUTO, availpages, CTLTYPE_INT|CTLFLAG_RD, @@ -1635,6 +1631,8 @@ do_next: /* Trim off space for the message buffer. */ phys_avail[pa_indx] -= round_page(MSGBUF_SIZE); + avail_end = phys_avail[pa_indx]; + /* Map the message buffer. */ for (off = 0; off < round_page(MSGBUF_SIZE); off += PAGE_SIZE) pmap_kenter((vm_offset_t)msgbufp + off, phys_avail[pa_indx] + -- 2.41.0