336
|
1
|
|
2
|
|
3 typedef union {
|
|
4 struct _PTE {
|
|
5 unsigned long v:1;
|
|
6 unsigned long vsid:24;
|
|
7 unsigned long h:1;
|
|
8 unsigned long api:6;
|
|
9 unsigned long rpn:20;
|
|
10
|
|
11 unsigned long :3;
|
|
12 unsigned long r:1;
|
|
13 unsigned long c:1;
|
|
14 unsigned long w:1;
|
|
15 unsigned long i:1;
|
|
16 unsigned long m:1;
|
|
17 unsigned long g:1;
|
|
18 unsigned long :1;
|
|
19 unsigned long pp:2;
|
338
|
20 long long lpn:40;
|
336
|
21 } pte;
|
|
22 struct {
|
|
23 unsigned char v:1;
|
|
24 signed long vsid:24;
|
|
25 unsigned long h:1;
|
|
26 signed char api:6;
|
|
27 signed long rpn:20;
|
|
28
|
|
29 signed long :3;
|
|
30 unsigned long r:1;
|
|
31 unsigned long c:1;
|
|
32 unsigned long w:1;
|
|
33 unsigned long i:1;
|
|
34 unsigned long m:1;
|
|
35 unsigned long g:1;
|
|
36 unsigned long :1;
|
|
37 signed long pp:2;
|
|
38 } sg;
|
|
39 unsigned long u[2];
|
|
40 } PTE;
|
|
41
|
|
42 PTE g;
|
|
43
|
|
44 main()
|
|
45 {
|
|
46 PTE a,*p;
|
|
47 int i = 0;
|
|
48 int j = 0;
|
|
49
|
|
50 a.pte.rpn = 55;
|
|
51 j = a.pte.rpn;
|
|
52 printf("% 3d: %d\n",i++,j);
|
|
53 a.pte.c = 1;
|
|
54 j = a.pte.c;
|
|
55 printf("% 3d: %d\n",i++,j);
|
|
56 a.pte.pp = -1;
|
|
57 j = a.pte.pp;
|
|
58 printf("% 3d: %d\n",i++,j);
|
|
59 a.sg.pp = -1;
|
|
60 j = a.sg.pp;
|
|
61 printf("% 3d: %d\n",i++,j);
|
|
62
|
|
63 p = &g;
|
|
64
|
|
65 g.u[0]=0;
|
|
66 g.u[1]=0;
|
|
67
|
|
68 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
69 g.pte. v = 3;
|
|
70 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
71 g.pte. vsid = -1;
|
|
72 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
73 g.pte. h = 3;
|
|
74 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
75 g.pte. api = 3;
|
|
76 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
77 g.pte. rpn = 3;
|
|
78 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
79
|
|
80 g.pte. r = 3;
|
|
81 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
82 g.pte. c = 3;
|
|
83 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
84 g.pte. w = 3;
|
|
85 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
86 g.pte. i = 3;
|
|
87 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
88 g.pte. m = 3;
|
|
89 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
90 g.pte. g = 3;
|
|
91 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
92 g.pte. pp = 3;
|
|
93 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
94
|
|
95 g.u[0]=-1;
|
|
96 g.u[1]=-1;
|
|
97
|
|
98 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
99 g.pte. v = 0;
|
|
100 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
101 g.pte. vsid = 0;
|
|
102 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
103 g.pte. h = 0;
|
|
104 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
105 g.pte. api = 0;
|
|
106 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
107 g.pte. rpn = 0;
|
|
108 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
109
|
|
110 g.pte. r = 0;
|
|
111 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
112 g.pte. c = 0;
|
|
113 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
114 g.pte. w = 0;
|
|
115 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
116 g.pte. i = 0;
|
|
117 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
118 g.pte. m = 0;
|
|
119 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
120 g.pte. g = 0;
|
|
121 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
122 g.pte. pp = 0;
|
|
123 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
124
|
|
125 g.u[0]=-1;
|
|
126 g.u[1]=-1;
|
|
127
|
|
128 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
129 g.pte. v = 0x5555555;
|
|
130 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
131 g.pte. vsid = 0x5555555;
|
|
132 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
133 g.pte. h = 0x5555555;
|
|
134 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
135 g.pte. api = 0x5555555;
|
|
136 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
137 g.pte. rpn = 0x5555555;
|
|
138 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
139
|
|
140 g.pte. r = 0x5555555;
|
|
141 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
142 g.pte. c = 0x5555555;
|
|
143 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
144 g.pte. w = 0x5555555;
|
|
145 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
146 g.pte. i = 0x5555555;
|
|
147 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
148 g.pte. m = 0x5555555;
|
|
149 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
150 g.pte. g = 0x5555555;
|
|
151 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
152 g.pte. pp = 0x5555555;
|
|
153 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
154
|
|
155 g.u[0]=-1;
|
|
156 g.u[1]=-1;
|
|
157
|
|
158 for(i=0;i<0x200;i++) {
|
|
159 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
160 g.pte. v = i;
|
|
161 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
162 g.pte. vsid = i;
|
|
163 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
164 g.pte. h = i;
|
|
165 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
166 g.pte. api = i;
|
|
167 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
168 g.pte. rpn = i;
|
|
169 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
170
|
|
171 g.pte. r = i;
|
|
172 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
173 g.pte. c = i;
|
|
174 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
175 g.pte. w = i;
|
|
176 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
177 g.pte. i = i;
|
|
178 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
179 g.pte. m = i;
|
|
180 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
181 g.pte. g = i;
|
|
182 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
183 g.pte. pp = i;
|
|
184 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
185 }
|
|
186
|
|
187 g = a;
|
|
188
|
|
189 printf("%d %d %d\n",a.pte.pp,g.pte.pp,p->pte.pp);
|
|
190 main2();
|
|
191 main5();
|
338
|
192 main3();
|
|
193 main4();
|
336
|
194 return 0;
|
|
195 }
|
|
196
|
|
197 main2()
|
|
198 {
|
|
199 int i = 0;
|
|
200
|
|
201 g.u[0]=0;
|
|
202 g.u[1]=0;
|
|
203
|
|
204 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
205 g.sg. v = 3;
|
|
206 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
207 g.sg. vsid = -1;
|
|
208 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
209 g.sg. h = 3;
|
|
210 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
211 g.sg. api = 3;
|
|
212 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
213 g.sg. rpn = 3;
|
|
214 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
215
|
|
216 g.sg. r = 3;
|
|
217 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
218 g.sg. c = 3;
|
|
219 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
220 g.sg. w = 3;
|
|
221 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
222 g.sg. i = 3;
|
|
223 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
224 g.sg. m = 3;
|
|
225 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
226 g.sg. g = 3;
|
|
227 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
228 g.sg. pp = 3;
|
|
229 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
230
|
|
231 g.u[0]=-1;
|
|
232 g.u[1]=-1;
|
|
233
|
|
234 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
235 g.sg. v = 0;
|
|
236 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
237 g.sg. vsid = 0;
|
|
238 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
239 g.sg. h = 0;
|
|
240 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
241 g.sg. api = 0;
|
|
242 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
243 g.sg. rpn = 0;
|
|
244 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
245
|
|
246 g.sg. r = 0;
|
|
247 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
248 g.sg. c = 0;
|
|
249 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
250 g.sg. w = 0;
|
|
251 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
252 g.sg. i = 0;
|
|
253 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
254 g.sg. m = 0;
|
|
255 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
256 g.sg. g = 0;
|
|
257 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
258 g.sg. pp = 0;
|
|
259 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
260
|
|
261 g.u[0]=-1;
|
|
262 g.u[1]=-1;
|
|
263
|
|
264 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
265 g.sg. v = 0x55;
|
|
266 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
267 g.sg. vsid = 0x5555555;
|
|
268 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
269 g.sg. h = 0x5555555;
|
|
270 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
271 g.sg. api = 0x55;
|
|
272 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
273 g.sg. rpn = 0x5555555;
|
|
274 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
275
|
|
276 g.sg. r = 0x5555555;
|
|
277 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
278 g.sg. c = 0x5555555;
|
|
279 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
280 g.sg. w = 0x5555555;
|
|
281 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
282 g.sg. i = 0x5555555;
|
|
283 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
284 g.sg. m = 0x5555555;
|
|
285 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
286 g.sg. g = 0x5555555;
|
|
287 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
288 g.sg. pp = 0x5555555;
|
|
289 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
290
|
|
291 g.u[0]=-1;
|
|
292 g.u[1]=-1;
|
|
293
|
|
294 for(i=-0x100;i<0x100;i++) {
|
|
295 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
296 g.sg. v = i;
|
|
297 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
298 g.sg. vsid = i;
|
|
299 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
300 g.sg. h = i;
|
|
301 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
302 g.sg. api = i;
|
|
303 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
304 g.sg. rpn = i;
|
|
305 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
306
|
|
307 g.sg. r = i;
|
|
308 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
309 g.sg. c = i;
|
|
310 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
311 g.sg. w = i;
|
|
312 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
313 g.sg. i = i;
|
|
314 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
315 g.sg. m = i;
|
|
316 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
317 g.sg. g = i;
|
|
318 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
319 g.sg. pp = i;
|
|
320 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
321 }
|
|
322
|
|
323 // printf("size of %d\n",sizeof(g.sg.pp)); no size of for bit-field
|
|
324
|
|
325 }
|
|
326
|
|
327 // int :12 bit-field cannot be a return value;
|
|
328 // main3( int a:8 ) bit-field cannot be an argument;
|
|
329 main3( int a )
|
|
330 {
|
|
331 // int b:9; // nor local variable
|
338
|
332 int b,i;
|
|
333 i = 7;
|
336
|
334
|
|
335
|
338
|
336 b = g.pte.rpn = -333;
|
|
337 printf("main3-0: %d\n",b);
|
|
338 b = g.pte.rpn--;
|
|
339 printf("main3-1: %d\n",b);
|
|
340 b = g.pte.rpn++;
|
|
341 printf("main3-2: %d\n",b);
|
|
342 b = --g.pte.rpn;
|
|
343 printf("main3-3: %d\n",b);
|
|
344 b = ++g.pte.rpn;
|
|
345 printf("main3-4: %d\n",b);
|
|
346 b = (g.pte.rpn += 3);
|
|
347 printf("main3-5: %d\n",b);
|
|
348 b = (g.pte.rpn -= 3);
|
|
349 printf("main3-6: %d\n",b);
|
|
350 b = (g.pte.rpn *= 3);
|
|
351 printf("main3-7: %d\n",b);
|
|
352 b = (g.pte.rpn /= 3);
|
|
353 printf("main3-8: %d\n",b);
|
|
354 b = (g.pte.rpn %= 3);
|
|
355 printf("main3-9: %d\n",b);
|
|
356 b = (g.pte.rpn |= 3);
|
|
357 printf("main3-10: %d\n",b);
|
|
358 b = (g.pte.rpn &= 3);
|
|
359 printf("main3-12: %d\n",b);
|
|
360 b = (g.pte.rpn ^= 3);
|
|
361 printf("main3-13: %d\n",b);
|
|
362 b = (g.pte.rpn <<= 3);
|
|
363 printf("main3-14: %d\n",b);
|
|
364 b = (g.pte.rpn >>= 3);
|
|
365 printf("main3-15: %d\n",b);
|
|
366
|
|
367 g.pte.rpn = -333;
|
|
368 printf("main3-16: %d\n",b);
|
|
369 b = g.pte.rpn--;
|
|
370 printf("main3-17: %d\n",b);
|
|
371 b = g.pte.rpn++;
|
|
372 printf("main3-18: %d\n",b);
|
|
373 b = --g.pte.rpn;
|
|
374 printf("main3-19: %d\n",b);
|
|
375 b = ++g.pte.rpn;
|
|
376 printf("main3-20: %d\n",b);
|
|
377 b = (g.pte.rpn += i);
|
|
378 printf("main3-21: %d\n",b);
|
|
379 b = (g.pte.rpn -= i);
|
|
380 printf("main3-22: %d\n",b);
|
|
381 b = (g.pte.rpn *= i);
|
|
382 printf("main3-23: %d\n",b);
|
|
383 b = (g.pte.rpn /= i);
|
|
384 printf("main3-24: %d\n",b);
|
|
385 b = (g.pte.rpn %= i);
|
|
386 printf("main3-25: %d\n",b);
|
|
387 b = (g.pte.rpn |= i);
|
|
388 printf("main3-26: %d\n",b);
|
|
389 b = (g.pte.rpn &= i);
|
|
390 printf("main3-27: %d\n",b);
|
|
391 b = (g.pte.rpn ^= i);
|
|
392 printf("main3-28: %d\n",b);
|
|
393 b = (g.pte.rpn <<= i);
|
|
394 printf("main3-29: %d\n",b);
|
|
395 b = (g.pte.rpn >>= i);
|
|
396 printf("main3-30: %d\n",b);
|
336
|
397
|
|
398 return --b;
|
|
399 }
|
|
400
|
338
|
401 main4( int a )
|
|
402 {
|
|
403 // int b:9; // nor local variable
|
|
404 int b,i;
|
|
405 PTE *pg = &g;
|
|
406
|
|
407 i = 7;
|
|
408
|
|
409
|
|
410 pg->pte.rpn = -333;
|
|
411 printf("main4-0: %d\n",b);
|
|
412 b = pg->pte.rpn--;
|
|
413 printf("main4-1: %d\n",b);
|
|
414 b = pg->pte.rpn++;
|
|
415 printf("main4-2: %d\n",b);
|
|
416 b = --pg->pte.rpn;
|
|
417 printf("main4-3: %d\n",b);
|
|
418 b = ++pg->pte.rpn;
|
|
419 printf("main4-4: %d\n",b);
|
|
420 b = (pg->pte.rpn += 3);
|
|
421 printf("main4-5: %d\n",b);
|
|
422 b = (pg->pte.rpn -= 3);
|
|
423 printf("main4-6: %d\n",b);
|
|
424 b = (pg->pte.rpn *= 3);
|
|
425 printf("main4-7: %d\n",b);
|
|
426 b = (pg->pte.rpn /= 3);
|
|
427 printf("main4-8: %d\n",b);
|
|
428 b = (pg->pte.rpn %= 3);
|
|
429 printf("main4-9: %d\n",b);
|
|
430 b = (pg->pte.rpn |= 3);
|
|
431 printf("main4-10: %d\n",b);
|
|
432 b = (pg->pte.rpn &= 3);
|
|
433 printf("main4-12: %d\n",b);
|
|
434 b = (pg->pte.rpn ^= 3);
|
|
435 printf("main4-13: %d\n",b);
|
|
436 b = (pg->pte.rpn <<= 3);
|
|
437 printf("main4-14: %d\n",b);
|
|
438 b = (pg->pte.rpn >>= 3);
|
|
439 printf("main4-15: %d\n",b);
|
|
440
|
|
441 pg->pte.rpn = -333;
|
|
442 printf("main4-16: %d\n",b);
|
|
443 b = pg->pte.rpn--;
|
|
444 printf("main4-17: %d\n",b);
|
|
445 b = pg->pte.rpn++;
|
|
446 printf("main4-18: %d\n",b);
|
|
447 b = --pg->pte.rpn;
|
|
448 printf("main4-19: %d\n",b);
|
|
449 b = ++pg->pte.rpn;
|
|
450 printf("main4-20: %d\n",b);
|
|
451 b = (pg->pte.rpn += i);
|
|
452 printf("main4-21: %d\n",b);
|
|
453 b = (pg->pte.rpn -= i);
|
|
454 printf("main4-22: %d\n",b);
|
|
455 b = (pg->pte.rpn *= i);
|
|
456 printf("main4-23: %d\n",b);
|
|
457 b = (pg->pte.rpn /= i);
|
|
458 printf("main4-24: %d\n",b);
|
|
459 b = (pg->pte.rpn %= i);
|
|
460 printf("main4-25: %d\n",b);
|
|
461 b = (pg->pte.rpn |= i);
|
|
462 printf("main4-26: %d\n",b);
|
|
463 b = (pg->pte.rpn &= i);
|
|
464 printf("main4-27: %d\n",b);
|
|
465 b = (pg->pte.rpn ^= i);
|
|
466 printf("main4-28: %d\n",b);
|
|
467 b = (pg->pte.rpn <<= i);
|
|
468 printf("main4-29: %d\n",b);
|
|
469 b = (pg->pte.rpn >>= i);
|
|
470 printf("main4-30: %d\n",b);
|
|
471
|
|
472 return --b;
|
|
473 }
|
|
474
|
|
475
|
336
|
476
|
|
477
|
|
478
|
|
479 union ll1 {
|
|
480 int a[8];
|
|
481 struct {
|
|
482 char a:4;
|
|
483 long long v:33;
|
|
484 long long w:33;
|
|
485 long long x:33;
|
|
486 } b;
|
|
487 } ll1;
|
|
488
|
|
489 union ll0 {
|
|
490 int a[8];
|
|
491 struct {
|
|
492 char a:4;
|
|
493 long long v:48;
|
|
494 long long w:48;
|
|
495 long long x:48;
|
|
496 } b;
|
|
497 } ll0;
|
|
498
|
|
499
|
|
500 union ll {
|
|
501 int a[8];
|
|
502 struct {
|
|
503 char a:4;
|
|
504 long long v:56;
|
|
505 long long w:56;
|
|
506 long long x:56;
|
|
507 } b;
|
|
508 } ll;
|
|
509
|
|
510 union cc {
|
|
511 int a;
|
|
512 struct {
|
|
513 char a:1;
|
|
514 char b:4;
|
|
515 char c:7;
|
|
516 char d:4;
|
|
517 char e:4;
|
|
518 char f:4;
|
|
519 } b;
|
|
520 } cc;
|
|
521
|
|
522 union ii {
|
|
523 int a;
|
|
524 struct {
|
|
525 int a:1;
|
|
526 int b:4;
|
|
527 int c:4;
|
|
528 int d:4;
|
|
529 int e:4;
|
|
530 int f:4;
|
|
531 } b;
|
|
532 } ii;
|
|
533
|
|
534 int m1 = -1;
|
|
535 int p1 = 1;
|
|
536 int zero = 0;
|
|
537
|
|
538 main5()
|
|
539 {
|
|
540 ii.b.a = -1;
|
|
541 printf("00:%d\n",ii.b.a);
|
|
542
|
|
543 ll1.b.v = m1;
|
|
544 printf("01:%llx\n",ll1.b.v);
|
|
545 printf("02:%08x %08x %08x %08x %08x %08x %08x %08x\n",
|
|
546 ll1.a[0],ll1.a[1],ll1.a[2],ll1.a[3],
|
|
547 ll1.a[4],ll1.a[5],ll1.a[6],ll1.a[7]
|
|
548 );
|
|
549 ll1.b.v = zero;
|
|
550 ll1.b.w = m1;
|
|
551 printf("02:%08x %08x %08x %08x %08x %08x %08x %08x\n",
|
|
552 ll1.a[0],ll1.a[1],ll1.a[2],ll1.a[3],
|
|
553 ll1.a[4],ll1.a[5],ll1.a[6],ll1.a[7]
|
|
554 );
|
|
555 ll1.b.w = zero;
|
|
556 ll1.b.x = m1;
|
|
557 printf("02:%08x %08x %08x %08x %08x %08x %08x %08x\n",
|
|
558 ll1.a[0],ll1.a[1],ll1.a[2],ll1.a[3],
|
|
559 ll1.a[4],ll1.a[5],ll1.a[6],ll1.a[7]
|
|
560 );
|
|
561
|
|
562 ll0.b.v = m1;
|
|
563 printf("01:%llx\n",ll0.b.v);
|
|
564 printf("02:%08x %08x %08x %08x %08x %08x %08x %08x\n",
|
|
565 ll0.a[0],ll0.a[1],ll0.a[2],ll0.a[3],
|
|
566 ll0.a[4],ll0.a[5],ll0.a[6],ll0.a[7]
|
|
567 );
|
|
568 ll0.b.v = zero;
|
|
569 ll0.b.w = m1;
|
|
570 printf("02:%08x %08x %08x %08x %08x %08x %08x %08x\n",
|
|
571 ll0.a[0],ll0.a[1],ll0.a[2],ll0.a[3],
|
|
572 ll0.a[4],ll0.a[5],ll0.a[6],ll0.a[7]
|
|
573 );
|
|
574 ll0.b.w = zero;
|
|
575 ll0.b.x = m1;
|
|
576 printf("02:%08x %08x %08x %08x %08x %08x %08x %08x\n",
|
|
577 ll0.a[0],ll0.a[1],ll0.a[2],ll0.a[3],
|
|
578 ll0.a[4],ll0.a[5],ll0.a[6],ll0.a[7]
|
|
579 );
|
|
580
|
|
581 ll.b.v = m1;
|
|
582 printf("1:%llx\n",ll.b.v);
|
|
583 printf("2:%08x %08x %08x %08x %08x %08x %08x %08x\n",
|
|
584 ll.a[0],ll.a[1],ll.a[2],ll.a[3],
|
|
585 ll.a[4],ll.a[5],ll.a[6],ll.a[7]
|
|
586 );
|
|
587 ll.b.v = zero;
|
|
588 ll.b.w = m1;
|
|
589 printf("2:%08x %08x %08x %08x %08x %08x %08x %08x\n",
|
|
590 ll.a[0],ll.a[1],ll.a[2],ll.a[3],
|
|
591 ll.a[4],ll.a[5],ll.a[6],ll.a[7]
|
|
592 );
|
|
593 ll.b.w = zero;
|
|
594 ll.b.x = m1;
|
|
595 printf("2:%08x %08x %08x %08x %08x %08x %08x %08x\n",
|
|
596 ll.a[0],ll.a[1],ll.a[2],ll.a[3],
|
|
597 ll.a[4],ll.a[5],ll.a[6],ll.a[7]
|
|
598 );
|
|
599
|
|
600 printf("char a:1; char b:4; char c:7; char d:4; char e:4; char f:4;\n");
|
|
601 cc.b.a = m1;
|
|
602 printf("a:%08x\n",cc.a);
|
|
603 cc.b.b = m1;
|
|
604 printf("b:%08x\n",cc.a);
|
|
605 cc.b.c = m1;
|
|
606 printf("c:%08x\n",cc.a);
|
|
607 cc.b.d = m1;
|
|
608 printf("d:%08x\n",cc.a);
|
|
609 cc.b.e = m1;
|
|
610 printf("e:%08x\n",cc.a);
|
|
611 cc.b.f = m1;
|
|
612 printf("f:%08x\n",cc.a);
|
|
613 printf("3:%d %d\n",cc.b.c,cc.b.d);
|
|
614 cc.a = m1;
|
|
615 printf("f:%08x\n",cc.a);
|
|
616 cc.b.a = zero;
|
|
617 printf("a:%08x\n",cc.a);
|
|
618 cc.b.b = zero;
|
|
619 printf("b:%08x\n",cc.a);
|
|
620 cc.b.c = zero;
|
|
621 printf("c:%08x\n",cc.a);
|
|
622 cc.b.d = zero;
|
|
623 printf("d:%08x\n",cc.a);
|
|
624 cc.b.e = zero;
|
|
625 printf("e:%08x\n",cc.a);
|
|
626 cc.b.f = zero;
|
|
627 printf("f:%08x\n",cc.a);
|
|
628 printf("3:%d %d\n",cc.b.c,cc.b.d);
|
|
629 cc.a = zero;
|
|
630 printf("f:%08x\n",cc.a);
|
|
631 cc.b.a = p1;
|
|
632 printf("a:%08x\n",cc.a);
|
|
633 cc.b.b = p1;
|
|
634 printf("b:%08x\n",cc.a);
|
|
635 cc.b.c = p1;
|
|
636 printf("c:%08x\n",cc.a);
|
|
637 cc.b.d = p1;
|
|
638 printf("d:%08x\n",cc.a);
|
|
639 cc.b.e = p1;
|
|
640 printf("e:%08x\n",cc.a);
|
|
641 cc.b.f = p1;
|
|
642 printf("f:%08x\n",cc.a);
|
|
643 printf("3:%d %d\n",cc.b.c,cc.b.d);
|
|
644 cc.a = m1;
|
|
645 printf("f:%08x\n",cc.a);
|
|
646 cc.b.a = p1;
|
|
647 printf("a:%08x\n",cc.a);
|
|
648 cc.b.b = p1;
|
|
649 printf("b:%08x\n",cc.a);
|
|
650 cc.b.c = p1;
|
|
651 printf("c:%08x\n",cc.a);
|
|
652 cc.b.d = p1;
|
|
653 printf("d:%08x\n",cc.a);
|
|
654 cc.b.e = p1;
|
|
655 printf("e:%08x\n",cc.a);
|
|
656 cc.b.f = p1;
|
|
657 printf("f:%08x\n",cc.a);
|
|
658 printf("3:%d %d\n",cc.b.c,cc.b.d);
|
|
659
|
|
660 ii.b.a = m1;
|
|
661 printf("6:%08x\n",ii.a);
|
|
662 ii.b.d = m1;
|
|
663 printf("6:%08x\n",ii.a);
|
|
664 printf("5:%d %d\n",ii.b.a,ii.b.d);
|
|
665 }
|
|
666
|
|
667
|
338
|
668 main3l( int a )
|
|
669 {
|
|
670 // int b:9; // nor local variable
|
|
671 long long b,i;
|
|
672 i = 7;
|
|
673
|
|
674
|
|
675 g.pte.lpn = -333;
|
|
676 printf("main3l-0: %d\n",b);
|
|
677 b = g.pte.lpn--;
|
|
678 printf("main3l-1: %d\n",b);
|
|
679 b = g.pte.lpn++;
|
|
680 printf("main3l-2: %d\n",b);
|
|
681 b = --g.pte.lpn;
|
|
682 printf("main3l-3: %d\n",b);
|
|
683 b = ++g.pte.lpn;
|
|
684 printf("main3l-4: %d\n",b);
|
|
685 b = (g.pte.lpn += 3);
|
|
686 printf("main3l-5: %d\n",b);
|
|
687 b = (g.pte.lpn -= 3);
|
|
688 printf("main3l-6: %d\n",b);
|
|
689 b = (g.pte.lpn *= 3);
|
|
690 printf("main3l-7: %d\n",b);
|
|
691 b = (g.pte.lpn /= 3);
|
|
692 printf("main3l-8: %d\n",b);
|
|
693 b = (g.pte.lpn %= 3);
|
|
694 printf("main3l-9: %d\n",b);
|
|
695 b = (g.pte.lpn |= 3);
|
|
696 printf("main3l-10: %d\n",b);
|
|
697 b = (g.pte.lpn &= 3);
|
|
698 printf("main3l-12: %d\n",b);
|
|
699 b = (g.pte.lpn ^= 3);
|
|
700 printf("main3l-13: %d\n",b);
|
|
701 b = (g.pte.lpn <<= 3);
|
|
702 printf("main3l-14: %d\n",b);
|
|
703 b = (g.pte.lpn >>= 3);
|
|
704 printf("main3l-15: %d\n",b);
|
|
705
|
|
706 g.pte.lpn = -333;
|
|
707 printf("main3l-16: %d\n",b);
|
|
708 b = g.pte.lpn--;
|
|
709 printf("main3l-17: %d\n",b);
|
|
710 b = g.pte.lpn++;
|
|
711 printf("main3l-18: %d\n",b);
|
|
712 b = --g.pte.lpn;
|
|
713 printf("main3l-19: %d\n",b);
|
|
714 b = ++g.pte.lpn;
|
|
715 printf("main3l-20: %d\n",b);
|
|
716 b = (g.pte.lpn += i);
|
|
717 printf("main3l-21: %d\n",b);
|
|
718 b = (g.pte.lpn -= i);
|
|
719 printf("main3l-22: %d\n",b);
|
|
720 b = (g.pte.lpn *= i);
|
|
721 printf("main3l-23: %d\n",b);
|
|
722 b = (g.pte.lpn /= i);
|
|
723 printf("main3l-24: %d\n",b);
|
|
724 b = (g.pte.lpn %= i);
|
|
725 printf("main3l-25: %d\n",b);
|
|
726 b = (g.pte.lpn |= i);
|
|
727 printf("main3l-26: %d\n",b);
|
|
728 b = (g.pte.lpn &= i);
|
|
729 printf("main3l-27: %d\n",b);
|
|
730 b = (g.pte.lpn ^= i);
|
|
731 printf("main3l-28: %d\n",b);
|
|
732 b = (g.pte.lpn <<= i);
|
|
733 printf("main3l-29: %d\n",b);
|
|
734 b = (g.pte.lpn >>= i);
|
|
735 printf("main3l-30: %d\n",b);
|
|
736
|
|
737 return --b;
|
|
738 }
|
|
739
|