Hacker News new | past | comments | ask | show | jobs | submit login
Rust on MIPS64 Windows NT 4.0 (gamozolabs.github.io)
203 points by ingve on Nov 17, 2021 | hide | past | favorite | 26 comments



I love it - wonderful hacking in the traditional sense. NT 4.0 is the perfect "weird old Windows" for this kind of weird adventures thing. It was released early enough it supported all sorts of weird architectures of the time but was also late enough that it had things like the MSR IPv6 stack and a lot of NT-isms that are still relevant/familiar with today's still NT based Windows.


For emulator usage, there are a couple more inconveniences: no USB stack so no support for QEMU’s usb-tablet device means the mouse position constantly gets out of sync (there are third-party stacks but I could never get them to work); active-only FTP is something of a pain to get through to the host (and again I could never get it to connect to the QEMU-invoked smbd). But the installation is several times smaller than 2000 (mostly because it doesn’t yet have weird now-abandoned things like the Microsoft Transaction Server), and that’s rather pleasant.


Never tried it on QEMU so I'm no help there (though if you can get network up VNC is probably workable). On VMware with the legacy tools package installed the mouse seemed pretty consistent in the console though.

Regarding file transfer I think I put an early 5.x version of WinSCP on the virtual disk image and that worked pretty well for FTP/SFTP. Might be other options but mostly I just loaded the IPv6 and Firefox install packages that way and it seemed to go fine for that.


Why would you use FTP instead of Samba?


Again, because I can’t get the NT 4 guest (or the NT 3.51 guest, or the 98 guest) to connect to the QEMU-launched smbd and I can’t be arsed to configure Samba and the relevant NAT and/or bridging myself, whereas the builtin FTP client mostly works out of the box except that I need to set up some network interface stuff on the host. (The last memory I have of seriously investigating Samba is when I read the entirety of the Samba HOWTO with a view of assisting the school network admins back when I was around 15 years old and—as I now recognize—knew next to nothing about networking. I probably still have something of an ugh zone around it.) I expect it’s because NT 4 only talks some sort of obsolete version of SMB or its underlying stack that modern Samba doesn’t enable by default, but again I just can’t bring myself to care when it’s a 30-minute hack whose only purpose is to get IE onto the VM and then I can bootstrap my way to saner things.

If you just happen to know the solution off the top of your head, please share it, by all means, that’s half the reason I posted that in the first place. But today is not the day I delve into the guts of old-style Microsoft/IBM networks.

The thing with mouse desync is similarly weird, because for me the mouse doesn’t desync when connecting to the VM over VNC using MultiVNC on Android, on a frickin’ touchscreen, but always desyncs when using either builtin Gtk, builtin SDL, or SPICE on Vinagre (which uses VNC under the hood supposedly?..) locally on Gnome Wayland, except the HiDPI-host bugs are different for each of those. In all cases QEMU is emulating a normal PS/2 mouse that shouldn’t have any support for absolute positioning. I mean, what? How does that even work? It’s not even the fun kind of “how does that even work”, just a lot of imperfect, subtly mismatched emulations stacked on top of one another. Monkey sad.


Over time the defaults of smb.conf have changed to where they no longer automatically support the older protocol versions and authentication methods of NT/9x/etc., but here's the secret to getting it to work (until they finally remove support):

In the [global] section of smb.conf, add:

server min protocol = NT1

lanman auth = yes

ntlm auth = yes

Then re-generate your SMB passwords. NTLM auth is used by NT and above clients, and LANMAN auth is needed for 9x and DOS.

https://askubuntu.com/questions/1213759/allow-smb-1-with-lan...


My favorite part about cross compilation is the magic of connecting the new and familiar to historical or remote things. It can really feel like establishing a new trade route. This adventure is a seller example of something inspires these feelings.

Great read, and maybe the PE support in LLVM will be generalized someday!


This is cool!

I'm ever so slowly trying to get Rust producing programs I can run on my Newton MessagePad 2000.

There's some good stuff in this article that I think I can take as valuable lessons in that ambition.


Nice reminder we had pretty cool 64-bit computers well before they became mainstream.

I remember I wanted Visual Studio for NT on MIPS, PPC, or Alpha and I couldn’t get it. Just that and Office would have opened the market for these chips.


Visual Studio for Alpha existed. At my company none of the third-party libraries we used were available for anything other than x86, but our code compiled and ran on Alpha NT with no problem at all. I'm nearly sure that Office was available too.


I think only the C/C++ development environment existed for those platforms, but I can try to dig more. Maybe I couldn't find them at the precise timeframe I had an Alpha to play with.


I definitely used Visual Studio on Alpha for C++.

And it had VB too: https://news.microsoft.com/1998/12/07/microsoft-announces-av...


I wonder what did it lack... I suspect I couldn't find it because, at the time, I didn't have the full MSDN subscription. I only got it a couple years later, after DEC was acquired by Compaq, who didn't know what to do with Alpha and, by then, that Alpha was looooong gone.


Oh that's right. Besides DEC Alpha, NT worked on Prof. Hennessy's baby / SGI's Visual Workstation boxen too.

Edit: I remember using SPIM (MIPS simulator) in undergrad and writing a Java subset to MIPS assembly compiler.


To avoid x86-isms slipping into the OS, Windows NT was developed originally on an i860-based platform, then one based on MIPS.


NT was designed in part by a former Digital Equipment Corp architect who did a lot of work on Vax/VMS.

Windows NT was the subject of the appendix of my Operating system book. Replaced now by "Windows 2000" (NT5.0), which was the next OS.

https://www.os-book.com/OS8/os8c/appendices-dir/c.pdf



They also avoided the DWORD x86ism and peppered LONG everywhere, preventing a clean upgrade to LP64 since long reasonably had to match as well.


Why was SetWindowLong (taking LONG) superseded by SetWindowLongPtr (taking LONG_PTR) on 64-bit versions of Windows?


Because SetWindowLong can be used to set a callback function, i.e. a 64-bit pointer - but LONG remains 32 bit on 64-bit Windows. Backward compatibility stipulated the need for a new function name


Visual Workstations were 32-bit x86, and the models 320 and 540 were PC-incompatible (they had their own firmware). Windows NT had special drover support for them.


Reminds me of how I started programming software for the Tandy 2000 -- using Turbo Pascal 7 for DOS. As long as I use 8086 instructions and my own library routines and not e.g., BGI or anything that assumes a PC, the EXEs will run fine on a (emulated) Tandy 2000, because it's still a 16-bit x86 architecture. The weird I/O mapping of this PC-incompatible machine could be accommodated with inline asm. So it's not cross-CPU-arch, but still using more modern tools to program for a weird old machine, and I love it.


Turbo Pascal 3 worked on the Apricot F10 (a similar non-PC MSDOS machine) if my memory serves it was a port of the CP/M version so you just had to tell it what display driver to use (vt100/vt52/adm12 etc)


Yeah, with the right magic settings and possibly use of ANSI.SYS, some early versions of TP could be gotten to run on the 2000.

TP7 could not, but I could use the DOS PC version to compile and assemble software for the 2000.


Excellent article, didn't even think Rust could be contorted into doing these things so kudos.


Afaik Microsoft built their own developer workstations based on the MIPS Magnum R4000 processor because nobody made them commercially and to make Dave Cutler and his team happy.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: