arch/arm/xen/hypercall.S

Source file repositories/reference/linux-study-clean/arch/arm/xen/hypercall.S

File Facts

System
Linux kernel
Corpus path
arch/arm/xen/hypercall.S
Extension
.S
Size
3796 bytes
Lines
122
Domain
Architecture Layer
Bucket
arch/arm
Inferred role
Architecture Layer: arch/arm
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/linkage.h>
#include <asm/assembler.h>
#include <asm/opcodes-virt.h>
#include <xen/interface/xen.h>


#define XEN_IMM 0xEA1

#define HYPERCALL_SIMPLE(hypercall)		\
ENTRY(HYPERVISOR_##hypercall)			\
	mov r12, #__HYPERVISOR_##hypercall;	\
	__HVC(XEN_IMM);						\
	ret lr;					\
ENDPROC(HYPERVISOR_##hypercall)

#define HYPERCALL0 HYPERCALL_SIMPLE
#define HYPERCALL1 HYPERCALL_SIMPLE
#define HYPERCALL2 HYPERCALL_SIMPLE
#define HYPERCALL3 HYPERCALL_SIMPLE
#define HYPERCALL4 HYPERCALL_SIMPLE

#define HYPERCALL5(hypercall)			\
ENTRY(HYPERVISOR_##hypercall)			\
	stmdb sp!, {r4}						\
	ldr r4, [sp, #4]					\
	mov r12, #__HYPERVISOR_##hypercall;	\
	__HVC(XEN_IMM);						\
	ldm sp!, {r4}						\
	ret lr					\
ENDPROC(HYPERVISOR_##hypercall)

                .text

HYPERCALL2(xen_version);
HYPERCALL3(console_io);
HYPERCALL3(grant_table_op);
HYPERCALL2(sched_op);
HYPERCALL2(event_channel_op);
HYPERCALL2(hvm_op);
HYPERCALL2(memory_op);
HYPERCALL2(physdev_op);
HYPERCALL3(vcpu_op);
HYPERCALL1(platform_op_raw);
HYPERCALL2(multicall);
HYPERCALL2(vm_assist);
HYPERCALL3(dm_op);

ENTRY(privcmd_call)
	stmdb sp!, {r4}
	mov r12, r0
	mov r0, r1
	mov r1, r2
	mov r2, r3
	ldr r3, [sp, #8]
	/*
	 * Privcmd calls are issued by the userspace. We need to allow the
	 * kernel to access the userspace memory before issuing the hypercall.
	 */
	uaccess_enable r4

	/* r4 is loaded now as we use it as scratch register before */
	ldr r4, [sp, #4]
	__HVC(XEN_IMM)

	/*
	 * Disable userspace access from kernel. This is fine to do it
	 * unconditionally as no set_fs(KERNEL_DS) is called before.
	 */
	uaccess_disable r4

Annotation

Implementation Notes