GithubHelp home page GithubHelp logo

What does `BIG_ENDIAN` do in fpu.h about halfix HOT 1 CLOSED

nepx avatar nepx commented on May 22, 2024
What does `BIG_ENDIAN` do in fpu.h

from halfix.

Comments (1)

nepx avatar nepx commented on May 22, 2024

Hello,

This emulator uses the SoftFloat package from Bochs, which handles big-endian data better than I do:

/*----------------------------------------------------------------------------
| Software IEC/IEEE floating-point types.
*----------------------------------------------------------------------------*/

#ifdef BX_BIG_ENDIAN
typedef struct {	// leave alignment to compiler
    uint16_t exp;
    uint64_t fraction;
} floatx80;
#else
typedef struct {
    uint64_t fraction;
    uint16_t exp;
} floatx80;
#endif

Aliasing the MMX registers to the FP stack was a hack involving a union (but it works, so there's that!), and I had to make sure that both registers were laid out the same way (replacing fraction for r8. r16, etc.). Rather than BX_BIG_ENDIAN, I went with the simpler BIG_ENDIAN.

The fact that BIG_ENDIAN is defined on x86-64 systems is a good point (and a slightly strange one, too, considering that x86-64 is a little-endian system) and something that definitely needs to be fixed, but in practice it's never caused me any trouble.

Concerning endianness: big endian hosts might work, but I doubt they do. Reworking the emulator to handle guest loads/stores would be a massive multi-month project, but sadly I don't have any big-endian systems to debug on. At the very least, all those crazy arith_rmw macros in opcodes.c will need to be reworked.

from halfix.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.