Re:*(char*)0 = 0; - What Does the C++ Programmer Intend with...
by stefan_ on Tuesday October 17, 2023 @03:52PM
(#37920635)
On ATmega processors, the register file is mapped to 0, so this would be writing 0 to r0.. which GCC reserves as a dedicated 0 register anyway.
[ Parent
| on HN ]
Re:*(char*)0 = 0; - What Does the C++ Programmer Intend with...
by tzs on Tuesday October 17, 2023 @07:45PM
(#37923055)
The PDP-10 did that. There was actually core memory at addresses 0-15 but if you had registers they overlaid that.
Yes, I said if you had registers--if you were cheap you could buy your PDP-10 without registers and all the instructions that referenced registers would use core instead.
Since the registers were in effect just 16 words of fast semiconductor memory overlaying the first 16 words of slow core memory you could do anything in them that you could do in regular memory, including running code out of them.
If you had a small loop that did a lot of iterations you could sometimes get a significant speed boost by copying the loop into the registers and running it there.