Hi, I meet with the same issue. I verify it in my ubutu 12.04. GCC46, Nasm
2.09. I meet with the build failure.
1) 0x10 is not power of two.
2) invalid combination of opcode and operands
I provide my patch that can pass build. Please help review it.
diff --git a/MdePkg/Library/BaseLib/Ia32/Thunk16.nasm
b/MdePkg/Library/BaseLib/Ia32/Thunk16.nasm
index 2e5a580..105238d 100644
--- a/MdePkg/Library/BaseLib/Ia32/Thunk16.nasm
+++ b/MdePkg/Library/BaseLib/Ia32/Thunk16.nasm
@@ -174,7 +174,7 @@ BITS 16
o32 retf ; transfer control to user code
-ALIGN 0x10
+ALIGN 16
_NullSegDesc DQ 0
_16CsDesc:
DW -1
diff --git a/MdePkg/Library/BaseLib/X64/Thunk16.nasm
b/MdePkg/Library/BaseLib/X64/Thunk16.nasm
index 8858e74..e11bb24 100644
--- a/MdePkg/Library/BaseLib/X64/Thunk16.nasm
+++ b/MdePkg/Library/BaseLib/X64/Thunk16.nasm
@@ -190,7 +190,7 @@ o32 lidt [cs:bp + (_16Idtr - .Base)]
o32 retf ; transfer control to user code
-ALIGN 0x8
+ALIGN 8
CODE16 equ _16Code - $
DATA16 equ _16Data - $
@@ -237,11 +237,12 @@ BITS 64
push rsi
push rdi
- mov rbx, ds
+ xor rbx, rbx
+ mov ebx, ds
push rbx ; Save ds segment register on the stack
- mov rbx, es
+ mov ebx, es
push rbx ; Save es segment register on the stack
- mov rbx, ss
+ mov ebx, ss
push rbx ; Save ss segment register on the stack
push fs
@@ -307,11 +308,11 @@ BITS 64
pop gs
pop fs
pop rbx
- mov ss, rbx
+ mov ss, ebx
pop rbx
- mov es, rbx
+ mov es, ebx
pop rbx
- mov ds, rbx
+ mov ds, ebx
pop rdi
pop rsi
-----Original Message-----
From: Mike Maslenkin [mailto:[email protected]]
Sent: Thursday, August 21, 2014 5:40 AM
To: [email protected]
Subject: Re: [edk2] [PATCH 5/8] MdePkg/BaseLib Thunk16: Replace X64 GAS Thunk16
with NASM version
Hello Jordan !
build -p build -p IntelFrameworkModulePkg/IntelFrameworkModulePkg.dsc
-a X64
told me about next errors:
Building ...
/home/mg/sources/jljusten/edk2/MdePkg/Library/BaseReportStatusCodeLibNull/BaseReportStatusCodeLibNull.inf
[X64]
/home/mg/sources/jljusten/edk2/Build/IntelFrameworkModuleAll/DEBUG_GCC47/X64/MdePkg/Library/BaseLib/BaseLib/OUTPUT/X64/Thunk16.iii:193:
error: segment alignment `0x8' is not power of two
make: ***
[/home/mg/sources/jljusten/edk2/Build/IntelFrameworkModuleAll/DEBUG_GCC47/X64/MdePkg/Library/BaseLib/BaseLib/OUTPUT/X64/Thunk16.obj]
Error 1
/home/mg/sources/jljusten/edk2/Build/IntelFrameworkModuleAll/DEBUG_GCC47/X64/MdePkg/Library/BaseLib/BaseLib/OUTPUT/X64/Thunk16.iii:240:
error: invalid combination of opcode and operands
/home/mg/sources/jljusten/edk2/Build/IntelFrameworkModuleAll/DEBUG_GCC47/X64/MdePkg/Library/BaseLib/BaseLib/OUTPUT/X64/Thunk16.iii:242:
error: invalid combination of opcode and operands
/home/mg/sources/jljusten/edk2/Build/IntelFrameworkModuleAll/DEBUG_GCC47/X64/MdePkg/Library/BaseLib/BaseLib/OUTPUT/X64/Thunk16.iii:244:
error: invalid combination of opcode and operands
/home/mg/sources/jljusten/edk2/Build/IntelFrameworkModuleAll/DEBUG_GCC47/X64/MdePkg/Library/BaseLib/BaseLib/OUTPUT/X64/Thunk16.iii:310:
error: invalid combination of opcode and operands
/home/mg/sources/jljusten/edk2/Build/IntelFrameworkModuleAll/DEBUG_GCC47/X64/MdePkg/Library/BaseLib/BaseLib/OUTPUT/X64/Thunk16.iii:312:
error: invalid combination of opcode and operands
/home/mg/sources/jljusten/edk2/Build/IntelFrameworkModuleAll/DEBUG_GCC47/X64/MdePkg/Library/BaseLib/BaseLib/OUTPUT/X64/Thunk16.iii:314:
error: invalid combination of opcode and operands
make: ***
[/home/mg/sources/jljusten/edk2/Build/IntelFrameworkModuleAll/DEBUG_GCC47/X64/MdePkg/Library/BaseLib/BaseLib/OUTPUT/X64/Thunk16.obj]
Error 1
The last errors come from this
+global ASM_PFX(InternalAsmThunk16)
+ASM_PFX(InternalAsmThunk16):
<skip>
^^^^^^^^^^^^^^^^^^^^^^^
> + push rbx ; Save ds segment register on the stack
> + mov rbx, es
> ^^^^^^^^^^^^^^^^^^^^^^^
> + push rbx ; Save es segment register on the stack
> + mov rbx, ss
^^^^^^^^^^^^^^^^^^^^^^^
> + push rbx ; Save ss segment register on the stack
<skip>
> + mov ss, rbx
> ^^^^^^^^^^^^^^^^^^^^^^^
> + pop rbx
> + mov es, rbx
^^^^^^^^^^^^^^^^^^^^^^^
> + pop rbx
> + mov ds, rbx
^^^^^^^^^^^^^^^^^^^^^^^
Initially I used a NASM version used in our build system. Do not know for where
we got it but it reported itself as NASM version 2.09.04
After that I installed a default NASM that comes with openSuSE 12.2:
NASM version 2.09.08 compiled on Jun 16 2011
I got same errors.
So, please clarify which minimal version of NASM is required.
------------------------------------------------------------------------------
Slashdot TV.
Video for Nerds. Stuff that matters.
http://tv.slashdot.org/
_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-devel
------------------------------------------------------------------------------
Slashdot TV.
Video for Nerds. Stuff that matters.
http://tv.slashdot.org/
_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-devel