bcopyxx: EDX already points to the GDT; no reason to recompute
authorH. Peter Anvin <hpa@zytor.com>
Tue, 5 May 2009 04:56:06 +0000 (21:56 -0700)
committerH. Peter Anvin <hpa@zytor.com>
Tue, 5 May 2009 04:56:06 +0000 (21:56 -0700)
We already have the EDX register pointing to the GDT, so recomputing
the address of the GDT is completely pointless.  This shaves an
additional few bytes off the bcopyxx safe area (now down to 543 bytes
including the 128-byte stack and the 15-byte alignment slop.)

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

index 4d0266e..4689788 100644 (file)
@@ -239,19 +239,16 @@ pm_shuffle:
                jmp edi                 ; Protected mode entry
 
                ; We have a real-mode entry point, so we need to return
-               ; to real mode...
+               ; to real mode.  Note: EDX already points to the GDT.
 pm_shuffle_real_mode:
-               call .here
-.here:         pop ebx
                mov eax,edi
-               add ebx,bcopy_gdt-.here
-               mov [ebx+PM_CS16+2],ax
-               mov [ebx+PM_DS16+2],ax
+               mov [edx+PM_CS16+2],ax
+               mov [edx+PM_DS16+2],ax
                shr eax,16
-               mov [ebx+PM_CS16+4],al
-               mov [ebx+PM_CS16+7],ah
-               mov [ebx+PM_DS16+4],al
-               mov [ebx+PM_DS16+7],ah
+               mov [edx+PM_CS16+4],al
+               mov [edx+PM_CS16+7],ah
+               mov [edx+PM_DS16+4],al
+               mov [edx+PM_DS16+7],ah
                mov eax,cr0
                and al,~1
                popfd                   ; Clean the flags