tools/testing/selftests/kvm/lib/riscv/handlers.S

Source file repositories/reference/linux-study-clean/tools/testing/selftests/kvm/lib/riscv/handlers.S

File Facts

System
Linux kernel
Corpus path
tools/testing/selftests/kvm/lib/riscv/handlers.S
Extension
.S
Size
1885 bytes
Lines
105
Domain
Support Tooling And Documentation
Bucket
tools
Inferred role
Support Tooling And Documentation: tools
Status
atlas-only

Why This File Exists

Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.

Dependency Surface

Detected Declarations

Annotated Snippet

#ifndef __ASSEMBLY__
#define __ASSEMBLY__
#endif

#include <asm/csr.h>

.macro save_context
	addi  sp, sp, (-8*36)
	sd    x1, 8(sp)
	sd    x2, 16(sp)
	sd    x3, 24(sp)
	sd    x4, 32(sp)
	sd    x5, 40(sp)
	sd    x6, 48(sp)
	sd    x7, 56(sp)
	sd    x8, 64(sp)
	sd    x9, 72(sp)
	sd    x10, 80(sp)
	sd    x11, 88(sp)
	sd    x12, 96(sp)
	sd    x13, 104(sp)
	sd    x14, 112(sp)
	sd    x15, 120(sp)
	sd    x16, 128(sp)
	sd    x17, 136(sp)
	sd    x18, 144(sp)
	sd    x19, 152(sp)
	sd    x20, 160(sp)
	sd    x21, 168(sp)
	sd    x22, 176(sp)
	sd    x23, 184(sp)
	sd    x24, 192(sp)
	sd    x25, 200(sp)
	sd    x26, 208(sp)
	sd    x27, 216(sp)
	sd    x28, 224(sp)
	sd    x29, 232(sp)
	sd    x30, 240(sp)
	sd    x31, 248(sp)
	csrr  s0, CSR_SEPC
	csrr  s1, CSR_SSTATUS
	csrr  s2, CSR_STVAL
	csrr  s3, CSR_SCAUSE
	sd    s0, 0(sp)
	sd    s1, 256(sp)
	sd    s2, 264(sp)
	sd    s3, 272(sp)
.endm

.macro restore_context
	ld    s3, 272(sp)
	ld    s2, 264(sp)
	ld    s1, 256(sp)
	ld    s0, 0(sp)
	csrw  CSR_SCAUSE, s3
	csrw  CSR_SSTATUS, s1
	csrw  CSR_SEPC, s0
	ld    x31, 248(sp)
	ld    x30, 240(sp)
	ld    x29, 232(sp)
	ld    x28, 224(sp)
	ld    x27, 216(sp)
	ld    x26, 208(sp)
	ld    x25, 200(sp)
	ld    x24, 192(sp)
	ld    x23, 184(sp)
	ld    x22, 176(sp)
	ld    x21, 168(sp)
	ld    x20, 160(sp)
	ld    x19, 152(sp)

Annotation

Implementation Notes