Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 13 May 2003 09:49:13 -0700 (PDT)
From:      John Baldwin <jhb@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 31075 for review
Message-ID:  <200305131649.h4DGnDDv024948@repoman.freebsd.org>

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

Change 31075 by jhb@jhb_laptop on 2003/05/13 09:48:29

	IFC @31064.

Affected files ...

.. //depot/projects/smpng/sys/amd64/amd64/cpu_switch.S#2 integrate
.. //depot/projects/smpng/sys/amd64/amd64/elf_machdep.c#2 integrate
.. //depot/projects/smpng/sys/amd64/amd64/exception.S#3 integrate
.. //depot/projects/smpng/sys/amd64/amd64/genassym.c#2 integrate
.. //depot/projects/smpng/sys/amd64/amd64/identcpu.c#2 integrate
.. //depot/projects/smpng/sys/amd64/amd64/machdep.c#3 integrate
.. //depot/projects/smpng/sys/amd64/amd64/nexus.c#2 integrate
.. //depot/projects/smpng/sys/amd64/amd64/pmap.c#2 integrate
.. //depot/projects/smpng/sys/amd64/amd64/support.S#2 integrate
.. //depot/projects/smpng/sys/amd64/amd64/sys_machdep.c#2 integrate
.. //depot/projects/smpng/sys/amd64/amd64/trap.c#3 integrate
.. //depot/projects/smpng/sys/amd64/include/_types.h#2 integrate
.. //depot/projects/smpng/sys/amd64/include/asm.h#2 integrate
.. //depot/projects/smpng/sys/amd64/include/bus.h#2 integrate
.. //depot/projects/smpng/sys/amd64/include/bus_amd64.h#1 branch
.. //depot/projects/smpng/sys/amd64/include/bus_at386.h#2 delete
.. //depot/projects/smpng/sys/amd64/include/bus_dma.h#2 integrate
.. //depot/projects/smpng/sys/amd64/include/bus_memio.h#2 integrate
.. //depot/projects/smpng/sys/amd64/include/bus_pio.h#2 integrate
.. //depot/projects/smpng/sys/amd64/include/frame.h#2 integrate
.. //depot/projects/smpng/sys/amd64/include/md_var.h#2 integrate
.. //depot/projects/smpng/sys/amd64/include/pcb.h#2 integrate
.. //depot/projects/smpng/sys/amd64/include/stdarg.h#2 integrate
.. //depot/projects/smpng/sys/amd64/include/sysarch.h#2 integrate
.. //depot/projects/smpng/sys/amd64/include/ucontext.h#2 integrate
.. //depot/projects/smpng/sys/amd64/isa/icu_vector.S#2 integrate
.. //depot/projects/smpng/sys/boot/common/load_elf.c#9 integrate
.. //depot/projects/smpng/sys/boot/i386/libi386/elf64_freebsd.c#2 integrate
.. //depot/projects/smpng/sys/boot/i386/libi386/i386_module.c#8 integrate
.. //depot/projects/smpng/sys/compat/svr4/svr4.h#2 integrate
.. //depot/projects/smpng/sys/conf/Makefile.amd64#2 integrate
.. //depot/projects/smpng/sys/conf/files#77 integrate
.. //depot/projects/smpng/sys/conf/majors#24 integrate
.. //depot/projects/smpng/sys/dev/acpica/Osd/OsdHardware.c#7 integrate
.. //depot/projects/smpng/sys/dev/ata/ata-card.c#10 integrate
.. //depot/projects/smpng/sys/dev/ata/ata-chipset.c#12 integrate
.. //depot/projects/smpng/sys/dev/ata/ata-pci.h#8 integrate
.. //depot/projects/smpng/sys/dev/firewire/firewire.c#17 integrate
.. //depot/projects/smpng/sys/dev/firewire/sbp.c#17 integrate
.. //depot/projects/smpng/sys/dev/fxp/if_fxpreg.h#7 integrate
.. //depot/projects/smpng/sys/dev/ips/ips.c#1 branch
.. //depot/projects/smpng/sys/dev/ips/ips.h#1 branch
.. //depot/projects/smpng/sys/dev/ips/ips_commands.c#1 branch
.. //depot/projects/smpng/sys/dev/ips/ips_disk.c#1 branch
.. //depot/projects/smpng/sys/dev/ips/ips_disk.h#1 branch
.. //depot/projects/smpng/sys/dev/ips/ips_ioctl.c#1 branch
.. //depot/projects/smpng/sys/dev/ips/ips_ioctl.h#1 branch
.. //depot/projects/smpng/sys/dev/ips/ips_pci.c#1 branch
.. //depot/projects/smpng/sys/dev/kbd/atkbdc.c#6 integrate
.. //depot/projects/smpng/sys/dev/usb/umass.c#23 integrate
.. //depot/projects/smpng/sys/dev/usb/usbdevs#31 integrate
.. //depot/projects/smpng/sys/dev/usb/usbdevs.h#32 integrate
.. //depot/projects/smpng/sys/dev/usb/usbdevs_data.h#32 integrate
.. //depot/projects/smpng/sys/geom/geom_dev.c#24 integrate
.. //depot/projects/smpng/sys/geom/geom_disk.c#25 integrate
.. //depot/projects/smpng/sys/i386/conf/GENERIC#36 integrate
.. //depot/projects/smpng/sys/i386/conf/NOTES#58 integrate
.. //depot/projects/smpng/sys/i386/linux/linux_sysvec.c#31 integrate
.. //depot/projects/smpng/sys/kern/kern_malloc.c#21 integrate
.. //depot/projects/smpng/sys/kern/link_elf.c#20 integrate
.. //depot/projects/smpng/sys/kern/subr_mbuf.c#31 integrate
.. //depot/projects/smpng/sys/kern/vfs_subr.c#52 integrate
.. //depot/projects/smpng/sys/modules/Makefile#52 integrate
.. //depot/projects/smpng/sys/modules/ips/Makefile#1 branch
.. //depot/projects/smpng/sys/modules/netgraph/bluetooth/Makefile#2 integrate
.. //depot/projects/smpng/sys/modules/netgraph/bluetooth/bluetooth/Makefile#2 integrate
.. //depot/projects/smpng/sys/modules/netgraph/bluetooth/bt3c/Makefile#2 integrate
.. //depot/projects/smpng/sys/modules/netgraph/bluetooth/h4/Makefile#2 integrate
.. //depot/projects/smpng/sys/modules/netgraph/bluetooth/hci/Makefile#2 integrate
.. //depot/projects/smpng/sys/modules/netgraph/bluetooth/l2cap/Makefile#2 integrate
.. //depot/projects/smpng/sys/modules/netgraph/bluetooth/socket/Makefile#2 integrate
.. //depot/projects/smpng/sys/modules/netgraph/bluetooth/ubt/Makefile#2 integrate
.. //depot/projects/smpng/sys/modules/netgraph/bluetooth/ubtbcmfw/Makefile#1 branch
.. //depot/projects/smpng/sys/netgraph/bluetooth/common/ng_bluetooth.c#2 integrate
.. //depot/projects/smpng/sys/netgraph/bluetooth/drivers/bt3c/ng_bt3c_pccard.c#3 integrate
.. //depot/projects/smpng/sys/netgraph/bluetooth/drivers/bt3c/ng_bt3c_var.h#2 integrate
.. //depot/projects/smpng/sys/netgraph/bluetooth/drivers/h4/TODO#2 integrate
.. //depot/projects/smpng/sys/netgraph/bluetooth/drivers/h4/ng_h4.c#3 integrate
.. //depot/projects/smpng/sys/netgraph/bluetooth/drivers/h4/ng_h4_prse.h#2 integrate
.. //depot/projects/smpng/sys/netgraph/bluetooth/drivers/h4/ng_h4_var.h#2 integrate
.. //depot/projects/smpng/sys/netgraph/bluetooth/drivers/ubt/TODO#2 integrate
.. //depot/projects/smpng/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c#5 integrate
.. //depot/projects/smpng/sys/netgraph/bluetooth/drivers/ubt/ng_ubt_var.h#2 integrate
.. //depot/projects/smpng/sys/netgraph/bluetooth/drivers/ubtbcmfw/ubtbcmfw.c#1 branch
.. //depot/projects/smpng/sys/netgraph/bluetooth/hci/TODO#2 integrate
.. //depot/projects/smpng/sys/netgraph/bluetooth/hci/ng_hci_cmds.c#3 integrate
.. //depot/projects/smpng/sys/netgraph/bluetooth/hci/ng_hci_cmds.h#2 integrate
.. //depot/projects/smpng/sys/netgraph/bluetooth/hci/ng_hci_evnt.c#3 integrate
.. //depot/projects/smpng/sys/netgraph/bluetooth/hci/ng_hci_evnt.h#2 integrate
.. //depot/projects/smpng/sys/netgraph/bluetooth/hci/ng_hci_main.c#2 integrate
.. //depot/projects/smpng/sys/netgraph/bluetooth/hci/ng_hci_misc.c#3 integrate
.. //depot/projects/smpng/sys/netgraph/bluetooth/hci/ng_hci_misc.h#2 integrate
.. //depot/projects/smpng/sys/netgraph/bluetooth/hci/ng_hci_prse.h#2 integrate
.. //depot/projects/smpng/sys/netgraph/bluetooth/hci/ng_hci_ulpi.c#3 integrate
.. //depot/projects/smpng/sys/netgraph/bluetooth/hci/ng_hci_ulpi.h#2 integrate
.. //depot/projects/smpng/sys/netgraph/bluetooth/hci/ng_hci_var.h#2 integrate
.. //depot/projects/smpng/sys/netgraph/bluetooth/include/ng_bluetooth.h#2 integrate
.. //depot/projects/smpng/sys/netgraph/bluetooth/include/ng_bt3c.h#2 integrate
.. //depot/projects/smpng/sys/netgraph/bluetooth/include/ng_btsocket.h#2 integrate
.. //depot/projects/smpng/sys/netgraph/bluetooth/include/ng_btsocket_hci_raw.h#2 integrate
.. //depot/projects/smpng/sys/netgraph/bluetooth/include/ng_btsocket_l2cap.h#2 integrate
.. //depot/projects/smpng/sys/netgraph/bluetooth/include/ng_btsocket_rfcomm.h#1 branch
.. //depot/projects/smpng/sys/netgraph/bluetooth/include/ng_h4.h#2 integrate
.. //depot/projects/smpng/sys/netgraph/bluetooth/include/ng_hci.h#2 integrate
.. //depot/projects/smpng/sys/netgraph/bluetooth/include/ng_l2cap.h#2 integrate
.. //depot/projects/smpng/sys/netgraph/bluetooth/include/ng_ubt.h#2 integrate
.. //depot/projects/smpng/sys/netgraph/bluetooth/l2cap/TODO#2 integrate
.. //depot/projects/smpng/sys/netgraph/bluetooth/l2cap/ng_l2cap_cmds.c#2 integrate
.. //depot/projects/smpng/sys/netgraph/bluetooth/l2cap/ng_l2cap_cmds.h#3 integrate
.. //depot/projects/smpng/sys/netgraph/bluetooth/l2cap/ng_l2cap_evnt.c#3 integrate
.. //depot/projects/smpng/sys/netgraph/bluetooth/l2cap/ng_l2cap_evnt.h#2 integrate
.. //depot/projects/smpng/sys/netgraph/bluetooth/l2cap/ng_l2cap_llpi.c#3 integrate
.. //depot/projects/smpng/sys/netgraph/bluetooth/l2cap/ng_l2cap_llpi.h#2 integrate
.. //depot/projects/smpng/sys/netgraph/bluetooth/l2cap/ng_l2cap_main.c#2 integrate
.. //depot/projects/smpng/sys/netgraph/bluetooth/l2cap/ng_l2cap_misc.c#3 integrate
.. //depot/projects/smpng/sys/netgraph/bluetooth/l2cap/ng_l2cap_misc.h#2 integrate
.. //depot/projects/smpng/sys/netgraph/bluetooth/l2cap/ng_l2cap_prse.h#2 integrate
.. //depot/projects/smpng/sys/netgraph/bluetooth/l2cap/ng_l2cap_ulpi.c#2 integrate
.. //depot/projects/smpng/sys/netgraph/bluetooth/l2cap/ng_l2cap_ulpi.h#2 integrate
.. //depot/projects/smpng/sys/netgraph/bluetooth/l2cap/ng_l2cap_var.h#2 integrate
.. //depot/projects/smpng/sys/netgraph/bluetooth/socket/TODO#2 integrate
.. //depot/projects/smpng/sys/netgraph/bluetooth/socket/ng_btsocket.c#2 integrate
.. //depot/projects/smpng/sys/netgraph/bluetooth/socket/ng_btsocket_hci_raw.c#6 integrate
.. //depot/projects/smpng/sys/netgraph/bluetooth/socket/ng_btsocket_l2cap.c#5 integrate
.. //depot/projects/smpng/sys/netgraph/bluetooth/socket/ng_btsocket_l2cap_raw.c#4 integrate
.. //depot/projects/smpng/sys/netgraph/bluetooth/socket/ng_btsocket_rfcomm.c#1 branch
.. //depot/projects/smpng/sys/pci/if_dc.c#36 integrate
.. //depot/projects/smpng/sys/pci/if_dcreg.h#13 integrate

Differences ...

==== //depot/projects/smpng/sys/amd64/amd64/cpu_switch.S#2 (text+ko) ====

@@ -33,7 +33,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/amd64/amd64/cpu_switch.S,v 1.138 2003/05/01 01:05:21 peter Exp $
+ * $FreeBSD: src/sys/amd64/amd64/cpu_switch.S,v 1.139 2003/05/12 02:37:28 peter Exp $
  */
 
 #include <machine/asmacros.h>
@@ -92,27 +92,39 @@
 	jz	badsw2				/* no, panic */
 #endif
 
-	movq	TD_PCB(%rdi),%rdx
+	movq	TD_PCB(%rdi),%r8
 
 	movq	(%rsp),%rax			/* Hardware registers */
-	movq	%rax,PCB_RIP(%rdx)
-	movq	%rbx,PCB_RBX(%rdx)
-	movq	%rsp,PCB_RSP(%rdx)
-	movq	%rbp,PCB_RBP(%rdx)
-	movq	%r12,PCB_R12(%rdx)
-	movq	%r13,PCB_R13(%rdx)
-	movq	%r14,PCB_R14(%rdx)
-	movq	%r15,PCB_R15(%rdx)
+	movq	%rax,PCB_RIP(%r8)
+	movq	%rbx,PCB_RBX(%r8)
+	movq	%rsp,PCB_RSP(%r8)
+	movq	%rbp,PCB_RBP(%r8)
+	movq	%r12,PCB_R12(%r8)
+	movq	%r13,PCB_R13(%r8)
+	movq	%r14,PCB_R14(%r8)
+	movq	%r15,PCB_R15(%r8)
 	pushfq					/* PSL */
-	popq	PCB_RFLAGS(%rdx)
+	popq	PCB_RFLAGS(%r8)
+
+	/* Save userland %fs */
+	movl	$MSR_FSBASE,%ecx
+	rdmsr
+	movl	%eax,PCB_FSBASE(%r8)
+	movl	%edx,PCB_FSBASE+4(%r8)
+
+	/* Save userland %gs */
+	movl	$MSR_KGSBASE,%ecx
+	rdmsr
+	movl	%eax,PCB_GSBASE(%r8)
+	movl	%edx,PCB_GSBASE+4(%r8)
 
 	/* have we used fp, and need a save? */
 	cmpq	%rdi,PCPU(FPCURTHREAD)
 	jne	1f
 	pushq	%rdi
 	pushq	%rsi
-	addq	$PCB_SAVEFPU,%rdx		/* h/w bugs make saving complicated */
-	movq	%rdx, %rdi
+	addq	$PCB_SAVEFPU,%r8		/* h/w bugs make saving complicated */
+	movq	%r8, %rdi
 	call	npxsave				/* do it in a big C function */
 	popq	%rsi
 	popq	%rdi
@@ -123,12 +135,12 @@
 	testq	%rsi,%rsi			/* no thread? */
 	jz	badsw3				/* no, panic */
 #endif
-	movq	TD_PCB(%rsi),%rdx
+	movq	TD_PCB(%rsi),%r8
 	xorq	%rax, %rax
 	movl	PCPU(CPUID), %eax
 
 	/* switch address space */
-	movq	PCB_CR3(%rdx),%rdx
+	movq	PCB_CR3(%r8),%rdx
 	movq	%rdx,%cr3			/* new address space */
 
 	/* Release bit from old pmap->pm_active */
@@ -146,26 +158,38 @@
 	 * At this point, we've switched address spaces and are ready
 	 * to load up the rest of the next context.
 	 */
-	movq	TD_PCB(%rsi),%rdx
+	movq	TD_PCB(%rsi),%r8
+
+	/* Restore userland %fs */
+	movl	$MSR_FSBASE,%ecx
+	movl	PCB_FSBASE(%r8),%eax
+	movl	PCB_FSBASE+4(%r8),%edx
+	wrmsr
+
+	/* Restore userland %gs */
+	movl	$MSR_KGSBASE,%ecx
+	movl	PCB_GSBASE(%r8),%eax
+	movl	PCB_GSBASE+4(%r8),%edx
+	wrmsr
 
 	/* Update the TSS_RSP0 pointer for the next interrupt */
-	leaq	-16(%rdx), %rbx
+	leaq	-16(%r8), %rbx
 	movq	%rbx, common_tss + COMMON_TSS_RSP0
 
 	/* Restore context. */
-	movq	PCB_RBX(%rdx),%rbx
-	movq	PCB_RSP(%rdx),%rsp
-	movq	PCB_RBP(%rdx),%rbp
-	movq	PCB_R12(%rdx),%r12
-	movq	PCB_R13(%rdx),%r13
-	movq	PCB_R14(%rdx),%r14
-	movq	PCB_R15(%rdx),%r15
-	movq	PCB_RIP(%rdx),%rax
+	movq	PCB_RBX(%r8),%rbx
+	movq	PCB_RSP(%r8),%rsp
+	movq	PCB_RBP(%r8),%rbp
+	movq	PCB_R12(%r8),%r12
+	movq	PCB_R13(%r8),%r13
+	movq	PCB_R14(%r8),%r14
+	movq	PCB_R15(%r8),%r15
+	movq	PCB_RIP(%r8),%rax
 	movq	%rax,(%rsp)
-	pushq	PCB_RFLAGS(%rdx)
+	pushq	PCB_RFLAGS(%r8)
 	popfq
 
-	movq	%rdx, PCPU(CURPCB)
+	movq	%r8, PCPU(CURPCB)
 	movq	%rsi, PCPU(CURTHREAD)		/* into next thread */
 
 	ret

==== //depot/projects/smpng/sys/amd64/amd64/elf_machdep.c#2 (text+ko) ====

@@ -22,7 +22,7 @@
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/amd64/amd64/elf_machdep.c,v 1.14 2003/05/01 01:05:21 peter Exp $
+ * $FreeBSD: src/sys/amd64/amd64/elf_machdep.c,v 1.15 2003/05/11 22:40:24 peter Exp $
  */
 
 #include <sys/param.h>
@@ -170,7 +170,7 @@
 			break;
 
 		default:
-			printf("kldload: unexpected relocation type %d\n",
+			printf("kldload: unexpected relocation type %ld\n",
 			       rtype);
 			return -1;
 	}

==== //depot/projects/smpng/sys/amd64/amd64/exception.S#3 (text+ko) ====

@@ -31,7 +31,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/amd64/amd64/exception.S,v 1.106 2003/05/08 00:05:00 peter Exp $
+ * $FreeBSD: src/sys/amd64/amd64/exception.S,v 1.109 2003/05/12 18:33:19 peter Exp $
  */
 
 #include <machine/asmacros.h>
@@ -51,16 +51,16 @@
 /*
  * Trap and fault vector routines.
  *
- * Most traps are 'trap gates', SDT_SYS386TGT.  A trap gate pushes state on
- * the stack that mostly looks like an interrupt, but does not disable 
- * interrupts.  A few of the traps we are use are interrupt gates, 
- * SDT_SYS386IGT, which are nearly the same thing except interrupts are
- * disabled on entry.
+ * All traps are 'interrupt gates', SDT_SYSIGT.  An interrupt gate pushes
+ * state on the stack but also disables interrupts.  This is important for
+ * us for the use of the swapgs instruction.  We cannot be interrupted
+ * until the GS.base value is correct.  For most traps, we automatically
+ * then enable interrupts if the interrupted context had them enabled.
+ * This is equivalent to the i386 port's use of SDT_SYS386TGT.
  *
  * The cpu will push a certain amount of state onto the kernel stack for
- * the current process.  The amount of state depends on the type of trap 
- * and whether the trap crossed rings or not.  See i386/include/frame.h.  
- * At the very least the current EFLAGS (status register, which includes 
+ * the current process.  See amd64/include/frame.h.  
+ * This includes the current RFLAGS (status register, which includes 
  * the interrupt disable state prior to the trap), the code segment register,
  * and the return instruction pointer are pushed by the cpu.  The cpu 
  * will also push an 'error' code for certain traps.  We push a dummy 
@@ -74,63 +74,89 @@
  */
 #define	IDTVEC(name)	ALIGN_TEXT; .globl __CONCAT(X,name); \
 			.type __CONCAT(X,name),@function; __CONCAT(X,name):
-#define	TRAP(a)		pushq $(a) ; jmp alltraps
 
 MCOUNT_LABEL(user)
 MCOUNT_LABEL(btrap)
 
+/* Traps that we leave interrupts disabled for.. */
+#define	TRAP_NOEN(a)	\
+	subq $TF_RIP,%rsp; \
+	movq $(a),TF_TRAPNO(%rsp) ; \
+	movq $0,TF_ADDR(%rsp) ; \
+	movq $0,TF_ERR(%rsp) ; \
+	jmp alltraps_noen
+IDTVEC(dbg)
+	TRAP_NOEN(T_TRCTRAP)
+IDTVEC(bpt)
+	TRAP_NOEN(T_BPTFLT)
+
+/* Regular traps; The cpu does not supply tf_err for these. */
+#define	TRAP(a)	 \
+	subq $TF_RIP,%rsp; \
+	movq $(a),TF_TRAPNO(%rsp) ; \
+	movq $0,TF_ADDR(%rsp) ; \
+	movq $0,TF_ERR(%rsp) ; \
+	jmp alltraps
 IDTVEC(div)
-	pushq $0; TRAP(T_DIVIDE)
-IDTVEC(dbg)
-	pushq $0; TRAP(T_TRCTRAP)
+	TRAP(T_DIVIDE)
 IDTVEC(nmi)
-	pushq $0; TRAP(T_NMI)
-IDTVEC(bpt)
-	pushq $0; TRAP(T_BPTFLT)
+	TRAP(T_NMI)
 IDTVEC(ofl)
-	pushq $0; TRAP(T_OFLOW)
+	TRAP(T_OFLOW)
 IDTVEC(bnd)
-	pushq $0; TRAP(T_BOUND)
+	TRAP(T_BOUND)
 IDTVEC(ill)
-	pushq $0; TRAP(T_PRIVINFLT)
+	TRAP(T_PRIVINFLT)
 IDTVEC(dna)
-	pushq $0; TRAP(T_DNA)
+	TRAP(T_DNA)
 IDTVEC(fpusegm)
-	pushq $0; TRAP(T_FPOPFLT)
+	TRAP(T_FPOPFLT)
+IDTVEC(mchk)
+	TRAP(T_MCHK)
+IDTVEC(rsvd)
+	TRAP(T_RESERVED)
+IDTVEC(fpu)
+	TRAP(T_ARITHTRAP)
+IDTVEC(xmm)
+	TRAP(T_XMMFLT)
+
+/* This group of traps have tf_err already pushed by the cpu */
+#define	TRAP_ERR(a)	\
+	subq $TF_ERR,%rsp; \
+	movq $(a),TF_TRAPNO(%rsp) ; \
+	movq $0,TF_ADDR(%rsp) ; \
+	jmp alltraps_noen
 IDTVEC(tss)
-	TRAP(T_TSSFLT)
+	TRAP_ERR(T_TSSFLT)
 IDTVEC(missing)
-	TRAP(T_SEGNPFLT)
+	TRAP_ERR(T_SEGNPFLT)
 IDTVEC(stk)
-	TRAP(T_STKFLT)
+	TRAP_ERR(T_STKFLT)
 IDTVEC(prot)
-	TRAP(T_PROTFLT)
-IDTVEC(page)
-	TRAP(T_PAGEFLT)
-IDTVEC(mchk)
-	pushq $0; TRAP(T_MCHK)
-IDTVEC(rsvd)
-	pushq $0; TRAP(T_RESERVED)
-IDTVEC(fpu)
-	pushq $0; TRAP(T_ARITHTRAP)
+	TRAP_ERR(T_PROTFLT)
 IDTVEC(align)
-	TRAP(T_ALIGNFLT)
-IDTVEC(xmm)
-	pushq $0; TRAP(T_XMMFLT)
+	TRAP_ERR(T_ALIGNFLT)
 	
 	/*
-	 * alltraps entry point.  Interrupts are enabled if this was a trap
-	 * gate (TGT), else disabled if this was an interrupt gate (IGT).
-	 * Note that int0x80_syscall is a trap gate.  Only page faults
-	 * use an interrupt gate.
+	 * alltraps entry point.  Use swapgs if this is the first time in the
+	 * kernel from userland.  Reenable interrupts if they were enabled
+	 * before the trap.  This approximates SDT_SYS386TGT on the i386 port.
 	 */
 
 	SUPERALIGN_TEXT
 	.globl	alltraps
 	.type	alltraps,@function
 alltraps:
-	subq	$TF_TRAPNO,%rsp		/* tf_err and tf_trapno already pushed */
+	testb	$SEL_RPL_MASK,TF_CS(%rsp) /* Did we come from kernel? */
+	jz	alltraps_testi		/* already running with kernel GS.base */
+	swapgs
+alltraps_testi:
+	testl	$PSL_I,TF_RFLAGS(%rsp)
+	jz	alltraps_pushregs
+	sti
+alltraps_pushregs:
 	movq	%rdi,TF_RDI(%rsp)
+alltraps_pushregs_no_rdi:
 	movq	%rsi,TF_RSI(%rsp)
 	movq	%rdx,TF_RDX(%rsp)
 	movq	%rcx,TF_RCX(%rsp)
@@ -153,22 +179,56 @@
 	MEXITCOUNT
 	jmp	doreti			/* Handle any pending ASTs */
 
+	/*
+	 * alltraps_noen entry point.  Unlike alltraps above, we want to
+	 * leave the interrupts disabled.  This corresponds to
+	 * SDT_SYS386IGT on the i386 port.
+	 */
+	SUPERALIGN_TEXT
+	.globl	alltraps_noen
+	.type	alltraps_noen,@function
+alltraps_noen:
+	testb	$SEL_RPL_MASK,TF_CS(%rsp) /* Did we come from kernel? */
+	jz	alltraps_pushregs	/* already running with kernel GS.base */
+	swapgs
+	jmp	alltraps_pushregs
+
+IDTVEC(dblfault)
+	subq	$TF_ERR,%rsp
+	movq	$T_DOUBLEFLT,TF_TRAPNO(%rsp)
+	testb	$SEL_RPL_MASK,TF_CS(%rsp) /* Did we come from kernel? */
+	jz	1f			/* already running with kernel GS.base */
+	swapgs
+1:	call	dblfault_handler
+2:	hlt
+	jmp	2b
+
+IDTVEC(page)
+	subq	$TF_ERR,%rsp
+	movq	$T_PAGEFLT,TF_TRAPNO(%rsp)
+	testb	$SEL_RPL_MASK,TF_CS(%rsp) /* Did we come from kernel? */
+	jz	1f			/* already running with kernel GS.base */
+	swapgs
+1:	movq	%rdi,TF_RDI(%rsp)	/* free up a GP register */
+	movq	%cr2,%rdi		/* preserve %cr2 before ..  */
+	movq	%rdi,TF_ADDR(%rsp)	/* enabling interrupts. */
+	testl	$PSL_I,TF_RFLAGS(%rsp)
+	jz	alltraps_pushregs_no_rdi
+	sti
+	jmp	alltraps_pushregs_no_rdi
+
 /*
  * Call gate entry for FreeBSD ELF and Linux/NetBSD syscall (int 0x80)
  *
- * Even though the name says 'int0x80', this is actually a TGT (trap gate)
- * rather then an IGT (interrupt gate).  Thus interrupts are enabled on
- * entry just as they are for a normal syscall.
- *
- * This leaves a place to put eflags so that the call frame can be
- * converted to a trap frame. Note that the eflags is (semi-)bogusly
- * pushed into (what will be) tf_err and then copied later into the
- * final spot. It has to be done this way because esp can't be just
- * temporarily altered for the pushfl - an interrupt might come in
- * and clobber the saved cs/eip.
+ * This is a SDT_SYSIDT entry point (unlike the i386 port) so that we
+ * can do a swapgs before enabling interrupts.  This is critical because
+ * if we took an interrupt before swapgs, the interrupt code would see
+ * that it originated in supervisor mode and skip the swapgs.
  */
 	SUPERALIGN_TEXT
 IDTVEC(int0x80_syscall)
+	swapgs
+	sti
 	pushq	$2			/* sizeof "int 0x80" */
 	subq	$TF_ERR,%rsp		/* skip over tf_trapno */
 	movq	%rdi,TF_RDI(%rsp)
@@ -196,19 +256,21 @@
  * and the new privilige level.  We are still running on the old user stack
  * pointer.  We have to juggle a few things around to find our stack etc.
  * swapgs gives us access to our PCPU space only.
- * XXX The PCPU stuff is stubbed out right now...
  */
 IDTVEC(fast_syscall)
-	#swapgs
+	swapgs
 	movq	%rsp,PCPU(SCRATCH_RSP)
 	movq	common_tss+COMMON_TSS_RSP0,%rsp
 	/* Now emulate a trapframe. Ugh. */
 	subq	$TF_SIZE,%rsp
-	movq	$KUDSEL,TF_SS(%rsp)
 	/* defer TF_RSP till we have a spare register */
 	movq	%r11,TF_RFLAGS(%rsp)
+	movq	%rcx,TF_RIP(%rsp)	/* %rcx original value is in %r10 */
+	movq	PCPU(SCRATCH_RSP),%r11	/* %r11 already saved */
+	movq	%r11,TF_RSP(%rsp)	/* user stack pointer */
+	sti
+	movq	$KUDSEL,TF_SS(%rsp)
 	movq	$KUCSEL,TF_CS(%rsp)
-	movq	%rcx,TF_RIP(%rsp)	/* %rcx original value is in %r10 */
 	movq	$2,TF_ERR(%rsp)
 	movq	%rdi,TF_RDI(%rsp)	/* arg 1 */
 	movq	%rsi,TF_RSI(%rsp)	/* arg 2 */
@@ -223,14 +285,10 @@
 	movq	%r13,TF_R13(%rsp)	/* C preserved */
 	movq	%r14,TF_R14(%rsp)	/* C preserved */
 	movq	%r15,TF_R15(%rsp)	/* C preserved */
-	movq	PCPU(SCRATCH_RSP),%r12	/* %r12 already saved */
-	movq	%r12,TF_RSP(%rsp)	/* user stack pointer */
-	sti
 	call	syscall
 	movq	PCPU(CURPCB),%rax
 	testq	$PCB_FULLCTX,PCB_FLAGS(%rax)
 	jne	3f
-	/* simplified from doreti */
 1:	/* Check for and handle AST's on return to userland */
 	cli
 	movq	PCPU(CURTHREAD),%rax
@@ -255,7 +313,7 @@
 	movq	TF_RIP(%rsp),%rcx	/* original %rip */
 	movq	TF_RSP(%rsp),%r9	/* user stack pointer */
 	movq	%r9,%rsp		/* original %rsp */
-	#swapgs
+	swapgs
 	sysretq
 3:	/* Requested full context restore, use doreti for that */
 	andq	$~PCB_FULLCTX,PCB_FLAGS(%rax)
@@ -344,12 +402,16 @@
 	movq	TF_R13(%rsp),%r13
 	movq	TF_R14(%rsp),%r14
 	movq	TF_R15(%rsp),%r15
-	addq	$TF_RIP,%rsp		/* skip over tf_err, tf_trapno */
+	testb	$SEL_RPL_MASK,TF_CS(%rsp) /* Did we come from kernel? */
+	jz	1f			/* keep running with kernel GS.base */
+	cli
+	swapgs
+1:	addq	$TF_RIP,%rsp		/* skip over tf_err, tf_trapno */
 	.globl	doreti_iret
 doreti_iret:
 	iretq
 
-  	/*
+	/*
 	 * doreti_iret_fault and friends.  Alternative return code for
 	 * the case where we get a fault in the doreti_exit code
 	 * above.  trap() (i386/i386/trap.c) catches this specific
@@ -360,7 +422,13 @@
 	.globl	doreti_iret_fault
 doreti_iret_fault:
 	subq	$TF_RIP,%rsp		/* space including tf_err, tf_trapno */
-	movq	%rdi,TF_RDI(%rsp)
+	testb	$SEL_RPL_MASK,TF_CS(%rsp) /* Did we come from kernel? */
+	jz	1f			/* already running with kernel GS.base */
+	swapgs
+1:	testl	$PSL_I,TF_RFLAGS(%rsp)
+	jz	2f
+	sti
+2:	movq	%rdi,TF_RDI(%rsp)
 	movq	%rsi,TF_RSI(%rsp)
 	movq	%rdx,TF_RDX(%rsp)
 	movq	%rcx,TF_RCX(%rsp)

==== //depot/projects/smpng/sys/amd64/amd64/genassym.c#2 (text+ko) ====

@@ -34,7 +34,7 @@
  * SUCH DAMAGE.
  *
  *	from: @(#)genassym.c	5.11 (Berkeley) 5/10/91
- * $FreeBSD: src/sys/amd64/amd64/genassym.c,v 1.141 2003/05/01 01:05:21 peter Exp $
+ * $FreeBSD: src/sys/amd64/amd64/genassym.c,v 1.144 2003/05/12 18:33:19 peter Exp $
  */
 
 #include "opt_compat.h"
@@ -70,6 +70,7 @@
 #include <machine/cpu.h>
 #include <machine/sigframe.h>
 #include <machine/proc.h>
+#include <machine/specialreg.h>
 
 ASSYM(P_VMSPACE, offsetof(struct proc, p_vmspace));
 ASSYM(VM_PMAP, offsetof(struct vmspace, vm_pmap));
@@ -106,6 +107,8 @@
 ASSYM(PAGE_SHIFT, PAGE_SHIFT);
 ASSYM(PAGE_MASK, PAGE_MASK);
 ASSYM(PDRSHIFT, PDRSHIFT);
+ASSYM(PDPSHIFT, PDPSHIFT);
+ASSYM(PML4SHIFT, PML4SHIFT);
 ASSYM(USRSTACK, USRSTACK);
 ASSYM(VM_MAXUSER_ADDRESS, VM_MAXUSER_ADDRESS);
 ASSYM(KERNBASE, KERNBASE);
@@ -120,6 +123,8 @@
 ASSYM(PCB_RBX, offsetof(struct pcb, pcb_rbx));
 ASSYM(PCB_RIP, offsetof(struct pcb, pcb_rip));
 ASSYM(PCB_RFLAGS, offsetof(struct pcb, pcb_rflags));
+ASSYM(PCB_FSBASE, offsetof(struct pcb, pcb_fsbase));
+ASSYM(PCB_GSBASE, offsetof(struct pcb, pcb_gsbase));
 
 ASSYM(PCB_FLAGS, offsetof(struct pcb, pcb_flags));
 ASSYM(PCB_FULLCTX, PCB_FULLCTX);
@@ -147,6 +152,7 @@
 ASSYM(TF_RCX, offsetof(struct trapframe, tf_rcx));
 ASSYM(TF_RAX, offsetof(struct trapframe, tf_rax));
 ASSYM(TF_TRAPNO, offsetof(struct trapframe, tf_trapno));
+ASSYM(TF_ADDR, offsetof(struct trapframe, tf_addr));
 ASSYM(TF_ERR, offsetof(struct trapframe, tf_err));
 ASSYM(TF_RIP, offsetof(struct trapframe, tf_rip));
 ASSYM(TF_CS, offsetof(struct trapframe, tf_cs));
@@ -176,6 +182,8 @@
 ASSYM(KUCSEL, GSEL(GUCODE_SEL, SEL_UPL));
 ASSYM(KUDSEL, GSEL(GUDATA_SEL, SEL_UPL));
 
+ASSYM(MSR_FSBASE, MSR_FSBASE);
+ASSYM(MSR_KGSBASE, MSR_KGSBASE);
 ASSYM(GPROC0_SEL, GPROC0_SEL);
 
 ASSYM(MTX_LOCK, offsetof(struct mtx, mtx_lock));

==== //depot/projects/smpng/sys/amd64/amd64/identcpu.c#2 (text+ko) ====

@@ -38,7 +38,7 @@
  * SUCH DAMAGE.
  *
  *	from: Id: machdep.c,v 1.193 1996/06/18 01:22:04 bde Exp
- * $FreeBSD: src/sys/amd64/amd64/identcpu.c,v 1.123 2003/05/01 01:05:21 peter Exp $
+ * $FreeBSD: src/sys/amd64/amd64/identcpu.c,v 1.124 2003/05/11 23:01:04 peter Exp $
  */
 
 #include "opt_cpu.h"
@@ -129,9 +129,9 @@
 		 * (also describes ``Features'' encodings.
 		 */
 		strcpy(cpu_model, "AMD ");
-		switch (cpu_id & 0xFF0) {
+		switch (cpu_id & 0xF00) {
 		case 0xf00:
-			strcat(cpu_model, "Hammer");
+			strcat(cpu_model, "AMD64 Processor");
 			break;
 		default:
 			strcat(cpu_model, "Unknown");

==== //depot/projects/smpng/sys/amd64/amd64/machdep.c#3 (text+ko) ====

@@ -35,7 +35,7 @@
  * SUCH DAMAGE.
  *
  *	from: @(#)machdep.c	7.4 (Berkeley) 6/3/91
- * $FreeBSD: src/sys/amd64/amd64/machdep.c,v 1.568 2003/05/08 08:25:51 peter Exp $
+ * $FreeBSD: src/sys/amd64/amd64/machdep.c,v 1.575 2003/05/12 18:37:56 peter Exp $
  */
 
 #include "opt_atalk.h"
@@ -130,7 +130,7 @@
 SYSINIT(cpu, SI_SUB_CPU, SI_ORDER_FIRST, cpu_startup, NULL)
 
 int	_udatasel, _ucodesel;
-u_int	atdevbase;
+u_long	atdevbase;
 
 u_int64_t	modulep;	/* phys addr of metadata table */
 u_int64_t	physfree;	/* first free page after kernel */
@@ -245,7 +245,7 @@
 	sf.sf_uc.uc_stack.ss_flags = (p->p_flag & P_ALTSTACK)
 	    ? ((oonstack) ? SS_ONSTACK : 0) : SS_DISABLE;
 	sf.sf_uc.uc_mcontext.mc_onstack = (oonstack) ? 1 : 0;
-	bcopy(regs, &sf.sf_uc.uc_mcontext.mc_r15, sizeof(*regs));
+	bcopy(regs, &sf.sf_uc.uc_mcontext.mc_rdi, sizeof(*regs));
 	sf.sf_uc.uc_mcontext.mc_len = sizeof(sf.sf_uc.uc_mcontext); /* magic */
 	get_fpcontext(td, &sf.sf_uc.uc_mcontext);
 	fpstate_drop(td);
@@ -280,11 +280,11 @@
 		/* Fill in POSIX parts */
 		sf.sf_si.si_signo = sig;
 		sf.sf_si.si_code = code;
-		regs->tf_rcx = regs->tf_err;	/* arg 4 in %rcx */
+		regs->tf_rcx = regs->tf_addr;	/* arg 4 in %rcx */
 	} else {
 		/* Old FreeBSD-style arguments. */
 		regs->tf_rsi = code;		/* arg 2 in %rsi */
-		regs->tf_rcx = regs->tf_err;	/* arg 4 in %rcx */
+		regs->tf_rcx = regs->tf_addr;	/* arg 4 in %rcx */
 		sf.sf_ahu.sf_handler = catcher;
 	}
 	PROC_UNLOCK(p);
@@ -352,7 +352,7 @@
 	 * one less debugger trap, so allowing it is fairly harmless.
 	 */
 	if (!EFL_SECURE(rflags & ~PSL_RF, regs->tf_rflags & ~PSL_RF)) {
-		printf("sigreturn: rflags = 0x%x\n", rflags);
+		printf("sigreturn: rflags = 0x%lx\n", rflags);
 		return (EINVAL);
 	}
 
@@ -371,7 +371,7 @@
 	ret = set_fpcontext(td, &ucp->uc_mcontext);
 	if (ret != 0)
 		return (ret);
-	bcopy(&ucp->uc_mcontext.mc_r15, regs, sizeof(*regs));
+	bcopy(&ucp->uc_mcontext.mc_rdi, regs, sizeof(*regs));
 
 	PROC_LOCK(p);
 #if defined(COMPAT_43) || defined(COMPAT_SUNOS)
@@ -465,6 +465,12 @@
 	u_long ps_strings;
 {
 	struct trapframe *regs = td->td_frame;
+	struct pcb *pcb = td->td_pcb;
+	
+	pcb->pcb_fsbase = 0;
+	pcb->pcb_gsbase = 0;
+	wrmsr(MSR_FSBASE, 0);
+	wrmsr(MSR_KGSBASE, 0);	/* User value while we're in the kernel */
 
 	bzero((char *)regs, sizeof(struct trapframe));
 	regs->tf_rip = entry;
@@ -654,7 +660,7 @@
 	IDTVEC(bnd), IDTVEC(ill), IDTVEC(dna), IDTVEC(fpusegm),
 	IDTVEC(tss), IDTVEC(missing), IDTVEC(stk), IDTVEC(prot),
 	IDTVEC(page), IDTVEC(mchk), IDTVEC(rsvd), IDTVEC(fpu), IDTVEC(align),
-	IDTVEC(xmm), IDTVEC(int0x80_syscall),
+	IDTVEC(xmm), IDTVEC(dblfault), IDTVEC(int0x80_syscall),
 	IDTVEC(fast_syscall), IDTVEC(fast_syscall32);
 
 void
@@ -1182,9 +1188,9 @@
 	lgdt(&r_gdt);
 	pc = &__pcpu;
 
-	wrmsr(MSR_FSBASE, (u_int64_t)pc);
+	wrmsr(MSR_FSBASE, 0);		/* User value */
 	wrmsr(MSR_GSBASE, (u_int64_t)pc);
-	wrmsr(MSR_KGSBASE, (u_int64_t)pc);
+	wrmsr(MSR_KGSBASE, 0);		/* User value while we're in the kernel */
 
 	pcpu_init(pc, 0, sizeof(struct pcpu));
 	PCPU_SET(prvspace, pc);
@@ -1204,28 +1210,28 @@
 
 	/* exceptions */
 	for (x = 0; x < NIDT; x++)
-		setidt(x, &IDTVEC(rsvd), SDT_SYSTGT, SEL_KPL, 0);
-	setidt(0, &IDTVEC(div),  SDT_SYSTGT, SEL_KPL, 0);
+		setidt(x, &IDTVEC(rsvd), SDT_SYSIGT, SEL_KPL, 0);
+	setidt(0, &IDTVEC(div),  SDT_SYSIGT, SEL_KPL, 0);
 	setidt(1, &IDTVEC(dbg),  SDT_SYSIGT, SEL_KPL, 0);
-	setidt(2, &IDTVEC(nmi),  SDT_SYSTGT, SEL_KPL, 0);
+	setidt(2, &IDTVEC(nmi),  SDT_SYSIGT, SEL_KPL, 0);
  	setidt(3, &IDTVEC(bpt),  SDT_SYSIGT, SEL_KPL, 0);
-	setidt(4, &IDTVEC(ofl),  SDT_SYSTGT, SEL_KPL, 0);
-	setidt(5, &IDTVEC(bnd),  SDT_SYSTGT, SEL_KPL, 0);
-	setidt(6, &IDTVEC(ill),  SDT_SYSTGT, SEL_KPL, 0);
-	setidt(7, &IDTVEC(dna),  SDT_SYSTGT, SEL_KPL, 0);
-	setidt(8, (inthand_t *)dblfault_handler, SDT_SYSIGT, SEL_KPL, 1);
-	setidt(9, &IDTVEC(fpusegm),  SDT_SYSTGT, SEL_KPL, 0);
-	setidt(10, &IDTVEC(tss),  SDT_SYSTGT, SEL_KPL, 0);
-	setidt(11, &IDTVEC(missing),  SDT_SYSTGT, SEL_KPL, 0);
-	setidt(12, &IDTVEC(stk),  SDT_SYSTGT, SEL_KPL, 0);
-	setidt(13, &IDTVEC(prot),  SDT_SYSTGT, SEL_KPL, 0);
+	setidt(4, &IDTVEC(ofl),  SDT_SYSIGT, SEL_KPL, 0);
+	setidt(5, &IDTVEC(bnd),  SDT_SYSIGT, SEL_KPL, 0);
+	setidt(6, &IDTVEC(ill),  SDT_SYSIGT, SEL_KPL, 0);
+	setidt(7, &IDTVEC(dna),  SDT_SYSIGT, SEL_KPL, 0);
+	setidt(8, &IDTVEC(dblfault), SDT_SYSIGT, SEL_KPL, 1);
+	setidt(9, &IDTVEC(fpusegm),  SDT_SYSIGT, SEL_KPL, 0);
+	setidt(10, &IDTVEC(tss),  SDT_SYSIGT, SEL_KPL, 0);
+	setidt(11, &IDTVEC(missing),  SDT_SYSIGT, SEL_KPL, 0);
+	setidt(12, &IDTVEC(stk),  SDT_SYSIGT, SEL_KPL, 0);
+	setidt(13, &IDTVEC(prot),  SDT_SYSIGT, SEL_KPL, 0);
 	setidt(14, &IDTVEC(page),  SDT_SYSIGT, SEL_KPL, 0);
-	setidt(15, &IDTVEC(rsvd),  SDT_SYSTGT, SEL_KPL, 0);
-	setidt(16, &IDTVEC(fpu),  SDT_SYSTGT, SEL_KPL, 0);
-	setidt(17, &IDTVEC(align), SDT_SYSTGT, SEL_KPL, 0);
-	setidt(18, &IDTVEC(mchk),  SDT_SYSTGT, SEL_KPL, 0);
-	setidt(19, &IDTVEC(xmm), SDT_SYSTGT, SEL_KPL, 0);
- 	setidt(0x80, &IDTVEC(int0x80_syscall), SDT_SYSTGT, SEL_UPL, 0);
+	setidt(15, &IDTVEC(rsvd),  SDT_SYSIGT, SEL_KPL, 0);
+	setidt(16, &IDTVEC(fpu),  SDT_SYSIGT, SEL_KPL, 0);
+	setidt(17, &IDTVEC(align), SDT_SYSIGT, SEL_KPL, 0);
+	setidt(18, &IDTVEC(mchk),  SDT_SYSIGT, SEL_KPL, 0);
+	setidt(19, &IDTVEC(xmm), SDT_SYSIGT, SEL_KPL, 0);
+ 	setidt(0x80, &IDTVEC(int0x80_syscall), SDT_SYSIGT, SEL_UPL, 0);
 
 	r_idt.rd_limit = sizeof(idt0) - 1;
 	r_idt.rd_base = (long) idt;
@@ -1251,8 +1257,6 @@
 
 	/* make an initial tss so cpu can get interrupt stack on syscall! */
 	common_tss.tss_rsp0 = thread0.td_kstack + KSTACK_PAGES * PAGE_SIZE - sizeof(struct pcb);
-	/* XXX we need to update tss_rsp0 in cpu_switch */
-	/* XXX maybe not yet, everything is still running in supervisor mode */
 
 	/* doublefault stack space, runs on ist1 */
 	common_tss.tss_ist1 = (long)&dblfault_stack[sizeof(dblfault_stack)];
@@ -1698,63 +1702,4 @@
 
 #endif /* DDB */
 
-void
-bcopy(const void *src, void *dest, size_t len)
-{
-	const char *csrc;
-	char *cdest;
-	size_t i;
-
-	csrc = (const char *)src;
-	cdest = (char *)dest;
-	if (src < dest) {
-		for (i = len - 1; i != (size_t)-1; i--)
-			cdest[i] = csrc[i];
-	} else {
-		for (i = 0; i < len; i++)
-			cdest[i] = csrc[i];
-	}
-}
-
-void *
-memcpy(void *dest, const void *src, size_t len)
-{
-
-	bcopy(src, dest, len);
-	return dest;
-}
-
-void
-bzero(void *buf, size_t len)
-{
-	char *cbuf;
-	size_t i;
-
-	cbuf = (char *)buf;
-	for (i = 0; i < len; i++)
-		cbuf[i] = 0;
-}
-
-void
-pagezero(void *buf)
-{
-
-	bzero(buf, PAGE_SIZE);
-}
-
-int
-bcmp(const void *s1, const void *s2, size_t len)
-{
-	const char *cs1, *cs2;
-	int diff;
-	size_t i;
-
-	cs1 = (const char *)s1;
-	cs2 = (const char *)s2;
-	for (i = 0; i < len; i++) {
-		diff = cs2[i] - cs1[i];
-		if (diff)
-			return diff;
-	}
-	return 0;
-}
+MODULE_VERSION(acpi, 100);

==== //depot/projects/smpng/sys/amd64/amd64/nexus.c#2 (text+ko) ====

@@ -26,7 +26,7 @@
  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/amd64/amd64/nexus.c,v 1.50 2003/05/01 01:05:21 peter Exp $
+ * $FreeBSD: src/sys/amd64/amd64/nexus.c,v 1.51 2003/05/12 02:44:37 peter Exp $
  */
 
 /*
@@ -323,9 +323,9 @@
 		return 0;
 
 	if (type == SYS_RES_MEMORY) {
-		rman_set_bustag(rv, I386_BUS_SPACE_MEM);
+		rman_set_bustag(rv, AMD64_BUS_SPACE_MEM);
 	} else if (type == SYS_RES_IOPORT) {
-		rman_set_bustag(rv, I386_BUS_SPACE_IO);
+		rman_set_bustag(rv, AMD64_BUS_SPACE_IO);
 		rman_set_bushandle(rv, rv->r_start);
 	}
 
@@ -346,7 +346,7 @@
 	/*
 	 * If this is a memory resource, map it into the kernel.
 	 */
-	if (rman_get_bustag(r) == I386_BUS_SPACE_MEM) {
+	if (rman_get_bustag(r) == AMD64_BUS_SPACE_MEM) {
 		caddr_t vaddr = 0;
 
 		if (rman_get_end(r) < 1024 * 1024) {
@@ -378,7 +378,7 @@
 	/*
 	 * If this is a memory resource, unmap it.
 	 */
-	if ((rman_get_bustag(r) == I386_BUS_SPACE_MEM) &&
+	if ((rman_get_bustag(r) == AMD64_BUS_SPACE_MEM) &&
 	    (rman_get_end(r) >= 1024 * 1024)) {
 		u_int32_t psize;
 

==== //depot/projects/smpng/sys/amd64/amd64/pmap.c#2 (text+ko) ====

@@ -39,7 +39,7 @@
  * SUCH DAMAGE.
  *
  *	from:	@(#)pmap.c	7.7 (Berkeley)	5/12/91
- * $FreeBSD: src/sys/amd64/amd64/pmap.c,v 1.406 2003/05/01 01:05:21 peter Exp $
+ * $FreeBSD: src/sys/amd64/amd64/pmap.c,v 1.407 2003/05/11 22:40:24 peter Exp $
  */
 /*-
  * Copyright (c) 2003 Networks Associates Technology, Inc.
@@ -1797,8 +1797,8 @@
 	 * Page Directory table entry not valid, we need a new PT page
 	 */
 	if (pte == NULL) {
-		panic("pmap_enter: invalid page directory pdir=%#jx, va=%#x\n",
-			(uintmax_t)pmap->pm_pdir[PTDPTDI], va);
+		panic("pmap_enter: invalid page directory pdir=%#lx, va=%#lx\n",
+			pmap->pm_pdir[PTDPTDI], va);
 	}
 
 	pa = VM_PAGE_TO_PHYS(m) & PG_FRAME;
@@ -1869,7 +1869,7 @@
 		err = pmap_remove_pte(pmap, pte, va);
 		vm_page_unlock_queues();
 		if (err)
-			panic("pmap_enter: pte vanished, va: 0x%x", va);
+			panic("pmap_enter: pte vanished, va: 0x%lx", va);
 	}
 
 	/*
@@ -2563,7 +2563,7 @@
 		tpte = *pte;
 
 		if (tpte == 0) {
-			printf("TPTE at %p  IS ZERO @ VA %08x\n",
+			printf("TPTE at %p  IS ZERO @ VA %08lx\n",
 							pte, pv->pv_va);
 			panic("bad pte");
 		}

==== //depot/projects/smpng/sys/amd64/amd64/support.S#2 (text+ko) ====

@@ -30,19 +30,157 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/amd64/amd64/support.S,v 1.97 2003/05/01 01:05:21 peter Exp $
+ * $FreeBSD: src/sys/amd64/amd64/support.S,v 1.99 2003/05/11 22:38:54 peter Exp $
  */
 
 #include <machine/asmacros.h>
-#include <machine/cputypes.h>
 #include <machine/pmap.h>
-#include <machine/specialreg.h>
 
 #include "assym.s"
 
 
 	.text
 
+/*
+ * bcopy family

>>> TRUNCATED FOR MAIL (1000 lines) <<<



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