Step
up to the Plate.
Problem 2How
many bytes of storage space are sufficient for storing the context
information for a context switch on an 8051? (The 8051 has 8 8-bit
general purpose registers R0-R7, a 16-bit data pointer, a 16-bit program
counter an 8-bit stack pointer, and an 8-bit program status word or
PSW.)
Answer:
Six bytes! This is achieved by not saving the general-purpose registers,
and saving only the data pointer, program counter, stack pointer and
program status word. The 8051 has a special feature that makes this
possible. The general-purpose registers are mapped into the first
32 bytes of internal ram. By setting the PSW register, you can specify
whether the general purpose registers map to the first, second, third
or fourth bank of 8 bytes of internal ram. Of course this imposes
a limitation that your application must have no more than four unique
contexts. However, this makes for a very fast context switch.
12-99
|