[HN Gopher] Rust on MIPS64 Windows NT 4.0
       ___________________________________________________________________
        
       Rust on MIPS64 Windows NT 4.0
        
       Author : ingve
       Score  : 155 points
       Date   : 2021-11-16 13:18 UTC (1 days ago)
        
 (HTM) web link (gamozolabs.github.io)
 (TXT) w3m dump (gamozolabs.github.io)
        
       | im_down_w_otp wrote:
       | 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.
        
       | bitwize wrote:
       | 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.
        
       | mrlonglong wrote:
       | Excellent article, didn't even think Rust could be contorted into
       | doing these things so kudos.
        
       | Ericson2314 wrote:
       | 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!
        
       | rbanffy wrote:
       | 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.
        
         | ectopod wrote:
         | 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.
        
           | rbanffy wrote:
           | 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.
        
             | ectopod wrote:
             | I definitely used Visual Studio on Alpha for C++.
             | 
             | And it had VB too:
             | https://news.microsoft.com/1998/12/07/microsoft-announces-
             | av...
        
               | rbanffy wrote:
               | 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.
        
       | errcorrectcode wrote:
       | 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.
        
         | bitwize wrote:
         | 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.
        
         | twoodfin wrote:
         | To avoid x86-isms slipping into the OS, Windows NT was
         | developed originally on an i860-based platform, then one based
         | on MIPS.
        
           | kevin_thibedeau wrote:
           | They also avoided the DWORD x86ism and peppered LONG
           | everywhere, preventing a clean upgrade to LP64 since long
           | reasonably had to match as well.
        
             | matja wrote:
             | Why was SetWindowLong (taking LONG) superseded by
             | SetWindowLongPtr (taking LONG_PTR) on 64-bit versions of
             | Windows?
        
               | nikanj wrote:
               | 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
        
           | acomjean wrote:
           | 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
        
             | kryptiskt wrote:
             | That architect is Dave Cutler:
             | https://news.microsoft.com/features/the-engineers-
             | engineer-c...
        
       | zamadatix wrote:
       | 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.
        
         | mananaysiempre wrote:
         | 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.
        
           | ciupicri wrote:
           | Why would you use FTP instead of Samba?
        
             | mananaysiempre wrote:
             | 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.
        
           | zamadatix wrote:
           | 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.
        
       | tibbydudeza wrote:
       | 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.
        
       ___________________________________________________________________
       (page generated 2021-11-17 23:01 UTC)