diff options
author | phk <phk@FreeBSD.org> | 1999-10-30 06:32:05 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 1999-10-30 06:32:05 +0000 |
commit | 8d8f53dcdc1e1126b75d084478a6ff0d4664f39d (patch) | |
tree | 3c9df194f59066cf56f290cfea6886eefc551a5e /sys/vm/vm_glue.c | |
parent | ad79c6009cc16320a9a1ee513845cb84a567ec52 (diff) | |
download | FreeBSD-src-8d8f53dcdc1e1126b75d084478a6ff0d4664f39d.zip FreeBSD-src-8d8f53dcdc1e1126b75d084478a6ff0d4664f39d.tar.gz |
Change useracc() and kernacc() to use VM_PROT_{READ|WRITE|EXECUTE} for the
"rw" argument, rather than hijacking B_{READ|WRITE}.
Fix two bugs (physio & cam) resulting by the confusion caused by this.
Submitted by: Tor.Egge@fast.no
Reviewed by: alc, ken (partly)
Diffstat (limited to 'sys/vm/vm_glue.c')
-rw-r--r-- | sys/vm/vm_glue.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/sys/vm/vm_glue.c b/sys/vm/vm_glue.c index 5fe78fd..3caa562 100644 --- a/sys/vm/vm_glue.c +++ b/sys/vm/vm_glue.c @@ -118,8 +118,11 @@ kernacc(addr, len, rw) { boolean_t rv; vm_offset_t saddr, eaddr; - vm_prot_t prot = rw == B_READ ? VM_PROT_READ : VM_PROT_WRITE; + vm_prot_t prot; + KASSERT(rw & (~VM_PROT_ALL), + ("illegal ``rw'' argument to kernacc (%x)\n", rw)); + prot = rw; saddr = trunc_page((vm_offset_t)addr); eaddr = round_page((vm_offset_t)addr + len); vm_map_lock_read(kernel_map); @@ -134,10 +137,13 @@ useracc(addr, len, rw) int len, rw; { boolean_t rv; - vm_prot_t prot = rw == B_READ ? VM_PROT_READ : VM_PROT_WRITE; + vm_prot_t prot; vm_map_t map; vm_map_entry_t save_hint; + KASSERT(rw & (~VM_PROT_ALL), + ("illegal ``rw'' argument to useracc (%x)\n", rw)); + prot = rw; /* * XXX - check separately to disallow access to user area and user * page tables - they are in the map. |