Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 5 Apr 2009 00:08:45 GMT
From:      Andrew Thompson <thompsa@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 160219 for review
Message-ID:  <200904050008.n3508jJk044994@repoman.freebsd.org>

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

Change 160219 by thompsa@thompsa_burger on 2009/04/05 00:08:37

	IFC @160218

Affected files ...

.. //depot/projects/usb/src/sys/amd64/acpica/acpi_switch.S#2 integrate
.. //depot/projects/usb/src/sys/amd64/acpica/acpi_wakecode.S#3 integrate
.. //depot/projects/usb/src/sys/amd64/acpica/acpi_wakeup.c#4 integrate
.. //depot/projects/usb/src/sys/amd64/amd64/apic_vector.S#4 integrate
.. //depot/projects/usb/src/sys/amd64/amd64/cpu_switch.S#12 integrate
.. //depot/projects/usb/src/sys/amd64/amd64/db_interface.c#2 integrate
.. //depot/projects/usb/src/sys/amd64/amd64/db_trace.c#8 integrate
.. //depot/projects/usb/src/sys/amd64/amd64/exception.S#10 integrate
.. //depot/projects/usb/src/sys/amd64/amd64/genassym.c#12 integrate
.. //depot/projects/usb/src/sys/amd64/amd64/machdep.c#16 integrate
.. //depot/projects/usb/src/sys/amd64/amd64/mp_machdep.c#20 integrate
.. //depot/projects/usb/src/sys/amd64/amd64/sys_machdep.c#2 integrate
.. //depot/projects/usb/src/sys/amd64/amd64/trap.c#13 integrate
.. //depot/projects/usb/src/sys/amd64/amd64/vm_machdep.c#12 integrate
.. //depot/projects/usb/src/sys/amd64/ia32/ia32_exception.S#3 integrate
.. //depot/projects/usb/src/sys/amd64/ia32/ia32_misc.c#1 branch
.. //depot/projects/usb/src/sys/amd64/ia32/ia32_reg.c#2 integrate
.. //depot/projects/usb/src/sys/amd64/ia32/ia32_signal.c#8 integrate
.. //depot/projects/usb/src/sys/amd64/ia32/ia32_sigtramp.S#4 integrate
.. //depot/projects/usb/src/sys/amd64/include/asmacros.h#4 integrate
.. //depot/projects/usb/src/sys/amd64/include/frame.h#2 integrate
.. //depot/projects/usb/src/sys/amd64/include/md_var.h#8 integrate
.. //depot/projects/usb/src/sys/amd64/include/pcb.h#8 integrate
.. //depot/projects/usb/src/sys/amd64/include/pcpu.h#7 integrate
.. //depot/projects/usb/src/sys/amd64/include/proc.h#3 integrate
.. //depot/projects/usb/src/sys/amd64/include/reg.h#3 integrate
.. //depot/projects/usb/src/sys/amd64/include/segments.h#4 integrate
.. //depot/projects/usb/src/sys/amd64/include/signal.h#2 integrate
.. //depot/projects/usb/src/sys/amd64/include/sysarch.h#2 integrate
.. //depot/projects/usb/src/sys/amd64/include/ucontext.h#2 integrate
.. //depot/projects/usb/src/sys/amd64/linux32/linux32_locore.s#5 integrate
.. //depot/projects/usb/src/sys/amd64/linux32/linux32_machdep.c#13 integrate
.. //depot/projects/usb/src/sys/amd64/linux32/linux32_sysvec.c#17 integrate
.. //depot/projects/usb/src/sys/arm/arm/locore.S#7 integrate
.. //depot/projects/usb/src/sys/arm/conf/AVILA#14 integrate
.. //depot/projects/usb/src/sys/arm/conf/CAMBRIA#6 integrate
.. //depot/projects/usb/src/sys/arm/include/atomic.h#7 integrate
.. //depot/projects/usb/src/sys/arm/include/vmparam.h#8 integrate
.. //depot/projects/usb/src/sys/boot/i386/libi386/smbios.c#3 integrate
.. //depot/projects/usb/src/sys/cam/cam_xpt.c#16 integrate
.. //depot/projects/usb/src/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c#4 integrate
.. //depot/projects/usb/src/sys/compat/freebsd32/freebsd32.h#6 integrate
.. //depot/projects/usb/src/sys/compat/freebsd32/freebsd32_ioctl.c#2 integrate
.. //depot/projects/usb/src/sys/compat/freebsd32/freebsd32_ioctl.h#2 integrate
.. //depot/projects/usb/src/sys/compat/freebsd32/freebsd32_proto.h#13 integrate
.. //depot/projects/usb/src/sys/compat/freebsd32/freebsd32_syscall.h#13 integrate
.. //depot/projects/usb/src/sys/compat/freebsd32/freebsd32_syscalls.c#13 integrate
.. //depot/projects/usb/src/sys/compat/freebsd32/freebsd32_sysent.c#13 integrate
.. //depot/projects/usb/src/sys/compat/freebsd32/syscalls.master#13 integrate
.. //depot/projects/usb/src/sys/compat/ia32/ia32_signal.h#3 integrate
.. //depot/projects/usb/src/sys/conf/files#58 integrate
.. //depot/projects/usb/src/sys/conf/files.amd64#20 integrate
.. //depot/projects/usb/src/sys/conf/files.i386#22 integrate
.. //depot/projects/usb/src/sys/conf/files.ia64#12 integrate
.. //depot/projects/usb/src/sys/conf/files.powerpc#19 integrate
.. //depot/projects/usb/src/sys/conf/newvers.sh#8 integrate
.. //depot/projects/usb/src/sys/conf/options#24 integrate
.. //depot/projects/usb/src/sys/contrib/dev/uath/ar5523.bin.uu#1 branch
.. //depot/projects/usb/src/sys/dev/acpi_support/acpi_asus.c#11 integrate
.. //depot/projects/usb/src/sys/dev/age/if_age.c#8 integrate
.. //depot/projects/usb/src/sys/dev/age/if_agereg.h#2 integrate
.. //depot/projects/usb/src/sys/dev/ata/ata-pci.c#13 integrate
.. //depot/projects/usb/src/sys/dev/ata/ata-pci.h#16 integrate
.. //depot/projects/usb/src/sys/dev/ata/ata-sata.c#3 integrate
.. //depot/projects/usb/src/sys/dev/ata/chipsets/ata-ahci.c#6 integrate
.. //depot/projects/usb/src/sys/dev/ata/chipsets/ata-intel.c#4 integrate
.. //depot/projects/usb/src/sys/dev/ata/chipsets/ata-jmicron.c#3 integrate
.. //depot/projects/usb/src/sys/dev/ata/chipsets/ata-marvell.c#5 integrate
.. //depot/projects/usb/src/sys/dev/ata/chipsets/ata-nvidia.c#4 integrate
.. //depot/projects/usb/src/sys/dev/ata/chipsets/ata-promise.c#4 integrate
.. //depot/projects/usb/src/sys/dev/ata/chipsets/ata-serverworks.c#3 integrate
.. //depot/projects/usb/src/sys/dev/ata/chipsets/ata-siliconimage.c#4 integrate
.. //depot/projects/usb/src/sys/dev/ata/chipsets/ata-sis.c#5 integrate
.. //depot/projects/usb/src/sys/dev/ata/chipsets/ata-via.c#4 integrate
.. //depot/projects/usb/src/sys/dev/ath/if_ath.c#21 integrate
.. //depot/projects/usb/src/sys/dev/ath/if_athvar.h#17 integrate
.. //depot/projects/usb/src/sys/dev/drm/drm_pci.c#5 integrate
.. //depot/projects/usb/src/sys/dev/drm/drm_pciids.h#8 integrate
.. //depot/projects/usb/src/sys/dev/drm/r600_cp.c#3 integrate
.. //depot/projects/usb/src/sys/dev/drm/radeon_cp.c#8 integrate
.. //depot/projects/usb/src/sys/dev/ed/ax88x90reg.h#2 integrate
.. //depot/projects/usb/src/sys/dev/ed/dl100xxreg.h#2 integrate
.. //depot/projects/usb/src/sys/dev/ed/if_ed.c#6 integrate
.. //depot/projects/usb/src/sys/dev/ed/if_ed_pccard.c#8 integrate
.. //depot/projects/usb/src/sys/dev/ed/if_ed_wd80x3.c#2 integrate
.. //depot/projects/usb/src/sys/dev/ed/if_edreg.h#2 integrate
.. //depot/projects/usb/src/sys/dev/ed/if_edvar.h#3 integrate
.. //depot/projects/usb/src/sys/dev/if_ndis/if_ndis.c#22 integrate
.. //depot/projects/usb/src/sys/dev/ipw/if_ipw.c#9 integrate
.. //depot/projects/usb/src/sys/dev/iwi/if_iwi.c#10 integrate
.. //depot/projects/usb/src/sys/dev/iwn/if_iwn.c#6 integrate
.. //depot/projects/usb/src/sys/dev/malo/if_malo.c#3 integrate
.. //depot/projects/usb/src/sys/dev/malo/if_malo_pci.c#3 integrate
.. //depot/projects/usb/src/sys/dev/malo/if_malohal.c#2 integrate
.. //depot/projects/usb/src/sys/dev/mii/axphy.c#1 branch
.. //depot/projects/usb/src/sys/dev/mii/axphyreg.h#1 branch
.. //depot/projects/usb/src/sys/dev/mii/miidevs#12 integrate
.. //depot/projects/usb/src/sys/dev/ofw/ofw_standard.c#2 integrate
.. //depot/projects/usb/src/sys/dev/ofw/openfirm.c#6 integrate
.. //depot/projects/usb/src/sys/dev/pccard/pccarddevs#13 integrate
.. //depot/projects/usb/src/sys/dev/pccbb/pccbb_pci.c#10 integrate
.. //depot/projects/usb/src/sys/dev/pci/pci.c#19 integrate
.. //depot/projects/usb/src/sys/dev/powermac_nvram/powermac_nvram.c#4 integrate
.. //depot/projects/usb/src/sys/dev/ral/rt2560.c#11 integrate
.. //depot/projects/usb/src/sys/dev/ral/rt2560var.h#6 integrate
.. //depot/projects/usb/src/sys/dev/ral/rt2661.c#11 integrate
.. //depot/projects/usb/src/sys/dev/ral/rt2661var.h#5 integrate
.. //depot/projects/usb/src/sys/dev/re/if_re.c#17 integrate
.. //depot/projects/usb/src/sys/dev/sound/pci/hda/hdac.c#27 integrate
.. //depot/projects/usb/src/sys/dev/uart/uart_cpu_powerpc.c#5 integrate
.. //depot/projects/usb/src/sys/dev/usb/controller/usb_controller.c#11 integrate
.. //depot/projects/usb/src/sys/dev/usb/usbdevs#52 integrate
.. //depot/projects/usb/src/sys/dev/usb/wlan/if_rum.c#8 integrate
.. //depot/projects/usb/src/sys/dev/usb/wlan/if_rumvar.h#5 integrate
.. //depot/projects/usb/src/sys/dev/usb/wlan/if_uath.c#1 branch
.. //depot/projects/usb/src/sys/dev/usb/wlan/if_uathreg.h#1 branch
.. //depot/projects/usb/src/sys/dev/usb/wlan/if_uathvar.h#1 branch
.. //depot/projects/usb/src/sys/dev/usb/wlan/if_ural.c#8 integrate
.. //depot/projects/usb/src/sys/dev/usb/wlan/if_uralvar.h#5 integrate
.. //depot/projects/usb/src/sys/dev/usb/wlan/if_zyd.c#8 integrate
.. //depot/projects/usb/src/sys/dev/usb/wlan/usb_wlan.h#4 integrate
.. //depot/projects/usb/src/sys/dev/wi/if_wi.c#9 integrate
.. //depot/projects/usb/src/sys/dev/wpi/if_wpi.c#10 integrate
.. //depot/projects/usb/src/sys/dev/xen/balloon/balloon.c#3 integrate
.. //depot/projects/usb/src/sys/dev/xen/console/console.c#5 integrate
.. //depot/projects/usb/src/sys/geom/geom.h#7 integrate
.. //depot/projects/usb/src/sys/geom/geom_disk.c#8 integrate
.. //depot/projects/usb/src/sys/geom/geom_disk.h#4 integrate
.. //depot/projects/usb/src/sys/geom/geom_subr.c#10 integrate
.. //depot/projects/usb/src/sys/geom/journal/g_journal.c#9 integrate
.. //depot/projects/usb/src/sys/geom/mirror/g_mirror.c#6 integrate
.. //depot/projects/usb/src/sys/geom/part/g_part.c#17 integrate
.. //depot/projects/usb/src/sys/geom/part/g_part_ebr.c#5 integrate
.. //depot/projects/usb/src/sys/geom/part/g_part_gpt.c#12 integrate
.. //depot/projects/usb/src/sys/geom/part/g_part_mbr.c#8 integrate
.. //depot/projects/usb/src/sys/geom/part/g_part_pc98.c#10 integrate
.. //depot/projects/usb/src/sys/geom/raid3/g_raid3.c#6 integrate
.. //depot/projects/usb/src/sys/geom/vinum/geom_vinum.c#4 integrate
.. //depot/projects/usb/src/sys/geom/vinum/geom_vinum.h#4 integrate
.. //depot/projects/usb/src/sys/geom/vinum/geom_vinum_create.c#1 branch
.. //depot/projects/usb/src/sys/geom/vinum/geom_vinum_drive.c#7 integrate
.. //depot/projects/usb/src/sys/geom/vinum/geom_vinum_events.c#1 branch
.. //depot/projects/usb/src/sys/geom/vinum/geom_vinum_init.c#4 integrate
.. //depot/projects/usb/src/sys/geom/vinum/geom_vinum_list.c#3 integrate
.. //depot/projects/usb/src/sys/geom/vinum/geom_vinum_move.c#3 integrate
.. //depot/projects/usb/src/sys/geom/vinum/geom_vinum_plex.c#5 integrate
.. //depot/projects/usb/src/sys/geom/vinum/geom_vinum_raid5.c#3 integrate
.. //depot/projects/usb/src/sys/geom/vinum/geom_vinum_raid5.h#3 integrate
.. //depot/projects/usb/src/sys/geom/vinum/geom_vinum_rename.c#4 integrate
.. //depot/projects/usb/src/sys/geom/vinum/geom_vinum_rm.c#5 integrate
.. //depot/projects/usb/src/sys/geom/vinum/geom_vinum_share.c#4 integrate
.. //depot/projects/usb/src/sys/geom/vinum/geom_vinum_share.h#2 integrate
.. //depot/projects/usb/src/sys/geom/vinum/geom_vinum_state.c#3 integrate
.. //depot/projects/usb/src/sys/geom/vinum/geom_vinum_subr.c#5 integrate
.. //depot/projects/usb/src/sys/geom/vinum/geom_vinum_var.h#3 integrate
.. //depot/projects/usb/src/sys/geom/vinum/geom_vinum_volume.c#4 integrate
.. //depot/projects/usb/src/sys/i386/cpufreq/hwpstate.c#1 branch
.. //depot/projects/usb/src/sys/i386/i386/machdep.c#14 integrate
.. //depot/projects/usb/src/sys/i386/include/signal.h#2 integrate
.. //depot/projects/usb/src/sys/i386/include/ucontext.h#2 integrate
.. //depot/projects/usb/src/sys/i386/include/vmparam.h#8 integrate
.. //depot/projects/usb/src/sys/i386/include/xen/xenpmap.h#3 integrate
.. //depot/projects/usb/src/sys/i386/include/xen/xenvar.h#2 integrate
.. //depot/projects/usb/src/sys/i386/xen/pmap.c#6 integrate
.. //depot/projects/usb/src/sys/i386/xen/xen_machdep.c#8 integrate
.. //depot/projects/usb/src/sys/ia64/ia32/ia32_misc.c#1 branch
.. //depot/projects/usb/src/sys/kern/kern_shutdown.c#9 integrate
.. //depot/projects/usb/src/sys/kern/sysv_sem.c#9 integrate
.. //depot/projects/usb/src/sys/kern/vfs_cache.c#21 integrate
.. //depot/projects/usb/src/sys/kern/vfs_mount.c#20 integrate
.. //depot/projects/usb/src/sys/kern/vfs_subr.c#19 integrate
.. //depot/projects/usb/src/sys/mips/include/bus.h#2 integrate
.. //depot/projects/usb/src/sys/modules/ath/Makefile#4 integrate
.. //depot/projects/usb/src/sys/modules/cpufreq/Makefile#3 integrate
.. //depot/projects/usb/src/sys/modules/geom/geom_vinum/Makefile#2 integrate
.. //depot/projects/usb/src/sys/modules/mii/Makefile#7 integrate
.. //depot/projects/usb/src/sys/modules/usb/uath/Makefile#1 branch
.. //depot/projects/usb/src/sys/net/bpf.h#8 integrate
.. //depot/projects/usb/src/sys/net/if.c#21 integrate
.. //depot/projects/usb/src/sys/net80211/ieee80211.c#18 integrate
.. //depot/projects/usb/src/sys/net80211/ieee80211_ddb.c#12 integrate
.. //depot/projects/usb/src/sys/net80211/ieee80211_freebsd.c#12 integrate
.. //depot/projects/usb/src/sys/net80211/ieee80211_freebsd.h#14 integrate
.. //depot/projects/usb/src/sys/net80211/ieee80211_hostap.c#9 integrate
.. //depot/projects/usb/src/sys/net80211/ieee80211_ioctl.c#20 integrate
.. //depot/projects/usb/src/sys/net80211/ieee80211_ioctl.h#10 integrate
.. //depot/projects/usb/src/sys/net80211/ieee80211_node.c#19 integrate
.. //depot/projects/usb/src/sys/net80211/ieee80211_output.c#20 integrate
.. //depot/projects/usb/src/sys/net80211/ieee80211_proto.h#13 integrate
.. //depot/projects/usb/src/sys/net80211/ieee80211_scan.c#7 integrate
.. //depot/projects/usb/src/sys/net80211/ieee80211_scan.h#4 integrate
.. //depot/projects/usb/src/sys/net80211/ieee80211_sta.c#7 integrate
.. //depot/projects/usb/src/sys/net80211/ieee80211_superg.c#3 integrate
.. //depot/projects/usb/src/sys/net80211/ieee80211_superg.h#3 integrate
.. //depot/projects/usb/src/sys/net80211/ieee80211_var.h#18 integrate
.. //depot/projects/usb/src/sys/net80211/ieee80211_wds.c#7 integrate
.. //depot/projects/usb/src/sys/netinet/igmp.c#12 integrate
.. //depot/projects/usb/src/sys/netinet/ip_fw.h#13 integrate
.. //depot/projects/usb/src/sys/netinet/ip_fw2.c#20 integrate
.. //depot/projects/usb/src/sys/netinet/ip_fw_pfil.c#8 integrate
.. //depot/projects/usb/src/sys/netinet/sctp_indata.c#16 integrate
.. //depot/projects/usb/src/sys/netinet/sctp_input.c#17 integrate
.. //depot/projects/usb/src/sys/netinet/sctp_output.c#19 integrate
.. //depot/projects/usb/src/sys/netinet/sctp_pcb.c#16 integrate
.. //depot/projects/usb/src/sys/netinet/sctp_structs.h#11 integrate
.. //depot/projects/usb/src/sys/netinet/sctp_sysctl.c#12 integrate
.. //depot/projects/usb/src/sys/netinet/sctp_sysctl.h#10 integrate
.. //depot/projects/usb/src/sys/netinet/sctp_uio.h#14 integrate
.. //depot/projects/usb/src/sys/netinet/sctp_usrreq.c#16 integrate
.. //depot/projects/usb/src/sys/netinet/sctputil.c#19 integrate
.. //depot/projects/usb/src/sys/powerpc/aim/machdep.c#7 integrate
.. //depot/projects/usb/src/sys/powerpc/aim/mmu_oea.c#6 integrate
.. //depot/projects/usb/src/sys/powerpc/aim/mmu_oea64.c#1 branch
.. //depot/projects/usb/src/sys/powerpc/aim/mp_cpudep.c#3 integrate
.. //depot/projects/usb/src/sys/powerpc/aim/ofw_machdep.c#4 integrate
.. //depot/projects/usb/src/sys/powerpc/aim/swtch.S#5 integrate
.. //depot/projects/usb/src/sys/powerpc/aim/trap_subr.S#5 integrate
.. //depot/projects/usb/src/sys/powerpc/aim/uio_machdep.c#2 delete
.. //depot/projects/usb/src/sys/powerpc/aim/uma_machdep.c#2 integrate
.. //depot/projects/usb/src/sys/powerpc/aim/vm_machdep.c#4 integrate
.. //depot/projects/usb/src/sys/powerpc/booke/machdep.c#8 integrate
.. //depot/projects/usb/src/sys/powerpc/booke/pmap.c#8 integrate
.. //depot/projects/usb/src/sys/powerpc/booke/uio_machdep.c#2 delete
.. //depot/projects/usb/src/sys/powerpc/include/hid.h#3 integrate
.. //depot/projects/usb/src/sys/powerpc/include/intr.h#2 integrate
.. //depot/projects/usb/src/sys/powerpc/include/md_var.h#7 integrate
.. //depot/projects/usb/src/sys/powerpc/include/pmap.h#6 integrate
.. //depot/projects/usb/src/sys/powerpc/include/sf_buf.h#3 integrate
.. //depot/projects/usb/src/sys/powerpc/include/spr.h#7 integrate
.. //depot/projects/usb/src/sys/powerpc/include/sysarch.h#1 branch
.. //depot/projects/usb/src/sys/powerpc/include/vmparam.h#7 integrate
.. //depot/projects/usb/src/sys/powerpc/ofw/ofw_syscons.c#5 integrate
.. //depot/projects/usb/src/sys/powerpc/powermac/cpcht.c#1 branch
.. //depot/projects/usb/src/sys/powerpc/powermac/cpchtvar.h#1 branch
.. //depot/projects/usb/src/sys/powerpc/powerpc/bus_machdep.c#2 integrate
.. //depot/projects/usb/src/sys/powerpc/powerpc/cpu.c#7 integrate
.. //depot/projects/usb/src/sys/powerpc/powerpc/dump_machdep.c#1 branch
.. //depot/projects/usb/src/sys/powerpc/powerpc/mem.c#4 integrate
.. //depot/projects/usb/src/sys/powerpc/powerpc/mmu_if.m#6 integrate
.. //depot/projects/usb/src/sys/powerpc/powerpc/pmap_dispatch.c#9 integrate
.. //depot/projects/usb/src/sys/security/mac_biba/mac_biba.c#12 integrate
.. //depot/projects/usb/src/sys/security/mac_bsdextended/mac_bsdextended.c#13 integrate
.. //depot/projects/usb/src/sys/security/mac_mls/mac_mls.c#13 integrate
.. //depot/projects/usb/src/sys/sys/elf_common.h#12 integrate
.. //depot/projects/usb/src/sys/sys/kerneldump.h#4 integrate
.. //depot/projects/usb/src/sys/sys/systm.h#14 integrate
.. //depot/projects/usb/src/sys/sys/vnode.h#18 integrate
.. //depot/projects/usb/src/sys/tools/vnode_if.awk#4 integrate
.. //depot/projects/usb/src/sys/ufs/ffs/ffs_softdep.c#11 integrate
.. //depot/projects/usb/src/sys/vm/vm_extern.h#5 integrate
.. //depot/projects/usb/src/sys/vm/vm_mmap.c#16 integrate
.. //depot/projects/usb/src/sys/xen/evtchn/evtchn.c#6 integrate
.. //depot/projects/usb/src/sys/xen/reboot.c#2 integrate

Differences ...

==== //depot/projects/usb/src/sys/amd64/acpica/acpi_switch.S#2 (text+ko) ====

@@ -25,7 +25,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/amd64/acpica/acpi_switch.S,v 1.1 2009/03/17 00:48:11 jkim Exp $
+ * $FreeBSD: src/sys/amd64/acpica/acpi_switch.S,v 1.4 2009/04/02 01:46:57 jkim Exp $
  */
 
 #include <machine/asmacros.h>
@@ -64,12 +64,15 @@
 	/* Fetch PCB. */
 	movq	WAKEUP_CTX(xpcb), %r11
 
-	/* Restore segment registers. */
-	mov	WAKEUP_PCB(DS), %ds
-	mov	WAKEUP_PCB(ES), %es
-	mov	WAKEUP_XPCB(SS), %ss
-	mov	WAKEUP_PCB(FS), %fs
-	mov	WAKEUP_PCB(GS), %gs
+	/* Force kernel segment registers. */
+	movl	$KDSEL, %eax
+	movw	%ax, %ds
+	movw	%ax, %es
+	movw	%ax, %ss
+	movl	$KUF32SEL, %eax
+	movw	%ax, %fs
+	movl	$KUG32SEL, %eax
+	movw	%ax, %gs
 
 	movl	$MSR_FSBASE, %ecx
 	movl	WAKEUP_PCB(FSBASE), %eax
@@ -123,9 +126,19 @@
 	/* Restore descriptor tables. */
 	lidt	WAKEUP_XPCB(IDT)
 	lldt	WAKEUP_XPCB(LDT)
+
+#define	SDT_SYSTSS	9
+#define	SDT_SYSBSY	11
+
+	/* Clear "task busy" bit and reload TR. */
+	movq	PCPU(TSS), %rax
+	andb	$(~SDT_SYSBSY | SDT_SYSTSS), 5(%rax)
 	movw	WAKEUP_XPCB(TR), %ax
 	ltr	%ax
 
+#undef	SDT_SYSTSS
+#undef	SDT_SYSBSY
+
 	/* Restore other callee saved registers. */
 	movq	WAKEUP_PCB(R15), %r15
 	movq	WAKEUP_PCB(R14), %r14

==== //depot/projects/usb/src/sys/amd64/acpica/acpi_wakecode.S#3 (text+ko) ====

@@ -26,7 +26,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/amd64/acpica/acpi_wakecode.S,v 1.2 2009/03/23 22:35:30 jkim Exp $
+ * $FreeBSD: src/sys/amd64/acpica/acpi_wakecode.S,v 1.3 2009/04/02 00:23:56 jkim Exp $
  */
 
 #define LOCORE
@@ -223,6 +223,12 @@
 bootgdt:
 	.long	0x00000000
 	.long	0x00000000
+	.long	0x00000000
+	.long	0x00000000
+	.long	0x00000000
+	.long	0x00000000
+	.long	0x00000000
+	.long	0x00000000
 
 bootcode64:
 	.long	0x0000ffff
@@ -261,6 +267,8 @@
 wakeup_gdt:
 	.word	0
 	.quad	0
+
+	ALIGN_DATA
 wakeup_efer:
 	.quad	0
 wakeup_pat:

==== //depot/projects/usb/src/sys/amd64/acpica/acpi_wakeup.c#4 (text+ko) ====

@@ -28,7 +28,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/amd64/acpica/acpi_wakeup.c,v 1.24 2009/03/23 22:35:30 jkim Exp $");
+__FBSDID("$FreeBSD: src/sys/amd64/acpica/acpi_wakeup.c,v 1.25 2009/04/02 00:23:56 jkim Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -78,7 +78,6 @@
 int			acpi_restorecpu(struct xpcb *, vm_offset_t);
 int			acpi_savecpu(struct xpcb *);
 
-static void		acpi_reset_tss(int cpu);
 static void		acpi_alloc_wakeup_handler(void);
 static void		acpi_stop_beep(void *);
 
@@ -116,8 +115,6 @@
 	    stopxpcbs[cpu].xpcb_gdt.rd_base);
 	WAKECODE_FIXUP(wakeup_cpu, int, cpu);
 
-	acpi_reset_tss(cpu);
-
 	/* do an INIT IPI: assert RESET */
 	lapic_ipi_raw(APIC_DEST_DESTFLD | APIC_TRIGMOD_EDGE |
 	    APIC_LEVEL_ASSERT | APIC_DESTMODE_PHY | APIC_DELMODE_INIT, apic_id);
@@ -220,19 +217,6 @@
 }
 #endif
 
-static void
-acpi_reset_tss(int cpu)
-{
-	uint32_t	*tss;
-
-	/*
-	 * We have to clear "task busy" bit in TSS to restore
-	 * task register later.  Otherwise, ltr causes GPF.
-	 */
-	tss = (uint32_t *)&gdt[NGDT * cpu + GPROC0_SEL] + 1;
-	*tss &= ~((SDT_SYSBSY ^ SDT_SYSTSS) << 8);
-}
-
 int
 acpi_sleep_machdep(struct acpi_softc *sc, int state)
 {
@@ -289,8 +273,6 @@
 		    stopxpcbs[0].xpcb_gdt.rd_base);
 		WAKECODE_FIXUP(wakeup_cpu, int, 0);
 
-		acpi_reset_tss(0);
-
 		/* Call ACPICA to enter the desired sleep state */
 		if (state == ACPI_STATE_S4 && sc->acpi_s4bios)
 			status = AcpiEnterSleepStateS4bios();

==== //depot/projects/usb/src/sys/amd64/amd64/apic_vector.S#4 (text+ko) ====

@@ -28,7 +28,7 @@
  * SUCH DAMAGE.
  *
  *	from: vector.s, 386BSD 0.1 unknown origin
- * $FreeBSD: src/sys/amd64/amd64/apic_vector.S,v 1.111 2009/03/17 00:48:11 jkim Exp $
+ * $FreeBSD: src/sys/amd64/amd64/apic_vector.S,v 1.112 2009/04/01 13:09:26 kib Exp $
  */
 
 /*
@@ -219,10 +219,8 @@
 	movl	$0, LA_EOI(%rax)	/* End Of Interrupt to APIC */
 
 	call	cpustop_handler
+	jmp	doreti
 
-	POP_FRAME
-	iretq
-
 /*
  * Executed by a CPU when it receives an IPI_SUSPEND from another CPU.
  */
@@ -251,6 +249,5 @@
 	call	smp_rendezvous_action
 	movq	lapic, %rax
 	movl	$0, LA_EOI(%rax)	/* End Of Interrupt to APIC */
-	POP_FRAME			/* Why not doreti? */
-	iretq
+	jmp	doreti
 #endif /* SMP */

==== //depot/projects/usb/src/sys/amd64/amd64/cpu_switch.S#12 (text+ko) ====

@@ -30,7 +30,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.167 2009/03/17 00:48:11 jkim Exp $
+ * $FreeBSD: src/sys/amd64/amd64/cpu_switch.S,v 1.168 2009/04/01 13:09:26 kib Exp $
  */
 
 #include <machine/asmacros.h>
@@ -75,8 +75,6 @@
 1:
 	movq	TD_PCB(%rdi),%r8		/* Old pcb */
 	movl	PCPU(CPUID), %eax
-	movq	PCB_FSBASE(%r8),%r9
-	movq	PCB_GSBASE(%r8),%r10
 	/* release bit from old pm_active */
 	movq	TD_PROC(%rdi), %rdx		/* oldtd->td_proc */
 	movq	P_VMSPACE(%rdx), %rdx		/* proc->p_vmspace */
@@ -110,28 +108,6 @@
 	movq	%rbx,PCB_RBX(%r8)
 	movq	%rax,PCB_RIP(%r8)
 
-	/*
-	 * Reread fs and gs bases. Explicit fs segment register load
-	 * by the usermode code may change actual fs base without
-	 * updating pcb_{fs,gs}base.
-	 *
-	 * %rdx still contains the mtx, save %rdx around rdmsr.
-	 */
-	movq	%rdx,%r11
-	movl	$MSR_FSBASE,%ecx
-	rdmsr
-	shlq	$32,%rdx
-	leaq	(%rax,%rdx),%r9
-	movl	$MSR_KGSBASE,%ecx
-	rdmsr
-	shlq	$32,%rdx
-	leaq	(%rax,%rdx),%r10
-	movq	%r11,%rdx
-
-	testl	$PCB_32BIT,PCB_FLAGS(%r8)
-	jnz	store_seg
-done_store_seg:
-
 	testl	$PCB_DBREGS,PCB_FLAGS(%r8)
 	jnz	store_dr			/* static predict not taken */
 done_store_dr:
@@ -192,36 +168,47 @@
 	testl	$TDP_KTHREAD,TD_PFLAGS(%rsi)
 	jnz	do_kthread
 
-	testl	$PCB_32BIT,PCB_FLAGS(%r8)
-	jnz	load_seg
-done_load_seg:
+	/*
+	 * Load ldt register
+	 */
+	movq	TD_PROC(%rsi),%rcx
+	cmpq	$0, P_MD+MD_LDT(%rcx)
+	jne	do_ldt
+	xorl	%eax,%eax
+ld_ldt:	lldt	%ax
 
-	cmpq	PCB_FSBASE(%r8),%r9
-	jz	1f
-	/* Restore userland %fs */
-restore_fsbase:
-	movl	$MSR_FSBASE,%ecx
+	/* Restore fs base in GDT */
 	movl	PCB_FSBASE(%r8),%eax
-	movl	PCB_FSBASE+4(%r8),%edx
-	wrmsr
-1:
-	cmpq	PCB_GSBASE(%r8),%r10
-	jz	2f
-	/* Restore userland %gs */
-	movl	$MSR_KGSBASE,%ecx
+	movq	PCPU(FS32P),%rdx
+	movw	%ax,2(%rdx)
+	shrl	$16,%eax
+	movb	%al,4(%rdx)
+	shrl	$8,%eax
+	movb	%al,7(%rdx)
+
+	/* Restore gs base in GDT */
 	movl	PCB_GSBASE(%r8),%eax
-	movl	PCB_GSBASE+4(%r8),%edx
-	wrmsr
-2:
+	movq	PCPU(GS32P),%rdx
+	movw	%ax,2(%rdx)
+	shrl	$16,%eax
+	movb	%al,4(%rdx)
+	shrl	$8,%eax
+	movb	%al,7(%rdx)
 
-do_tss:
+do_kthread:
+	/* Do we need to reload tss ? */
+	movq	PCPU(TSSP),%rax
+	movq	PCB_TSSP(%r8),%rdx
+	testq	%rdx,%rdx
+	cmovzq	PCPU(COMMONTSSP),%rdx
+	cmpq	%rax,%rdx
+	jne	do_tss
+done_tss:
+	movq	%r8,PCPU(RSP0)
+	movq	%r8,PCPU(CURPCB)
 	/* Update the TSS_RSP0 pointer for the next interrupt */
-	movq	PCPU(TSSP), %rax
-	movq	%r8, PCPU(RSP0)
-	movq	%r8, PCPU(CURPCB)
-	addq	$COMMON_TSS_RSP0, %rax
-	movq	%rsi, PCPU(CURTHREAD)		/* into next thread */
-	movq	%r8, (%rax)
+	movq	%r8,COMMON_TSS_RSP0(%rdx)
+	movq	%rsi,PCPU(CURTHREAD)		/* into next thread */
 
 	/* Test if debug registers should be restored. */
 	testl	$PCB_DBREGS,PCB_FLAGS(%r8)
@@ -250,45 +237,6 @@
 	 * We use jumps rather than call in order to avoid the stack.
 	 */
 
-do_kthread:
-	/*
-	 * Copy old fs/gsbase to new kthread pcb for future switches
-	 * This maintains curpcb->pcb_[fg]sbase as caches of the MSR
-	 */
-	movq	%r9,PCB_FSBASE(%r8)
-	movq	%r10,PCB_GSBASE(%r8)
-	jmp	do_tss
-
-store_seg:
-	mov	%gs,PCB_GS(%r8)
-	testl	$PCB_GS32BIT,PCB_FLAGS(%r8)
-	jnz	2f
-1:	mov	%ds,PCB_DS(%r8)
-	mov	%es,PCB_ES(%r8)
-	mov	%fs,PCB_FS(%r8)
-	jmp	done_store_seg
-2:	movq	PCPU(GS32P),%rax
-	movq	(%rax),%rax
-	movq	%rax,PCB_GS32SD(%r8)
-	jmp	1b
-
-load_seg:
-	testl	$PCB_GS32BIT,PCB_FLAGS(%r8)
-	jnz	2f
-1:	movl	$MSR_GSBASE,%ecx
-	rdmsr
-	mov	PCB_GS(%r8),%gs
-	wrmsr
-	mov	PCB_DS(%r8),%ds
-	mov	PCB_ES(%r8),%es
-	mov	PCB_FS(%r8),%fs
-	jmp	restore_fsbase
-	/* Restore userland %gs while preserving kernel gsbase */
-2:	movq	PCPU(GS32P),%rax
-	movq	PCB_GS32SD(%r8),%rcx
-	movq	%rcx,(%rax)
-	jmp	1b
-
 store_dr:
 	movq	%dr7,%rax			/* yes, do the save */
 	movq	%dr0,%r15
@@ -325,6 +273,29 @@
 	movq	%r11,%dr6
 	movq	%rax,%dr7
 	jmp	done_load_dr
+
+do_tss:	movq	%rdx,PCPU(TSSP)
+	movq	%rdx,%rcx
+	movq	PCPU(TSS),%rax
+	movw	%rcx,2(%rax)
+	shrq	$16,%rcx
+	movb	%cl,4(%rax)
+	shrq	$8,%rcx
+	movb	%cl,7(%rax)
+	shrq	$8,%rcx
+	movl	%ecx,8(%rax)
+	movb	$0x89,5(%rax)	/* unset busy */
+	movl	$TSSSEL,%eax
+	ltr	%ax
+	jmp	done_tss
+
+do_ldt:	movq	PCPU(LDT),%rax
+	movq	P_MD+MD_LDT_SD(%rcx),%rdx
+	movq	%rdx,(%rax)
+	movq	P_MD+MD_LDT_SD+8(%rcx),%rdx
+	movq	%rdx,8(%rax)
+	movl	$LDTSEL,%eax
+	jmp	ld_ldt
 END(cpu_switch)
 
 /*
@@ -398,12 +369,6 @@
 	movq	(%rsp),%rax
 	movq	%rax,PCB_RIP(%r8)
 
-	mov	%ds,PCB_DS(%r8)
-	mov	%es,PCB_ES(%r8)
-	mov	%ss,XPCB_SS(%r8)
-	mov	%fs,PCB_FS(%r8)
-	mov	%gs,PCB_GS(%r8)
-
 	movq	%rbx,PCB_RBX(%r8)
 	movq	%rsp,PCB_RSP(%r8)
 	movq	%rbp,PCB_RBP(%r8)

==== //depot/projects/usb/src/sys/amd64/amd64/db_interface.c#2 (text+ko) ====

@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/amd64/amd64/db_interface.c,v 1.81 2005/01/05 20:17:20 imp Exp $");
+__FBSDID("$FreeBSD: src/sys/amd64/amd64/db_interface.c,v 1.82 2009/04/01 13:09:26 kib Exp $");
 
 /*
  * Interface to new debugger.
@@ -139,7 +139,11 @@
 db_show_mdpcpu(struct pcpu *pc)
 {
 
-#if 0
-	db_printf("currentldt   = 0x%x\n", pc->pc_currentldt);
-#endif
+	db_printf("curpmap		= %p\n", pc->pc_curpmap);
+	db_printf("tssp		= %p\n", pc->pc_tssp);
+	db_printf("commontssp	= %p\n", pc->pc_commontssp);
+	db_printf("rsp0		= 0x%lx\n", pc->pc_rsp0);
+	db_printf("gs32p		= %p\n", pc->pc_gs32p);
+	db_printf("ldt		= %p\n", pc->pc_ldt);
+	db_printf("tss		= %p\n", pc->pc_tss);
 }

==== //depot/projects/usb/src/sys/amd64/amd64/db_trace.c#8 (text+ko) ====

@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/amd64/amd64/db_trace.c,v 1.84 2009/03/17 00:48:11 jkim Exp $");
+__FBSDID("$FreeBSD: src/sys/amd64/amd64/db_trace.c,v 1.85 2009/04/01 13:09:26 kib Exp $");
 
 #include "opt_compat.h"
 
@@ -69,12 +69,10 @@
 #define	DB_OFFSET(x)	(db_expr_t *)offsetof(struct trapframe, x)
 struct db_variable db_regs[] = {
 	{ "cs",		DB_OFFSET(tf_cs),	db_frame },
-#if 0
 	{ "ds",		DB_OFFSET(tf_ds),	db_frame },
 	{ "es",		DB_OFFSET(tf_es),	db_frame },
 	{ "fs",		DB_OFFSET(tf_fs),	db_frame },
 	{ "gs",		DB_OFFSET(tf_gs),	db_frame },
-#endif
 	{ "ss",		NULL,			db_ss },
 	{ "rax",	DB_OFFSET(tf_rax),	db_frame },
 	{ "rcx",        DB_OFFSET(tf_rcx),	db_frame },
@@ -94,7 +92,7 @@
 	{ "r15",	DB_OFFSET(tf_r15),	db_frame },
 	{ "rip",	DB_OFFSET(tf_rip),	db_frame },
 	{ "rflags",	DB_OFFSET(tf_rflags),	db_frame },
-#define	DB_N_SHOW_REGS	20	/* Don't show registers after here. */
+#define	DB_N_SHOW_REGS	24	/* Don't show registers after here. */
 	{ "dr0",	NULL,			db_dr0 },
 	{ "dr1",	NULL,			db_dr1 },
 	{ "dr2",	NULL,			db_dr2 },
@@ -357,7 +355,7 @@
 		rbp = tf->tf_rbp;
 		switch (frame_type) {
 		case TRAP:
-			db_printf("--- trap %#lr", tf->tf_trapno);
+			db_printf("--- trap %#r", tf->tf_trapno);
 			break;
 		case SYSCALL:
 			db_printf("--- syscall");

==== //depot/projects/usb/src/sys/amd64/amd64/exception.S#10 (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.137 2009/02/03 09:01:45 jkoshy Exp $
+ * $FreeBSD: src/sys/amd64/amd64/exception.S,v 1.138 2009/04/01 13:09:26 kib Exp $
  */
 
 #include "opt_atpic.h"
@@ -42,6 +42,7 @@
 #include <machine/asmacros.h>
 #include <machine/psl.h>
 #include <machine/trap.h>
+#include <machine/specialreg.h>
 
 #include "assym.s"
 
@@ -99,7 +100,7 @@
 /* Traps that we leave interrupts disabled for.. */
 #define	TRAP_NOEN(a)	\
 	subq $TF_RIP,%rsp; \
-	movq $(a),TF_TRAPNO(%rsp) ; \
+	movl $(a),TF_TRAPNO(%rsp) ; \
 	movq $0,TF_ADDR(%rsp) ; \
 	movq $0,TF_ERR(%rsp) ; \
 	jmp alltraps_noen
@@ -111,7 +112,7 @@
 /* Regular traps; The cpu does not supply tf_err for these. */
 #define	TRAP(a)	 \
 	subq $TF_RIP,%rsp; \
-	movq $(a),TF_TRAPNO(%rsp) ; \
+	movl $(a),TF_TRAPNO(%rsp) ; \
 	movq $0,TF_ADDR(%rsp) ; \
 	movq $0,TF_ERR(%rsp) ; \
 	jmp alltraps
@@ -139,7 +140,7 @@
 /* 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) ; \
+	movl $(a),TF_TRAPNO(%rsp) ; \
 	movq $0,TF_ADDR(%rsp) ; \
 	jmp alltraps
 IDTVEC(tss)
@@ -164,6 +165,10 @@
 	testb	$SEL_RPL_MASK,TF_CS(%rsp) /* Did we come from kernel? */
 	jz	alltraps_testi		/* already running with kernel GS.base */
 	swapgs
+	movw	%fs,TF_FS(%rsp)
+	movw	%gs,TF_GS(%rsp)
+	movw	%es,TF_ES(%rsp)
+	movw	%ds,TF_DS(%rsp)
 alltraps_testi:
 	testl	$PSL_I,TF_RFLAGS(%rsp)
 	jz	alltraps_pushregs
@@ -185,6 +190,7 @@
 	movq	%r13,TF_R13(%rsp)
 	movq	%r14,TF_R14(%rsp)
 	movq	%r15,TF_R15(%rsp)
+	movl	$TF_HASSEGS,TF_FLAGS(%rsp)
 	FAKE_MCOUNT(TF_RIP(%rsp))
 #ifdef KDTRACE_HOOKS
 	/*
@@ -193,7 +199,7 @@
 	 * interrupt. For all other trap types, just handle them in
 	 * the usual way.
 	 */
-	cmpq	$T_BPTFLT,TF_TRAPNO(%rsp)
+	cmpl	$T_BPTFLT,TF_TRAPNO(%rsp)
 	jne	calltrap
 
 	/* Check if there is no DTrace hook registered. */
@@ -228,13 +234,17 @@
 	.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 */
+	jz	1f	/* already running with kernel GS.base */
 	swapgs
+1:	movw	%fs,TF_FS(%rsp)
+	movw	%gs,TF_GS(%rsp)
+	movw	%es,TF_ES(%rsp)
+	movw	%ds,TF_DS(%rsp)
 	jmp	alltraps_pushregs
 
 IDTVEC(dblfault)
 	subq	$TF_ERR,%rsp
-	movq	$T_DOUBLEFLT,TF_TRAPNO(%rsp)
+	movl	$T_DOUBLEFLT,TF_TRAPNO(%rsp)
 	movq	$0,TF_ADDR(%rsp)
 	movq	$0,TF_ERR(%rsp)
 	movq	%rdi,TF_RDI(%rsp)
@@ -252,6 +262,11 @@
 	movq	%r13,TF_R13(%rsp)
 	movq	%r14,TF_R14(%rsp)
 	movq	%r15,TF_R15(%rsp)
+	movw	%fs,TF_FS(%rsp)
+	movw	%gs,TF_GS(%rsp)
+	movw	%es,TF_ES(%rsp)
+	movw	%ds,TF_DS(%rsp)
+	movl	$TF_HASSEGS,TF_FLAGS(%rsp)
 	testb	$SEL_RPL_MASK,TF_CS(%rsp) /* Did we come from kernel? */
 	jz	1f			/* already running with kernel GS.base */
 	swapgs
@@ -262,7 +277,7 @@
 
 IDTVEC(page)
 	subq	$TF_ERR,%rsp
-	movq	$T_PAGEFLT,TF_TRAPNO(%rsp)
+	movl	$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
@@ -270,6 +285,10 @@
 	movq	%rdi,TF_RDI(%rsp)	/* free up a GP register */
 	movq	%cr2,%rdi		/* preserve %cr2 before ..  */
 	movq	%rdi,TF_ADDR(%rsp)	/* enabling interrupts. */
+	movw	%fs,TF_FS(%rsp)
+	movw	%gs,TF_GS(%rsp)
+	movw	%es,TF_ES(%rsp)
+	movw	%ds,TF_DS(%rsp)
 	testl	$PSL_I,TF_RFLAGS(%rsp)
 	jz	alltraps_pushregs_no_rdi
 	sti
@@ -283,17 +302,19 @@
 	 */
 IDTVEC(prot)
 	subq	$TF_ERR,%rsp
-	movq	$T_PROTFLT,TF_TRAPNO(%rsp)
+	movl	$T_PROTFLT,TF_TRAPNO(%rsp)
 	movq	$0,TF_ADDR(%rsp)
 	movq	%rdi,TF_RDI(%rsp)	/* free up a GP register */
 	leaq	doreti_iret(%rip),%rdi
 	cmpq	%rdi,TF_RIP(%rsp)
-	je	2f			/* kernel but with user gsbase!! */
+	je	1f			/* kernel but with user gsbase!! */
 	testb	$SEL_RPL_MASK,TF_CS(%rsp) /* Did we come from kernel? */
-	jz	1f			/* already running with kernel GS.base */
-2:
-	swapgs
-1:
+	jz	2f			/* already running with kernel GS.base */
+1:	swapgs
+2:	movw	%fs,TF_FS(%rsp)
+	movw	%gs,TF_GS(%rsp)
+	movw	%es,TF_ES(%rsp)
+	movw	%ds,TF_DS(%rsp)
 	testl	$PSL_I,TF_RFLAGS(%rsp)
 	jz	alltraps_pushregs_no_rdi
 	sti
@@ -316,6 +337,10 @@
 	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 */
+	movw	%fs,TF_FS(%rsp)
+	movw	%gs,TF_GS(%rsp)
+	movw	%es,TF_ES(%rsp)
+	movw	%ds,TF_DS(%rsp)
 	sti
 	movq	$KUDSEL,TF_SS(%rsp)
 	movq	$KUCSEL,TF_CS(%rsp)
@@ -333,40 +358,11 @@
 	movq	%r13,TF_R13(%rsp)	/* C preserved */
 	movq	%r14,TF_R14(%rsp)	/* C preserved */
 	movq	%r15,TF_R15(%rsp)	/* C preserved */
+	movl	$TF_HASSEGS,TF_FLAGS(%rsp)
 	FAKE_MCOUNT(TF_RIP(%rsp))
 	movq	%rsp, %rdi
 	call	syscall
 	movq	PCPU(CURPCB),%rax
-	testq	$PCB_FULLCTX,PCB_FLAGS(%rax)
-	jne	3f
-1:	/* Check for and handle AST's on return to userland */
-	cli
-	movq	PCPU(CURTHREAD),%rax
-	testl	$TDF_ASTPENDING | TDF_NEEDRESCHED,TD_FLAGS(%rax)
-	je	2f
-	sti
-	movq	%rsp, %rdi
-	call	ast
-	jmp	1b
-2:	/* restore preserved registers */
-	MEXITCOUNT
-	movq	TF_RDI(%rsp),%rdi	/* bonus; preserve arg 1 */
-	movq	TF_RSI(%rsp),%rsi	/* bonus: preserve arg 2 */
-	movq	TF_RDX(%rsp),%rdx	/* return value 2 */
-	movq	TF_RAX(%rsp),%rax	/* return value 1 */
-	movq	TF_RBX(%rsp),%rbx	/* C preserved */
-	movq	TF_RBP(%rsp),%rbp	/* C preserved */
-	movq	TF_R12(%rsp),%r12	/* C preserved */
-	movq	TF_R13(%rsp),%r13	/* C preserved */
-	movq	TF_R14(%rsp),%r14	/* C preserved */
-	movq	TF_R15(%rsp),%r15	/* C preserved */
-	movq	TF_RFLAGS(%rsp),%r11	/* original %rflags */
-	movq	TF_RIP(%rsp),%rcx	/* original %rip */
-	movq	TF_RSP(%rsp),%r9	/* user stack pointer */
-	movq	%r9,%rsp		/* original %rsp */
-	swapgs
-	sysretq
-3:	/* Requested full context restore, use doreti for that */
 	andq	$~PCB_FULLCTX,PCB_FLAGS(%rax)
 	MEXITCOUNT
 	jmp	doreti
@@ -405,7 +401,7 @@
 
 IDTVEC(nmi)
 	subq	$TF_RIP,%rsp
-	movq	$(T_NMI),TF_TRAPNO(%rsp)
+	movl	$(T_NMI),TF_TRAPNO(%rsp)
 	movq	$0,TF_ADDR(%rsp)
 	movq	$0,TF_ERR(%rsp)
 	movq	%rdi,TF_RDI(%rsp)
@@ -423,6 +419,11 @@
 	movq	%r13,TF_R13(%rsp)
 	movq	%r14,TF_R14(%rsp)
 	movq	%r15,TF_R15(%rsp)
+	movw	%fs,TF_FS(%rsp)
+	movw	%gs,TF_GS(%rsp)
+	movw	%es,TF_ES(%rsp)
+	movw	%ds,TF_DS(%rsp)
+	movl	$TF_HASSEGS,TF_FLAGS(%rsp)
 	xorl	%ebx,%ebx
 	testb	$SEL_RPL_MASK,TF_CS(%rsp)
 	jnz	nmi_fromuserspace
@@ -515,9 +516,7 @@
 nocallchain:
 #endif
 	testl	%ebx,%ebx
-	jz	nmi_kernelexit
-	swapgs
-	jmp	nmi_restoreregs
+	jnz	doreti_exit
 nmi_kernelexit:	
 	/*
 	 * Put back the preserved MSR_GSBASE value.
@@ -633,7 +632,55 @@
 	 */
 doreti_exit:
 	MEXITCOUNT
-	movq	TF_RDI(%rsp),%rdi
+	movq	PCPU(CURTHREAD),%r8
+	movq	TD_PCB(%r8),%r8
+
+	/*
+	 * Do not reload segment registers for kernel.
+	 * Since we do not reload segments registers with sane
+	 * values on kernel entry, descriptors referenced by
+	 * segments registers may be not valid. This is fatal
+	 * for the usermode, but is innocent for the kernel.
+	 */
+	testb	$SEL_RPL_MASK,TF_CS(%rsp)
+	jz	ld_regs
+
+	testl	$TF_HASSEGS,TF_FLAGS(%rsp)
+	je	set_segs
+
+do_segs:
+	/* Restore %fs and fsbase */
+	movw	TF_FS(%rsp),%ax
+	.globl	ld_fs
+ld_fs:	movw	%ax,%fs
+	cmpw	$KUF32SEL,%ax
+	jne	1f
+	movl	$MSR_FSBASE,%ecx
+	movl	PCB_FSBASE(%r8),%eax
+	movl	PCB_FSBASE+4(%r8),%edx
+	wrmsr
+1:
+	/* Restore %gs and gsbase */
+	movw	TF_GS(%rsp),%si
+	pushfq
+	cli
+	movl	$MSR_GSBASE,%ecx
+	rdmsr
+	.globl	ld_gs
+ld_gs:	movw	%si,%gs

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



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