Source-Changes-HG archive

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

[src/trunk]: src/sys/uvm If we run out of virtual space in uvm_pageboot_alloc...



details:   https://anonhg.NetBSD.org/src/rev/9b681e561ff7
branches:  trunk
changeset: 473116:9b681e561ff7
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Thu May 20 20:07:55 1999 +0000

description:
If we run out of virtual space in uvm_pageboot_alloc(), fail gracefully
rather than unpredictably.

diffstat:

 sys/uvm/uvm_page.c |  15 ++++++++++-----
 1 files changed, 10 insertions(+), 5 deletions(-)

diffs (47 lines):

diff -r dce3023b0c5f -r 9b681e561ff7 sys/uvm/uvm_page.c
--- a/sys/uvm/uvm_page.c        Thu May 20 20:01:28 1999 +0000
+++ b/sys/uvm/uvm_page.c        Thu May 20 20:07:55 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uvm_page.c,v 1.18 1999/04/11 04:04:11 chs Exp $        */
+/*     $NetBSD: uvm_page.c,v 1.19 1999/05/20 20:07:55 thorpej Exp $    */
 
 /* 
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -385,6 +385,7 @@
 
 #else /* !PMAP_STEAL_MEMORY */
 
+       static boolean_t initialized = FALSE;
        vaddr_t addr, vaddr;
        paddr_t paddr;
 
@@ -392,21 +393,25 @@
        size = round_page(size);
 
        /*
-        * on first call to this function init ourselves.   we detect this
-        * by checking virtual_space_start/end which are in the zero'd BSS area.
+        * on first call to this function, initialize ourselves.
         */
-
-       if (virtual_space_start == virtual_space_end) {
+       if (initialized == FALSE) {
                pmap_virtual_space(&virtual_space_start, &virtual_space_end);
 
                /* round it the way we like it */
                virtual_space_start = round_page(virtual_space_start);
                virtual_space_end = trunc_page(virtual_space_end);
+
+               initialized = TRUE;
        }
 
        /*
         * allocate virtual memory for this request
         */
+       if (virtual_space_start == virtual_space_end ||
+           (virtual_space_end - virtual_space_start) < size) {
+               panic("uvm_pageboot_alloc: out of virtual space");
+       }
 
        addr = virtual_space_start;
        virtual_space_start += size;



Home | Main Index | Thread Index | Old Index