- The ABI is the abbreviation for the application Binary interface, which identifies the operating mode of the processor and the encoding format of the specification target file.
The MIPS instruction set architecture formally supports the 64-bit mode of operation since MIPS3, so the code can follow O32 (o meaning old), N32 (n meaning new) and N64 Abi.
- O32 and N64 are pure 32-bit and 64-bit modes, which, in addition to the length differences between pointers and variable types, n64 use registers to pass on more parameters and improve performance.
In terms of performance, 64-bit environments are not necessarily superior to 32-bit environments.
The former brings more space to the address, but also brings about a doubling of the system overhead.
For example, the change in the length of the pointer and variable type is almost equivalent to removing half of the cache on the processor, which has a fatal effect on some operational models.
- The N32 is a combination of 32-bit data structures and 64-bit instructions.
MIPS N32 ABI in the case of preserving almost all the features of the MIPS N64 ABI (mainly the function parameter passing conventions in registers and stacks),
The point is that only a long long and a double type are compiled into 64 bits.
The rest of the pointers are the same as the variable type settings (for example, the pointer and long int are 32 bits), so the o32 is closer to the MIPS N64 ABI.
The reason is that using 64-bit pointers on an application with enough 32-bit address space will not bring any benefit.
Although it is 32-bit, the differences with MIPS O32 ABI are very large, which should also be categorized into the MIPS64 family.
Both 32 and N64 are applied to 64-bit MIPS, and they use a register width of 64 bits.
In the stack, N32/n64 uses 8 bytes to hold a function parameter so that it is consistent with the width of the register.
The stack parameter structure specifies the width of the data type that needs to be set to a double (or long long),
Thus MIPS N32 and N64 require stacks to be aligned to 16 bytes.
Data types can be processed directly using standard MIPS directives only when they are naturally aligned.
- N32 ABI provides approximately 25% performance, and many customers choose N32 to write applications.
In addition to algorithmic improvements, the N32 uses a subset of the processor's 64-bit features to ensure a performance boost.
Because N32 still retains the 32-bit pattern, many O32 codes need to be recompiled to N32 for performance gains.
In fact, N32 's requirements for code are stricter, and converting O32-based code to N32 code is typically modified before it can be compiled successfully.
N32 Abi and O32 Abi are not binary compatible. O32 compiled application modules cannot be linked to N32 compiled application modules.
The entire application must use the same compilation settings.
- You can see the ABI of the elf executable file using the file command:
File/bin/bash
/bin/bash:elf 32-bit LSB executable, MIPS, N32 MIPS64 rel2 version 1 (SYSV),
Dynamically linked (uses shared libs), for Gnu/linux 3.4.0,
BUILDID[SHA1]=5563E09F3739CB705281C20DFB67134107FB4AB3, stripped
MIPS ABI N32