From owner-svn-src-head@FreeBSD.ORG Fri Sep 3 14:25:17 2010 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 5D00A1065746; Fri, 3 Sep 2010 14:25:17 +0000 (UTC) (envelope-from rdivacky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4BB898FC14; Fri, 3 Sep 2010 14:25:17 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o83EPHKv050880; Fri, 3 Sep 2010 14:25:17 GMT (envelope-from rdivacky@svn.freebsd.org) Received: (from rdivacky@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o83EPHCI050877; Fri, 3 Sep 2010 14:25:17 GMT (envelope-from rdivacky@svn.freebsd.org) Message-Id: <201009031425.o83EPHCI050877@svn.freebsd.org> From: Roman Divacky Date: Fri, 3 Sep 2010 14:25:17 +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: r212177 - 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: Fri, 03 Sep 2010 14:25:17 -0000 Author: rdivacky Date: Fri Sep 3 14:25:17 2010 New Revision: 212177 URL: http://svn.freebsd.org/changeset/base/212177 Log: Change the parameter passed to the inline assembly to u_short as we are dealing with 16bit segment registers. Change mov to movw. Approved by: rpaulo (mentor) Reviewed by: kib, rink 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 Fri Sep 3 13:54:02 2010 (r212176) +++ head/sys/amd64/include/cpufunc.h Fri Sep 3 14:25:17 2010 (r212177) @@ -421,40 +421,40 @@ invlpg(u_long addr) __asm __volatile("invlpg %0" : : "m" (*(char *)addr) : "memory"); } -static __inline u_int +static __inline u_short rfs(void) { - u_int sel; - __asm __volatile("mov %%fs,%0" : "=rm" (sel)); + u_short sel; + __asm __volatile("movw %%fs,%0" : "=rm" (sel)); return (sel); } -static __inline u_int +static __inline u_short rgs(void) { - u_int sel; - __asm __volatile("mov %%gs,%0" : "=rm" (sel)); + u_short sel; + __asm __volatile("movw %%gs,%0" : "=rm" (sel)); return (sel); } -static __inline u_int +static __inline u_short rss(void) { - u_int sel; - __asm __volatile("mov %%ss,%0" : "=rm" (sel)); + u_short sel; + __asm __volatile("movw %%ss,%0" : "=rm" (sel)); return (sel); } static __inline void -load_ds(u_int sel) +load_ds(u_short sel) { - __asm __volatile("mov %0,%%ds" : : "rm" (sel)); + __asm __volatile("movw %0,%%ds" : : "rm" (sel)); } static __inline void -load_es(u_int sel) +load_es(u_short sel) { - __asm __volatile("mov %0,%%es" : : "rm" (sel)); + __asm __volatile("movw %0,%%es" : : "rm" (sel)); } static __inline void @@ -476,10 +476,10 @@ cpu_mwait(int extensions, int hints) #define MSR_FSBASE 0xc0000100 #endif static __inline void -load_fs(u_int sel) +load_fs(u_short sel) { /* Preserve the fsbase value across the selector load */ - __asm __volatile("rdmsr; mov %0,%%fs; wrmsr" + __asm __volatile("rdmsr; movw %0,%%fs; wrmsr" : : "rm" (sel), "c" (MSR_FSBASE) : "eax", "edx"); } @@ -487,28 +487,28 @@ load_fs(u_int sel) #define MSR_GSBASE 0xc0000101 #endif static __inline void -load_gs(u_int sel) +load_gs(u_short sel) { /* * Preserve the gsbase value across the selector load. * Note that we have to disable interrupts because the gsbase * being trashed happens to be the kernel gsbase at the time. */ - __asm __volatile("pushfq; cli; rdmsr; mov %0,%%gs; wrmsr; popfq" + __asm __volatile("pushfq; cli; rdmsr; movw %0,%%gs; wrmsr; popfq" : : "rm" (sel), "c" (MSR_GSBASE) : "eax", "edx"); } #else /* Usable by userland */ static __inline void -load_fs(u_int sel) +load_fs(u_short sel) { - __asm __volatile("mov %0,%%fs" : : "rm" (sel)); + __asm __volatile("movw %0,%%fs" : : "rm" (sel)); } static __inline void -load_gs(u_int sel) +load_gs(u_short sel) { - __asm __volatile("mov %0,%%gs" : : "rm" (sel)); + __asm __volatile("movw %0,%%gs" : : "rm" (sel)); } #endif @@ -692,8 +692,8 @@ void load_dr4(u_int64_t dr4); void load_dr5(u_int64_t dr5); void load_dr6(u_int64_t dr6); void load_dr7(u_int64_t dr7); -void load_fs(u_int sel); -void load_gs(u_int sel); +void load_fs(u_short sel); +void load_gs(u_short sel); void ltr(u_short sel); void outb(u_int port, u_char data); void outl(u_int port, u_int data); Modified: head/sys/i386/include/cpufunc.h ============================================================================== --- head/sys/i386/include/cpufunc.h Fri Sep 3 13:54:02 2010 (r212176) +++ head/sys/i386/include/cpufunc.h Fri Sep 3 14:25:17 2010 (r212177) @@ -444,11 +444,11 @@ invlpg(u_int addr) #endif } -static __inline u_int +static __inline u_short rfs(void) { - u_int sel; - __asm __volatile("mov %%fs,%0" : "=rm" (sel)); + u_short sel; + __asm __volatile("movw %%fs,%0" : "=rm" (sel)); return (sel); } @@ -460,11 +460,11 @@ rgdt(void) return (gdtr); } -static __inline u_int +static __inline u_short rgs(void) { - u_int sel; - __asm __volatile("mov %%gs,%0" : "=rm" (sel)); + u_short sel; + __asm __volatile("movw %%gs,%0" : "=rm" (sel)); return (sel); } @@ -484,11 +484,11 @@ rldt(void) return (ldtr); } -static __inline u_int +static __inline u_short rss(void) { - u_int sel; - __asm __volatile("mov %%ss,%0" : "=rm" (sel)); + u_short sel; + __asm __volatile("movw %%ss,%0" : "=rm" (sel)); return (sel); } @@ -501,15 +501,15 @@ rtr(void) } static __inline void -load_fs(u_int sel) +load_fs(u_short sel) { - __asm __volatile("mov %0,%%fs" : : "rm" (sel)); + __asm __volatile("movw %0,%%fs" : : "rm" (sel)); } static __inline void -load_gs(u_int sel) +load_gs(u_short sel) { - __asm __volatile("mov %0,%%gs" : : "rm" (sel)); + __asm __volatile("movw %0,%%gs" : : "rm" (sel)); } static __inline void @@ -706,8 +706,8 @@ void load_dr4(u_int dr4); void load_dr5(u_int dr5); void load_dr6(u_int dr6); void load_dr7(u_int dr7); -void load_fs(u_int sel); -void load_gs(u_int sel); +void load_fs(u_short sel); +void load_gs(u_short sel); void ltr(u_short sel); void outb(u_int port, u_char data); void outl(u_int port, u_int data);