bcopyxx: align the relocated code to a 16-byte boundary
authorH. Peter Anvin <hpa@zytor.com>
Mon, 27 Apr 2009 20:48:24 +0000 (13:48 -0700)
committerH. Peter Anvin <hpa@zytor.com>
Mon, 27 Apr 2009 20:48:24 +0000 (13:48 -0700)
Align the relocated bcopyxx code to a 16-byte boundary.  There are
CPUs which have errata relating to GDTs which are not 16-byte aligned.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
core/bcopyxx.inc

index b237b00..06b03b2 100644 (file)
@@ -205,7 +205,8 @@ pm_bcopy:
 ;
 pm_shuffle:
                mov ebx,edi             ; EBX <- descriptor list
-               lea edx,[edi+ecx]       ; EDX <- shuffler end location
+               lea edx,[edi+ecx+15]    ; EDX <- where to relocate our code to
+               and edx,~15             ; Align 16 to benefit the GDT
                call pm_bcopy
                mov edi,edx
                mov esi,bcopyxx_start
@@ -299,7 +300,8 @@ bcopyxx_len equ $-bcopyxx_start
 bcopyxx_dwords equ bcopyxx_len >> 2
 
 bcopyxx_stack  equ 128                 ; We want this much stack
-bcopyxx_safe   equ bcopyxx_len + bcopyxx_stack
+               ; The +15 is for alignment
+bcopyxx_safe   equ bcopyxx_len + bcopyxx_stack + 15
 
 ;
 ; Space for a dummy task state segment.  It should never be actually