arch/sparc/include/asm/thread_info_64.h

Source file repositories/reference/linux-study-clean/arch/sparc/include/asm/thread_info_64.h

File Facts

System
Linux kernel
Corpus path
arch/sparc/include/asm/thread_info_64.h
Extension
.h
Size
8137 bytes
Lines
243
Domain
Architecture Layer
Bucket
arch/sparc
Inferred role
Architecture Layer: implementation source
Status
source implementation candidate

Why This File Exists

CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.

Dependency Surface

Detected Declarations

Annotated Snippet

struct thread_info {
	/* D$ line 1 */
	struct task_struct	*task;
	unsigned long		flags;
	__u8			fpsaved[7];
	__u8			status;
	unsigned long		ksp;

	/* D$ line 2 */
	unsigned long		fault_address;
	struct pt_regs		*kregs;
	int			preempt_count;	/* 0 => preemptable, <0 => BUG */
	__u8			new_child;
	__u8			__pad;
	__u16			cpu;

	unsigned long		*utraps;

	struct reg_window 	reg_window[NSWINS];
	unsigned long 		rwbuf_stkptrs[NSWINS];

	unsigned long		gsr[7];
	unsigned long		xfsr[7];

	struct pt_regs		*kern_una_regs;
	unsigned int		kern_una_insn;

	unsigned long		fpregs[(7 * 256) / sizeof(unsigned long)]
		__attribute__ ((aligned(64)));
};

#endif /* !(__ASSEMBLER__) */

/* offsets into the thread_info struct for assembly code access */
#define TI_TASK		0x00000000
#define TI_FLAGS	0x00000008
#define TI_FAULT_CODE	(TI_FLAGS + TI_FLAG_BYTE_FAULT_CODE)
#define TI_WSTATE	(TI_FLAGS + TI_FLAG_BYTE_WSTATE)
#define TI_CWP		(TI_FLAGS + TI_FLAG_BYTE_CWP)
#define TI_FPDEPTH	(TI_FLAGS + TI_FLAG_BYTE_FPDEPTH)
#define TI_WSAVED	(TI_FLAGS + TI_FLAG_BYTE_WSAVED)
#define TI_SYS_NOERROR	(TI_FLAGS + TI_FLAG_BYTE_NOERROR)
#define TI_FPSAVED	0x00000010
#define TI_KSP		0x00000018
#define TI_FAULT_ADDR	0x00000020
#define TI_KREGS	0x00000028
#define TI_PRE_COUNT	0x00000030
#define TI_NEW_CHILD	0x00000034
#define TI_CPU		0x00000036
#define TI_UTRAPS	0x00000038
#define TI_REG_WINDOW	0x00000040
#define TI_RWIN_SPTRS	0x000003c0
#define TI_GSR		0x000003f8
#define TI_XFSR		0x00000430
#define TI_KUNA_REGS	0x00000468
#define TI_KUNA_INSN	0x00000470
#define TI_FPREGS	0x00000480

/* We embed this in the uppermost byte of thread_info->flags */
#define FAULT_CODE_WRITE	0x01	/* Write access, implies D-TLB	   */
#define FAULT_CODE_DTLB		0x02	/* Miss happened in D-TLB	   */
#define FAULT_CODE_ITLB		0x04	/* Miss happened in I-TLB	   */
#define FAULT_CODE_WINFIXUP	0x08	/* Miss happened during spill/fill */
#define FAULT_CODE_BLKCOMMIT	0x10	/* Use blk-commit ASI in copy_page */
#define	FAULT_CODE_BAD_RA	0x20	/* Bad RA for sun4v		   */

#if PAGE_SHIFT == 13
#define THREAD_SIZE (2*PAGE_SIZE)
#define THREAD_SHIFT (PAGE_SHIFT + 1)
#else /* PAGE_SHIFT == 13 */
#define THREAD_SIZE PAGE_SIZE
#define THREAD_SHIFT PAGE_SHIFT
#endif /* PAGE_SHIFT == 13 */

/*
 * macros/functions for gaining access to the thread information structure
 */
#ifndef __ASSEMBLER__

#define INIT_THREAD_INFO(tsk)				\
{							\
	.task		=	&tsk,			\
	.preempt_count	=	INIT_PREEMPT_COUNT,	\
	.kregs		=	(struct pt_regs *)(init_stack+THREAD_SIZE)-1 \
}

/* how to get the thread information struct from C */
#ifndef BUILD_VDSO
register struct thread_info *current_thread_info_reg asm("g6");
#define current_thread_info()	(current_thread_info_reg)

Annotation

Implementation Notes