diff options
author | bde <bde@FreeBSD.org> | 1997-01-15 19:24:12 +0000 |
---|---|---|
committer | bde <bde@FreeBSD.org> | 1997-01-15 19:24:12 +0000 |
commit | dc8e52ae7629f1f2cc1d57fb07952a847065499a (patch) | |
tree | f1a7f72b6fb3f460479f3acd9ac66f65dcf1d0fc | |
parent | dd18dffcc8b7d5a41bf96d38d5da25ffb1f6b23d (diff) | |
download | FreeBSD-src-dc8e52ae7629f1f2cc1d57fb07952a847065499a.zip FreeBSD-src-dc8e52ae7629f1f2cc1d57fb07952a847065499a.tar.gz |
Fixed longstanding annoying warning about a type mismatch. pmap doesn't
really uses pt_entry_t internally, so don't use it here.
Fixed range checking for writing. The partial page (if any) following
etext wasn't writable.
-rw-r--r-- | sys/amd64/amd64/db_interface.c | 15 | ||||
-rw-r--r-- | sys/i386/i386/db_interface.c | 15 |
2 files changed, 16 insertions, 14 deletions
diff --git a/sys/amd64/amd64/db_interface.c b/sys/amd64/amd64/db_interface.c index 7c59f77..a06f421 100644 --- a/sys/amd64/amd64/db_interface.c +++ b/sys/amd64/amd64/db_interface.c @@ -184,19 +184,20 @@ db_write_bytes(addr, size, data) { register char *dst; - register pt_entry_t *ptep0 = 0; - pt_entry_t oldmap0 = { 0 }; + unsigned *ptep0 = NULL; + unsigned oldmap0 = 0; vm_offset_t addr1; - register pt_entry_t *ptep1 = 0; - pt_entry_t oldmap1 = { 0 }; + unsigned *ptep1 = NULL; + unsigned oldmap1 = 0; db_nofault = &db_jmpbuf; - if (addr >= VM_MIN_KERNEL_ADDRESS && addr <= (vm_offset_t)&etext) { + if (addr >= VM_MIN_KERNEL_ADDRESS && + addr <= round_page((vm_offset_t)&etext)) { ptep0 = pmap_pte(kernel_pmap, addr); oldmap0 = *ptep0; - *(int *)ptep0 |= /* INTEL_PTE_WRITE */ PG_RW; + *ptep0 |= PG_RW; addr1 = trunc_page(addr + size - 1); @@ -204,7 +205,7 @@ db_write_bytes(addr, size, data) if (trunc_page(addr) != addr1) { ptep1 = pmap_pte(kernel_pmap, addr1); oldmap1 = *ptep1; - *(int *)ptep1 |= /* INTEL_PTE_WRITE */ PG_RW; + *ptep1 |= PG_RW; } invltlb(); diff --git a/sys/i386/i386/db_interface.c b/sys/i386/i386/db_interface.c index 7c59f77..a06f421 100644 --- a/sys/i386/i386/db_interface.c +++ b/sys/i386/i386/db_interface.c @@ -184,19 +184,20 @@ db_write_bytes(addr, size, data) { register char *dst; - register pt_entry_t *ptep0 = 0; - pt_entry_t oldmap0 = { 0 }; + unsigned *ptep0 = NULL; + unsigned oldmap0 = 0; vm_offset_t addr1; - register pt_entry_t *ptep1 = 0; - pt_entry_t oldmap1 = { 0 }; + unsigned *ptep1 = NULL; + unsigned oldmap1 = 0; db_nofault = &db_jmpbuf; - if (addr >= VM_MIN_KERNEL_ADDRESS && addr <= (vm_offset_t)&etext) { + if (addr >= VM_MIN_KERNEL_ADDRESS && + addr <= round_page((vm_offset_t)&etext)) { ptep0 = pmap_pte(kernel_pmap, addr); oldmap0 = *ptep0; - *(int *)ptep0 |= /* INTEL_PTE_WRITE */ PG_RW; + *ptep0 |= PG_RW; addr1 = trunc_page(addr + size - 1); @@ -204,7 +205,7 @@ db_write_bytes(addr, size, data) if (trunc_page(addr) != addr1) { ptep1 = pmap_pte(kernel_pmap, addr1); oldmap1 = *ptep1; - *(int *)ptep1 |= /* INTEL_PTE_WRITE */ PG_RW; + *ptep1 |= PG_RW; } invltlb(); |