#31 bigendian support

open
nobody
None
5
2004-05-30
2004-05-30
No

Some internal registers in PearPC are always
little-endian (such as mConfig in pci.cc), but
then later used in a native endian fashion...

This patch adds macros "ppc_force_XXX_to_BE",
which is used when the source is LE and not native.
On a little-endian machine, it is a synonym for the old.

With this patch, Debian PPC now boots on a big-endian
machine
(but fails to be useful, since keyboard is missing->
other bug)

Thanks to Alexander Clausen - sk1p for help with this
issue, see bug:
http://sourceforge.net/tracker/index.php?func=detail&aid=959562&group_id=108675&atid=651195

Discussion

  • Alexander Clausen

    Logged In: YES
    user_id=934032

    hmm... i don't think this will work in this form for little
    endian plattforms.. for example: they don't need the endian
    swap in the nvram driver, where big-endian platforms need
    it. i guess we'll have to come up with a more flexible
    solution for this

     
  • Anders F Björklund

    Logged In: YES
    user_id=5895

    The whole project needs an endian "audit",
    to determine which format the vars are in:
    little-endian, big-endian, or native (either)

     
  • Stefan Weyergraf

    Logged In: YES
    user_id=3434

    I'd like to make an endian audit. Maybe you would help me
    with that?

     
  • Anders F Björklund

    Logged In: YES
    user_id=5895

    Keyboard works now, with the PCI patch
    (posted under Bugs somewhere)

    I can test under Mac OS X, if needed ?

    I just need to remap the X11 keys first
    (currently they are mapped all over...)

     
  • Anders F Björklund

    Logged In: YES
    user_id=5895

    Attached the patch for PIC here too

     
  • Stefan Weyergraf

    Logged In: YES
    user_id=3434

    ppc_force_XXX_to_BE absolutely is the wrong name. Please
    name it ppc_XXX_byte_reversed() because that's exactly what
    it does.

     
  • Anders F Björklund

    Logged In: YES
    user_id=5895

    Actually there are only two byteswap commands needed,
    one for shorts (2-byte) and one for longs (4-byte).

    Then it's up to the code to determine if data can be
    copied straight across, or if it needs to be swapped.

    That's why I said the code needed a review,
    since currently it assumes that "native" is LE
    while the PPC is BE. This is not (always) true.
    For each copy it needs to be determined what
    the TO and FROM formats are: LE, BE or native.

    Agree that the current patch is just a kludge.

     
  • Anders F Björklund

    Logged In: YES
    user_id=5895

    by the way, the PPC can swap in one instruction.
    But only when loading or storing, not in memory.

    Check out: lhbrx, sthbrx, lwbrx, stwbrx

     
  • Anders F Björklund

    Logged In: YES
    user_id=5895

    With the 64-bit versions, that makes three in total.
    Forgot about those, since I don't have any 64-bit...

     
  • Stefan Weyergraf

    Logged In: YES
    user_id=3434

    Could you make a new patch please, renaming things, etc. Thanks.

     
  • Alexander Clausen

    Logged In: YES
    user_id=934032

    I'll try to help with it.. maybe we should set up a page at
    the wiki (when it's back) to coordinate our efforts

     
  • Alexander Clausen

    Logged In: YES
    user_id=934032

    btw. just renaming the functions to ppc_XXX_byte_reversed
    won't work, because there are cases where we only need a
    byte swap on big endian, not on little endian (ie. the nvram
    driver, I don't know of any other right now). should we just
    wrap those into #ifdefs or create even more macros?

     
  • Stefan Weyergraf

    Logged In: YES
    user_id=3434

    We should create more macros (which will probably live
    inside #ifdefs)

     
  • Anders F Björklund

    Logged In: YES
    user_id=5895

    I'll wait until PearPC-things stabilize
    before doing any more work on it...
    (I have a real PowerPC or two, and don't
    feel like having more patches rejected)

    Alexander, you can still hack if you want.

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks