Sergey:
 So, X64 Thunk16.nasm could pass XCLANG build and ld.  What about IA32 
Thunk16.nasm code?

Thanks
Liming
From: Sergey Isakov [mailto:isakov...@bk.ru]
Sent: Friday, August 29, 2014 2:15 AM
To: edk2-devel@lists.sourceforge.net
Subject: Re: [edk2] [PATCH 0/8] NASM: Object files; Thunk16; Require for 
non-MSVC

That works!
Now I have next same problem (offtop?)
UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/ExceptionHandlerAsm.S

The same using of absolute addresses of CommonInterruptEntry
———
#
Exception0Handle:
    .byte   0x6a    #  push #VectorNum
    .byte   0
    pushq   %rax
    .byte   0x48, 0xB8
    .quad   ASM_PFX(CommonInterruptEntry)
    jmp     *%rax

————
It looks like more codes should be revised. And I vote to rewrite this part to 
nasm too.

On 28 авг. 2014 г., at 21:10, Sergey Isakov 
<isakov...@bk.ru<mailto:isakov...@bk.ru>> wrote:


I understand. The value of 16GdtrBase is patched by C-codes in procedure 
AsmPrepareThunk16()
So we may set
———
_16GdtrBase:
        DQ      0

-----

On 28 авг. 2014 г., at 15:48, Andrew Fish 
<af...@apple.com<mailto:af...@apple.com>> wrote:



On Aug 28, 2014, at 4:30 AM, Sergey Isakov 
<isakov...@bk.ru<mailto:isakov...@bk.ru>> wrote:


But what can you do with absolute addressing to _NullSeg?
-------
_EntryPoint:
        DD      _ToUserCode - ASM_PFX(m16Start)
        DW      CODE16
_16Gdtr:
        DW      GDT_SIZE - 1
_16GdtrBase:
        DQ      _NullSeg


It looks like Thunk16.S patches the value.

_EntryPoint: .long      ASM_PFX(ToUserCode) - ASM_PFX(m16Start)

             .word      CODE16

_16Gdtr:     .word      GDT_SIZE - 1

_16GdtrBase: .quad      0

_16Idtr:     .word      0x3ff

             .long      0
Thanks,

Andrew Fish



-------

On 28.08.2014, at 15:16, Andrew Fish wrote:



On Aug 28, 2014, at 12:15 AM, Sergey Isakov 
<isakov...@bk.ru<mailto:isakov...@bk.ru>> wrote:



Actually I just noticed you are getting an illegal text-relocation error. This 
is usually caused by an absolute relocation, and clang wants it to be IP 
relative. Basically Xcode/clang only supports a subset of the relocations that 
gcc uses for X64.
If I correctly understand you, compilation for Thunk16 is not possible in 
XCLANG toolset because of idea of this codes?


No, but this toolchain puts extra restrictions on how things can be coded.

For example Thunk16.asm contains absolute addressing

    lea     r8, @RetFromRealMode
But in Thunk16.S this is converted to IP relative addressing to support clang.

   lea     L_RetFromRealMode(%rip), %r8
Some of the .set address math in Thunk16.S is also working around addressing 
mode limitations, as it removes relocations from the code.

Thanks,

Andrew Fish
------------------------------------------------------------------------------
Slashdot TV.
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net<mailto:edk2-devel@lists.sourceforge.net>
https://lists.sourceforge.net/lists/listinfo/edk2-devel

------------------------------------------------------------------------------
Slashdot TV.
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net<mailto:edk2-devel@lists.sourceforge.net>
https://lists.sourceforge.net/lists/listinfo/edk2-devel

------------------------------------------------------------------------------
Slashdot TV.
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net<mailto:edk2-devel@lists.sourceforge.net>
https://lists.sourceforge.net/lists/listinfo/edk2-devel

------------------------------------------------------------------------------
Slashdot TV.
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net<mailto:edk2-devel@lists.sourceforge.net>
https://lists.sourceforge.net/lists/listinfo/edk2-devel

------------------------------------------------------------------------------
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to