Re: ld plugin bfd_make_readable leak
[binutils-gdb.git] / gdb / testsuite / gdb.arch / aarch64-mops-single-step.c
blob4a27867d4b5708f2e62e9a3c5944cc8c3100c82f
1 /* This file is part of GDB, the GNU debugger.
3 Copyright 2024 Free Software Foundation, Inc.
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 3 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>. */
18 #define TEST_STRING "Just a test string."
19 #define BUF_SIZE sizeof(TEST_STRING)
21 int
22 main (void)
24 char source[BUF_SIZE] = TEST_STRING;
25 char dest[BUF_SIZE];
26 char *p, *q;
27 long size, zero;
29 /* Note: The prfm instruction in the asm statements below is there just
30 to allow the testcase to recognize when the PC is at the instruction
31 right after the MOPS sequence. */
33 p = dest;
34 size = sizeof (dest);
35 zero = 0;
36 /* Break memset. */
37 /* memset implemented in MOPS instructions. */
38 __asm__ volatile ("setp [%0]!, %1!, %2\n\t"
39 "setm [%0]!, %1!, %2\n\t"
40 "sete [%0]!, %1!, %2\n\t"
41 "prfm pldl3keep, [%0, #0]\n\t"
42 : "+&r"(p), "+&r"(size)
43 : "r"(zero)
44 : "memory");
46 p = dest;
47 q = source;
48 size = sizeof (dest);
49 /* Break memcpy. */
50 /* memcpy implemented in MOPS instructions. */
51 __asm__ volatile ("cpyfp [%0]!, [%1]!, %2!\n\t"
52 "cpyfm [%0]!, [%1]!, %2!\n\t"
53 "cpyfe [%0]!, [%1]!, %2!\n\t"
54 "prfm pldl3keep, [%0, #0]\n\t"
55 : "+&r" (p), "+&r" (q), "+&r" (size)
57 : "memory");
59 p = dest;
60 q = source;
61 size = sizeof (dest);
62 /* Break memmove. */
63 /* memmove implemented in MOPS instructions. */
64 __asm__ volatile ("cpyp [%0]!, [%1]!, %2!\n\t"
65 "cpym [%0]!, [%1]!, %2!\n\t"
66 "cpye [%0]!, [%1]!, %2!\n\t"
67 "prfm pldl3keep, [%0, #0]\n\t"
68 : "+&r" (p), "+&r" (q), "+&r" (size)
70 : "memory");
72 return 0;