Author: jhb
Date: Thu Oct 29 21:25:46 2015
New Revision: 290164
URL: https://svnweb.freebsd.org/changeset/base/290164

Log:
  Use movw instead of movl (or plain mov) when moving segment registers
  into memory.  This is a nop on clang's assembler, but some assemblers
  complain if the size suffix is incorrect.
  
  Submitted by: bde

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      Thu Oct 29 21:12:57 2015        
(r290163)
+++ head/sys/i386/i386/exception.s      Thu Oct 29 21:25:46 2015        
(r290164)
@@ -158,11 +158,11 @@ IDTVEC(xmm)
 alltraps:
        pushal
        pushl   $0
-       movl    %ds,(%esp)
+       movw    %ds,(%esp)
        pushl   $0
-       movl    %es,(%esp)
+       movw    %es,(%esp)
        pushl   $0
-       movl    %fs,(%esp)
+       movw    %fs,(%esp)
 alltraps_with_regs_pushed:
        SET_KERNEL_SREGS
        cld
@@ -237,11 +237,11 @@ IDTVEC(lcall_syscall)
        subl    $4,%esp                 /* skip over tf_trapno */
        pushal
        pushl   $0
-       movl    %ds,(%esp)
+       movw    %ds,(%esp)
        pushl   $0
-       movl    %es,(%esp)
+       movw    %es,(%esp)
        pushl   $0
-       movl    %fs,(%esp)
+       movw    %fs,(%esp)
        SET_KERNEL_SREGS
        cld
        FAKE_MCOUNT(TF_EIP(%esp))
@@ -266,11 +266,11 @@ IDTVEC(int0x80_syscall)
        subl    $4,%esp                 /* skip over tf_trapno */
        pushal
        pushl   $0
-       movl    %ds,(%esp)
+       movw    %ds,(%esp)
        pushl   $0
-       movl    %es,(%esp)
+       movw    %es,(%esp)
        pushl   $0
-       movl    %fs,(%esp)
+       movw    %fs,(%esp)
        SET_KERNEL_SREGS
        cld
        FAKE_MCOUNT(TF_EIP(%esp))
@@ -426,15 +426,15 @@ doreti_iret_fault:
        subl    $8,%esp
        pushal
        pushl   $0
-       movl    %ds,(%esp)
+       movw    %ds,(%esp)
        .globl  doreti_popl_ds_fault
 doreti_popl_ds_fault:
        pushl   $0
-       movl    %es,(%esp)
+       movw    %es,(%esp)
        .globl  doreti_popl_es_fault
 doreti_popl_es_fault:
        pushl   $0
-       movl    %fs,(%esp)
+       movw    %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    Thu Oct 29 21:12:57 2015        
(r290163)
+++ head/sys/i386/include/asmacros.h    Thu Oct 29 21:25:46 2015        
(r290164)
@@ -147,11 +147,11 @@
        pushl   $0 ;            /* dummy trap type */                   \
        pushal ;                /* 8 ints */                            \
        pushl   $0 ;            /* save data and extra segments ... */  \
-       mov     %ds,(%esp) ;                                            \
+       movw    %ds,(%esp) ;                                            \
        pushl   $0 ;                                                    \
-       mov     %es,(%esp) ;                                            \
+       movw    %es,(%esp) ;                                            \
        pushl   $0 ;                                                    \
-       mov     %fs,(%esp)
+       movw    %fs,(%esp)
        
 #define        POP_FRAME                                                       
\
        popl    %fs ;                                                   \
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to