[NBLUG/talk] Bare metal question
ME
dugan at passwall.com
Sun May 25 11:02:01 PDT 2003
[chop]
> This puzzles me, for if a register can be used as
> something that is not a memory location, then what
> is a register?
I view registers as "small, fast, specialized memory that are built-into
the CPU and not in RAM."
I can't think of anything that can be stored at an address in RAM that
can't be stored in a register. (Note, "an address" being the same
bit-size/width of the largest register.)
Registers can be used to store values, addresses, and bit-wise
representations of letters (also a value) and of course instructions
(another kind of value that is instead used to provide direction.) They
can store results, and return values for exiting functions or programs as
well as more specific information on certain instructions and their
results (mostly math.) Of course, they are not big enough to store arrays
(for the most part - there are clunky exceptions.) However, not all
registers were designed to store all of the above kinds of data. Some are
general purpose and others are not and general purpose registers can be
limited to only work with certain instructions.
Many/most of the registers have specific purposes and deal with addresses
only (or were designed to deal with addresses.) What about the general
purpose registers? eax, ebx, ecx, edx and the less-than-32-bit
counterparts can store more than addresses. Even the some of the
special-purpose registers can be used to store values using non-standard
methods.
Registers provide immediate access to addresses/pointers and various
values (as listed above) for the CPU without having to go to RAM to fetch
them. (Of course, "going to RAM to fetch them" presently requires loading
addresses from "somewhere" into at least one register, or using addresses
previously stored in registers.) Technically, many of the registers could
be moved into RAM if instructions supported this and still permit the CPU
to process the same problems (at a significantly reduced speed.) Of
course, I dont see any easy way that a modification to the execution of
instructions could permit EIP, ESP, EBP and similar registers to be moved
into RAM, modifications to the work done by the instructions set could
permit the general purpose registers to be moved into RAM, even if it is
not a good idea.
Yes, there are things that can be done with registers than cannot be done
with RAM, and there are things in RAM that cannot be done in registers,
but the differences are mostly due to the instruction-set that is provided
with x86 and how each instruction may use RAM vs. registers or due to
differences in the size of data that can be contained in each.
> Proposition: A register is a mediator between
> electricity and memory, and a register
> serves in the transformation of electricity into memory.
"Electricity" here is a bit too general. Such generalizations could then
be applied to other objects:
This toaster serves in the transformation of electricity, bread and time
into toast. ;-) (I guess I am more of a "splitter" than a "lumper" here.)
If I were forced to make a broad generalization, I might try a different
route. The above example may be better applied to the CPU as a whole (with
its registers) and substituting RAM for memory:
"A CPU is a mediator between electricity and memory"
Since it is the CPU that actually uses the electricity to modify bits on
registers and in RAM. But this is a failed example, since electricity does
not get converted to/from data/instructions by itself - data/instructions
are converted to data/instructions and use electricity in this process,
making electricity a requirement.
Another view:
Registers are one of the three parts of CPU, RAM and instructions.
Or:
Registers act as glue between the CPU/instructions and RAM.
-ME
More information about the talk
mailing list