Remove ".intel_syntax", convert MASM to GAS.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9067 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
2ce5c88a7a
commit
db63aeea6d
|
@ -1,8 +1,3 @@
|
||||||
#
|
|
||||||
# ConvertAsm.py: Automatically generated from CpuAsm.asm
|
|
||||||
#
|
|
||||||
# TITLE CpuAsm.asm:
|
|
||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
#*
|
#*
|
||||||
#* Copyright 2006 - 2009, Intel Corporation
|
#* Copyright 2006 - 2009, Intel Corporation
|
||||||
|
@ -33,11 +28,10 @@
|
||||||
ExternalVectorTablePtr:
|
ExternalVectorTablePtr:
|
||||||
.byte 0, 0, 0, 0
|
.byte 0, 0, 0, 0
|
||||||
|
|
||||||
.intel_syntax
|
|
||||||
ASM_GLOBAL ASM_PFX(InitializeExternalVectorTablePtr)
|
ASM_GLOBAL ASM_PFX(InitializeExternalVectorTablePtr)
|
||||||
ASM_PFX(InitializeExternalVectorTablePtr):
|
ASM_PFX(InitializeExternalVectorTablePtr):
|
||||||
mov eax, [esp+4]
|
movl 4(%esp), %eax
|
||||||
mov ExternalVectorTablePtr, eax
|
movl %eax, ExternalVectorTablePtr
|
||||||
ret
|
ret
|
||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
@ -46,17 +40,16 @@ ASM_PFX(InitializeExternalVectorTablePtr):
|
||||||
# UINT16 Selector
|
# UINT16 Selector
|
||||||
# );
|
# );
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
.intel_syntax
|
|
||||||
ASM_GLOBAL ASM_PFX(SetCodeSelector)
|
ASM_GLOBAL ASM_PFX(SetCodeSelector)
|
||||||
ASM_PFX(SetCodeSelector):
|
ASM_PFX(SetCodeSelector):
|
||||||
mov %ecx, [%esp+4]
|
movl 4(%esp), %ecx
|
||||||
sub %esp, 0x10
|
subl $0x10, %esp
|
||||||
lea %eax, setCodeSelectorLongJump
|
leal setCodeSelectorLongJump, %eax
|
||||||
mov [%esp], %eax
|
movl %eax, (%esp)
|
||||||
mov [%esp+4], %cx
|
movw %cx, 4(%esp)
|
||||||
jmp fword ptr [%esp]
|
.byte 0xFF, 0x2C, 0x24 # jmp *(%esp) note:(FWORD jmp)
|
||||||
setCodeSelectorLongJump:
|
setCodeSelectorLongJump:
|
||||||
add %esp, 0x10
|
addl $0x10, %esp
|
||||||
ret
|
ret
|
||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
@ -65,15 +58,14 @@ setCodeSelectorLongJump:
|
||||||
# UINT16 Selector
|
# UINT16 Selector
|
||||||
# );
|
# );
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
.intel_syntax
|
|
||||||
ASM_GLOBAL ASM_PFX(SetDataSelectors)
|
ASM_GLOBAL ASM_PFX(SetDataSelectors)
|
||||||
ASM_PFX(SetDataSelectors):
|
ASM_PFX(SetDataSelectors):
|
||||||
mov %ecx, [%esp+4]
|
movl 4(%esp), %ecx
|
||||||
mov %ss, %cx
|
movw %cx, %ss
|
||||||
mov %ds, %cx
|
movw %cx, %ds
|
||||||
mov %es, %cx
|
movw %cx, %es
|
||||||
mov %fs, %cx
|
movw %cx, %fs
|
||||||
mov %gs, %cx
|
movw %cx, %gs
|
||||||
ret
|
ret
|
||||||
|
|
||||||
#---------------------------------------;
|
#---------------------------------------;
|
||||||
|
@ -81,7 +73,6 @@ ASM_PFX(SetDataSelectors):
|
||||||
#---------------------------------------;
|
#---------------------------------------;
|
||||||
# The follow algorithm is used for the common interrupt routine.
|
# The follow algorithm is used for the common interrupt routine.
|
||||||
|
|
||||||
.intel_syntax
|
|
||||||
ASM_GLOBAL ASM_PFX(CommonInterruptEntry)
|
ASM_GLOBAL ASM_PFX(CommonInterruptEntry)
|
||||||
ASM_PFX(CommonInterruptEntry):
|
ASM_PFX(CommonInterruptEntry):
|
||||||
cli
|
cli
|
||||||
|
@ -96,12 +87,12 @@ ASM_PFX(CommonInterruptEntry):
|
||||||
# Get the return address of call, actually, it is the
|
# Get the return address of call, actually, it is the
|
||||||
# address of vector number.
|
# address of vector number.
|
||||||
#
|
#
|
||||||
xchg ecx, [esp]
|
xchgl (%esp), %ecx
|
||||||
mov cx, [ecx]
|
movw (%ecx), %cx
|
||||||
and ecx, 0x0FFFF
|
andl $0x0FFFF, %ecx
|
||||||
cmp ecx, 32 # Intel reserved vector for exceptions?
|
cmpl $32, %ecx # Intel reserved vector for exceptions?
|
||||||
jae NoErrorCode
|
jae NoErrorCode
|
||||||
bt ASM_PFX(mErrorCodeFlag), ecx
|
bt %ecx, ASM_PFX(mErrorCodeFlag)
|
||||||
jc HasErrorCode
|
jc HasErrorCode
|
||||||
|
|
||||||
NoErrorCode:
|
NoErrorCode:
|
||||||
|
@ -125,13 +116,13 @@ NoErrorCode:
|
||||||
#
|
#
|
||||||
# Put Vector Number on stack
|
# Put Vector Number on stack
|
||||||
#
|
#
|
||||||
push ecx
|
pushl %ecx
|
||||||
|
|
||||||
#
|
#
|
||||||
# Put 0 (dummy) error code on stack, and restore ECX
|
# Put 0 (dummy) error code on stack, and restore ECX
|
||||||
#
|
#
|
||||||
xor ecx, ecx # ECX = 0
|
xorl %ecx, %ecx # ECX = 0
|
||||||
xchg ecx, [esp+4]
|
xchgl 4(%esp), %ecx
|
||||||
|
|
||||||
jmp ErrorCodeAndVectorOnStack
|
jmp ErrorCodeAndVectorOnStack
|
||||||
|
|
||||||
|
@ -158,7 +149,7 @@ HasErrorCode:
|
||||||
#
|
#
|
||||||
# Put Vector Number on stack and restore ECX
|
# Put Vector Number on stack and restore ECX
|
||||||
#
|
#
|
||||||
xchg ecx, [esp]
|
xchgl (%esp), %ecx
|
||||||
|
|
||||||
#
|
#
|
||||||
# Fall through to join main routine code
|
# Fall through to join main routine code
|
||||||
|
@ -168,8 +159,8 @@ CommonInterruptEntry_al_0000:
|
||||||
jmp CommonInterruptEntry_al_0000
|
jmp CommonInterruptEntry_al_0000
|
||||||
|
|
||||||
ErrorCodeAndVectorOnStack:
|
ErrorCodeAndVectorOnStack:
|
||||||
push ebp
|
pushl %ebp
|
||||||
mov ebp, esp
|
movl %esp, %ebp
|
||||||
|
|
||||||
#
|
#
|
||||||
# Stack:
|
# Stack:
|
||||||
|
@ -192,203 +183,203 @@ ErrorCodeAndVectorOnStack:
|
||||||
# Align stack to make sure that EFI_FX_SAVE_STATE_IA32 of EFI_SYSTEM_CONTEXT_IA32
|
# Align stack to make sure that EFI_FX_SAVE_STATE_IA32 of EFI_SYSTEM_CONTEXT_IA32
|
||||||
# is 16-byte aligned
|
# is 16-byte aligned
|
||||||
#
|
#
|
||||||
and esp, 0x0fffffff0
|
andl $0x0fffffff0, %esp
|
||||||
sub esp, 12
|
subl $12, %esp
|
||||||
|
|
||||||
#; UINT32 Edi, Esi, Ebp, Esp, Ebx, Edx, Ecx, Eax;
|
#; UINT32 Edi, Esi, Ebp, Esp, Ebx, Edx, Ecx, Eax;
|
||||||
push eax
|
pushl %eax
|
||||||
push ecx
|
pushl %ecx
|
||||||
push edx
|
pushl %edx
|
||||||
push ebx
|
pushl %ebx
|
||||||
lea ecx, [ebp + 6 * 4]
|
leal 24(%ebp), %ecx
|
||||||
push ecx # ESP
|
pushl %ecx # ESP
|
||||||
push dword ptr [ebp] # EBP
|
pushl (%ebp) # EBP
|
||||||
push esi
|
pushl %esi
|
||||||
push edi
|
pushl %edi
|
||||||
|
|
||||||
#; UINT32 Gs, Fs, Es, Ds, Cs, Ss;
|
#; UINT32 Gs, Fs, Es, Ds, Cs, Ss;
|
||||||
mov eax, ss
|
movl %ss, %eax
|
||||||
push eax
|
pushl %eax
|
||||||
movzx eax, word ptr [ebp + 4 * 4]
|
movzwl 16(%ebp), %eax
|
||||||
push eax
|
pushl %eax
|
||||||
mov eax, ds
|
movl %ds, %eax
|
||||||
push eax
|
pushl %eax
|
||||||
mov eax, es
|
movl %es, %eax
|
||||||
push eax
|
pushl %eax
|
||||||
mov eax, fs
|
movl %fs, %eax
|
||||||
push eax
|
pushl %eax
|
||||||
mov eax, gs
|
movl %gs, %eax
|
||||||
push eax
|
pushl %eax
|
||||||
|
|
||||||
#; UINT32 Eip;
|
#; UINT32 Eip;
|
||||||
mov eax, [ebp + 3 * 4]
|
movl 12(%ebp), %eax
|
||||||
push eax
|
pushl %eax
|
||||||
|
|
||||||
#; UINT32 Gdtr[2], Idtr[2];
|
#; UINT32 Gdtr[2], Idtr[2];
|
||||||
sub esp, 8
|
subl $8, %esp
|
||||||
sidt [esp]
|
sidt (%esp)
|
||||||
mov eax, [esp + 2]
|
movl 2(%esp), %eax
|
||||||
xchg eax, [esp]
|
xchgl (%esp), %eax
|
||||||
and eax, 0x0FFFF
|
andl $0x0FFFF, %eax
|
||||||
mov [esp+4], eax
|
movl %eax, 4(%esp)
|
||||||
|
|
||||||
sub esp, 8
|
subl $8, %esp
|
||||||
sgdt [esp]
|
sgdt (%esp)
|
||||||
mov eax, [esp + 2]
|
movl 2(%esp), %eax
|
||||||
xchg eax, [esp]
|
xchgl (%esp), %eax
|
||||||
and eax, 0x0FFFF
|
andl $0x0FFFF, %eax
|
||||||
mov [esp+4], eax
|
movl %eax, 4(%esp)
|
||||||
|
|
||||||
#; UINT32 Ldtr, Tr;
|
#; UINT32 Ldtr, Tr;
|
||||||
xor eax, eax
|
xorl %eax, %eax
|
||||||
str ax
|
str %ax
|
||||||
push eax
|
pushl %eax
|
||||||
sldt ax
|
sldt %ax
|
||||||
push eax
|
pushl %eax
|
||||||
|
|
||||||
#; UINT32 EFlags;
|
#; UINT32 EFlags;
|
||||||
mov eax, [ebp + 5 * 4]
|
movl 20(%ebp), %eax
|
||||||
push eax
|
pushl %eax
|
||||||
|
|
||||||
#; UINT32 Cr0, Cr1, Cr2, Cr3, Cr4;
|
#; UINT32 Cr0, Cr1, Cr2, Cr3, Cr4;
|
||||||
mov eax, cr4
|
movl %cr4, %eax
|
||||||
or eax, 0x208
|
orl $0x208, %eax
|
||||||
mov cr4, eax
|
movl %eax, %cr4
|
||||||
push eax
|
pushl %eax
|
||||||
mov eax, cr3
|
movl %cr3, %eax
|
||||||
push eax
|
pushl %eax
|
||||||
mov eax, cr2
|
movl %cr2, %eax
|
||||||
push eax
|
pushl %eax
|
||||||
xor eax, eax
|
xorl %eax, %eax
|
||||||
push eax
|
pushl %eax
|
||||||
mov eax, cr0
|
movl %cr0, %eax
|
||||||
push eax
|
pushl %eax
|
||||||
|
|
||||||
#; UINT32 Dr0, Dr1, Dr2, Dr3, Dr6, Dr7;
|
#; UINT32 Dr0, Dr1, Dr2, Dr3, Dr6, Dr7;
|
||||||
mov eax, dr7
|
movl %dr7, %eax
|
||||||
push eax
|
pushl %eax
|
||||||
#; clear Dr7 while executing debugger itself
|
#; clear Dr7 while executing debugger itself
|
||||||
xor eax, eax
|
xorl %eax, %eax
|
||||||
mov dr7, eax
|
movl %eax, %dr7
|
||||||
|
|
||||||
mov eax, dr6
|
movl %dr6, %eax
|
||||||
push eax
|
pushl %eax
|
||||||
#; insure all status bits in dr6 are clear...
|
#; insure all status bits in dr6 are clear...
|
||||||
xor eax, eax
|
xorl %eax, %eax
|
||||||
mov dr6, eax
|
movl %eax, %dr6
|
||||||
|
|
||||||
mov eax, dr3
|
movl %dr3, %eax
|
||||||
push eax
|
pushl %eax
|
||||||
mov eax, dr2
|
movl %dr2, %eax
|
||||||
push eax
|
pushl %eax
|
||||||
mov eax, dr1
|
movl %dr1, %eax
|
||||||
push eax
|
pushl %eax
|
||||||
mov eax, dr0
|
movl %dr0, %eax
|
||||||
push eax
|
pushl %eax
|
||||||
|
|
||||||
#; FX_SAVE_STATE_IA32 FxSaveState;
|
#; FX_SAVE_STATE_IA32 FxSaveState;
|
||||||
sub esp, 512
|
subl $512, %esp
|
||||||
mov edi, esp
|
movl %esp, %edi
|
||||||
.byte 0x0f, 0x0ae, 0x07 #fxsave [edi]
|
.byte 0x0f, 0x0ae, 0x07 #fxsave [edi]
|
||||||
|
|
||||||
#; UINT32 ExceptionData;
|
#; UINT32 ExceptionData;
|
||||||
push dword ptr [ebp + 2 * 4]
|
pushl 8(%ebp)
|
||||||
|
|
||||||
#; call into exception handler
|
#; call into exception handler
|
||||||
mov eax, ExternalVectorTablePtr # get the interrupt vectors base
|
movl ExternalVectorTablePtr, %eax # get the interrupt vectors base
|
||||||
or eax, eax # NULL?
|
orl %eax, %eax # NULL?
|
||||||
jz nullExternalExceptionHandler
|
jz nullExternalExceptionHandler
|
||||||
|
|
||||||
mov ecx, [ebp + 4]
|
mov 4(%ebp), %ecx
|
||||||
mov eax, [eax + ecx * 4]
|
movl (%eax,%ecx,4), %eax
|
||||||
or eax, eax # NULL?
|
orl %eax, %eax # NULL?
|
||||||
jz nullExternalExceptionHandler
|
jz nullExternalExceptionHandler
|
||||||
|
|
||||||
#; Prepare parameter and call
|
#; Prepare parameter and call
|
||||||
mov edx, esp
|
movl %esp, %edx
|
||||||
push edx
|
pushl %edx
|
||||||
mov edx, dword ptr [ebp + 1 * 4]
|
movl 4(%ebp), %edx
|
||||||
push edx
|
pushl %edx
|
||||||
|
|
||||||
#
|
#
|
||||||
# Call External Exception Handler
|
# Call External Exception Handler
|
||||||
#
|
#
|
||||||
call eax
|
call *%eax
|
||||||
add esp, 8
|
addl $8, %esp
|
||||||
|
|
||||||
nullExternalExceptionHandler:
|
nullExternalExceptionHandler:
|
||||||
|
|
||||||
cli
|
cli
|
||||||
#; UINT32 ExceptionData;
|
#; UINT32 ExceptionData;
|
||||||
add esp, 4
|
addl $4, %esp
|
||||||
|
|
||||||
#; FX_SAVE_STATE_IA32 FxSaveState;
|
#; FX_SAVE_STATE_IA32 FxSaveState;
|
||||||
mov esi, esp
|
movl %esp, %esi
|
||||||
.byte 0x0f, 0x0ae, 0x0e # fxrstor [esi]
|
.byte 0x0f, 0x0ae, 0x0e # fxrstor [esi]
|
||||||
add esp, 512
|
addl $512, %esp
|
||||||
|
|
||||||
#; UINT32 Dr0, Dr1, Dr2, Dr3, Dr6, Dr7;
|
#; UINT32 Dr0, Dr1, Dr2, Dr3, Dr6, Dr7;
|
||||||
pop eax
|
popl %eax
|
||||||
mov dr0, eax
|
movl %eax, %dr0
|
||||||
pop eax
|
popl %eax
|
||||||
mov dr1, eax
|
movl %eax, %dr1
|
||||||
pop eax
|
popl %eax
|
||||||
mov dr2, eax
|
movl %eax, %dr2
|
||||||
pop eax
|
popl %eax
|
||||||
mov dr3, eax
|
movl %eax, %dr3
|
||||||
#; skip restore of dr6. We cleared dr6 during the context save.
|
#; skip restore of dr6. We cleared dr6 during the context save.
|
||||||
add esp, 4
|
addl $4, %esp
|
||||||
pop eax
|
popl %eax
|
||||||
mov dr7, eax
|
movl %eax, %dr7
|
||||||
|
|
||||||
#; UINT32 Cr0, Cr1, Cr2, Cr3, Cr4;
|
#; UINT32 Cr0, Cr1, Cr2, Cr3, Cr4;
|
||||||
pop eax
|
popl %eax
|
||||||
mov cr0, eax
|
movl %eax, %cr0
|
||||||
add esp, 4 # not for Cr1
|
addl $4, %esp # not for Cr1
|
||||||
pop eax
|
popl %eax
|
||||||
mov cr2, eax
|
movl %eax, %cr2
|
||||||
pop eax
|
popl %eax
|
||||||
mov cr3, eax
|
movl %eax, %cr3
|
||||||
pop eax
|
popl %eax
|
||||||
mov cr4, eax
|
movl %eax, %cr4
|
||||||
|
|
||||||
#; UINT32 EFlags;
|
#; UINT32 EFlags;
|
||||||
pop dword ptr [ebp + 5 * 4]
|
popl 20(%ebp)
|
||||||
|
|
||||||
#; UINT32 Ldtr, Tr;
|
#; UINT32 Ldtr, Tr;
|
||||||
#; UINT32 Gdtr[2], Idtr[2];
|
#; UINT32 Gdtr[2], Idtr[2];
|
||||||
#; Best not let anyone mess with these particular registers...
|
#; Best not let anyone mess with these particular registers...
|
||||||
add esp, 24
|
addl $24, %esp
|
||||||
|
|
||||||
#; UINT32 Eip;
|
#; UINT32 Eip;
|
||||||
pop dword ptr [ebp + 3 * 4]
|
popl 12(%ebp)
|
||||||
|
|
||||||
#; UINT32 Gs, Fs, Es, Ds, Cs, Ss;
|
#; UINT32 Gs, Fs, Es, Ds, Cs, Ss;
|
||||||
#; NOTE - modified segment registers could hang the debugger... We
|
#; NOTE - modified segment registers could hang the debugger... We
|
||||||
#; could attempt to insulate ourselves against this possibility,
|
#; could attempt to insulate ourselves against this possibility,
|
||||||
#; but that poses risks as well.
|
#; but that poses risks as well.
|
||||||
#;
|
#;
|
||||||
pop gs
|
popl %gs
|
||||||
pop fs
|
popl %fs
|
||||||
pop es
|
popl %es
|
||||||
pop ds
|
popl %ds
|
||||||
pop dword ptr [ebp + 4 * 4]
|
popl 16(%ebp)
|
||||||
pop ss
|
popl %ss
|
||||||
|
|
||||||
#; UINT32 Edi, Esi, Ebp, Esp, Ebx, Edx, Ecx, Eax;
|
#; UINT32 Edi, Esi, Ebp, Esp, Ebx, Edx, Ecx, Eax;
|
||||||
pop edi
|
popl %edi
|
||||||
pop esi
|
popl %esi
|
||||||
add esp, 4 # not for ebp
|
addl $4, %esp # not for ebp
|
||||||
add esp, 4 # not for esp
|
addl $4, %esp # not for esp
|
||||||
pop ebx
|
popl %ebx
|
||||||
pop edx
|
popl %edx
|
||||||
pop ecx
|
popl %ecx
|
||||||
pop eax
|
popl %eax
|
||||||
|
|
||||||
mov esp, ebp
|
movl %ebp, %esp
|
||||||
pop ebp
|
popl %ebp
|
||||||
add esp, 8
|
addl $8, %esp
|
||||||
iretd
|
iretl
|
||||||
|
|
||||||
|
|
||||||
#END
|
#END
|
||||||
|
|
Loading…
Reference in New Issue