changeset 213:f4effd36aefc

kpt_alloc
author tobaru
date Thu, 23 Jan 2020 21:24:30 +0900
parents 6e03cee9733e
children 2ecf1e09e981
files src/impl/vm_impl_private.cbc
diffstat 1 files changed, 7 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/impl/vm_impl_private.cbc	Thu Jan 23 21:16:42 2020 +0900
+++ b/src/impl/vm_impl_private.cbc	Thu Jan 23 21:24:30 2020 +0900
@@ -121,9 +121,13 @@
     if ((r = kpt_mem.freelist) != NULL ) {
         kpt_mem.freelist = r->next;
     }
-   goto kpt_alloc_check_inital_page(vm_impl, next(...));
-}
+    release(&kpt_mem.lock);
 
-__code kpt_alloc_check_inital_page(struct vm_impl* vm_impl, __code next(...)) {
+    if ((r == NULL) && ((r = kmalloc (PT_ORDER)) == NULL)) {
+        // panic("oom: kpt_alloc");
+        // goto panic
+    }
+
+    memset(r, 0, PT_SZ);
     goto next((char*)r);
 }