D
dspfun
In general, how do you read contents of the CPU's registers and how do
you get hold of the addresses of the CPU's registers?
you get hold of the addresses of the CPU's registers?
There isn't a general answer. Not many processors have registers thatdspfun said:In general, how do you read contents of the CPU's registers and how do
you get hold of the addresses of the CPU's registers?
dspfun said:In general, how do you read contents of the CPU's registers and how do
you get hold of the addresses of the CPU's registers?
In general, how do you read contents of the CPU's registers
> and how do
you get hold of the addresses of the CPU's registers?
Also: on most CPUs, the registers do not have addresses.
dspfun said:In general, how do you read contents of the CPU's registers and
how do you get hold of the addresses of the CPU's registers?
C doesn't provide any portable means to do either one. I'd
advise you to seek help in a forum dedicated to your particular C
implementation.
Also: on most CPUs, theregistersdo not have addresses.
dspfun said:Thanks, that's why I haven't found a way to do this using C.
C specifically disallows taking the address of objects qualified with
register, even if they may not actually be stored in machine
registers. There're also some more limitations for objects qualified
with register. Under modern compilers, register is of little, if any,
usefulness.
That should be obvious from inspection. Like any superfluousWell as I read somewhere recently, the main audience for your code
isn't so much the compiler as a hypothetical future maintainer of your
code. And the register keyword surely transmits useful information
about the variable to him or her - ie that it's a key variable that
will be heavily used throughout the function.
Well as I read somewhere recently, the main audience for your code
isn't so much the compiler as a hypothetical future maintainer of your
code. And the register keyword surely transmits useful information
about the variable to him or her - ie that it's a key variable that
will be heavily used throughout the function.
In general, how do you read contents of the CPU's registers and how do
you get hold of the addresses of the CPU's registers?
Have you ever used an 8051?Daniel said:At about the time of 3/31/2007 2:57 PM, dspfun stated the following:
The short answer? You don't. The compiler takes care of it for you.
CPU registers are, by definition, in the CPU, not memory. So they don't
have addresses per say.
Have you ever used an 8051?
Have you ever used an 8051?
Some modesl of the IBM 1130 stored the index register in memory. Some
microprocessor (TI9900, IIRC) used a single hardware register to point
to a block of memory locations containing the "registers". The Microdata
Reality series had a memory resident "accumulator", which was occasionally
loaded with a two character subroutine "op<number>; return;" to make up
for a handful of opcodes that had a constant where they should have had
an index. Way Back Then, registers weren't that much faster than memory.
Your token olde farte,
Martin
Some modesl of the IBM 1130 stored the index register in memory. Some
microprocessor (TI9900, IIRC) used a single hardware register to point
to a block of memory locations containing the "registers".
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.