Linux Kernel Architecture

(Jacob Rumans) #1
Mauerer runapp01.tex V1 - 09/04/2008 6:08pm Page 1128

Appendix A: Architecture Specifics


A.7.4 Sparc64


Sparc64 processors also make use of an array in thept_regsstructure to provide memory space for the
individual registers. The registers are named and space is allocated by means of pre-processor constants,
as follows:

include/asm-sparc64/ptrace.h
struct pt_regs {
unsigned long u_regs[16]; /* globals and ins */
unsigned long tstate;
unsigned long tpc;
unsigned long tnpc;
unsigned int y;
unsigned int fprs;
};

#define UREG_G0 0
#define UREG_G1 1
#define UREG_G2 2
#define UREG_G3 3
#define UREG_G4 4
#define UREG_G5 5
#define UREG_G6 6
#define UREG_G7 7
#define UREG_I0 8
#define UREG_I1 9
#define UREG_I2 10
#define UREG_I3 11
#define UREG_I4 12
#define UREG_I5 13
#define UREG_I6 14
#define UREG_I7 15
#define UREG_FP UREG_I6
#define UREG_RETPC UREG_I7

In contrast to other architectures, Sparc64 tries to store the registers that are not always saved in
thread_infoinstead of inthread_struct. As usual, the platform must be able to differentiate itself
from the other ports. If the kernel is not compiled with the spinlock debugging option, the structure
could be empty. However, owing to an (earlier) GCC error (that the authors of the Sparc port do not
greatly appreciate, as suggested by the following source code comment), the structure contains a dummy
element:

include/asm-sparc64/processor.h
/* The Sparc processor specific thread struct. */
/* XXX This should die, everything can go into thread_info now. */
struct thread_struct {
#ifdef CONFIG_DEBUG_SPINLOCK
/* How many spinlocks held by this thread.
* Used with spin lock debugging to catch tasks
* sleeping illegally with locks held.
*/
int smp_lock_count;
unsigned int smp_lock_pc;
Free download pdf