Mercurial > hg > Members > menikon > CbC_xv6
changeset 220:c1d1721fd907
uva2ka_check_pe_types
author | tobaru |
---|---|
date | Fri, 24 Jan 2020 17:41:35 +0900 |
parents | b8597756f701 |
children | 098942ff5f44 |
files | src/impl/vm_impl.cbc src/impl/vm_impl.h src/impl/vm_impl_private.cbc |
diffstat | 3 files changed, 22 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/impl/vm_impl.cbc Fri Jan 24 17:22:51 2020 +0900 +++ b/src/impl/vm_impl.cbc Fri Jan 24 17:41:35 2020 +0900 @@ -30,6 +30,7 @@ vm_impl->allocuvm_loop = C_allocuvm_loopvm_impl; vm_impl->copyuvm_check_null = C_copyuvm_check_nullvm_impl; vm_impl->copyuvm_loop = C_copyuvm_loopvm_impl; + vm_impl->uva2ka_check_pe_types = C_uva2ka_check_pe_types; vm->init_vmm = C_init_vmmvm_impl; vm->kpt_freerange = C_kpt_freerangevm_impl; vm->kpt_alloc = C_kpt_allocvm_impl; @@ -125,7 +126,7 @@ __code uva2kavm_impl(struct vm_impl* vm, pde_t* pgdir, char* uva, __code next(...)) { - goto next(...); + goto uva2ka_check_pe_types(vm, pgdir, uva, next(...)); } __code copyoutvm_impl(struct vm_impl* vm, pde_t* pgdir, uint va, void* pp, uint len, __code next(...)) {
--- a/src/impl/vm_impl.h Fri Jan 24 17:22:51 2020 +0900 +++ b/src/impl/vm_impl.h Fri Jan 24 17:41:35 2020 +0900 @@ -26,6 +26,7 @@ __code copyuvm_check_null(Type* vm_impl, pde_t* pgdir, uint sz, __code next(...)); __code copyuvm_loop(Type* 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, ...)); __code clearpteu_check_ptevm_impl(Type* vm_impl, pde_t* pgdir, char* uva, __code next(...)); + __code uva2ka_check_pe_types(Type* vm_impl, pde_t* pgdir, char* uva, __code next(...)); __code next(...); } vm_impl;
--- a/src/impl/vm_impl_private.cbc Fri Jan 24 17:22:51 2020 +0900 +++ b/src/impl/vm_impl_private.cbc Fri Jan 24 17:41:35 2020 +0900 @@ -286,3 +286,22 @@ ret = 0; goto next(ret, ...); } + + +__code uva2ka_check_pe_types(struct vm_impl* vm, pde_t* pgdir, char* uva, __code next(int ret, ...)) { + pte_t* pte; + + pte = walkpgdir(pgdir, uva, 0); + + // make sure it exists + if ((*pte & PE_TYPES) == 0) { + ret = 0; + goto next(ret, ...); + } + goto uva2ka_check_pte_ap(vm, pgdir, uva, pte, next(...)); +} + +__code uva2ka_check_pte_ap(struct vm_impl* vm, pde_t* pgdir, char* uva, pte_t* pte, __code next(int ret, ...)) { + goto next(ret, ...); +} +