From owner-svn-src-head@FreeBSD.ORG Tue Jul 5 18:42:10 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 819E91065673; Tue, 5 Jul 2011 18:42:10 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 58E918FC0A; Tue, 5 Jul 2011 18:42:10 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p65IgAi1080861; Tue, 5 Jul 2011 18:42:10 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p65IgAEH080858; Tue, 5 Jul 2011 18:42:10 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <201107051842.p65IgAEH080858@svn.freebsd.org> From: Jung-uk Kim Date: Tue, 5 Jul 2011 18:42:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r223796 - in head/sys: amd64/include i386/include X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 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: Tue, 05 Jul 2011 18:42:10 -0000 Author: jkim Date: Tue Jul 5 18:42:10 2011 New Revision: 223796 URL: http://svn.freebsd.org/changeset/base/223796 Log: Correct cpu_monitor() and cpu_mwait() for amd64. These instructions take %rcx as "extensions" in long mode. If any unused bit is set in %rcx, these instructions cause general protection fault. Fix style nits and synchronize i386 with amd64. Modified: head/sys/amd64/include/cpufunc.h head/sys/i386/include/cpufunc.h Modified: head/sys/amd64/include/cpufunc.h ============================================================================== --- head/sys/amd64/include/cpufunc.h Tue Jul 5 18:40:37 2011 (r223795) +++ head/sys/amd64/include/cpufunc.h Tue Jul 5 18:42:10 2011 (r223796) @@ -467,16 +467,18 @@ load_es(u_short sel) } static __inline void -cpu_monitor(const void *addr, int extensions, int hints) +cpu_monitor(const void *addr, u_long extensions, u_int hints) { - __asm __volatile("monitor;" - : :"a" (addr), "c" (extensions), "d"(hints)); + + __asm __volatile("monitor" + : : "a" (addr), "c" (extensions), "d" (hints)); } static __inline void -cpu_mwait(int extensions, int hints) +cpu_mwait(u_long extensions, u_int hints) { - __asm __volatile("mwait;" : :"a" (hints), "c" (extensions)); + + __asm __volatile("mwait" : : "a" (hints), "c" (extensions)); } #ifdef _KERNEL Modified: head/sys/i386/include/cpufunc.h ============================================================================== --- head/sys/i386/include/cpufunc.h Tue Jul 5 18:40:37 2011 (r223795) +++ head/sys/i386/include/cpufunc.h Tue Jul 5 18:42:10 2011 (r223796) @@ -133,16 +133,18 @@ enable_intr(void) } static __inline void -cpu_monitor(const void *addr, int extensions, int hints) +cpu_monitor(const void *addr, u_long extensions, u_int hints) { - __asm __volatile("monitor;" - : :"a" (addr), "c" (extensions), "d"(hints)); + + __asm __volatile("monitor" + : : "a" (addr), "c" (extensions), "d" (hints)); } static __inline void -cpu_mwait(int extensions, int hints) +cpu_mwait(u_long extensions, u_int hints) { - __asm __volatile("mwait;" : :"a" (hints), "c" (extensions)); + + __asm __volatile("mwait" : : "a" (hints), "c" (extensions)); } static __inline void