Subject: Re: Machine-language reference sought
To: None <port-alpha@NetBSD.org>
From: der Mouse <mouse@Rodents.Montreal.QC.CA>
List: port-alpha
Date: 01/09/2004 12:29:02
>> I'd also be interested to find any documentation explaining which
>> registers are reserved, and for what uses, under NetBSD/alpha.
>> Perhaps it's lurking somewhere, but I've never found it.
> At a simple level, the register names in arch/alpha/include/reg.h
> provide some info. [...]
Sure, but how many of those does NetBSD itself actually depend on?
For example, on a SPARC, if I trash %o6 and/or %i6, I can expect to
fall over hard in some way next time I take a window overflow or
underflow trap or receive a caught signal. But that's a software
convention, not anythng the hardware itself knows about - and it's the
sort of software convention I'm wondering about on the alpha.
>> I'm contemplating writing some somewhat unusual code, and I suspect
>> I'm going to want all the registers I can get.
> OK, I'm curious! Can you give any more details?
I want to build a VAX emulator. I already have one that operates the
way evax does (presumably its relatives too), by running a C
implementation of the instructions. But it's slow.
I once tried to build a VAX emulator for the SPARC, but I never _quite_
could find enough registers, even after stealing another five or six by
getting creative with window saves and restores. While the Alpha has
no more registers than the SPARC (at least if the SPARC code doesn't
use multiple windows), they're twice as big and thus holding the VAX
state will take only half the registers it does on the SPARC. But I
still expect to need most of the available registers, and thus would
like to know which registers are reserved by (a) hardware, (b) palcode,
(c) kernel, and (d) compiler, so I can tell what registers I can't
touch, what registers I can bash provided I save and restore them, etc,
and what's liable to break if I bash which registers.
Of course, _best_ speed means doing JIT compilation to native machine
code. But I'm not quite that ambitious; an instruction-by-instruction
simulator in machine code seems like a good intermediate step.
It also should teach me alpha assembly, which is something I've been
meaning to learn for a while.
/~\ The ASCII der Mouse
\ / Ribbon Campaign
X Against HTML mouse@rodents.montreal.qc.ca
/ \ Email! 7D C8 61 52 5D E7 2D 39 4E F1 31 3E E8 B3 27 4B