Files
gasm-sdk/testdata/verify/bookkeep_riscv64.s
T

41 lines
946 B
ArmAsm

// Copyright (c) 2026 Petr Balvín <opensource@petrbalvin.org> (https://petrbalvin.org)
// SPDX-License-Identifier: BSD-3-Clause
// Differential kernel for the riscv64 bookkeeping statements and the
// slot-relative branches: FUNCDATA and PCDATA (the expanded forms of the
// funcdata.h macros, contributing no bytes), UNDEF (the toolchain's ebreak),
// and the JMP N(PC) slot jumps including the self-loop and the backward form.
#include "textflag.h"
TEXT ·bookkeep(SB), NOSPLIT, $8-8
FUNCDATA $1, marks<>(SB)
PCDATA $1, $-1
MOV ZERO, ret+0(FP)
PCDATA $1, $1
UNDEF
MOV $1, X10
RET
TEXT ·slots(SB), NOSPLIT, $0-0
MOV $1, X10
JMP 2(PC)
MOV $64, X11
MOV $128, X12
MOV $2, X11
MOV $3, X12
BEQ X10, X11, skip
JMP -2(PC)
skip:
JMP 0(PC)
TEXT ·marksreader(SB), NOSPLIT, $0-8
MOV $marks<>(SB), X10
MOV (X10), X11
MOV X11, ret+0(FP)
RET
GLOBL marks<>(SB), RODATA, $8
DATA marks<>+0(SB)/8, $1234605616436508552