Mercurial > hg > CbC > CbC_xv6
changeset 274:d1dfc4af40d7
use goto panic
author | anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Thu, 06 Feb 2020 20:22:31 +0900 |
parents | b58517e62ebf |
children | 173753022721 |
files | src/impl/vm_impl_private.cbc |
diffstat | 1 files changed, 28 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/src/impl/vm_impl_private.cbc Thu Feb 06 18:34:54 2020 +0900 +++ b/src/impl/vm_impl_private.cbc Thu Feb 06 20:22:31 2020 +0900 @@ -12,7 +12,10 @@ __code loaduvm_ptesize_checkvm_impl(struct vm_impl* vm_impl,char* addr, __code next(int ret, ...)) { if ((uint) addr %PTE_SZ != 0) { - // goto panic + char* msg = "addr % PTE_SZ != 0"; + struct Err* err = createKernelError(&proc->cbc_context); + Gearef(cbc_context, Err)->msg = msg; + goto err->panic(msg); } goto loaduvm_loopvm_impl(vm_impl, next(ret, ...)); @@ -58,7 +61,10 @@ __code loaduvm_check_pgdir(struct vm_impl* vm_impl, pte_t* pte, pde_t* pgdir, uint i, char* addr, uint pa, __code next(int ret, ...)) { if ((pte = walkpgdir(pgdir, addr + i, 0)) == 0) { - // goto panic + char* msg = "pte != walkpgdir..."; + struct Err* err = createKernelError(&proc->cbc_context); + Gearef(cbc_context, Err)->msg = msg; + goto err->panic(msg); } pa = PTE_ADDR(*pte); @@ -192,8 +198,10 @@ pte = walkpgdir(pgdir, uva, 0); if (pte == 0) { - // panic("clearpteu"); - // goto panic; + char* msg = "clearpteu"; + struct Err* err = createKernelError(&proc->cbc_context); + Gearef(cbc_context, Err)->msg = msg; + goto err->panic(msg); } // in ARM, we change the AP field (ap & 0x3) << 4) @@ -231,8 +239,10 @@ __code copyuvm_loop_check_walkpgdir(struct vm_impl* vm_impl, pde_t* pgdir, uint sz, pde_t* d, pte_t* pte, uint pa, uint i, uint ap, char* mem, __code next(int ret, ...)) { if ((pte = walkpgdir(pgdir, (void *) i, 0)) == 0) { - // panic("copyuvm: pte should exist"); - // goto panic(); + char* msg = "copyuvm: pte should exist"; + struct Err* err = createKernelError(&proc->cbc_context); + Gearef(cbc_context, Err)->msg = msg; + goto err->panic(msg); } goto copyuvm_loop_check_pte(vm_impl, pgdir, sz, d, pte, pa, i, ap, mem, __code next(int ret, ...)); } @@ -240,8 +250,10 @@ __code copyuvm_loop_check_pte(struct vm_impl* vm_impl, pde_t* pgdir, uint sz, pde_t* d, pte_t* pte, uint pa, uint i, uint ap, char* mem, __code next(int ret, ...)) { if (!(*pte & PE_TYPES)) { - // panic("copyuvm: page not present"); - // goto panic(); + char* msg = "copyuvm: page not present"; + struct Err* err = createKernelError(&proc->cbc_context); + Gearef(cbc_context, Err)->msg = msg; + goto err->panic(msg); } goto copyuvm_loop_check_mem(vm_impl, pgdir, sz, d, pte, pa, i, ap, mem, __code next(int ret, ...)); @@ -360,7 +372,10 @@ pushcli(); if (p->pgdir == 0) { - panic("switchuvm: no pgdir"); + char* msg = "switchuvm: no pgdir"; + struct Err* err = createKernelError(&proc->cbc_context); + Gearef(cbc_context, Err)->msg = msg; + goto err->panic(msg); } val = (uint) V2P(p->pgdir) | 0x00; @@ -377,8 +392,10 @@ char* mem; if (sz >= PTE_SZ) { - // goto panic; - // panic("inituvm: more than a page"); + char* msg = "inituvm: more than a page"; + struct Err* err = createKernelError(&proc->cbc_context); + Gearef(cbc_context, Err)->msg = msg; + goto err->panic(msg); } mem = alloc_page();