Haiku on 486?

Last week I discovered that in 2024 one guy managed to finally run Windows XP on 486 by patching all the CMPXCHG8B instructions used by the kernel. And ever since then I’ve been thinking about launching Haiku on a 486 VM (because what could be more useless?). Not sure if that would require anything more than rewriting the x86 atomic_xxx64 assembly functions, but I should give it a try the other day.

2 Likes

Funnily enough, I was actually thinking about this as well, having seen someone else mention the possibility at some point before. I think if you just disable the atomic_test_and_set64 routine and anything that uses it (i.e. you will need to build a kernel without PAE support), that should suffice on that front.

What other Pentium-specific features we make use of, I’m not sure. And actually running on a 486 bare-metal is likely impossible given the amount of RAM those systems usually had. Once upon a time (before packagefs, I think) I managed to get Haiku to run in about 93MB of RAM, and so if we’re back to around 128MB even with packagefs, that should still be possible without it. Getting from 93MB to 64MB may be possible with some hacks (e.g. build without ICU at all, change SMP_MAX_CPUS to 2, turn KDEBUG_LEVEL all the way down to 0… probably some other things I’m not thinking of at the moment, etc.) but going lower than 64MB will probably be very difficult.

2 Likes

I’ve seen a few commits with fixes for non-PAE machines. I wonder if those were pure theoretical ones, or people actually tried to build that. At first glance it seems to be as simple as setting __HAIKU_ARCH_PHYSICAL_BITS to 32.

Surprisingly, there are quite a few Socket 1/2/3 motherboards (listed here and here) that claims to support 128MB or even more. How accurate is that data and how easy would to buy one of those nowadays is a different question, of course. On the Vogons forum folks reported a few models they actually run with 256MB.

The non-PAE paging code is always built and can be enabled by choosing “Disable PAE” in the bootloader.

1 Like

I don’t see that option in the bootloader, but PAE is disabled with the “Ignore memory beyond 4GiB” option and also when it’s actually not supported by the CPU, so it shouldn’t be a problem.

1 Like

RDTSC , which is used by system_time() kernel function, which is used pretty much everywhere. That’s going to be more complicated than I initially thought :roll_eyes:
We could probably use PIT for system_time(), as Windows did on pre-Pentium CPUs. It will be slow and not that precise but I guess that’s the best possible option on a 486 machine (the other one is RTC which is even less precise).

Except we need it for other uses (triggering wakeup interruptions at programmed times) and it will be not so simple to handle both.

The choice to not support anything earlier than Pentium was not just by lazyness of the developers :slight_smile:

(Not saying that you shouldn’t try, but I guess it’s not going to be easy)

I have at least a few 486 boards here that can address at least 128mb, and even enough 32mb SIMMS to get to 128.

1 Like

They knew anything earlier would mean PIT(A) :smile:

If I reuse that timer functionality by adding a repeated timer event at a fixed rate (0.2 ms for example) and advance stored in-memory system time value in its handler, that should do the trick, no? The system won’t be tickless anymore, but that’s fine for the purpose of the experiment.

Good to know! It’d be interesting to test it on a real hardware, if I ever get it working. Btw, which 486 CPU variant(s) do you have?

More than i can recall, this place is plastered with droves of 386 and 486 era motherboards, and literal crates full of RAM, I have stacks of 486 CPUs, intel, AMD, cyrix, DX, SX, DX2, DX4, and even some 486 overdrives and socket 3 pentium overdrives, and one of those fancy 133MHz AMD Am5x86 chips.

I actually just finished building up and restoring a new unit a few months ago that uses the ECS SA486P AIO that is listed at the top of that first website, equipped with an intel 486 DX4 100MHz.

2 Likes

Maybe it will. I don’t know all the internals of that code well enough, it’s possible that you may miss a tick if interrupts are disabled and the clock could then get out of sync?

But also maybe it’s the least of your problems. For an initial experiment, this isa good way to start. Then see how well it works and improve as needed.

1 Like