From owner-svn-src-head@FreeBSD.ORG Fri Jun 12 15:06:18 2015 Return-Path: Delivered-To: svn-src-head@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D566E220; Fri, 12 Jun 2015 15:06:18 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B7B595FD; Fri, 12 Jun 2015 15:06:18 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t5CF6I0m044798; Fri, 12 Jun 2015 15:06:18 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t5CF6ICs044796; Fri, 12 Jun 2015 15:06:18 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201506121506.t5CF6ICs044796@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Fri, 12 Jun 2015 15:06:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r284324 - in head/sys/i386: i386 include X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Jun 2015 15:06:19 -0000 Author: jhb Date: Fri Jun 12 15:06:17 2015 New Revision: 284324 URL: https://svnweb.freebsd.org/changeset/base/284324 Log: Ensure that the upper 16 bits of segment registers manually saved in trapframes are cleared by explicitly pushing a zero and then moving the segment register into the low 16 bits. Certain Intel processors treat a push of a segment register as a move of the segment register into the low 16 bits leaving the upper 16 bits of the word in the stack unchanged. Reviewed by: kib MFC after: 1 month Modified: head/sys/i386/i386/exception.s head/sys/i386/include/asmacros.h Modified: head/sys/i386/i386/exception.s ============================================================================== --- head/sys/i386/i386/exception.s Fri Jun 12 15:03:59 2015 (r284323) +++ head/sys/i386/i386/exception.s Fri Jun 12 15:06:17 2015 (r284324) @@ -157,9 +157,12 @@ IDTVEC(xmm) .type alltraps,@function alltraps: pushal - pushl %ds - pushl %es - pushl %fs + pushl $0 + movl %ds,(%esp) + pushl $0 + movl %es,(%esp) + pushl $0 + movl %fs,(%esp) alltraps_with_regs_pushed: SET_KERNEL_SREGS cld @@ -233,9 +236,12 @@ IDTVEC(lcall_syscall) pushl $7 /* sizeof "lcall 7,0" */ subl $4,%esp /* skip over tf_trapno */ pushal - pushl %ds - pushl %es - pushl %fs + pushl $0 + movl %ds,(%esp) + pushl $0 + movl %es,(%esp) + pushl $0 + movl %fs,(%esp) SET_KERNEL_SREGS cld FAKE_MCOUNT(TF_EIP(%esp)) @@ -259,9 +265,12 @@ IDTVEC(int0x80_syscall) pushl $2 /* sizeof "int 0x80" */ subl $4,%esp /* skip over tf_trapno */ pushal - pushl %ds - pushl %es - pushl %fs + pushl $0 + movl %ds,(%esp) + pushl $0 + movl %es,(%esp) + pushl $0 + movl %fs,(%esp) SET_KERNEL_SREGS cld FAKE_MCOUNT(TF_EIP(%esp)) @@ -416,13 +425,16 @@ doreti_iret: doreti_iret_fault: subl $8,%esp pushal - pushl %ds + pushl $0 + movl %ds,(%esp) .globl doreti_popl_ds_fault doreti_popl_ds_fault: - pushl %es + pushl $0 + movl %es,(%esp) .globl doreti_popl_es_fault doreti_popl_es_fault: - pushl %fs + pushl $0 + movl %fs,(%esp) .globl doreti_popl_fs_fault doreti_popl_fs_fault: sti Modified: head/sys/i386/include/asmacros.h ============================================================================== --- head/sys/i386/include/asmacros.h Fri Jun 12 15:03:59 2015 (r284323) +++ head/sys/i386/include/asmacros.h Fri Jun 12 15:06:17 2015 (r284324) @@ -146,9 +146,12 @@ pushl $0 ; /* dummy error code */ \ pushl $0 ; /* dummy trap type */ \ pushal ; /* 8 ints */ \ - pushl %ds ; /* save data and extra segments ... */ \ - pushl %es ; \ - pushl %fs + pushl $0 ; /* save data and extra segments ... */ \ + mov %ds,(%esp) ; \ + pushl $0 ; \ + mov %es,(%esp) ; \ + pushl $0 ; \ + mov %fs,(%esp) #define POP_FRAME \ popl %fs ; \