Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 22 Dec 2010 19:57:03 +0000 (UTC)
From:      Jung-uk Kim <jkim@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r216673 - in head/sys/amd64: amd64 include
Message-ID:  <201012221957.oBMJv3QE032888@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jkim
Date: Wed Dec 22 19:57:03 2010
New Revision: 216673
URL: http://svn.freebsd.org/changeset/base/216673

Log:
  Increase size of pcb_flags to four bytes.
  
  Requested by:	bde, jhb

Modified:
  head/sys/amd64/amd64/cpu_switch.S
  head/sys/amd64/amd64/exception.S
  head/sys/amd64/include/pcb.h

Modified: head/sys/amd64/amd64/cpu_switch.S
==============================================================================
--- head/sys/amd64/amd64/cpu_switch.S	Wed Dec 22 19:04:14 2010	(r216672)
+++ head/sys/amd64/amd64/cpu_switch.S	Wed Dec 22 19:57:03 2010	(r216673)
@@ -94,7 +94,7 @@ END(cpu_throw)
 ENTRY(cpu_switch)
 	/* Switch to new thread.  First, save context. */
 	movq	TD_PCB(%rdi),%r8
-	orb	$PCB_FULL_IRET,PCB_FLAGS(%r8)
+	orl	$PCB_FULL_IRET,PCB_FLAGS(%r8)
 
 	movq	(%rsp),%rax			/* Hardware registers */
 	movq	%r15,PCB_R15(%r8)
@@ -106,7 +106,7 @@ ENTRY(cpu_switch)
 	movq	%rbx,PCB_RBX(%r8)
 	movq	%rax,PCB_RIP(%r8)
 
-	testb	$PCB_DBREGS,PCB_FLAGS(%r8)
+	testl	$PCB_DBREGS,PCB_FLAGS(%r8)
 	jnz	store_dr			/* static predict not taken */
 done_store_dr:
 
@@ -210,7 +210,7 @@ done_tss:
 	movq	%rsi,PCPU(CURTHREAD)		/* into next thread */
 
 	/* Test if debug registers should be restored. */
-	testb	$PCB_DBREGS,PCB_FLAGS(%r8)
+	testl	$PCB_DBREGS,PCB_FLAGS(%r8)
 	jnz	load_dr				/* static predict not taken */
 done_load_dr:
 

Modified: head/sys/amd64/amd64/exception.S
==============================================================================
--- head/sys/amd64/amd64/exception.S	Wed Dec 22 19:04:14 2010	(r216672)
+++ head/sys/amd64/amd64/exception.S	Wed Dec 22 19:57:03 2010	(r216673)
@@ -170,7 +170,7 @@ alltraps:
 	jz	alltraps_testi		/* already running with kernel GS.base */
 	swapgs
 	movq	PCPU(CURPCB),%rdi
-	andb	$~PCB_FULL_IRET,PCB_FLAGS(%rdi)
+	andl	$~PCB_FULL_IRET,PCB_FLAGS(%rdi)
 	movw	%fs,TF_FS(%rsp)
 	movw	%gs,TF_GS(%rsp)
 	movw	%es,TF_ES(%rsp)
@@ -243,7 +243,7 @@ alltraps_noen:
 	jz	1f	/* already running with kernel GS.base */
 	swapgs
 	movq	PCPU(CURPCB),%rdi
-	andb	$~PCB_FULL_IRET,PCB_FLAGS(%rdi)
+	andl	$~PCB_FULL_IRET,PCB_FLAGS(%rdi)
 1:	movw	%fs,TF_FS(%rsp)
 	movw	%gs,TF_GS(%rsp)
 	movw	%es,TF_ES(%rsp)
@@ -294,7 +294,7 @@ IDTVEC(page)
 	jz	1f			/* already running with kernel GS.base */
 	swapgs
 	movq	PCPU(CURPCB),%rdi
-	andb	$~PCB_FULL_IRET,PCB_FLAGS(%rdi)
+	andl	$~PCB_FULL_IRET,PCB_FLAGS(%rdi)
 1:	movq	%cr2,%rdi		/* preserve %cr2 before ..  */
 	movq	%rdi,TF_ADDR(%rsp)	/* enabling interrupts. */
 	movw	%fs,TF_FS(%rsp)
@@ -324,7 +324,7 @@ IDTVEC(prot)
 	jz	2f			/* already running with kernel GS.base */
 1:	swapgs
 2:	movq	PCPU(CURPCB),%rdi
-	orb	$PCB_FULL_IRET,PCB_FLAGS(%rdi)	/* always full iret from GPF */
+	orl	$PCB_FULL_IRET,PCB_FLAGS(%rdi)	/* always full iret from GPF */
 	movw	%fs,TF_FS(%rsp)
 	movw	%gs,TF_GS(%rsp)
 	movw	%es,TF_ES(%rsp)
@@ -356,7 +356,7 @@ IDTVEC(fast_syscall)
 	movw	%es,TF_ES(%rsp)
 	movw	%ds,TF_DS(%rsp)
 	movq	PCPU(CURPCB),%r11
-	andb	$~PCB_FULL_IRET,PCB_FLAGS(%r11)
+	andl	$~PCB_FULL_IRET,PCB_FLAGS(%r11)
 	sti
 	movq	$KUDSEL,TF_SS(%rsp)
 	movq	$KUCSEL,TF_CS(%rsp)
@@ -661,7 +661,7 @@ doreti_exit:
 	 */
 	testb	$SEL_RPL_MASK,TF_CS(%rsp)
 	jz	ld_regs
-	testb	$PCB_FULL_IRET,PCB_FLAGS(%r8)
+	testl	$PCB_FULL_IRET,PCB_FLAGS(%r8)
 	jz	ld_regs
 	testl	$TF_HASSEGS,TF_FLAGS(%rsp)
 	je	set_segs

Modified: head/sys/amd64/include/pcb.h
==============================================================================
--- head/sys/amd64/include/pcb.h	Wed Dec 22 19:04:14 2010	(r216672)
+++ head/sys/amd64/include/pcb.h	Wed Dec 22 19:57:03 2010	(r216673)
@@ -71,7 +71,7 @@ struct pcb {
 	struct region_descriptor pcb_ldt;
 	uint16_t	pcb_tr;
 
-	u_char		pcb_flags;
+	u_int		pcb_flags;
 #define	PCB_FULL_IRET	0x01	/* full iret is required */
 #define	PCB_DBREGS	0x02	/* process using debug registers */
 #define	PCB_KERNFPU	0x04	/* kernel uses fpu */
@@ -111,20 +111,20 @@ struct trapframe;
  * because traps and interrupts are executed only on instruction boundary.
  */
 static __inline void
-set_pcb_flags(struct pcb *pcb, const u_char flags)
+set_pcb_flags(struct pcb *pcb, const u_int flags)
 {
 
-	__asm __volatile("orb %b1,%0"
-	    : "=m" (pcb->pcb_flags) : "iq" (flags), "m" (pcb->pcb_flags)
+	__asm __volatile("orl %1,%0"
+	    : "=m" (pcb->pcb_flags) : "ir" (flags), "m" (pcb->pcb_flags)
 	    : "cc");
 }
 
 static __inline void
-clear_pcb_flags(struct pcb *pcb, const u_char flags)
+clear_pcb_flags(struct pcb *pcb, const u_int flags)
 {
 
-	__asm __volatile("andb %b1,%0"
-	    : "=m" (pcb->pcb_flags) : "iq" (~flags), "m" (pcb->pcb_flags)
+	__asm __volatile("andl %1,%0"
+	    : "=m" (pcb->pcb_flags) : "ir" (~flags), "m" (pcb->pcb_flags)
 	    : "cc");
 }
 



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