Mercurial > hg > Members > menikon > CbC_xv6
changeset 219:b8597756f701
fix loaduvm loop
author | tobaru |
---|---|
date | Fri, 24 Jan 2020 17:22:51 +0900 |
parents | 1c923ae14607 |
children | c1d1721fd907 |
files | src/impl/vm_impl.cbc src/impl/vm_impl.h src/impl/vm_impl_private.cbc |
diffstat | 3 files changed, 18 insertions(+), 18 deletions(-) [+] |
line wrap: on
line diff
--- a/src/impl/vm_impl.cbc Fri Jan 24 17:01:11 2020 +0900 +++ b/src/impl/vm_impl.cbc Fri Jan 24 17:22:51 2020 +0900 @@ -105,7 +105,7 @@ vm->offset = offset; vm->sz = sz; - goto loaduvm_ptesize_checkvm_impl(vm, next); + goto loaduvm_ptesize_checkvm_impl(vm, next(...)); } __code allocuvmvm_impl(struct vm_impl* vm, pde_t* pgdir, uint oldsz, uint newsz, __code next(...)) { @@ -115,7 +115,7 @@ __code clearpteuvm_impl(struct vm_impl* vm, pde_t* pgdir, char* uva, __code next(...)) { - goto clearpteu_check_ptevm_impl(vm, pgdir, uva, next(...); + goto clearpteu_check_ptevm_impl(vm, pgdir, uva, next(...)); } __code copyuvmvm_impl(struct vm_impl* vm, pde_t* pgdir, uint sz, __code next(...)) {
--- a/src/impl/vm_impl.h Fri Jan 24 17:01:11 2020 +0900 +++ b/src/impl/vm_impl.h Fri Jan 24 17:22:51 2020 +0900 @@ -19,8 +19,8 @@ uint ap; __code kpt_alloc_check_impl(Type* vm_impl, __code next(...)); - __code loaduvm_ptesize_check(Type* vm_impl, __code next(...)); - __code loaduvm_loop(Type* vm_impl, uint i, pte_t* pte, uint sz, __code next(...)); + __code loaduvm_ptesize_check(Type* vm_impl, __code next(int ret, ...)); + __code loaduvm_loop(Type* vm_impl, uint i, pte_t* pte, uint sz, __code next(int ret, ...)); __code allocuvm_check_newsz(Type* vm_impl, pde_t* pgdir, uint oldsz, uint newsz, __code next(...)); __code allocuvm_loop(Type* vm_impl, pde_t* pgdir, uint oldsz, uint newsz, uint a, __code next(...)); __code copyuvm_check_null(Type* vm_impl, pde_t* pgdir, uint sz, __code next(...));
--- a/src/impl/vm_impl_private.cbc Fri Jan 24 17:01:11 2020 +0900 +++ b/src/impl/vm_impl_private.cbc Fri Jan 24 17:22:51 2020 +0900 @@ -7,25 +7,25 @@ vm_impl* createvm_impl2(); */ -__code loaduvm_ptesize_checkvm_impl(struct vm_impl* vm_impl, __code next(...)) { +__code loaduvm_ptesize_checkvm_impl(struct vm_impl* vm_impl, __code next(int ret, ...)) { char* addr = vm_impl->addr; if ((uint) addr %PTE_SZ != 0) { // goto panic } - goto loaduvm_loopvm_impl(vm_impl, next(...)); + goto loaduvm_loopvm_impl(vm_impl, next(ret, ...)); } -__code loaduvm_loopvm_impl(struct vm_impl* vm_impl, __code next(...)) { +__code loaduvm_loopvm_impl(struct vm_impl* vm_impl, __code next(int ret, ...)) { uint i = vm_impl->i; uint sz = vm_impl->sz; if (i < sz) { - goto loaduvm_check_pgdir(vm_impl, next(...)); + goto loaduvm_check_pgdir(vm_impl, next(ret, ...)); } - goto loaduvm_exit(vm_impl, next(...)); + goto loaduvm_exit(vm_impl, next(ret, ...)); } @@ -58,7 +58,7 @@ } -__code loaduvm_check_pgdir(struct vm_impl* vm_impl, __code next(...)) { +__code loaduvm_check_pgdir(struct vm_impl* vm_impl, __code next(int ret, ...)) { pte_t* pte = vm_impl->pte; pde_t* pgdir = vm_impl->pgdir; uint i = vm_impl->i; @@ -75,10 +75,10 @@ vm_impl->addr = addr; vm_impl->pa = pa; - goto loaduvm_check_PTE_SZ(vm_impl, next(...)); + goto loaduvm_check_PTE_SZ(vm_impl, next(ret, ...)); } -__code loaduvm_check_PTE_SZ(struct vm_impl* vm_impl, __code next(...)) { +__code loaduvm_check_PTE_SZ(struct vm_impl* vm_impl, __code next(int ret, ...)) { uint sz = vm_impl->sz; uint i = vm_impl->i; uint n = vm_impl->n; @@ -93,18 +93,18 @@ } if (readi(ip, p2v(pa), offset + i, n) != n) { - // panic - // return -1; + ret = -1; + goto next(ret, ...); } vm_impl->n = n; - goto loaduvm_exit(vm_impl, next(...)); + goto loaduvm_loopvm_impl(vm_impl, next(ret, ...)); } -__code loaduvm_exit(struct vm_impl* vm_impl, __code next(...)) { - - goto next(...); +__code loaduvm_exit(struct vm_impl* vm_impl, __code next(int ret, ...)) { + ret = 0; + goto next(ret, ...); } struct run {