arch/riscv/kernel/tests/kprobes/test-kprobes-asm.S

Source file repositories/reference/linux-study-clean/arch/riscv/kernel/tests/kprobes/test-kprobes-asm.S

File Facts

System
Linux kernel
Corpus path
arch/riscv/kernel/tests/kprobes/test-kprobes-asm.S
Extension
.S
Size
4761 bytes
Lines
232
Domain
Architecture Layer
Bucket
arch/riscv
Inferred role
Architecture Layer: arch/riscv
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/asm.h>
#include "test-kprobes.h"

SYM_FUNC_START(test_kprobes_add)
	li a1, KPROBE_TEST_MAGIC_UPPER
	li a2, KPROBE_TEST_MAGIC_LOWER
test_kprobes_add_addr1:
	add a1, a1, a2
test_kprobes_add_addr2:
	add a0, a1, x0
	ret
SYM_FUNC_END(test_kprobes_add)

SYM_FUNC_START(test_kprobes_jal)
	li a0, 0
	mv a1, ra
	.option push
	.option norvc
test_kprobes_jal_addr1:
	jal x0, 2f
	ret
	.option pop
1:	li a0, KPROBE_TEST_MAGIC_UPPER
	ret
	.option push
	.option norvc
test_kprobes_jal_addr2:
2:	jal 1b
	.option pop
	li a2, KPROBE_TEST_MAGIC_LOWER
	add a0, a0, a2
	jr a1
SYM_FUNC_END(test_kprobes_jal)

SYM_FUNC_START(test_kprobes_jalr)
	la a0, 1f
	mv a1, ra
	.option push
	.option norvc
test_kprobes_jalr_addr:
	jalr a0
	.option pop
	li t0, KPROBE_TEST_MAGIC_UPPER
	add a0, a0, t0
	jr a1
1:	li a0, KPROBE_TEST_MAGIC_LOWER
	ret
SYM_FUNC_END(test_kprobes_jalr)

SYM_FUNC_START(test_kprobes_auipc)
test_kprobes_auipc_addr:
	auipc a0, KPROBE_TEST_MAGIC_LOWER
	la a1, test_kprobes_auipc_addr
	sub a0, a0, a1
	srli a0, a0, 12
	li a1, KPROBE_TEST_MAGIC_UPPER
	add a0, a0, a1
	ret
SYM_FUNC_END(test_kprobes_auipc)

SYM_FUNC_START(test_kprobes_branch)
	.option push
	.option norvc
	li a0, 0
	li a1, 1
	li a2, 2
test_kprobes_branch_addr1:
	beqz a0, 1f
	ret

Annotation

Implementation Notes