This project revives x87 FPU emulation for i486SX CPUs on NetBSD 10.x, reintroducing the MATH_EMULATE option that supported legacy processors without hardware FPUs. It aims to enhance compatibility and performance in retro-computing, providing essential tools for users and developers involved in maintaining vintage systems.
FPU Emulation Revival for i486SX on NetBSD
This retro-computing project aims to restore support for x87 floating-point unit (FPU) emulation in the NetBSD kernel, specifically targeting legacy 486SX-class processors that lack hardware FPUs. By integrating the original MATH_EMULATE
option into NetBSD 10.x and beyond, this initiative reverts and enhances the alterations made in commit dfe83e0, which previously removed FPU emulation support from the kernel.
Project Status
This project is in active development and may exhibit bugs or incomplete features. Users are encouraged to proceed with caution, as the developer is not liable for any issues resulting from its usage.
Known Issues
- The
fyl2x
instruction appears to function properly; however, invokinglog
functions fromlibc
yields incorrect results. - Certain operations may have subtle precision discrepancies.
Supported x87 FPU Instructions
Control & Initialization
Instruction | Status | Description | Opcode | Example |
---|---|---|---|---|
fninit | ✅ OK | Initialize FPU | 9B DB E3 | fninit |
Load Instructions
Instruction | Status | Description | Opcode | Example |
---|---|---|---|---|
fld | ✅ OK | Load floating-point value | D9 /0 | fld st(1) |
fldt | ✅ OK | Load 80-bit extended precision | DB /5 | fldt [mem] |
filds | ✅ OK | Load short integer | DB /0 | filds [mem] |
fildl | ✅ OK | Load long integer | DB /A | fildl [mem] |
Store Instructions
Instruction | Status | Description | Opcode | Example |
---|---|---|---|---|
fstps | ✅ OK | Store and pop single precision | D9 /3 | fstps [mem] |
fstpt | ✅ OK | Store 80-bit extended precision & pop | DB /7 | fstpt [mem] |
Arithmetic Operations
Instruction | Status | Description | Opcode | Example |
---|---|---|---|---|
fadd | ✅ OK | Add floating-point values | D8 /0 | fadd st(1), st |
faddl | ✅ OK | Add long double from memory | DA /0 | faddl [mem] |
fsub | ✅ OK | Subtract floating-point values | D8 /4 | fsub st(1), st |
fsubp | ✅ OK | Subtract with pop | DE /5 | fsubp st(1), st(0) |
fmul | ✅ OK | Multiply floating-point values | D8 /1 | fmul st(1), st |
fdiv | ✅ OK | Divide floating-point values | D8 /6 | fdiv st(1), st |
fdivp | ✅ OK | Divide with pop | DE /7 | fdivp st(1), st(0) |
fscale | ✅ OK | Scale ST(0) by ST(1) | D9 FD | fscale |
Comparison
Instruction | Status | Description | Opcode | Example |
---|---|---|---|---|
fcom | ✅ OK | Compare floating-point values | D8 /2 | fcom st(1) |
fucom | ✅ OK | Unordered compare ST(0) with ST(i) | DD E0+i | fucom st(1) |
fucomp | ✅ OK | Unordered compare and pop | DD E8+i | fucomp st(1) |
ftst | ✅ OK | Compare ST(0) with 0.0 | D9 E4 | ftst |
Stack Manipulation
Instruction | Status | Description | Opcode | Example |
---|---|---|---|---|
fxch | ✅ OK | Exchange ST(0) with ST(i) | D9 C8+i | fxch st(1) |
fchs | ✅ OK | Change sign of ST(0) | D9 E0 | fchs |
fabs | ✅ OK | Absolute value of ST(0) | D9 E1 | fabs |
frndint | ✅ OK | Round ST(0) to integer | D9 FC | frndint |
Logarithmic and Special Math Operations
Instruction | Status | Description | Opcode | Example |
---|---|---|---|---|
fyl2x | ⏳ TBD | Compute y × log₂(x) and pop | D9 F1 | fyl2x |
fyl2xp1 | ❌ N/A | Compute y × log₂(x+1) and pop | D9 F9 | fyl2xp1 |
fxtract | ❌ N/A | Extract significand and exponent from ST(0) | D9 F4 | fxtract |
f2xm1 | ✅ OK | Compute 2^x - 1 for ST(0) | D9 F0 | f2xm1 |
fpatan | ❌ N/A | Compute arctangent and pop | D9 F3 | fpatan |
fsqrt | ❌ N/A | Compute square root of ST(0) | D9 FA | fsqrt |
Visit the Releases section to find precompiled kernel images with FPU emulation capability, as well as related drive images.
No comments yet.
Sign in to be the first to comment.