tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: how to tell if a process is 64-bit



>> First, I have to ask: what does it mean to say that a particular
>> process is - or isn't - 64-bit?
> Many 64-bit ports support running 32-bit applications
> (compat_netbsd32, compat_linux32).

Exactly.

Is the answer "it can do arithmetic on 64-bit values"?  (Most - all, I
think - NetBSD ports qualify.  Indeed, I have trouble imagining any
machine with pretensions to general-purpose use, even 8-bitters like
the C=64, that doesn't.)

Is the answer "the CPU has 64-bit internal datapaths"?  (This is not a
per-process thing; it is probably true of some CPUs usually thought of
as 32-bit and probably false of some low-end "64-bit" CPUs.)

Is the answer "it's using an ISA with 64-bit registers and addresses"?
This actually can be broken down into the "registers" and "addresses"
portion, but, in practice, the two tend to go together.  (Always true
on most "64-bit" ports, a real question on amd64 (and others, if any)
which support 32-bit userland.)

Is the answer "it can address more than 4G of VM"?  (This is probably
equivalent, in practice, to the previous one.)

Is the answer "it can address VM above the 4G point"?  (For some ways
of looking at the questions, this is equiavlent to the previous one.  I
think amd64 CPUs can do this under some circumstances when executing
their 32-bit ISA, though I'd have to check the architecture document to
be sure, and they may be limited to something like the 64G point.)

I suspect the original question was thinking of the middle one,
probably with regard to amd64/i386.  I _think_ the CPU in that case can
switch its ISA on the fly; if so, the question may need to be more "is
it a 64-bit process at some particular moment?".  If not, "which
emulation is it using?" may be close enough to be useful, and is easy
to answer, though perhaps somewhat inconvenient (ktrace writes a record
with the emulation type; with no tracing points turned on that should
be all it writes).

/~\ The ASCII				  Mouse
\ / Ribbon Campaign
 X  Against HTML		mouse%rodents-montreal.org@localhost
/ \ Email!	     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B


Home | Main Index | Thread Index | Old Index