arch/powerpc/platforms/pseries/hvCall.S

Source file repositories/reference/linux-study-clean/arch/powerpc/platforms/pseries/hvCall.S

File Facts

System
Linux kernel
Corpus path
arch/powerpc/platforms/pseries/hvCall.S
Extension
.S
Size
6975 bytes
Lines
371
Domain
Architecture Layer
Bucket
arch/powerpc
Inferred role
Architecture Layer: arch/powerpc
Status
atlas-only

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/jump_label.h>
#include <asm/hvcall.h>
#include <asm/processor.h>
#include <asm/ppc_asm.h>
#include <asm/asm-offsets.h>
#include <asm/ptrace.h>
#include <asm/feature-fixups.h>

	.section	".text"
	
#ifdef CONFIG_TRACEPOINTS

#ifndef CONFIG_JUMP_LABEL
	.data

	.globl hcall_tracepoint_refcount
hcall_tracepoint_refcount:
	.8byte	0

	.section	".text"
#endif

/*
 * precall must preserve all registers.  use unused STK_PARAM()
 * areas to save snapshots and opcode. STK_PARAM() in the caller's
 * frame will be available even on ELFv2 because these are all
 * variadic functions.
 */
#define HCALL_INST_PRECALL(FIRST_REG)				\
	mflr	r0;						\
	std	r3,STK_PARAM(R3)(r1);				\
	std	r4,STK_PARAM(R4)(r1);				\
	std	r5,STK_PARAM(R5)(r1);				\
	std	r6,STK_PARAM(R6)(r1);				\
	std	r7,STK_PARAM(R7)(r1);				\
	std	r8,STK_PARAM(R8)(r1);				\
	std	r9,STK_PARAM(R9)(r1);				\
	std	r10,STK_PARAM(R10)(r1);				\
	std	r0,16(r1);					\
	addi	r4,r1,STK_PARAM(FIRST_REG);			\
	stdu	r1,-STACK_FRAME_MIN_SIZE(r1);			\
	bl	CFUNC(__trace_hcall_entry);			\
	ld	r3,STACK_FRAME_MIN_SIZE+STK_PARAM(R3)(r1);	\
	ld	r4,STACK_FRAME_MIN_SIZE+STK_PARAM(R4)(r1);	\
	ld	r5,STACK_FRAME_MIN_SIZE+STK_PARAM(R5)(r1);	\
	ld	r6,STACK_FRAME_MIN_SIZE+STK_PARAM(R6)(r1);	\
	ld	r7,STACK_FRAME_MIN_SIZE+STK_PARAM(R7)(r1);	\
	ld	r8,STACK_FRAME_MIN_SIZE+STK_PARAM(R8)(r1);	\
	ld	r9,STACK_FRAME_MIN_SIZE+STK_PARAM(R9)(r1);	\
	ld	r10,STACK_FRAME_MIN_SIZE+STK_PARAM(R10)(r1)

/*
 * postcall is performed immediately before function return which
 * allows liberal use of volatile registers.
 */
#define __HCALL_INST_POSTCALL					\
	ld	r0,STACK_FRAME_MIN_SIZE+STK_PARAM(R3)(r1);	\
	std	r3,STACK_FRAME_MIN_SIZE+STK_PARAM(R3)(r1);	\
	mr	r4,r3;						\
	mr	r3,r0;						\
	bl	CFUNC(__trace_hcall_exit);			\
	ld	r0,STACK_FRAME_MIN_SIZE+16(r1);			\
	addi	r1,r1,STACK_FRAME_MIN_SIZE;			\
	ld	r3,STK_PARAM(R3)(r1);				\
	mtlr	r0

#define HCALL_INST_POSTCALL_NORETS				\
	li	r5,0;						\
	__HCALL_INST_POSTCALL

Annotation

Implementation Notes