Subject: Proposed elimination of vm_pmap
To: None <tech-kern@NetBSD.ORG>
From: Gordon W. Ross <gwr@mc.com>
List: tech-kern
Date: 05/12/1997 20:28:57
I propose the elimination of the member vm_pmap in struct vmspace,
because that member (which has type pmap) causes struct vmspace to
have varying size depending on the pmap implementation.  Further,
the XXX marks found near most references to vm_pmap imply that the
use of that member was not intended as a permanent thing.

It is fairly easy to eliminate that member by asking the pmap code
to allocate a pmap when we need one, and fixing other references to
use vm_map.pmap instead.  There were some port-specific files I did
not want to play with, in which case a __VM_PMAP_HACK define in the
pmap.h for the port offers a temporary "stay of execution" for the
vm_pmap member.

Port masters should eliminate the __VM_PMAP_HACK definition in pmap.h
and make sure the kernel still builds and runs.  (Changes for all the
m68k ports are included below.)

I've attached the proposed changes below.
Please let me know if there are objections.

Thanks,
Gordon


cvs diff -c sys/vm/vm.h
Index: sys/vm/vm.h
===================================================================
RCS file: /cvsroot/src/sys/vm/vm.h,v
retrieving revision 1.13
diff -c -r1.13 vm.h
*** vm.h	1994/06/29 06:47:52	1.13
--- vm.h	1997/05/13 00:18:06
***************
*** 76,82 ****
--- 76,85 ----
   */
  struct vmspace {
  	struct	vm_map vm_map;	/* VM address map */
+ #ifdef	__VM_PMAP_HACK
+ 	/* XXX - All should use vm_map.pmap instead. */
  	struct	pmap vm_pmap;	/* private physical map */
+ #endif
  	int	vm_refcnt;	/* number of references */
  	caddr_t	vm_shm;		/* SYS5 shared memory private data XXX */
  /* we copy from vm_startcopy to the end of the structure on fork */
***************
*** 90,93 ****
--- 93,103 ----
  	caddr_t	vm_daddr;	/* user virtual address of data XXX */
  	caddr_t vm_maxsaddr;	/* user VA at max stack growth */
  };
+ 
+ #ifdef	pmap_resident_count
+ #define vm_resident_count(vm) (pmap_resident_count((vm)->vm_map.pmap))
+ #else
+ #define vm_resident_count(vm) ((vm)->vm_rssize)
+ #endif
+ 
  #endif /* VM_H */
cvs diff -c sys/vm/vm_map.c
Index: sys/vm/vm_map.c
===================================================================
RCS file: /cvsroot/src/sys/vm/vm_map.c,v
retrieving revision 1.26
diff -c -r1.26 vm_map.c
*** vm_map.c	1997/02/25 23:27:08	1.26
--- vm_map.c	1997/05/13 00:18:15
***************
*** 186,196 ****
  {
  	register struct vmspace *vm;
  
! 	MALLOC(vm, struct vmspace *, sizeof(struct vmspace), M_VMMAP, M_WAITOK);
! 	bzero(vm, (caddr_t) &vm->vm_startcopy - (caddr_t) vm);
  	vm_map_init(&vm->vm_map, min, max, pageable);
! 	pmap_pinit(&vm->vm_pmap);
  	vm->vm_map.pmap = &vm->vm_pmap;		/* XXX */
  	vm->vm_refcnt = 1;
  	return (vm);
  }
--- 186,202 ----
  {
  	register struct vmspace *vm;
  
! 	vm = (struct vmspace *)
! 		malloc(sizeof(struct vmspace), M_VMMAP, M_WAITOK);
! 	/* Just clear the whole struct.  It is not large anyway. */
! 	bzero(vm, sizeof(*vm));
  	vm_map_init(&vm->vm_map, min, max, pageable);
! #ifdef	__VM_PMAP_HACK
! 	pmap_pinit(&vm->vm_pmap);		/* XXX */
  	vm->vm_map.pmap = &vm->vm_pmap;		/* XXX */
+ #else	/* __VM_PMAP_HACK */
+ 	vm->vm_map.pmap = pmap_create(0);
+ #endif	/* __VM_PMAP_HACK */
  	vm->vm_refcnt = 1;
  	return (vm);
  }
***************
*** 209,215 ****
  		vm_map_lock(&vm->vm_map);
  		(void) vm_map_delete(&vm->vm_map, vm->vm_map.min_offset,
  		    vm->vm_map.max_offset);
! 		pmap_release(&vm->vm_pmap);
  		FREE(vm, M_VMMAP);
  	}
  }
--- 215,226 ----
  		vm_map_lock(&vm->vm_map);
  		(void) vm_map_delete(&vm->vm_map, vm->vm_map.min_offset,
  		    vm->vm_map.max_offset);
! #ifdef	__VM_PMAP_HACK
! 		pmap_release(&vm->vm_pmap); 	/* XXX */
! #else	/* __VM_PMAP_HACK */
! 		pmap_destroy(vm->vm_map.pmap);
! 		vm->vm_map.pmap = NULL;
! #endif	/* __VM_PMAP_HACK */
  		FREE(vm, M_VMMAP);
  	}
  }
***************
*** 2128,2135 ****
  	    old_map->entries_pageable);
  	bcopy(&vm1->vm_startcopy, &vm2->vm_startcopy,
  	    (caddr_t) (vm1 + 1) - (caddr_t) &vm1->vm_startcopy);
- 	new_pmap = &vm2->vm_pmap;		/* XXX */
  	new_map = &vm2->vm_map;			/* XXX */
  
  	old_entry = old_map->header.next;
  
--- 2139,2146 ----
  	    old_map->entries_pageable);
  	bcopy(&vm1->vm_startcopy, &vm2->vm_startcopy,
  	    (caddr_t) (vm1 + 1) - (caddr_t) &vm1->vm_startcopy);
  	new_map = &vm2->vm_map;			/* XXX */
+ 	new_pmap = new_map->pmap;
  
  	old_entry = old_map->header.next;
  
cvs diff -c sys/kern/init_main.c
Index: sys/kern/init_main.c
===================================================================
RCS file: /cvsroot/src/sys/kern/init_main.c,v
retrieving revision 1.98
diff -c -r1.98 init_main.c
*** init_main.c	1997/03/26 22:38:45	1.98
--- init_main.c	1997/05/13 00:18:22
***************
*** 240,251 ****
  	limit0.p_refcnt = 1;
  
  	/* Allocate a prototype map so we have something to fork. */
! 	p->p_vmspace = &vmspace0;
! 	vmspace0.vm_refcnt = 1;
! 	pmap_pinit(&vmspace0.vm_pmap);
! 	vm_map_init(&p->p_vmspace->vm_map, round_page(VM_MIN_ADDRESS),
! 	    trunc_page(VM_MAX_ADDRESS), TRUE);
! 	vmspace0.vm_map.pmap = &vmspace0.vm_pmap;
  	p->p_addr = proc0paddr;				/* XXX */
  
  	/*
--- 240,248 ----
  	limit0.p_refcnt = 1;
  
  	/* Allocate a prototype map so we have something to fork. */
! 	p->p_vmspace = vmspace_alloc(round_page(VM_MIN_ADDRESS),
! 				     trunc_page(VM_MAX_ADDRESS), TRUE);
! 
  	p->p_addr = proc0paddr;				/* XXX */
  
  	/*
cvs diff -c sys/kern/kern_sysctl.c
Index: sys/kern/kern_sysctl.c
===================================================================
RCS file: /cvsroot/src/sys/kern/kern_sysctl.c,v
retrieving revision 1.25
diff -c -r1.25 kern_sysctl.c
*** kern_sysctl.c	1997/03/21 06:50:48	1.25
--- kern_sysctl.c	1997/05/13 00:18:31
***************
*** 726,740 ****
  	} else {
  		register struct vmspace *vm = p->p_vmspace;
  
! #ifdef pmap_resident_count
! 		ep->e_vm.vm_rssize = pmap_resident_count(&vm->vm_pmap); /*XXX*/
! #else
! 		ep->e_vm.vm_rssize = vm->vm_rssize;
! #endif
  		ep->e_vm.vm_tsize = vm->vm_tsize;
  		ep->e_vm.vm_dsize = vm->vm_dsize;
  		ep->e_vm.vm_ssize = vm->vm_ssize;
- 		ep->e_vm.vm_pmap = vm->vm_pmap;
  	}
  	if (p->p_pptr)
  		ep->e_ppid = p->p_pptr->p_pid;
--- 726,735 ----
  	} else {
  		register struct vmspace *vm = p->p_vmspace;
  
! 		ep->e_vm.vm_rssize = vm_resident_count(vm);
  		ep->e_vm.vm_tsize = vm->vm_tsize;
  		ep->e_vm.vm_dsize = vm->vm_dsize;
  		ep->e_vm.vm_ssize = vm->vm_ssize;
  	}
  	if (p->p_pptr)
  		ep->e_ppid = p->p_pptr->p_pid;
cvs diff -c sys/kern/tty.c
Index: sys/kern/tty.c
===================================================================
RCS file: /cvsroot/src/sys/kern/tty.c,v
retrieving revision 1.89
diff -c -r1.89 tty.c
*** tty.c	1997/04/07 16:09:28	1.89
--- tty.c	1997/05/13 00:18:39
***************
*** 1926,1942 ****
  		    stime.tv_usec / 10000);
  
  #define	pgtok(a)	(((u_long) ((a) * NBPG) / 1024))
! 		/* Print percentage cpu, resident set size. */
  		tmp = (pick->p_pctcpu * 10000 + FSCALE / 2) >> FSHIFT;
! 		ttyprintf(tp, "%d%% %ldk\n",
! 		    tmp / 100,
! 		    pick->p_stat == SIDL || pick->p_stat == SZOMB ? 0 :
! #ifdef pmap_resident_count
! 			pgtok(pmap_resident_count(&pick->p_vmspace->vm_pmap))
! #else
! 			pgtok(pick->p_vmspace->vm_rssize)
! #endif
! 			);
  	}
  	tp->t_rocount = 0;	/* so pending input will be retyped if BS */
  }
--- 1926,1943 ----
  		    stime.tv_usec / 10000);
  
  #define	pgtok(a)	(((u_long) ((a) * NBPG) / 1024))
! 		/* Print percentage cpu. */
  		tmp = (pick->p_pctcpu * 10000 + FSCALE / 2) >> FSHIFT;
! 		ttyprintf(tp, "%d%% ", tmp / 100);
! 
! 		/* Print resident set size. */
! 		if (pick->p_stat == SIDL || pick->p_stat == SZOMB)
! 			tmp = 0;
! 		else {
! 			register struct vmspace *vm = pick->p_vmspace;
! 			tmp = pgtok(vm_resident_count(vm));
! 		}
! 		ttyprintf(tp, "%ldk\n", tmp);
  	}
  	tp->t_rocount = 0;	/* so pending input will be retyped if BS */
  }
cvs diff -c sys/arch/alpha/include/pmap.new.h
Index: sys/arch/alpha/include/pmap.new.h
===================================================================
RCS file: /cvsroot/src/sys/arch/alpha/include/pmap.new.h,v
retrieving revision 1.4
diff -c -r1.4 pmap.new.h
*** pmap.new.h	1997/04/06 08:47:34	1.4
--- pmap.new.h	1997/05/13 00:18:47
***************
*** 358,361 ****
--- 358,363 ----
   */
  extern pmap_t		kernel_pmap;	/* pointer to the kernel pmap	*/
  
+ #define	__VM_PMAP_HACK
+ 
  #endif	_PMAP_MACHINE_
cvs diff -c sys/arch/alpha/include/pmap.old.h
Index: sys/arch/alpha/include/pmap.old.h
===================================================================
RCS file: /cvsroot/src/sys/arch/alpha/include/pmap.old.h,v
retrieving revision 1.8
diff -c -r1.8 pmap.old.h
*** pmap.old.h	1997/04/11 05:45:39	1.8
--- pmap.old.h	1997/05/13 00:18:53
***************
*** 195,198 ****
--- 195,200 ----
  void	pmap_unmap_prom __P((void));
  #endif /* _KERNEL */
  
+ #define	__VM_PMAP_HACK
+ 
  #endif /* _PMAP_MACHINE_ */
cvs diff -c sys/arch/amiga/amiga/genassym.c
Index: sys/arch/amiga/amiga/genassym.c
===================================================================
RCS file: /cvsroot/src/sys/arch/amiga/amiga/genassym.c,v
retrieving revision 1.31
diff -c -r1.31 genassym.c
*** genassym.c	1997/02/02 18:37:16	1.31
--- genassym.c	1997/05/13 00:19:01
***************
*** 105,111 ****
  	
  	printf("#define\tPM_STCHG %p\n", (void *)&pmap->pm_stchanged);
  
! 	printf("#define\tVM_PMAP %p\n", (void *)&vms->vm_pmap);
  	printf("#define\tV_INTR %p\n", (void *)&vm->v_intr);
  	
  	printf("#define\tUPAGES %d\n", UPAGES);
--- 105,111 ----
  	
  	printf("#define\tPM_STCHG %p\n", (void *)&pmap->pm_stchanged);
  
! 	printf("#define\tVM_PMAP %p\n", (void *)&vms->vm_map.pmap);
  	printf("#define\tV_INTR %p\n", (void *)&vm->v_intr);
  	
  	printf("#define\tUPAGES %d\n", UPAGES);
cvs diff -c sys/arch/amiga/amiga/locore.s
Index: sys/arch/amiga/amiga/locore.s
===================================================================
RCS file: /cvsroot/src/sys/arch/amiga/amiga/locore.s,v
retrieving revision 1.79
diff -c -r1.79 locore.s
*** locore.s	1997/04/25 01:35:45	1.79
--- locore.s	1997/05/13 00:19:08
***************
*** 1256,1262 ****
  	tstl	a0			| map == VM_MAP_NULL?
  	jeq	Lbadsw			| panic
  #endif
! 	lea	a0@(VM_PMAP),a0		| pmap = &vmspace.vm_pmap
  	tstl	a0@(PM_STCHG)		| pmap->st_changed?
  	jeq	Lswnochg		| no, skip
  	pea	a1@			| push pcb (at p_addr)
--- 1256,1262 ----
  	tstl	a0			| map == VM_MAP_NULL?
  	jeq	Lbadsw			| panic
  #endif
! 	movl	a0@(VM_PMAP),a0		| pmap = vmspace->vm_map.pmap
  	tstl	a0@(PM_STCHG)		| pmap->st_changed?
  	jeq	Lswnochg		| no, skip
  	pea	a1@			| push pcb (at p_addr)
cvs diff -c sys/arch/arm32/include/pmap.h
Index: sys/arch/arm32/include/pmap.h
===================================================================
RCS file: /cvsroot/src/sys/arch/arm32/include/pmap.h,v
retrieving revision 1.5
diff -c -r1.5 pmap.h
*** pmap.h	1997/01/26 01:34:45	1.5
--- pmap.h	1997/05/13 00:19:15
***************
*** 127,132 ****
--- 127,135 ----
  }
  
  #endif	/* _KERNEL */
+ 
+ #define	__VM_PMAP_HACK
+ 
  #endif	/* _ARM32_PMAP_H_ */
  
  /* End of pmap.h */
cvs diff -c sys/arch/atari/atari/genassym.cf
Index: sys/arch/atari/atari/genassym.cf
===================================================================
RCS file: /cvsroot/src/sys/arch/atari/atari/genassym.cf,v
retrieving revision 1.1
diff -c -r1.1 genassym.cf
*** genassym.cf	1997/03/17 13:23:15	1.1
--- genassym.cf	1997/05/13 00:19:25
***************
*** 88,94 ****
  define	PM_STCHG		offsetof(struct pmap, pm_stchanged)
  
  # VM structure fields
! define	VM_PMAP			offsetof(struct vmspace, vm_pmap)
  
  # interrupt/fault metering
  define	V_INTR			offsetof(struct vmmeter, v_intr)
--- 88,94 ----
  define	PM_STCHG		offsetof(struct pmap, pm_stchanged)
  
  # VM structure fields
! define	VM_PMAP			offsetof(struct vmspace, vm_map.pmap)
  
  # interrupt/fault metering
  define	V_INTR			offsetof(struct vmmeter, v_intr)
cvs diff -c sys/arch/atari/atari/locore.s
Index: sys/arch/atari/atari/locore.s
===================================================================
RCS file: /cvsroot/src/sys/arch/atari/atari/locore.s,v
retrieving revision 1.37
diff -c -r1.37 locore.s
*** locore.s	1997/04/25 01:37:27	1.37
--- locore.s	1997/05/13 00:19:33
***************
*** 1104,1110 ****
  	tstl	a0			|  map == VM_MAP_NULL? 
  	jeq	Lbadsw			|  panic 
  #endif
! 	lea	a0@(VM_PMAP),a0		|  pmap = &vmspace.vm_pmap 
  	tstl	a0@(PM_STCHG)		|  pmap->st_changed? 
  	jeq	Lswnochg		|  no, skip 
  	pea	a1@			|  push pcb (at p_addr) 
--- 1104,1110 ----
  	tstl	a0			|  map == VM_MAP_NULL? 
  	jeq	Lbadsw			|  panic 
  #endif
! 	movl	a0@(VM_PMAP),a0		|  pmap = vmspace->vm_map.pmap
  	tstl	a0@(PM_STCHG)		|  pmap->st_changed? 
  	jeq	Lswnochg		|  no, skip 
  	pea	a1@			|  push pcb (at p_addr) 
cvs diff -c sys/arch/hp300/hp300/genassym.cf
Index: sys/arch/hp300/hp300/genassym.cf
===================================================================
RCS file: /cvsroot/src/sys/arch/hp300/hp300/genassym.cf,v
retrieving revision 1.7
diff -c -r1.7 genassym.cf
*** genassym.cf	1997/05/05 21:12:49	1.7
--- genassym.cf	1997/05/13 00:19:40
***************
*** 149,155 ****
  define	SRUN			SRUN
  
  # VM structure fields
! define	VM_PMAP			offsetof(struct vmspace, vm_pmap)
  define	PM_STCHG		offsetof(struct pmap, pm_stchanged)
  
  # interrupt/fault metering
--- 149,155 ----
  define	SRUN			SRUN
  
  # VM structure fields
! define	VM_PMAP			offsetof(struct vmspace, vm_map.pmap)
  define	PM_STCHG		offsetof(struct pmap, pm_stchanged)
  
  # interrupt/fault metering
cvs diff -c sys/arch/hp300/hp300/locore.s
Index: sys/arch/hp300/hp300/locore.s
===================================================================
RCS file: /cvsroot/src/sys/arch/hp300/hp300/locore.s,v
retrieving revision 1.73
diff -c -r1.73 locore.s
*** locore.s	1997/05/05 21:14:04	1.73
--- locore.s	1997/05/13 00:19:48
***************
*** 1212,1218 ****
  	tstl	a0			| map == VM_MAP_NULL?
  	jeq	Lbadsw			| panic
  #endif
! 	lea	a0@(VM_PMAP),a0		| pmap = &vmspace.vm_pmap
  	tstl	a0@(PM_STCHG)		| pmap->st_changed?
  	jeq	Lswnochg		| no, skip
  	pea	a1@			| push pcb (at p_addr)
--- 1212,1218 ----
  	tstl	a0			| map == VM_MAP_NULL?
  	jeq	Lbadsw			| panic
  #endif
! 	movl	a0@(VM_PMAP),a0		| pmap = vmspace->vm_map.pmap
  	tstl	a0@(PM_STCHG)		| pmap->st_changed?
  	jeq	Lswnochg		| no, skip
  	pea	a1@			| push pcb (at p_addr)
cvs diff -c sys/arch/i386/include/pmap.h
Index: sys/arch/i386/include/pmap.h
===================================================================
RCS file: /cvsroot/src/sys/arch/i386/include/pmap.h,v
retrieving revision 1.24
diff -c -r1.24 pmap.h
*** pmap.h	1996/11/18 01:08:01	1.24
--- pmap.h	1997/05/13 00:19:54
***************
*** 204,207 ****
--- 204,209 ----
  
  #endif	/* _KERNEL */
  
+ #define	__VM_PMAP_HACK
+ 
  #endif /* _I386_PMAP_H_ */
cvs diff -c sys/arch/mac68k/mac68k/genassym.cf
Index: sys/arch/mac68k/mac68k/genassym.cf
===================================================================
RCS file: /cvsroot/src/sys/arch/mac68k/mac68k/genassym.cf,v
retrieving revision 1.1
diff -c -r1.1 genassym.cf
*** genassym.cf	1997/04/15 06:11:40	1.1
--- genassym.cf	1997/05/13 00:20:01
***************
*** 72,78 ****
  
  define	PM_STCHG		offsetof(struct pmap, pm_stchanged)
  
! define	VM_PMAP 		offsetof(struct vmspace, vm_pmap)
  define	V_SWTCH 		offsetof(struct vmmeter, v_swtch)
  define	V_TRAP			offsetof(struct vmmeter, v_trap)
  define	V_SYSCALL		offsetof(struct vmmeter, v_syscall)
--- 72,78 ----
  
  define	PM_STCHG		offsetof(struct pmap, pm_stchanged)
  
! define	VM_PMAP 		offsetof(struct vmspace, vm_map.pmap)
  define	V_SWTCH 		offsetof(struct vmmeter, v_swtch)
  define	V_TRAP			offsetof(struct vmmeter, v_trap)
  define	V_SYSCALL		offsetof(struct vmmeter, v_syscall)
cvs diff -c sys/arch/mac68k/mac68k/locore.s
Index: sys/arch/mac68k/mac68k/locore.s
===================================================================
RCS file: /cvsroot/src/sys/arch/mac68k/mac68k/locore.s,v
retrieving revision 1.78
diff -c -r1.78 locore.s
*** locore.s	1997/04/25 01:39:06	1.78
--- locore.s	1997/05/13 00:20:08
***************
*** 1139,1145 ****
  	tstl	a0			| map == VM_MAP_NULL?
  	jeq	Lbadsw			| panic
  #endif /* DIAGNOSTIC */
! 	lea	a0@(VM_PMAP),a0		| pmap = &vmspace.vm_pmap
  	tstl	a0@(PM_STCHG)		| pmap->st_changed?
  	jeq	Lswnochg		| no, skip
  	pea	a1@			| push pcb (at p_addr)
--- 1139,1145 ----
  	tstl	a0			| map == VM_MAP_NULL?
  	jeq	Lbadsw			| panic
  #endif /* DIAGNOSTIC */
! 	movl	a0@(VM_PMAP),a0		| pmap = vmspace->vm_map.pmap
  	tstl	a0@(PM_STCHG)		| pmap->st_changed?
  	jeq	Lswnochg		| no, skip
  	pea	a1@			| push pcb (at p_addr)
cvs diff -c sys/arch/mips/include/pmap.h
Index: sys/arch/mips/include/pmap.h
===================================================================
RCS file: /cvsroot/src/sys/arch/mips/include/pmap.h,v
retrieving revision 1.9
diff -c -r1.9 pmap.h
*** pmap.h	1996/03/19 04:15:15	1.9
--- pmap.h	1997/05/13 00:20:15
***************
*** 102,105 ****
--- 102,107 ----
  #define pmap_kernel()		(&kernel_pmap_store)
  #endif	/* _KERNEL */
  
+ #define	__VM_PMAP_HACK
+ 
  #endif	/* _PMAP_MACHINE_ */
cvs diff -c sys/arch/mvme68k/mvme68k/genassym.cf
Index: sys/arch/mvme68k/mvme68k/genassym.cf
===================================================================
RCS file: /cvsroot/src/sys/arch/mvme68k/mvme68k/genassym.cf,v
retrieving revision 1.2
diff -c -r1.2 genassym.cf
*** genassym.cf	1997/03/13 04:37:20	1.2
--- genassym.cf	1997/05/13 00:20:22
***************
*** 129,135 ****
  define	SRUN			SRUN
  
  # VM structure fields
! define	VM_PMAP			offsetof(struct vmspace, vm_pmap)
  define	PM_STCHG		offsetof(struct pmap, pm_stchanged)
  
  # interrupt/fault metering
--- 129,135 ----
  define	SRUN			SRUN
  
  # VM structure fields
! define	VM_PMAP			offsetof(struct vmspace, vm_map.pmap)
  define	PM_STCHG		offsetof(struct pmap, pm_stchanged)
  
  # interrupt/fault metering
cvs diff -c sys/arch/mvme68k/mvme68k/locore.s
Index: sys/arch/mvme68k/mvme68k/locore.s
===================================================================
RCS file: /cvsroot/src/sys/arch/mvme68k/mvme68k/locore.s,v
retrieving revision 1.22
diff -c -r1.22 locore.s
*** locore.s	1997/04/25 01:42:51	1.22
--- locore.s	1997/05/13 00:20:29
***************
*** 1064,1070 ****
  	tstl	a0			| map == VM_MAP_NULL?
  	jeq	Lbadsw			| panic
  #endif
! 	lea	a0@(VM_PMAP),a0		| pmap = &vmspace.vm_pmap
  	tstl	a0@(PM_STCHG)		| pmap->st_changed?
  	jeq	Lswnochg		| no, skip
  	pea	a1@			| push pcb (at p_addr)
--- 1064,1070 ----
  	tstl	a0			| map == VM_MAP_NULL?
  	jeq	Lbadsw			| panic
  #endif
! 	movl	a0@(VM_PMAP),a0		| pmap = vmspace->vm_map.pmap
  	tstl	a0@(PM_STCHG)		| pmap->st_changed?
  	jeq	Lswnochg		| no, skip
  	pea	a1@			| push pcb (at p_addr)
cvs diff -c sys/arch/pc532/include/pmap.h
Index: sys/arch/pc532/include/pmap.h
===================================================================
RCS file: /cvsroot/src/sys/arch/pc532/include/pmap.h,v
retrieving revision 1.14
diff -c -r1.14 pmap.h
*** pmap.h	1997/03/20 12:02:42	1.14
--- pmap.h	1997/05/13 00:20:35
***************
*** 202,205 ****
--- 202,207 ----
  
  #endif	/* _KERNEL */
  
+ #define	__VM_PMAP_HACK
+ 
  #endif /* _NS532_PMAP_H_ */
cvs diff -c sys/arch/powerpc/include/pmap.h
Index: sys/arch/powerpc/include/pmap.h
===================================================================
RCS file: /cvsroot/src/sys/arch/powerpc/include/pmap.h,v
retrieving revision 1.1
diff -c -r1.1 pmap.h
*** pmap.h	1996/09/30 16:34:29	1.1
--- pmap.h	1997/05/13 00:20:44
***************
*** 74,77 ****
--- 74,80 ----
  
  #endif	/* _KERNEL */
  #endif	/* _LOCORE */
+ 
+ #define	__VM_PMAP_HACK
+ 
  #endif	/* _MACHINE_PMAP_H_ */
cvs diff -c sys/arch/sparc/include/pmap.h
Index: sys/arch/sparc/include/pmap.h
===================================================================
RCS file: /cvsroot/src/sys/arch/sparc/include/pmap.h,v
retrieving revision 1.24
diff -c -r1.24 pmap.h
*** pmap.h	1996/05/27 20:29:03	1.24
--- pmap.h	1997/05/13 00:20:55
***************
*** 369,372 ****
--- 369,374 ----
  
  #endif /* _KERNEL */
  
+ #define	__VM_PMAP_HACK
+ 
  #endif /* _SPARC_PMAP_H_ */
cvs diff -c sys/arch/vax/include/pmap.h
Index: sys/arch/vax/include/pmap.h
===================================================================
RCS file: /cvsroot/src/sys/arch/vax/include/pmap.h,v
retrieving revision 1.17
diff -c -r1.17 pmap.h
*** pmap.h	1996/07/20 17:58:22	1.17
--- pmap.h	1997/05/13 00:21:02
***************
*** 122,125 ****
--- 122,128 ----
  void	pmap_bootstrap __P((void));
  void	pmap_expandp0 __P((struct pmap *, int));
  void	pmap_expandp1 __P((struct pmap *));
+ 
+ #define	__VM_PMAP_HACK
+ 
  #endif PMAP_H
cvs diff -c sys/arch/x68k/x68k/genassym.c
Index: sys/arch/x68k/x68k/genassym.c
===================================================================
RCS file: /cvsroot/src/sys/arch/x68k/x68k/genassym.c,v
retrieving revision 1.6
diff -c -r1.6 genassym.c
*** genassym.c	1997/01/20 15:15:20	1.6
--- genassym.c	1997/05/13 00:21:15
***************
*** 149,155 ****
  	def("SRUN", SRUN);
  
  	/* VM structure fields */
! 	off("VM_PMAP", struct vmspace, vm_pmap);
  	off("PM_STCHG", struct pmap, pm_stchanged);
  
  	/* interrupt/fault metering */
--- 149,155 ----
  	def("SRUN", SRUN);
  
  	/* VM structure fields */
! 	off("VM_PMAP", struct vmspace, vm_map.pmap);
  	off("PM_STCHG", struct pmap, pm_stchanged);
  
  	/* interrupt/fault metering */
cvs diff -c sys/arch/x68k/x68k/locore.s
Index: sys/arch/x68k/x68k/locore.s
===================================================================
RCS file: /cvsroot/src/sys/arch/x68k/x68k/locore.s,v
retrieving revision 1.17
diff -c -r1.17 locore.s
*** locore.s	1997/04/25 01:53:09	1.17
--- locore.s	1997/05/13 00:21:22
***************
*** 1301,1307 ****
  	tstl	a0			| map == VM_MAP_NULL?
  	jeq	Lbadsw			| panic
  #endif
! 	lea	a0@(VM_PMAP),a0		| pmap = &vmspace.vm_pmap
  	tstl	a0@(PM_STCHG)		| pmap->st_changed?
  	jeq	Lswnochg		| no, skip
  	pea	a1@			| push pcb (at p_addr)
--- 1301,1307 ----
  	tstl	a0			| map == VM_MAP_NULL?
  	jeq	Lbadsw			| panic
  #endif
! 	movl	a0@(VM_PMAP),a0		| pmap = vmspace->vm_map.pmap
  	tstl	a0@(PM_STCHG)		| pmap->st_changed?
  	jeq	Lswnochg		| no, skip
  	pea	a1@			| push pcb (at p_addr)