1 /* Test program for byte registers.
3 Copyright 2010-2019 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/>. */
30 main (int argc
, char **argv
)
32 register int eax
asm ("eax");
33 register int ebx
asm ("ebx");
34 register int ecx
asm ("ecx");
35 register int edx
asm ("edx");
37 asm ("mov 0(%0), %%eax\n\t"
38 "mov 4(%0), %%ebx\n\t"
39 "mov 8(%0), %%ecx\n\t"
40 "mov 12(%0), %%edx\n\t"
41 : /* no output operands */
43 : "eax", "ebx", "ecx", "edx");
45 asm ("nop" /* first breakpoint here */
46 /* i386-{byte,word}.exp write eax-edx here.
47 Tell gcc/clang they're live. */
48 : "=r" (eax
), "=r" (ebx
), "=r" (ecx
), "=r" (edx
)
51 asm ("mov %%eax, 0(%0)\n\t"
52 "mov %%ebx, 4(%0)\n\t"
53 "mov %%ecx, 8(%0)\n\t"
54 "mov %%edx, 12(%0)\n\t"
55 : /* no output operands */
57 /* Mark these as inputs so that gcc/clang won't try to use them as
58 a temp to build %0. */
59 "r" (eax
), "r" (ebx
), "r" (ecx
), "r" (edx
));
60 puts ("Bye!"); /* second breakpoint here */