On Aug 28, 2014, at 4:30 AM, Sergey Isakov <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> 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
>> 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

------------------------------------------------------------------------------
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