What is this? How does one tell we have a 32-bit process on a
64-bit processor? Its my current project - there must be a way,
but Linux does a good job of hiding this from you, and the kernel.
The Linux kernel uses a layer of abstraction to allow multiple different
exec file formats (or "exec_domains"). So, there are very few places
in the kernel which need this distinction: a 32-bit process is a
"64-bit" one, but just doesnt bother to address its address space above
4GB. (And such code typically wont utilise the extended registers
or addressing modes).
So, how does one tell? How does one care?
Well, one area is a core file: the kernel knows how to write
an ELF32 core file vs an ELF64 one, but this is done through the
abstraction layer.
I thought, but cannot find, a reference to a bit in one of the
cpu registers (CR0, CR1, etc) which tells you which mode we
are in, and therefore guess I am looking in the wrong place, and/or
even the cpu doesnt have a notion. (Well, it *must* do because some
opcodes were remapped from 32-bit to 64-bit mode, so something
exists).
At the moment, telling the two apart in a system call trap is proving
elusive. (A 32-bit task will execute a different syscall entry into
the kernel compared to a 64-bit app, but this may just be semantics, e.g.
a 64-bit app may be able to invoke a 32-bit system call, and vice versa).
Something is going to answer me (hello Google!)
Post created by CRiSP v10.0.3a-b5937
http://sourceware.org/git/gitweb.cgi?p=systemtap.git;a=blob;f=runtime/compatdefs.h
ReplyDelete