Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 13 Oct 2006 14:29:48 GMT
From:      Oleksandr Tymoshenko <gonzo@FreeBSD.org>
To:        Perforce Change Reviews <perforce@FreeBSD.org>
Subject:   PERFORCE change 107823 for review
Message-ID:  <200610131429.k9DETmux033115@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=107823

Change 107823 by gonzo@gonzo_hq on 2006/10/13 14:29:01

	o More symbols in genassym.c for assembler routines:
	    - PTE for realstack
	    - realstack address
	    - segments boundaries
	o Wire realstack pages to prevent exceptions in TLBMiss'es generated
	    by userland pages access.

Affected files ...

.. //depot/projects/mips2/src/sys/mips/mips/genassym.c#3 edit
.. //depot/projects/mips2/src/sys/mips/mips/swtch.S#5 edit

Differences ...

==== //depot/projects/mips2/src/sys/mips/mips/genassym.c#3 (text+ko) ====

@@ -59,15 +59,14 @@
 #include <sys/proc.h>
 #include <net/if.h>
 #include <netinet/in.h>
-#include <nfs/nfsproto.h>
-#include <nfs/rpcv2.h>
-#include <nfsclient/nfs.h>
-#include <nfsclient/nfsdiskless.h>
 
 #include <machine/locore.h>
 #include <machine/pcb.h>
 #include <machine/reg.h>
 
+ASSYM(MIPS_KSEG0_START, MIPS_KSEG0_START);
+ASSYM(MIPS_KSSEG_START, MIPS_KSSEG_START);
+ASSYM(MIPS_PG_G, PG_G);
 ASSYM(P_VMSPACE, offsetof(struct proc, p_vmspace));
 ASSYM(PC_CURTHREAD, offsetof(struct pcpu, pc_curthread));
 ASSYM(PC_CURPCB, offsetof(struct pcpu, pc_curpcb));
@@ -84,6 +83,9 @@
 ASSYM(TD_PROC, offsetof(struct thread, td_proc));
 
 ASSYM(TD_MD_REGS, offsetof(struct thread, td_md.md_regs));
+ASSYM(TD_MD_REALSTACK, offsetof(struct thread, td_md.md_realstack));
+ASSYM(TD_MD_PTE0, offsetof(struct thread, td_md.md_stack_pte[0]));
+ASSYM(TD_MD_PTE1, offsetof(struct thread, td_md.md_stack_pte[1]));
 
 ASSYM(FRAME_SIZ, sizeof(struct frame));
 ASSYM(FRAME_ZERO, offsetof(struct frame, f_regs[ZERO]));

==== //depot/projects/mips2/src/sys/mips/mips/swtch.S#5 (text+ko) ====

@@ -45,6 +45,66 @@
 	nop
 	lw	t3, 0(sp)
 	addu	sp, 8
+
+	lw	t1, TD_MD_PTE0(a1)		# a1 = stack_pte[0]
+	lw	t2, TD_MD_PTE1(a1)		# a2 = stack_pte[1]
+	lw	v0, TD_MD_REALSTACK(a1)		# va = md_realstack
+	li	s0, MIPS_KSSEG_START
+	blt	v0, s0, resume
+	nop
+
+	and	s0, v0, 0x1000
+	beq	s0, zero, entry0
+	nop
+
+	break
+
+entry0:
+	mtc0	v0, MIPS_COP_0_TLB_HI		# VPN = va
+	COP0_SYNC
+	nop
+	nop
+	tlbp					# probe VPN
+	COP0_SYNC
+	nop
+	nop
+	mfc0	s0, MIPS_COP_0_TLB_INDEX
+	nop
+	bltz	s0, entry0set
+	sll	s0, s0, 13			# PAGE_SHIFT + 1
+	la	s0, MIPS_KSEG0_START(s0)
+	mtc0	s0, MIPS_COP_0_TLB_HI
+	COP0_SYNC
+	mtc0	zero, MIPS_COP_0_TLB_LO0
+	COP0_SYNC
+	mtc0	zero, MIPS_COP_0_TLB_LO1
+	COP0_SYNC
+	nop
+	nop
+	tlbwi
+	COP0_SYNC
+	nop
+	nop
+	mtc0	v0, MIPS_COP_0_TLB_HI		# set VPN again
+	COP0_SYNC
+entry0set:
+	mtc0	zero, MIPS_COP_0_TLB_INDEX	# TLB entry #0
+	COP0_SYNC
+	or	t1, MIPS_PG_G
+	mtc0	t1, MIPS_COP_0_TLB_LO0		# upte[0] | PG_G
+	COP0_SYNC
+	or	t2, MIPS_PG_G
+	mtc0	t2, MIPS_COP_0_TLB_LO1		# upte[1] | PG_G
+	COP0_SYNC
+	nop
+	nop
+	tlbwi					# set TLB entry #0
+	COP0_SYNC
+	nop
+	nop
+resume:
+
+
 	.set at
 	lw	t2, pcpup
 	.set noat



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200610131429.k9DETmux033115>