diff options
author | Artur Grabowski <art@cvs.openbsd.org> | 2003-01-16 04:16:01 +0000 |
---|---|---|
committer | Artur Grabowski <art@cvs.openbsd.org> | 2003-01-16 04:16:01 +0000 |
commit | 9c82fff6b0c0956ba32aa6094a6ae198058c0f23 (patch) | |
tree | 12b89fcb94b16c7e8b9ce50030c83c4cd9b6d358 /sys/arch/i386 | |
parent | 5690aab243487f8d7209ab30739a83d0cfda3cf6 (diff) |
Getting rid of vm_offset_t
Diffstat (limited to 'sys/arch/i386')
-rw-r--r-- | sys/arch/i386/i386/db_memrw.c | 24 | ||||
-rw-r--r-- | sys/arch/i386/i386/db_trace.c | 4 | ||||
-rw-r--r-- | sys/arch/i386/i386/freebsd_machdep.c | 14 | ||||
-rw-r--r-- | sys/arch/i386/i386/machdep.c | 52 | ||||
-rw-r--r-- | sys/arch/i386/i386/mem.c | 19 | ||||
-rw-r--r-- | sys/arch/i386/i386/trap.c | 14 | ||||
-rw-r--r-- | sys/arch/i386/i386/vm_machdep.c | 29 | ||||
-rw-r--r-- | sys/arch/i386/include/bus.h | 4 | ||||
-rw-r--r-- | sys/arch/i386/include/cpu.h | 4 | ||||
-rw-r--r-- | sys/arch/i386/include/vmparam.h | 12 |
10 files changed, 78 insertions, 98 deletions
diff --git a/sys/arch/i386/i386/db_memrw.c b/sys/arch/i386/i386/db_memrw.c index 17a28bed671..c90b5569580 100644 --- a/sys/arch/i386/i386/db_memrw.c +++ b/sys/arch/i386/i386/db_memrw.c @@ -1,4 +1,4 @@ -/* $OpenBSD: db_memrw.c,v 1.5 2001/11/28 15:02:58 art Exp $ */ +/* $OpenBSD: db_memrw.c,v 1.6 2003/01/16 04:15:17 art Exp $ */ /* $NetBSD: db_memrw.c,v 1.6 1999/04/12 20:38:19 pk Exp $ */ /* @@ -48,12 +48,9 @@ * Read bytes from kernel address space for debugger. */ void -db_read_bytes(addr, size, data) - vm_offset_t addr; - register size_t size; - register char *data; +db_read_bytes(vaddr_t addr, size_t size, char *data) { - register char *src; + char *src; src = (char *)addr; while (size-- > 0) @@ -64,22 +61,19 @@ db_read_bytes(addr, size, data) * Write bytes to kernel address space for debugger. */ void -db_write_bytes(addr, size, data) - vm_offset_t addr; - register size_t size; - register char *data; +db_write_bytes(vaddr_t addr, size_t size, char *data) { - register char *dst; + char *dst; - register pt_entry_t *ptep0 = 0; + pt_entry_t *ptep0 = 0; pt_entry_t oldmap0 = { 0 }; - vm_offset_t addr1; - register pt_entry_t *ptep1 = 0; + vaddr_t addr1; + pt_entry_t *ptep1 = 0; pt_entry_t oldmap1 = { 0 }; extern char etext; if (addr >= VM_MIN_KERNEL_ADDRESS && - addr < (vm_offset_t)&etext) { + addr < (vaddr_t)&etext) { ptep0 = PTE_BASE + i386_btop(addr); oldmap0 = *ptep0; *(int *)ptep0 |= /* INTEL_PTE_WRITE */ PG_RW; diff --git a/sys/arch/i386/i386/db_trace.c b/sys/arch/i386/i386/db_trace.c index 90bc7ef66d8..8939b48ccf7 100644 --- a/sys/arch/i386/i386/db_trace.c +++ b/sys/arch/i386/i386/db_trace.c @@ -1,4 +1,4 @@ -/* $OpenBSD: db_trace.c,v 1.7 2002/05/18 09:49:17 art Exp $ */ +/* $OpenBSD: db_trace.c,v 1.8 2003/01/16 04:15:17 art Exp $ */ /* $NetBSD: db_trace.c,v 1.18 1996/05/03 19:42:01 christos Exp $ */ /* @@ -63,7 +63,7 @@ struct db_variable *db_eregs = db_regs + sizeof(db_regs)/sizeof(db_regs[0]); /* * Stack trace. */ -#define INKERNEL(va) (((vm_offset_t)(va)) >= VM_MIN_KERNEL_ADDRESS) +#define INKERNEL(va) (((vaddr_t)(va)) >= VM_MIN_KERNEL_ADDRESS) struct i386_frame { struct i386_frame *f_frame; diff --git a/sys/arch/i386/i386/freebsd_machdep.c b/sys/arch/i386/i386/freebsd_machdep.c index 387ec943199..20b9faf868b 100644 --- a/sys/arch/i386/i386/freebsd_machdep.c +++ b/sys/arch/i386/i386/freebsd_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: freebsd_machdep.c,v 1.13 2002/07/20 19:24:56 art Exp $ */ +/* $OpenBSD: freebsd_machdep.c,v 1.14 2003/01/16 04:15:17 art Exp $ */ /* $NetBSD: freebsd_machdep.c,v 1.10 1996/05/03 19:42:05 christos Exp $ */ /*- @@ -358,12 +358,10 @@ freebsd_to_netbsd_ptrace_regs(fregs, nregs, nfpregs) #define FREEBSD_REGS_OFFSET 0x2000 int -freebsd_ptrace_getregs(fregs, addr, datap) - struct freebsd_ptrace_reg *fregs; - caddr_t addr; - register_t *datap; +freebsd_ptrace_getregs(struct freebsd_ptrace_reg *fregs, caddr_t addr, + register_t *datap) { - vm_offset_t offset = (vm_offset_t)addr; + vaddr_t offset = (vaddr_t)addr; if (offset == FREEBSD_U_AR0_OFFSET) { *datap = FREEBSD_REGS_OFFSET + FREEBSD_USRSTACK; @@ -372,7 +370,7 @@ freebsd_ptrace_getregs(fregs, addr, datap) offset <= FREEBSD_REGS_OFFSET + sizeof(fregs->freebsd_ptrace_regs)-sizeof(register_t)) { *datap = *(register_t *)&((caddr_t)&fregs->freebsd_ptrace_regs) - [(vm_offset_t) addr - FREEBSD_REGS_OFFSET]; + [(vaddr_t) addr - FREEBSD_REGS_OFFSET]; return 0; } else if (offset >= FREEBSD_U_SAVEFP_OFFSET && offset <= FREEBSD_U_SAVEFP_OFFSET + @@ -393,7 +391,7 @@ freebsd_ptrace_setregs(fregs, addr, data) caddr_t addr; int data; { - vm_offset_t offset = (vm_offset_t)addr; + vaddr_t offset = (vaddr_t)addr; if (offset >= FREEBSD_REGS_OFFSET && offset <= FREEBSD_REGS_OFFSET + diff --git a/sys/arch/i386/i386/machdep.c b/sys/arch/i386/i386/machdep.c index 624abaa9a24..9e5c29904e5 100644 --- a/sys/arch/i386/i386/machdep.c +++ b/sys/arch/i386/i386/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.218 2003/01/15 01:43:44 mickey Exp $ */ +/* $OpenBSD: machdep.c,v 1.219 2003/01/16 04:15:17 art Exp $ */ /* $NetBSD: machdep.c,v 1.214 1996/11/10 03:16:17 thorpej Exp $ */ /*- @@ -216,8 +216,8 @@ extern int boothowto; int physmem; struct dumpmem { - vm_offset_t start; - vm_size_t end; + paddr_t start; + paddr_t end; } dumpmem[VM_PHYSSEG_MAX]; u_int ndumpmem; @@ -234,7 +234,7 @@ int i386_fpu_exception; int i386_fpu_fdivbug; bootarg_t *bootargp; -vm_offset_t avail_end; +paddr_t avail_end; struct vm_map *exec_map = NULL; struct vm_map *phys_map = NULL; @@ -260,11 +260,11 @@ struct extent *iomem_ex; static int ioport_malloc_safe; caddr_t allocsys(caddr_t); -void setup_buffers(vm_offset_t *); +void setup_buffers(vaddr_t *); void dumpsys(void); int cpu_dump(void); void identifycpu(void); -void init386(vm_offset_t); +void init386(paddr_t); void consinit(void); int bus_mem_add_mapping(bus_addr_t, bus_size_t, @@ -504,10 +504,10 @@ allocsys(v) void setup_buffers(maxaddr) - vm_offset_t *maxaddr; + vaddr_t *maxaddr; { - vm_size_t size; - vm_offset_t addr; + vsize_t size; + vaddr_t addr; int base, residual, left, chunk, i; struct pglist pgs, saved_pgs; struct vm_page *pg; @@ -591,7 +591,7 @@ setup_buffers(maxaddr) * The rest of each buffer occupies virtual space, * but has no physical memory allocated for it. */ - addr = (vm_offset_t)buffers + i * MAXBSIZE; + addr = (vaddr_t)buffers + i * MAXBSIZE; for (size = PAGE_SIZE * (i < residual ? base + 1 : base); size > 0; size -= PAGE_SIZE, addr += PAGE_SIZE) { pmap_kenter_pa(addr, VM_PAGE_TO_PHYS(pg), @@ -1781,15 +1781,14 @@ cpu_dump() * getting on the dump stack, either when called above, or by * the auto-restart code. */ -static vm_offset_t dumpspace; +static vaddr_t dumpspace; -vm_offset_t -reserve_dumppages(p) - vm_offset_t p; +vaddr_t +reserve_dumppages(vaddr_t p) { dumpspace = p; - return (p + NBPG); + return (p + PAGE_SIZE); } void @@ -2021,10 +2020,10 @@ extern int IDTVEC(f00f_redirect); int cpu_f00f_bug = 0; void -fix_f00f() +fix_f00f(void) { struct region_descriptor region; - vm_offset_t va; + vaddr_t va; pt_entry_t *pte; void *p; @@ -2054,8 +2053,7 @@ fix_f00f() #endif void -init386(first_avail) - vm_offset_t first_avail; +init386(paddr_t first_avail) { int i; struct region_descriptor region; @@ -2141,7 +2139,7 @@ init386(first_avail) /* XXX here, until we can use bios for printfs */ /* call pmap initialization to make new kernel address space */ - pmap_bootstrap((vm_offset_t)atdevbase + IOM_SIZE); + pmap_bootstrap((vaddr_t)atdevbase + IOM_SIZE); /* Boot arguments are in a single page specified by /boot */ if (bootapiver & BAPIV_VECTOR) { @@ -2698,7 +2696,7 @@ bus_mem_add_mapping(bpa, size, cacheable, bshp) bus_space_handle_t *bshp; { u_long pa, endpa; - vm_offset_t va; + vaddr_t va; pt_entry_t *pte; pa = i386_trunc_page(bpa); @@ -3140,7 +3138,7 @@ _bus_dmamem_map(t, segs, nsegs, size, kvap, flags) caddr_t *kvap; int flags; { - vm_offset_t va; + vaddr_t va; bus_addr_t addr; int curseg; @@ -3184,7 +3182,7 @@ _bus_dmamem_unmap(t, kva, size) #endif size = round_page(size); - uvm_km_free(kernel_map, (vm_offset_t)kva, size); + uvm_km_free(kernel_map, (vaddr_t)kva, size); } /* @@ -3262,7 +3260,7 @@ _bus_dmamap_load_buffer(t, map, buf, buflen, p, flags, lastaddrp, segp, first) /* * Get the physical address for this segment. */ - pmap_extract(pmap, (vm_offset_t)vaddr, (paddr_t *)&curaddr); + pmap_extract(pmap, vaddr, (paddr_t *)&curaddr); /* * Compute the segment size, and adjust counts. @@ -3333,10 +3331,10 @@ _bus_dmamem_alloc_range(t, size, alignment, boundary, segs, nsegs, rsegs, int nsegs; int *rsegs; int flags; - vm_offset_t low; - vm_offset_t high; + paddr_t low; + paddr_t high; { - vm_offset_t curaddr, lastaddr; + paddr_t curaddr, lastaddr; struct vm_page *m; struct pglist mlist; int curseg, error; diff --git a/sys/arch/i386/i386/mem.c b/sys/arch/i386/i386/mem.c index 478a0931d4e..e5a77b94cc9 100644 --- a/sys/arch/i386/i386/mem.c +++ b/sys/arch/i386/i386/mem.c @@ -1,5 +1,5 @@ /* $NetBSD: mem.c,v 1.31 1996/05/03 19:42:19 christos Exp $ */ -/* $OpenBSD: mem.c,v 1.23 2002/03/14 01:26:32 millert Exp $ */ +/* $OpenBSD: mem.c,v 1.24 2003/01/16 04:15:17 art Exp $ */ /* * Copyright (c) 1988 University of Utah. * Copyright (c) 1982, 1986, 1990, 1993 @@ -125,14 +125,11 @@ mmclose(dev, flag, mode, p) /*ARGSUSED*/ int -mmrw(dev, uio, flags) - dev_t dev; - struct uio *uio; - int flags; +mmrw(dev_t dev, struct uio *uio, int flags) { - register vm_offset_t o, v; - register int c; - register struct iovec *iov; + vaddr_t o, v; + int c; + struct iovec *iov; int error = 0; static int physlock; @@ -161,15 +158,15 @@ mmrw(dev, uio, flags) /* minor device 0 is physical memory */ case 0: v = uio->uio_offset; - pmap_enter(pmap_kernel(), (vm_offset_t)vmmap, + pmap_enter(pmap_kernel(), (vaddr_t)vmmap, trunc_page(v), uio->uio_rw == UIO_READ ? VM_PROT_READ : VM_PROT_WRITE, PMAP_WIRED); pmap_update(pmap_kernel()); o = uio->uio_offset & PGOFSET; c = min(uio->uio_resid, (int)(NBPG - o)); error = uiomove((caddr_t)vmmap + o, c, uio); - pmap_remove(pmap_kernel(), (vm_offset_t)vmmap, - (vm_offset_t)vmmap + NBPG); + pmap_remove(pmap_kernel(), (vaddr_t)vmmap, + (vaddr_t)vmmap + NBPG); pmap_update(pmap_kernel()); continue; diff --git a/sys/arch/i386/i386/trap.c b/sys/arch/i386/i386/trap.c index ffd96d49161..8827ecd6a1d 100644 --- a/sys/arch/i386/i386/trap.c +++ b/sys/arch/i386/i386/trap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: trap.c,v 1.52 2003/01/09 22:27:09 miod Exp $ */ +/* $OpenBSD: trap.c,v 1.53 2003/01/16 04:15:17 art Exp $ */ /* $NetBSD: trap.c,v 1.95 1996/05/05 06:50:02 mycroft Exp $ */ /*- @@ -413,16 +413,15 @@ trap(frame) /* FALLTHROUGH */ case T_PAGEFLT|T_USER: { /* page fault */ - vm_offset_t va, fa; + vaddr_t va, fa; struct vmspace *vm = p->p_vmspace; struct vm_map *map; int rv; - extern struct vm_map *kernel_map; unsigned nss; if (vm == NULL) goto we_re_toast; - fa = (vm_offset_t)rcr2(); + fa = (vaddr_t)rcr2(); va = trunc_page(fa); /* * It is only a kernel address space fault iff: @@ -542,15 +541,14 @@ out: * Compensate for 386 brain damage (missing URKR) */ int -trapwrite(addr) - unsigned addr; +trapwrite(unsigned int addr) { - vm_offset_t va; + vaddr_t va; unsigned nss; struct proc *p; struct vmspace *vm; - va = trunc_page((vm_offset_t)addr); + va = trunc_page((vaddr_t)addr); if (va >= VM_MAXUSER_ADDRESS) return 1; diff --git a/sys/arch/i386/i386/vm_machdep.c b/sys/arch/i386/i386/vm_machdep.c index b9ea3359811..e77093d2039 100644 --- a/sys/arch/i386/i386/vm_machdep.c +++ b/sys/arch/i386/i386/vm_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vm_machdep.c,v 1.37 2002/06/11 22:15:12 wilfried Exp $ */ +/* $OpenBSD: vm_machdep.c,v 1.38 2003/01/16 04:15:17 art Exp $ */ /* $NetBSD: vm_machdep.c,v 1.61 1996/05/03 19:42:35 christos Exp $ */ /*- @@ -272,9 +272,9 @@ pagemove(from, to, size) #endif { if (otpte & PG_V) - pmap_update_pg((vm_offset_t) to); + pmap_update_pg((vaddr_t) to); if (ofpte & PG_V) - pmap_update_pg((vm_offset_t) from); + pmap_update_pg((vaddr_t) from); } from += PAGE_SIZE; @@ -291,12 +291,11 @@ pagemove(from, to, size) * Convert kernel VA to physical address */ int -kvtop(addr) - caddr_t addr; +kvtop(caddr_t addr) { - vm_offset_t pa; + paddr_t pa; - if (pmap_extract(pmap_kernel(), (vm_offset_t)addr, &pa) == FALSE) + if (pmap_extract(pmap_kernel(), (vaddr_t)addr, &pa) == FALSE) panic("kvtop: zero page frame"); return((int)pa); } @@ -320,17 +319,15 @@ kvtop(addr) * (a name with only slightly more meaning than "kernelmap") */ void -vmapbuf(bp, len) - struct buf *bp; - vm_size_t len; +vmapbuf(struct buf *bp, vsize_t len) { - vm_offset_t faddr, taddr, off; + vaddr_t faddr, taddr, off; paddr_t fpa; if ((bp->b_flags & B_PHYS) == 0) panic("vmapbuf"); faddr = trunc_page((vaddr_t)(bp->b_saveaddr = bp->b_data)); - off = (vm_offset_t)bp->b_data - faddr; + off = (vaddr_t)bp->b_data - faddr; len = round_page(off + len); taddr= uvm_km_valloc_wait(phys_map, len); bp->b_data = (caddr_t)(taddr + off); @@ -362,16 +359,14 @@ vmapbuf(bp, len) * We also invalidate the TLB entries and restore the original b_addr. */ void -vunmapbuf(bp, len) - struct buf *bp; - vm_size_t len; +vunmapbuf(struct buf *bp, vsize_t len) { - vm_offset_t addr, off; + vaddr_t addr, off; if ((bp->b_flags & B_PHYS) == 0) panic("vunmapbuf"); addr = trunc_page((vaddr_t)bp->b_data); - off = (vm_offset_t)bp->b_data - addr; + off = (vaddr_t)bp->b_data - addr; len = round_page(off + len); pmap_kremove(addr, len); pmap_update(pmap_kernel()); diff --git a/sys/arch/i386/include/bus.h b/sys/arch/i386/include/bus.h index 7ab5bc7ef48..17eb623e549 100644 --- a/sys/arch/i386/include/bus.h +++ b/sys/arch/i386/include/bus.h @@ -1,4 +1,4 @@ -/* $OpenBSD: bus.h,v 1.33 2002/03/14 01:26:33 millert Exp $ */ +/* $OpenBSD: bus.h,v 1.34 2003/01/16 04:16:00 art Exp $ */ /* $NetBSD: bus.h,v 1.6 1996/11/10 03:19:25 thorpej Exp $ */ /*- @@ -899,7 +899,7 @@ paddr_t _bus_dmamem_mmap(bus_dma_tag_t tag, bus_dma_segment_t *segs, int _bus_dmamem_alloc_range(bus_dma_tag_t tag, bus_size_t size, bus_size_t alignment, bus_size_t boundary, bus_dma_segment_t *segs, int nsegs, int *rsegs, int flags, - vm_offset_t low, vm_offset_t high); + paddr_t low, paddr_t high); #endif /* _I386_BUS_DMA_PRIVATE */ #endif /* _I386_BUS_H_ */ diff --git a/sys/arch/i386/include/cpu.h b/sys/arch/i386/include/cpu.h index 05256eaf371..373902d18ed 100644 --- a/sys/arch/i386/include/cpu.h +++ b/sys/arch/i386/include/cpu.h @@ -1,4 +1,4 @@ -/* $OpenBSD: cpu.h,v 1.44 2003/01/09 22:27:09 miod Exp $ */ +/* $OpenBSD: cpu.h,v 1.45 2003/01/16 04:16:00 art Exp $ */ /* $NetBSD: cpu.h,v 1.35 1996/05/05 19:29:26 christos Exp $ */ /*- @@ -207,7 +207,7 @@ void isa_defaultirq(void); int isa_nmi(void); /* pmap.c */ -void pmap_bootstrap(vm_offset_t); +void pmap_bootstrap(vaddr_t); /* vm_machdep.c */ int kvtop(caddr_t); diff --git a/sys/arch/i386/include/vmparam.h b/sys/arch/i386/include/vmparam.h index 29e4e4d689b..68ac4d12f71 100644 --- a/sys/arch/i386/include/vmparam.h +++ b/sys/arch/i386/include/vmparam.h @@ -1,4 +1,4 @@ -/* $OpenBSD: vmparam.h,v 1.24 2002/02/17 22:59:52 maja Exp $ */ +/* $OpenBSD: vmparam.h,v 1.25 2003/01/16 04:16:00 art Exp $ */ /* $NetBSD: vmparam.h,v 1.15 1994/10/27 04:16:34 cgd Exp $ */ /*- @@ -104,11 +104,11 @@ #define PTDPTDI PDSLOT_PTE /* user/kernel map constants */ -#define VM_MIN_ADDRESS ((vm_offset_t)0) -#define VM_MAXUSER_ADDRESS ((vm_offset_t)((PTDPTDI<<PDSHIFT) - USPACE)) -#define VM_MAX_ADDRESS ((vm_offset_t)((PTDPTDI<<PDSHIFT) + (PTDPTDI<<PGSHIFT))) -#define VM_MIN_KERNEL_ADDRESS ((vm_offset_t)KERNBASE) -#define VM_MAX_KERNEL_ADDRESS ((vm_offset_t)(APTDPTDI<<PDSHIFT)) +#define VM_MIN_ADDRESS ((vaddr_t)0) +#define VM_MAXUSER_ADDRESS ((vaddr_t)((PTDPTDI<<PDSHIFT) - USPACE)) +#define VM_MAX_ADDRESS ((vaddr_t)((PTDPTDI<<PDSHIFT) + (PTDPTDI<<PGSHIFT))) +#define VM_MIN_KERNEL_ADDRESS ((vaddr_t)KERNBASE) +#define VM_MAX_KERNEL_ADDRESS ((vaddr_t)(APTDPTDI<<PDSHIFT)) /* virtual sizes (bytes) for various kernel submaps */ #define VM_PHYS_SIZE (USRIOSIZE*PAGE_SIZE) |