resume:
ifdef(`M68881',
`
	set	allfpi,0xff
	tst.w	do_fpu		# is an fpu present?
	beq.b	no_fpu1
				# Yes, so halt prev. process use of 881 fpu
	mov.l	fpu_ptr,%a0
	btst	&0,3(%a0)		# if UFPRWRT is false,
	bne.b	L%43
#	fmovm.x	&0,(%a0)	# ==> kludge until 881 fsave bugs are fixed
					# (no sdb-updated info in u-vector)
	fsave	124(%a0)		# then save the 881 internal state
	tst.b	124(%a0)		# is the internal state null?
	beq.b	L%43
	fmovm.x	&allfpi,16(%a0)		# No, so save fp0..fp7
	fmovm.l	%control,%status,%iaddr,112(%a0) # and 881 system regs
L%43:
no_fpu1:
')dnl
	set FC_S, 4			# generic supervisor function code

	mov.w	%sr,%d0		# save current PS
	mov.w	&HIGHPRI,%sr	# inhibit interrupts

	mov.l	8(%sp),%a0	# address of save_area
	mov.l	4(%sp),%a1	# address of new "u" areas PTEs
	mov.l	u_pte,%a2	# address of global "u" areas PTEs
	mov.l	&u,%a3		# logical addrress of u-block
	mov.l	&(U_SIZE/GRAIN)-1,%d1	# size of u-block in pages minus 1
L%umap:
	mov.l	(%a1)+,(%a2)+	# update the system page tables
							# flush u-block entries from the ATC
	short	0xf013			# pflush &FC_S,mask=4,(%a3)
	short	0x3895
	add.w	&U_SIZE,%a3
	dbra	%d1,L%umap
#
	mov.l	%cacr,%d2
	or.w	&0x0800,%d2	# clear data cache
	mov.l	%d2,%cacr

	movm.l	(%a0),&REGMASK	# restore previous a7-a1,d7-d2
	mov.w	%d0,%sr		# restore priority
ifdef(`M68881',
`
	tst.w	do_fpu		# is an fpu present?
	beq.b	no_fpu2		 # Yes, so start next processs use of 881 fpu
	mov.l	fpu_ptr,%a0
	tst.b	124(%a0)	# Is prev. 881 internal state null?
	beq.b	L%47
	fmovm.x	16(%a0),&allfpi	# No, so reset fp0..fp7
	fmovm.l	112(%a0),%control,%status,%iaddr # and 881 system regs
	frestore 124(%a0)	# restore 881 from u.u_fpu.fsave
	and.l	&-2,(%a0)	# turn off UFPRWRT in u.u_fpu.ustate
	bra.b	L%49
L%47:					# Yes, 881s internal state was null
	frestore 124(%a0)		# restore 881 from u.u_fpu.fsave
	btst	&0,3(%a0)		# was the UFPRWRT flag set by ptrace?
	beq.b	L%49
	fmovm.x	16(%a0),&allfpi		# Yes, so set fp0..fp7
	fmovm.l	112(%a0),%control,%status,%iaddr # and 881 system regs
					# from u.u_fpu.regs
	and.l	&-2,(%a0)		# turn off UFPRWRT in u.u_fpu.ustate
L%49:
no_fpu2:
')dnl
	mov.l	&1,%d0		# return (1)
	jmp	(%a1)
