Sergey,
I don't have a 16-bit disassembler handy, or a gcc toolchain installed. Can you
send the disassembly of the entire function, including the byte values.
It is not clear to me how this works correctly with gcc? The 0x66 prefix
changes the operand size, and the 0x2e prefix forces the CS segment. But a 0x2e
prefix is ignored in 64-bit mode.
Thus it looks to me that clang is generating a 32-bit instruction, which kind
of makes sense? But that is not what gcc is doing?
Thunk16.obj[0x77]: 66 2e 0f 01 97 f8 ff ff ff lgdt %cs:-8(%edi)
I'll try and fix stuff with .byte directives.
Thanks,
Andrew Fish
On Jan 21, 2013, at 11:40 AM, Isakov Sergey <isakov...@bk.ru> wrote:
> Hi Andrew,
> As you are maintainer of XCLANG compilation I call to you to resolve the
> problem.
> I reported about it a year ago but now I see the wrong version of Thunk16.s
> is returned into the library
> MdePkg/Library/BaseLib/X64/Thunk16.S
> The problematic codes is here
> --------------
> .byte 0x66,0x2e # 2eh is "cs:" segment override
> lgdt (SavedGdt - L_Base)(%rdi)
> .byte 0x66
> movl $0xc0000080,%ecx
> rdmsr
>
> --------------
> Good compilation with GCC toolset. Disassemble as
> --------------
> 000000b7 662e0f0157ee lgdt cs:[bx-0012]
>
> 000000bd 66b9800000c0 mov ecx, c0000080
>
> 000000c3 0f32 rdmsr
>
> -------------
> Now the same produced by XCLANG
> ---------------
> 000001e7 662e0f0197f8ff lgdt cs:[bx-8]
>
> 000001ee ff db 0xff
>
> 000001ef ff66b9 jmp word ptr [bp-0047]
>
> 000001f2 800000 add byte ptr [bx+si], 0x0
>
> 000001f5 c00f32 ror byte ptr [bx], 0x32
>
> ---------------
> It is happen because Clang don't like expressions like (SavedGdt - L_Base)
> This must be replaced by constants, or the toolset must use another ASM
> compiler.
> This is a reason why Ovmf by XCLANG is not working.
>
> Sergey
> ------------------------------------------------------------------------------
> Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
> MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
> with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
> MVPs and experts. SALE $99.99 this month only -- learn more at:
> http://p.sf.net/sfu/learnmore_122412_______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/edk2-devel
------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. SALE $99.99 this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122412
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel