arch/riscv/include/asm/semihost.h

Source file repositories/reference/linux-study-clean/arch/riscv/include/asm/semihost.h

File Facts

System
Linux kernel
Corpus path
arch/riscv/include/asm/semihost.h
Extension
.h
Size
596 bytes
Lines
27
Domain
Architecture Layer
Bucket
arch/riscv
Inferred role
Architecture Layer: implementation source
Status
source 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

#ifndef _RISCV_SEMIHOST_H_
#define _RISCV_SEMIHOST_H_

struct uart_port;

static inline void smh_putc(struct uart_port *port, unsigned char c)
{
	asm volatile("addi    a1, %0, 0\n"
		     "addi    a0, zero, 3\n"
		     ".balign 16\n"
		     ".option push\n"
		     ".option norvc\n"
		     "slli    zero, zero, 0x1f\n"
		     "ebreak\n"
		     "srai    zero, zero, 0x7\n"
		     ".option pop\n"
		     : : "r" (&c) : "a0", "a1", "memory");
}

#endif /* _RISCV_SEMIHOST_H_ */

Annotation

Implementation Notes