frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Open in hackernews

Show HN: I486SX_soft_FPU – Software FPU Emulator for NetBSD 10 on 486SX

https://github.com/mezantrop/i486SX_soft_FPU
117•mezantrop•9mo ago
First Release is Here!

I'm excited to announce the first release of i486SX_soft_FPU — a software FPU emulator for the classic Intel 486SX CPU, running on NetBSD 10!

This project brings floating-point support back to life for 486SX machines, even though modern NetBSD versions no longer natively support processors without a hardware FPU. If you're into retrocomputing, operating system hacking, or just love old-school hardware, check it out!

Project page: https://github.com/mezantrop/i486SX_soft_FPU Contributions, feedback, and testing are all very welcome!

Let's keep these vintage machines alive!

#retrocomputing #NetBSD #486SX #opensource

Comments

_mlbt•9mo ago
These used to be very common before Pentium processors. Many (most?) compiler tool chains included a software FPU emulator.

Very cool project!

actionfromafar•9mo ago
I think GCC didn't have the emulating library, but the operating system had. (Such as Debian.) So you could compile and link your programs against a soft-float library. ( Something like this https://github.com/ant6n/ieeelib )

What this NetBSD project does is not exactly like that though, it lets programs use regular 487 float instructions, which are trapped by the kernel, which steps in and emulates what the hardware float instruction would have done.

It worked very well for regular program, because most programs would not use float instructions to any significant degree.

If you however were going to use floats a lot for long calculations, a soft-float library would be much faster.

queenkjuul•9mo ago
Funny enough, I've been compiling a lot of stuff for 386 Linux lately. You can build a kernel with built in software floating point, at which point it doesn't matter what your library/compiler do. If your kernel isn't built to handle that, you can build glibc with floating point emulation.

At least this is my impression, working with 2.2.x/2.4.x kernels, gcc 2.7~3.3, and glibc ~2.2

anyfoo•9mo ago
Yap. But as hinted by the comments before you, if you have CPUs without FPUs, you probably want to enable userspace (e.g. glibc) soft math support anyway, since it doesn’t have the overhead of trapping the instructions and context switching into the kernel and back.

The benefit of OP’s solution in the kernel is that it works for everything out of the box, including pre-compiled binaries, and those that you can’t rebuild for whatever reason to begin with.

rasz•9mo ago
Duke Nukem 3D is compiled with FPU emulation. Game engine is 99.9% fixed point math, only requires FPU for rarely used slopes (setupslopevlin_ and slopevlin_).

It just so happens first room when starting the game - rooftop - has sloped roof vents and later walls with sloped edge. Even on fast FPUless 90MHz NexGen Nx586 (AMD K6 father) FPS drops down to 10-14fps on that roof https://www.youtube.com/watch?v=41O2bNG2qKA&t=234s while staying above 30 when facing away from slopes.

anthk•9mo ago
Could a table help there?
theragra•9mo ago
I recently encountered this when developing for atmel attiny13a, that has 1KB memory for code. I found that my code somehow cannot fit. Then found that just one line takes around 100 bytes. Insane!

After some experiments, I remembered university course and was able to understand what is going on.

When using float types or operations, fpu emulation is used, which takes huge amount of memory for anything.

I think atmel is using gcc, but not sure if you emulation is part of gcc or atmel libraries.

rzzzt•9mo ago
That .jpg in the readme file loaded from right to left. What is this sorcery?
actionfromafar•9mo ago
Apparently¹ :

    <img align="right">
I'm also impressed. :-D

1: https://github.com/mezantrop/i486SX_soft_FPU/blob/main/READM...

accrual•9mo ago
The align tag isn't related, the image will load right-to-left even if opened by itself in a new tab.

In JPEGSnoop I see Raw Image Orientation = Landscape. Maybe it was taken and encoded horizontally and the image itself is stored in a right-to-left scan order.

accrual•9mo ago
I am also just noticing the laptop display seems to be held together with K'nex... truly a hacker setup.
akadruid1•9mo ago
I believe at least some of it is LEGO Technic
mezantrop•9mo ago
https://x.com/Mezzzantrop/status/1880490334452609425 If you are interested, that's how the gear looks like ;)
adzm•9mo ago
Pretty sure it's orientation in the jpeg itself
quotemstr•9mo ago

    Z$ identify -verbose weird-jpeg.jpg
    Image:
      Filename: weird-jpeg.jpg
      ...
      Orientation: RightTop
    ^^^^^^^^^^^^^^^^^^^^^^^^^^
      ...
      Properties:
        ...
        unknown: iPhone 12 Pro
queenkjuul•9mo ago
This is awesome. I'm working on packaging a Linux distro for my 386 and 486, but I've stuck to just using very old kernels.
LeFantome•9mo ago
I am sure you are aware of this: https://github.com/marmolak/gray386linux

It uses kernel 3.7

For 486, there was a release just two months ago using kernel 6.13: https://github.com/marmolak/gray486linux

queenkjuul•9mo ago
I actually wasn't familiar with those, they're cool but don't quite fit all my goals, though could still be useful to me
accrual•9mo ago
This is super cool and I'm very glad to see such work! Does NetBSD natively support the 486DX CPUs which still have the FPU enabled?

I know OpenBSD dropped support for i486 in 6.8, making 6.7 the last that runs natively on them (FPU or not). The support was lost when moving to LLVM 9 and enabling `-march=i586 on i386`. However, old Socket 3 boards can still run the latest version of OpenBSD if one drops a Pentium Overdrive in. :)

dcassett•9mo ago
> Does NetBSD natively support the 486DX CPUs which still have the FPU enabled?

According to [1] they do

"Any i486 or better CPU should work - genuine Intel or a compatible such as Cyrix, AMD, or NexGen."

[1] https://wiki.netbsd.org/ports/i386/

PrivacyAI•9mo ago
This is super cool!
hsnewman•9mo ago
I tried it under the Misterfpga ao486 core and it failed, not finding a partition to boot from. :(
karlgkk•9mo ago
So you just consoomed something. Thanks for the contribution
natas•9mo ago
I wonder if this means we will soon be able to run Netbsd-10.1 (and above) on MiSTer with ao486 core.
userbinator•9mo ago
Not only the 486SX but a lot of alternative x86 SoCs aimed at embedded systems have no FPU, including the original Vortex86.
jabl•9mo ago
Just a few days ago patches were posted proposing to drop Linux kernel support for x86 cpus lacking a FPU: https://lore.kernel.org/lkml/20250425084216.3913608-1-mingo@...
remlov•9mo ago
Good thing this has nothing to do with NetBSD.
ahartmetz•9mo ago
From an outside POV, Linux supports quite unreasonably old hardware, so it's always weird and surprising when someone decides that "now it's TOO unreasonable to keep supporting it".
karlgkk•9mo ago
It often shows up when someone needs to touch an area of code, where archaic compatibility makes everyone’s life harder.
evmar•9mo ago
I noticed math_emulate.c comes from Linux (it even has a " * (C) 1991 Linus Torvalds" bit on it). I was wondering what the license on that code is. It looks like Linux adopted GPL in 1992 so maybe this copy predates that, but it was under some other non-BSD license before that.
einr•9mo ago
The full license for Linux prior to 0.12 was:

  This kernel is (C) 1991 Linus Torvalds, but all or part of it may be
  redistributed provided you do the following:

  - Full source must be available (and free), if not with the
    distribution then at least on asking for it.

  - Copyright notices must be intact. (In fact, if you distribute
    only parts of it you may have to add copyrights, as there aren't
    (C)'s in all files.) Small partial excerpts may be copied
    without bothering with copyrights.

  - You may not distibute this for a fee, not even "handling"
    costs.
This is clearly written by someone who has no business writing software licenses ;) but does not appear to be incompatible with the BSD license and in fact, the code in question originates from 386BSD (https://github.com/386bsd/386bsd/blob/2.0/usr/src/kernel/mat...) and made it from there into the NetBSD mainline.
nikanj•9mo ago
I don't think the BSD license is compatible with "you may not distribute this for a fee"
einr•9mo ago
True! And if so, that license has clearly been broken many times by everyone selling 386BSD, NetBSD and Linux <0.12 on CD-ROMs etc ;)

Then again -- and IANAL -- the license is worded so vaguely that I doubt any of it is enforcible. "You may not distibute this for a fee" -- what is "this"? Is it the entire kernel or does it apply to small excerpts of it? Because apparently "small partial excerpts may be copied without bothering with copyrights". But do you mean copyright attribution or are you rescinding your copyright entirely if I only copy "small partial excerpts"? But what is a small partial excerpt? And so on and so forth...

wkat4242•9mo ago
I think nikanj means that this is not a stipulation of the BSD license at all, that's why it's not compatible with what Linus made there.
LeFantome•9mo ago
But the Linus license has no bearing on the rest of the code base at all.

The entire concept of “compatibility” is an artifact of copyleft. In the rest of the license universe, each piece of code is covered by its own license and it does not matter what licenses other code uses.

This license does not apply to the rest of BSD. The BSD license does not apply to this code.

LeFantome•9mo ago
“this” is the code that Linus licensed as he did. Only that code. If you use a snippet, that snippet is governed by the license. The license does not magically extend to other code or even to any modifications that have been made since. This is not the GPL.
yjftsjthsd-h•9mo ago
Why not? BSD style licenses generally just impose constraints around liability and attribution; I can't see any reason why that wouldn't be compatible with a separate constraint on charging money. IANAL, though, so take with grain of salt.
LeFantome•9mo ago
The GPL has wrongly taught us to focus on “compatibility”. Compatibility is pretty much exclusively a copyleft issue.

There is no reason that you cannot use this code with this license in a larger BSD work. It is “compatible” in that sense.

This specific code has additional restrictions (not charging). That does not add any restrictions to the rest of the code though.

So, if you are charging, you are in violation of the license just for this code snippet. Linus Torvalds, the copyright holder, could try to enforce the license against you. Since he gives it away, no financial damages. Which means the remedy would be that you would not be able to use this code anymore (but could still use the rest of BSD).

I do not expect Linus to pursue enforcement on this one.

It would be a very difficult case to win anyway as you would have to prove that people were being charged specifically for the Linus code and not for other code covered by BSD (which allows charging).

I would argue that this license has not even been violated, unless somebody has put a price tag on this specific code.

Turboblack•9mo ago
finally something really useful, I wish you creative success, you are doing the right thing
bezko•9mo ago
What are some examples of an OS needing to do floating point numbers calculations?

OpenCiv3: Open-source, cross-platform reimagining of Civilization III

https://openciv3.org/
426•klaussilveira•5h ago•97 comments

Hello world does not compile

https://github.com/anthropics/claudes-c-compiler/issues/1
21•mfiguiere•42m ago•8 comments

The Waymo World Model

https://waymo.com/blog/2026/02/the-waymo-world-model-a-new-frontier-for-autonomous-driving-simula...
775•xnx•11h ago•472 comments

Show HN: Look Ma, No Linux: Shell, App Installer, Vi, Cc on ESP32-S3 / BreezyBox

https://github.com/valdanylchuk/breezydemo
142•isitcontent•6h ago•15 comments

Monty: A minimal, secure Python interpreter written in Rust for use by AI

https://github.com/pydantic/monty
135•dmpetrov•6h ago•57 comments

Dark Alley Mathematics

https://blog.szczepan.org/blog/three-points/
41•quibono•4d ago•3 comments

Show HN: I spent 4 years building a UI design tool with only the features I use

https://vecti.com
246•vecti•8h ago•117 comments

A century of hair samples proves leaded gas ban worked

https://arstechnica.com/science/2026/02/a-century-of-hair-samples-proves-leaded-gas-ban-worked/
70•jnord•3d ago•4 comments

Show HN: If you lose your memory, how to regain access to your computer?

https://eljojo.github.io/rememory/
180•eljojo•8h ago•124 comments

Microsoft open-sources LiteBox, a security-focused library OS

https://github.com/microsoft/litebox
314•aktau•12h ago•154 comments

How we made geo joins 400× faster with H3 indexes

https://floedb.ai/blog/how-we-made-geo-joins-400-faster-with-h3-indexes
12•matheusalmeida•1d ago•0 comments

Sheldon Brown's Bicycle Technical Info

https://www.sheldonbrown.com/
311•ostacke•12h ago•85 comments

Hackers (1995) Animated Experience

https://hackers-1995.vercel.app/
397•todsacerdoti•13h ago•217 comments

An Update on Heroku

https://www.heroku.com/blog/an-update-on-heroku/
322•lstoll•12h ago•233 comments

PC Floppy Copy Protection: Vault Prolok

https://martypc.blogspot.com/2024/09/pc-floppy-copy-protection-vault-prolok.html
12•kmm•4d ago•0 comments

Show HN: R3forth, a ColorForth-inspired language with a tiny VM

https://github.com/phreda4/r3
48•phreda4•5h ago•8 comments

I spent 5 years in DevOps – Solutions engineering gave me what I was missing

https://infisical.com/blog/devops-to-solutions-engineering
109•vmatsiiako•11h ago•34 comments

How to effectively write quality code with AI

https://heidenstedt.org/posts/2026/how-to-effectively-write-quality-code-with-ai/
186•i5heu•8h ago•129 comments

Understanding Neural Network, Visually

https://visualrambling.space/neural-network/
236•surprisetalk•3d ago•31 comments

I now assume that all ads on Apple news are scams

https://kirkville.com/i-now-assume-that-all-ads-on-apple-news-are-scams/
976•cdrnsf•15h ago•415 comments

Learning from context is harder than we thought

https://hy.tencent.com/research/100025?langVersion=en
144•limoce•3d ago•79 comments

Introducing the Developer Knowledge API and MCP Server

https://developers.googleblog.com/introducing-the-developer-knowledge-api-and-mcp-server/
17•gfortaine•3h ago•2 comments

I'm going to cure my girlfriend's brain tumor

https://andrewjrod.substack.com/p/im-going-to-cure-my-girlfriends-brain
49•ray__•2h ago•11 comments

FORTH? Really!?

https://rescrv.net/w/2026/02/06/associative
41•rescrv•13h ago•17 comments

Evaluating and mitigating the growing risk of LLM-discovered 0-days

https://red.anthropic.com/2026/zero-days/
35•lebovic•1d ago•11 comments

Why I Joined OpenAI

https://www.brendangregg.com/blog/2026-02-07/why-i-joined-openai.html
52•SerCe•2h ago•42 comments

Show HN: Smooth CLI – Token-efficient browser for AI agents

https://docs.smooth.sh/cli/overview
77•antves•1d ago•57 comments

The Oklahoma Architect Who Turned Kitsch into Art

https://www.bloomberg.com/news/features/2026-01-31/oklahoma-architect-bruce-goff-s-wild-home-desi...
18•MarlonPro•3d ago•4 comments

Claude Composer

https://www.josh.ing/blog/claude-composer
108•coloneltcb•2d ago•71 comments

Show HN: Slack CLI for Agents

https://github.com/stablyai/agent-slack
39•nwparker•1d ago•10 comments