riscv-unwind-long-insn.S revision 1.1 1 1.1 christos /* Copyright 2019-2023 Free Software Foundation, Inc.
2 1.1 christos
3 1.1 christos This program is free software; you can redistribute it and/or modify
4 1.1 christos it under the terms of the GNU General Public License as published by
5 1.1 christos the Free Software Foundation; either version 3 of the License, or
6 1.1 christos (at your option) any later version.
7 1.1 christos
8 1.1 christos This program is distributed in the hope that it will be useful,
9 1.1 christos but WITHOUT ANY WARRANTY; without even the implied warranty of
10 1.1 christos MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 1.1 christos GNU General Public License for more details.
12 1.1 christos
13 1.1 christos You should have received a copy of the GNU General Public License
14 1.1 christos along with this program. If not, see <http://www.gnu.org/licenses/>. */
15 1.1 christos
16 1.1 christos .option nopic
17 1.1 christos .text
18 1.1 christos
19 1.1 christos .align 1
20 1.1 christos .globl bar
21 1.1 christos .type bar, @function
22 1.1 christos bar:
23 1.1 christos tail 1f
24 1.1 christos .size bar, .-func
25 1.1 christos
26 1.1 christos .align 1
27 1.1 christos .globl func
28 1.1 christos .type func, @function
29 1.1 christos func:
30 1.1 christos /* A fake instruction of either 6 or 8 bytes. This is never
31 1.1 christos executed, but the prologue scanner will try to decode it.
32 1.1 christos These long instructions are ISA extensions, use .byte rather
33 1.1 christos than an actual instruction mnemonic so that the test can be
34 1.1 christos compiled with a toolchain that doesn't include any long
35 1.1 christos instruction extensions. */
36 1.1 christos #if BAD_INSN_LEN == 6
37 1.1 christos /* A fake 6 byte instruction. */
38 1.1 christos .byte 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00
39 1.1 christos #elif BAD_INSN_LEN == 8
40 1.1 christos /* A fake 8 byte instruction. */
41 1.1 christos .byte 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
42 1.1 christos #else
43 1.1 christos #error unexpected bad instruction length
44 1.1 christos #endif
45 1.1 christos
46 1.1 christos 1:
47 1.1 christos addi sp,sp,-16
48 1.1 christos #if __SIZEOF_POINTER__ == 8
49 1.1 christos sd s0,8(sp)
50 1.1 christos #else
51 1.1 christos sw s0,8(sp)
52 1.1 christos #endif
53 1.1 christos addi s0,sp,16
54 1.1 christos nop
55 1.1 christos #if __SIZEOF_POINTER__ == 8
56 1.1 christos ld s0,8(sp)
57 1.1 christos #else
58 1.1 christos lw s0,8(sp)
59 1.1 christos #endif
60 1.1 christos addi sp,sp,16
61 1.1 christos jr ra
62 1.1 christos .size func, .-func
63 1.1 christos .section .note.GNU-stack,"",@progbits
64