VirtualBox

Changeset 60461 in vbox


Ignore:
Timestamp:
Apr 12, 2016 3:29:17 PM (9 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
106550
Message:

VBoxBs3ObjConverter.cpp: Documented GCC fixup fun that I have to sort out later.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/VBoxBs3ObjConverter.cpp

    r60336 r60461  
    17291729                                         iAddend, paRelocs[iReloc].r_offset, i, pszSegNm);
    17301730                        if (fSelfRel)
    1731                             *uLoc.pu32 = -iAddend - 4; //; u %"bs3CpuBasic2_RaiseXcpt1_lm64"
     1731                        {
     1732                            if (iAddend == -4)
     1733                                *uLoc.pu32 = 0; /* Normal self relative jump/calls. */
     1734                            else
     1735                            {
     1736                                /* Examples:
     1737                                        - AND [datasymbol wrt RIP], 0fh
     1738                                          The self relative fixup is followed by a 1 byte immediate.
     1739                                          GCC/GAS emits a -5 addend here.
     1740                                        - MOV [datasymbol wrt RIP], 1234h
     1741                                          The self relative fixup is followed by a 2 byte immediate.
     1742                                          GCC/GAS emits a -6 addend here.
     1743
     1744                                   These are tricky as both wlink and link386 seems to apply addends
     1745                                   stored in the LEDATA in the same was as the optional target
     1746                                   displacements in the FIXUPP records.  This means for self relative
     1747                                   fixups we have to make assumption about the relative placement of
     1748                                   the fixup location and the target when dealing with relative ones.
     1749
     1750                                   GCC/GAS is obviuosly already doing this, but our segment ordering
     1751                                   is abit different.  The 16-bit DATA and SYSTEM segments are located
     1752                                   before the 64-bit text segments.  This then means we have to move
     1753                                   the 32-bit and 64-bit DATA up in front of the 64-bit text too.
     1754
     1755                                   In order to figure it out correctly, we need to disassemble the
     1756                                   instruction as there is no way we can move the two 16-bit data
     1757                                   segments. Sigh.
     1758                                   */
     1759//printf("%#x PC32: addend=%d\n",  paRelocs[iReloc].r_offset, iAddend);
     1760                                *uLoc.pu32 = -iAddend - 4; //; u %"bs3CpuBasic2_RaiseXcpt1_lm64"
     1761                            }
     1762                        }
    17321763                        else
    17331764                            *uLoc.pu32 = iAddend;
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette