arch/sparc/lib/copy_user.S

Source file repositories/reference/linux-study-clean/arch/sparc/lib/copy_user.S

File Facts

System
Linux kernel
Corpus path
arch/sparc/lib/copy_user.S
Extension
.S
Size
9609 bytes
Lines
395
Domain
Architecture Layer
Bucket
arch/sparc
Inferred role
Architecture Layer: exported/initcall integration point
Status
integration 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

#include <linux/export.h>
#include <asm/ptrace.h>
#include <asm/asmmacro.h>
#include <asm/page.h>
#include <asm/thread_info.h>

/* Work around cpp -rob */
#define ALLOC #alloc
#define EXECINSTR #execinstr

#define EX_ENTRY(l1, l2)			\
	.section __ex_table,ALLOC;		\
	.align	4;				\
	.word	l1, l2;				\
	.text;

#define EX(x,y,a,b) 				\
98: 	x,y;					\
	.section .fixup,ALLOC,EXECINSTR;	\
	.align	4;				\
99:	retl;					\
	 a, b, %o0;				\
	EX_ENTRY(98b, 99b)

#define EX2(x,y,c,d,e,a,b) 			\
98: 	x,y;					\
	.section .fixup,ALLOC,EXECINSTR;	\
	.align	4;				\
99:	c, d, e;				\
	retl;					\
	 a, b, %o0;				\
	EX_ENTRY(98b, 99b)

#define EXO2(x,y) 				\
98: 	x, y;					\
	EX_ENTRY(98b, 97f)

#define LD(insn, src, offset, reg, label)	\
98:	insn [%src + (offset)], %reg;		\
	.section .fixup,ALLOC,EXECINSTR;	\
99:	ba	label;				\
	 mov	offset, %g5;			\
	EX_ENTRY(98b, 99b)

#define ST(insn, dst, offset, reg, label)	\
98:	insn %reg, [%dst + (offset)];		\
	.section .fixup,ALLOC,EXECINSTR;	\
99:	ba	label;				\
	 mov	offset, %g5;			\
	EX_ENTRY(98b, 99b)

/* Both these macros have to start with exactly the same insn */
/* left: g7 + (g1 % 128) - offset */
#define MOVE_BIGCHUNK(src, dst, offset, t0, t1, t2, t3, t4, t5, t6, t7) \
	LD(ldd, src, offset + 0x00, t0, bigchunk_fault)	\
	LD(ldd, src, offset + 0x08, t2, bigchunk_fault)	\
	LD(ldd, src, offset + 0x10, t4, bigchunk_fault)	\
	LD(ldd, src, offset + 0x18, t6, bigchunk_fault)	\
	ST(st, dst, offset + 0x00, t0, bigchunk_fault)	\
	ST(st, dst, offset + 0x04, t1, bigchunk_fault)	\
	ST(st, dst, offset + 0x08, t2, bigchunk_fault)	\
	ST(st, dst, offset + 0x0c, t3, bigchunk_fault)	\
	ST(st, dst, offset + 0x10, t4, bigchunk_fault)	\
	ST(st, dst, offset + 0x14, t5, bigchunk_fault)	\
	ST(st, dst, offset + 0x18, t6, bigchunk_fault)	\
	ST(st, dst, offset + 0x1c, t7, bigchunk_fault)

/* left: g7 + (g1 % 128) - offset */
#define MOVE_BIGALIGNCHUNK(src, dst, offset, t0, t1, t2, t3, t4, t5, t6, t7) \
	LD(ldd, src, offset + 0x00, t0, bigchunk_fault)	\

Annotation

Implementation Notes