"Ask" <ask.q@indiatimes.com> writes:
A basic question that was confusing me - is there any upper limit on
the size of a program ? Say the architecture is 32 bit. I was of the
opinion that at most the program can have 2^32 instructions and virtual
memory size is 2^32 Is this correct ?
Not entirely. Some architectures reserve some portions of the address
space for memory-mapped i/o, interrupt vectors, etc. So you,
generally, can't have programs that fill the entire address space.
Also, the address space need not be 2^N, where N is the size of a
machine word. Some use segmented addressing to increase the address
space beyond this, and others limit the addressable space to something
smaller. And some limit the size of the PC to something smaller than
a machine word.
Early ARM processors used the top 4 bits of the PC for arithmetic
flags and the next two for interrupt enable flags, so programs could
only reside in the low 2^26 bytes (= 64MB) of memory. ARM was
designed in 1985, when most machines were limited to 64KB, so this
didn't seem unreasonable. Around 1990, ARM moved the flags into a
separate register, allowing the PC to use the full 32 bits.
Torben