1 /* Test program for byte registers.
3 Copyright 2010-2018 Free Software Foundation, Inc.
5 This file is part of GDB.
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>. */
40 main (int argc, char **argv)
42 register int eax asm ("eax");
43 register int ebx asm ("ebx");
44 register int ecx asm ("ecx");
45 register int edx asm ("edx");
46 register int esi asm ("esi");
47 register int edi asm ("edi");
48 register long r8 asm ("r8");
49 register long r9 asm ("r9");
50 register long r10 asm ("r10");
51 register long r11 asm ("r11");
52 register long r12 asm ("r12");
53 register long r13 asm ("r13");
54 register long r14 asm ("r14");
55 register long r15 asm ("r15");
57 asm ("mov 0(%0), %%eax\n\t"
58 "mov 4(%0), %%ebx\n\t"
59 "mov 8(%0), %%ecx\n\t"
60 "mov 12(%0), %%edx\n\t"
61 "mov 16(%0), %%esi\n\t"
62 "mov 20(%0), %%edi\n\t"
63 : /* no output operands */
65 : "eax", "ebx", "ecx", "edx", "esi", "edi");
66 asm ("nop"); /* first breakpoint here */
68 asm ("mov 24(%0), %%r8d\n\t"
69 "mov 28(%0), %%r9d\n\t"
70 "mov 32(%0), %%r10d\n\t"
71 "mov 36(%0), %%r11\n\t"
72 "mov 40(%0), %%r12d\n\t"
73 "mov 44(%0), %%r13d\n\t"
74 "mov 48(%0), %%r14d\n\t"
75 "mov 52(%0), %%r15d\n\t"
76 : /* no output operands */
78 : "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15");
80 asm ("nop" /* second breakpoint here */
81 /* amd64-{byte,word,dword}.exp write eax-edi here.
82 Tell gcc/clang they're live. */
83 : "=r" (eax), "=r" (ebx), "=r" (ecx),
84 "=r" (edx), "=r" (esi), "=r" (edi)
87 asm ("mov %%eax, 0(%0)\n\t"
88 "mov %%ebx, 4(%0)\n\t"
89 "mov %%ecx, 8(%0)\n\t"
90 "mov %%edx, 12(%0)\n\t"
91 "mov %%esi, 16(%0)\n\t"
92 "mov %%edi, 20(%0)\n\t"
93 : /* no output operands */
95 /* Mark these as inputs so that gcc/clang won't try to use them as
96 a temp to build %0. */
97 "r" (eax), "r" (ebx), "r" (ecx),
98 "r" (edx), "r" (esi), "r" (edi));
100 asm ("nop" /* third breakpoint here */
101 /* amd64-{byte,word,dword}.exp write r8-r15 here.
102 Tell gcc/clang they're live. */
103 : "=r" (r8), "=r" (r9), "=r" (r10), "=r" (r11),
104 "=r" (r12), "=r" (r13), "=r" (r14), "=r" (r15)
107 asm ("mov %%r8d, 24(%0)\n\t"
108 "mov %%r9d, 28(%0)\n\t"
109 "mov %%r10d, 32(%0)\n\t"
110 "mov %%r11d, 36(%0)\n\t"
111 "mov %%r12d, 40(%0)\n\t"
112 "mov %%r13d, 44(%0)\n\t"
113 "mov %%r14d, 48(%0)\n\t"
114 "mov %%r15d, 52(%0)\n\t"
115 : /* no output operands */
117 /* Mark these as inputs so that gcc/clang won't try to use them as
118 a temp to build %0. */
119 "r" (r8), "r" (r9), "r" (r10), "r" (r11),
120 "r" (r12), "r" (r13), "r" (r14), "r" (r15));
121 puts ("Bye!"); /* forth breakpoint here */