]>
Commit | Line | Data |
---|---|---|
1ba53b71 L |
1 | /* Test program for byte registers. |
2 | ||
0b302171 | 3 | Copyright 2010-2012 Free Software Foundation, Inc. |
1ba53b71 L |
4 | |
5 | This file is part of GDB. | |
6 | ||
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. | |
11 | ||
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. | |
16 | ||
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/>. */ | |
19 | ||
20 | #include <stdio.h> | |
21 | ||
22 | int data[] = { | |
23 | 0x14131211, | |
24 | 0x24232221, | |
25 | 0x34333231, | |
26 | 0x44434241, | |
27 | 0x54535251, | |
28 | 0x64636261, | |
29 | 0x74737271, | |
30 | 0x84838281, | |
31 | 0x94939291, | |
32 | 0xa4a3a2a1, | |
33 | 0xb4b3b2b1, | |
34 | 0xc4c3c2c1, | |
35 | 0xd4d3d2d1, | |
36 | 0xe4e3e2e1, | |
37 | }; | |
38 | ||
39 | int | |
40 | main (int argc, char **argv) | |
41 | { | |
42 | asm ("mov 0(%0), %%eax\n\t" | |
43 | "mov 4(%0), %%ebx\n\t" | |
44 | "mov 8(%0), %%ecx\n\t" | |
45 | "mov 12(%0), %%edx\n\t" | |
46 | "mov 16(%0), %%esi\n\t" | |
47 | "mov 20(%0), %%edi\n\t" | |
48 | : /* no output operands */ | |
49 | : "r" (data) | |
50 | : "eax", "ebx", "ecx", "edx", "esi", "edi"); | |
51 | asm ("nop"); /* first breakpoint here */ | |
52 | ||
53 | asm ("mov 24(%0), %%r8d\n\t" | |
54 | "mov 28(%0), %%r9d\n\t" | |
55 | "mov 32(%0), %%r10d\n\t" | |
56 | "mov 36(%0), %%r11\n\t" | |
57 | "mov 40(%0), %%r12d\n\t" | |
58 | "mov 44(%0), %%r13d\n\t" | |
59 | "mov 48(%0), %%r14d\n\t" | |
60 | "mov 52(%0), %%r15d\n\t" | |
61 | : /* no output operands */ | |
62 | : "r" (data) | |
63 | : "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15"); | |
64 | asm ("nop"); /* second breakpoint here */ | |
65 | ||
66 | asm ("mov %%eax, 0(%0)\n\t" | |
67 | "mov %%ebx, 4(%0)\n\t" | |
68 | "mov %%ecx, 8(%0)\n\t" | |
69 | "mov %%edx, 12(%0)\n\t" | |
70 | "mov %%esi, 16(%0)\n\t" | |
71 | "mov %%edi, 20(%0)\n\t" | |
72 | : /* no output operands */ | |
73 | : "r" (data) | |
74 | : "eax", "ebx", "ecx", "edx", "esi", "edi"); | |
75 | asm ("nop"); /* third breakpoint here */ | |
76 | ||
77 | asm ("mov %%r8d, 24(%0)\n\t" | |
78 | "mov %%r9d, 28(%0)\n\t" | |
79 | "mov %%r10d, 32(%0)\n\t" | |
80 | "mov %%r11d, 36(%0)\n\t" | |
81 | "mov %%r12d, 40(%0)\n\t" | |
82 | "mov %%r13d, 44(%0)\n\t" | |
83 | "mov %%r14d, 48(%0)\n\t" | |
84 | "mov %%r15d, 52(%0)\n\t" | |
85 | : /* no output operands */ | |
86 | : "r" (data) | |
87 | : "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15"); | |
88 | puts ("Bye!"); /* forth breakpoint here */ | |
89 | ||
90 | return 0; | |
91 | } |