comparison src/impl/vm_impl_private.cbc @ 204:f4effd36aefc

kpt_alloc
author tobaru
date Thu, 23 Jan 2020 21:24:30 +0900
parents 6e03cee9733e
children 2ecf1e09e981
comparison
equal deleted inserted replaced
203:6e03cee9733e 204:f4effd36aefc
119 __code kpt_alloc_check_impl(struct vm_impl* vm_impl, __code next(...)) { 119 __code kpt_alloc_check_impl(struct vm_impl* vm_impl, __code next(...)) {
120 struct run* r; 120 struct run* r;
121 if ((r = kpt_mem.freelist) != NULL ) { 121 if ((r = kpt_mem.freelist) != NULL ) {
122 kpt_mem.freelist = r->next; 122 kpt_mem.freelist = r->next;
123 } 123 }
124 goto kpt_alloc_check_inital_page(vm_impl, next(...)); 124 release(&kpt_mem.lock);
125 }
126 125
127 __code kpt_alloc_check_inital_page(struct vm_impl* vm_impl, __code next(...)) { 126 if ((r == NULL) && ((r = kmalloc (PT_ORDER)) == NULL)) {
127 // panic("oom: kpt_alloc");
128 // goto panic
129 }
130
131 memset(r, 0, PT_SZ);
128 goto next((char*)r); 132 goto next((char*)r);
129 } 133 }