Initial support for per-core privileged mode stacks
There are several situations in which the kernel/OS needs to check or reset the privileged mode stack pointers. Until now the kernel would have been using hardcoded addresses for this, but that won't work for SMP setups, where each core will need to have its own unique privileged mode stacks, or for SVC-mode threading, where each thread is given its own SVC stack. To resolve this, store the default stack pointers in a struct in kernel workspace, and fetch the values from there as needed. ARMv7 introduces extra, core-local, CP15 registers for storing thread/process IDs. So on ARMv7+, we'll use the TPIDRPRW register to hold the pointer to the workspace struct. On startup the kernel will correctly initialise this register for the primary core; the SMP module is expected to initialise the register & workspace for the other cores, as needed. Older CPUs (which are assumed to be single-core) will access the struct directly via a hardcoded address.
Showing with 198 additions and 25 deletions