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 {
|
365
|
23 char v:1;
|
336
|
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();
|
365
|
194 main6();
|
|
195 main7();
|
336
|
196 return 0;
|
|
197 }
|
|
198
|
|
199 main2()
|
|
200 {
|
|
201 int i = 0;
|
|
202
|
|
203 g.u[0]=0;
|
|
204 g.u[1]=0;
|
|
205
|
|
206 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
207 g.sg. v = 3;
|
|
208 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
209 g.sg. vsid = -1;
|
|
210 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
211 g.sg. h = 3;
|
|
212 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
213 g.sg. api = 3;
|
|
214 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
215 g.sg. rpn = 3;
|
|
216 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
217
|
|
218 g.sg. r = 3;
|
|
219 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
220 g.sg. c = 3;
|
|
221 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
222 g.sg. w = 3;
|
|
223 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
224 g.sg. i = 3;
|
|
225 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
226 g.sg. m = 3;
|
|
227 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
228 g.sg. g = 3;
|
|
229 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
230 g.sg. pp = 3;
|
|
231 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
232
|
|
233 g.u[0]=-1;
|
|
234 g.u[1]=-1;
|
|
235
|
|
236 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
237 g.sg. v = 0;
|
|
238 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
239 g.sg. vsid = 0;
|
|
240 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
241 g.sg. h = 0;
|
|
242 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
243 g.sg. api = 0;
|
|
244 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
245 g.sg. rpn = 0;
|
|
246 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
247
|
|
248 g.sg. r = 0;
|
|
249 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
250 g.sg. c = 0;
|
|
251 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
252 g.sg. w = 0;
|
|
253 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
254 g.sg. i = 0;
|
|
255 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
256 g.sg. m = 0;
|
|
257 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
258 g.sg. g = 0;
|
|
259 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
260 g.sg. pp = 0;
|
|
261 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
262
|
|
263 g.u[0]=-1;
|
|
264 g.u[1]=-1;
|
|
265
|
|
266 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
267 g.sg. v = 0x55;
|
|
268 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
269 g.sg. vsid = 0x5555555;
|
|
270 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
271 g.sg. h = 0x5555555;
|
|
272 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
273 g.sg. api = 0x55;
|
|
274 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
275 g.sg. rpn = 0x5555555;
|
|
276 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
277
|
|
278 g.sg. r = 0x5555555;
|
|
279 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
280 g.sg. c = 0x5555555;
|
|
281 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
282 g.sg. w = 0x5555555;
|
|
283 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
284 g.sg. i = 0x5555555;
|
|
285 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
286 g.sg. m = 0x5555555;
|
|
287 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
288 g.sg. g = 0x5555555;
|
|
289 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
290 g.sg. pp = 0x5555555;
|
|
291 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
292
|
|
293 g.u[0]=-1;
|
|
294 g.u[1]=-1;
|
|
295
|
|
296 for(i=-0x100;i<0x100;i++) {
|
|
297 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
298 g.sg. v = i;
|
|
299 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
300 g.sg. vsid = i;
|
|
301 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
302 g.sg. h = i;
|
|
303 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
304 g.sg. api = i;
|
|
305 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
306 g.sg. rpn = i;
|
|
307 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
308
|
|
309 g.sg. r = i;
|
|
310 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
311 g.sg. c = i;
|
|
312 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
313 g.sg. w = i;
|
|
314 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
315 g.sg. i = i;
|
|
316 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
317 g.sg. m = i;
|
|
318 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
319 g.sg. g = i;
|
|
320 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
321 g.sg. pp = i;
|
|
322 printf("% 3d: 0x%08x%08x\n",i++,g.u[0],g.u[1]);
|
|
323 }
|
|
324
|
|
325 // printf("size of %d\n",sizeof(g.sg.pp)); no size of for bit-field
|
|
326
|
|
327 }
|
|
328
|
|
329 // int :12 bit-field cannot be a return value;
|
|
330 // main3( int a:8 ) bit-field cannot be an argument;
|
|
331 main3( int a )
|
|
332 {
|
|
333 // int b:9; // nor local variable
|
338
|
334 int b,i;
|
|
335 i = 7;
|
336
|
336
|
|
337
|
338
|
338 b = g.pte.rpn = -333;
|
|
339 printf("main3-0: %d\n",b);
|
|
340 b = g.pte.rpn--;
|
|
341 printf("main3-1: %d\n",b);
|
|
342 b = g.pte.rpn++;
|
|
343 printf("main3-2: %d\n",b);
|
|
344 b = --g.pte.rpn;
|
|
345 printf("main3-3: %d\n",b);
|
|
346 b = ++g.pte.rpn;
|
|
347 printf("main3-4: %d\n",b);
|
|
348 b = (g.pte.rpn += 3);
|
|
349 printf("main3-5: %d\n",b);
|
|
350 b = (g.pte.rpn -= 3);
|
|
351 printf("main3-6: %d\n",b);
|
|
352 b = (g.pte.rpn *= 3);
|
|
353 printf("main3-7: %d\n",b);
|
|
354 b = (g.pte.rpn /= 3);
|
|
355 printf("main3-8: %d\n",b);
|
|
356 b = (g.pte.rpn %= 3);
|
|
357 printf("main3-9: %d\n",b);
|
|
358 b = (g.pte.rpn |= 3);
|
|
359 printf("main3-10: %d\n",b);
|
|
360 b = (g.pte.rpn &= 3);
|
|
361 printf("main3-12: %d\n",b);
|
|
362 b = (g.pte.rpn ^= 3);
|
|
363 printf("main3-13: %d\n",b);
|
|
364 b = (g.pte.rpn <<= 3);
|
|
365 printf("main3-14: %d\n",b);
|
|
366 b = (g.pte.rpn >>= 3);
|
|
367 printf("main3-15: %d\n",b);
|
|
368
|
|
369 g.pte.rpn = -333;
|
|
370 printf("main3-16: %d\n",b);
|
|
371 b = g.pte.rpn--;
|
|
372 printf("main3-17: %d\n",b);
|
|
373 b = g.pte.rpn++;
|
|
374 printf("main3-18: %d\n",b);
|
|
375 b = --g.pte.rpn;
|
|
376 printf("main3-19: %d\n",b);
|
|
377 b = ++g.pte.rpn;
|
|
378 printf("main3-20: %d\n",b);
|
|
379 b = (g.pte.rpn += i);
|
|
380 printf("main3-21: %d\n",b);
|
|
381 b = (g.pte.rpn -= i);
|
|
382 printf("main3-22: %d\n",b);
|
|
383 b = (g.pte.rpn *= i);
|
|
384 printf("main3-23: %d\n",b);
|
|
385 b = (g.pte.rpn /= i);
|
|
386 printf("main3-24: %d\n",b);
|
|
387 b = (g.pte.rpn %= i);
|
|
388 printf("main3-25: %d\n",b);
|
|
389 b = (g.pte.rpn |= i);
|
|
390 printf("main3-26: %d\n",b);
|
|
391 b = (g.pte.rpn &= i);
|
|
392 printf("main3-27: %d\n",b);
|
|
393 b = (g.pte.rpn ^= i);
|
|
394 printf("main3-28: %d\n",b);
|
|
395 b = (g.pte.rpn <<= i);
|
|
396 printf("main3-29: %d\n",b);
|
|
397 b = (g.pte.rpn >>= i);
|
|
398 printf("main3-30: %d\n",b);
|
336
|
399
|
|
400 return --b;
|
|
401 }
|
|
402
|
338
|
403 main4( int a )
|
|
404 {
|
|
405 // int b:9; // nor local variable
|
|
406 int b,i;
|
|
407 PTE *pg = &g;
|
|
408
|
|
409 i = 7;
|
|
410
|
|
411
|
|
412 pg->pte.rpn = -333;
|
|
413 printf("main4-0: %d\n",b);
|
|
414 b = pg->pte.rpn--;
|
|
415 printf("main4-1: %d\n",b);
|
|
416 b = pg->pte.rpn++;
|
|
417 printf("main4-2: %d\n",b);
|
|
418 b = --pg->pte.rpn;
|
|
419 printf("main4-3: %d\n",b);
|
|
420 b = ++pg->pte.rpn;
|
|
421 printf("main4-4: %d\n",b);
|
|
422 b = (pg->pte.rpn += 3);
|
|
423 printf("main4-5: %d\n",b);
|
|
424 b = (pg->pte.rpn -= 3);
|
|
425 printf("main4-6: %d\n",b);
|
|
426 b = (pg->pte.rpn *= 3);
|
|
427 printf("main4-7: %d\n",b);
|
|
428 b = (pg->pte.rpn /= 3);
|
|
429 printf("main4-8: %d\n",b);
|
|
430 b = (pg->pte.rpn %= 3);
|
|
431 printf("main4-9: %d\n",b);
|
|
432 b = (pg->pte.rpn |= 3);
|
|
433 printf("main4-10: %d\n",b);
|
|
434 b = (pg->pte.rpn &= 3);
|
|
435 printf("main4-12: %d\n",b);
|
|
436 b = (pg->pte.rpn ^= 3);
|
|
437 printf("main4-13: %d\n",b);
|
|
438 b = (pg->pte.rpn <<= 3);
|
|
439 printf("main4-14: %d\n",b);
|
|
440 b = (pg->pte.rpn >>= 3);
|
|
441 printf("main4-15: %d\n",b);
|
|
442
|
|
443 pg->pte.rpn = -333;
|
|
444 printf("main4-16: %d\n",b);
|
|
445 b = pg->pte.rpn--;
|
|
446 printf("main4-17: %d\n",b);
|
|
447 b = pg->pte.rpn++;
|
|
448 printf("main4-18: %d\n",b);
|
|
449 b = --pg->pte.rpn;
|
|
450 printf("main4-19: %d\n",b);
|
|
451 b = ++pg->pte.rpn;
|
|
452 printf("main4-20: %d\n",b);
|
|
453 b = (pg->pte.rpn += i);
|
|
454 printf("main4-21: %d\n",b);
|
|
455 b = (pg->pte.rpn -= i);
|
|
456 printf("main4-22: %d\n",b);
|
|
457 b = (pg->pte.rpn *= i);
|
|
458 printf("main4-23: %d\n",b);
|
|
459 b = (pg->pte.rpn /= i);
|
|
460 printf("main4-24: %d\n",b);
|
|
461 b = (pg->pte.rpn %= i);
|
|
462 printf("main4-25: %d\n",b);
|
|
463 b = (pg->pte.rpn |= i);
|
|
464 printf("main4-26: %d\n",b);
|
|
465 b = (pg->pte.rpn &= i);
|
|
466 printf("main4-27: %d\n",b);
|
|
467 b = (pg->pte.rpn ^= i);
|
|
468 printf("main4-28: %d\n",b);
|
|
469 b = (pg->pte.rpn <<= i);
|
|
470 printf("main4-29: %d\n",b);
|
|
471 b = (pg->pte.rpn >>= i);
|
|
472 printf("main4-30: %d\n",b);
|
|
473
|
|
474 return --b;
|
|
475 }
|
|
476
|
|
477
|
336
|
478
|
|
479
|
|
480
|
|
481 union ll1 {
|
|
482 int a[8];
|
|
483 struct {
|
|
484 char a:4;
|
|
485 long long v:33;
|
|
486 long long w:33;
|
|
487 long long x:33;
|
|
488 } b;
|
|
489 } ll1;
|
|
490
|
|
491 union ll0 {
|
|
492 int a[8];
|
|
493 struct {
|
|
494 char a:4;
|
|
495 long long v:48;
|
|
496 long long w:48;
|
|
497 long long x:48;
|
|
498 } b;
|
|
499 } ll0;
|
|
500
|
|
501
|
|
502 union ll {
|
|
503 int a[8];
|
|
504 struct {
|
|
505 char a:4;
|
|
506 long long v:56;
|
|
507 long long w:56;
|
|
508 long long x:56;
|
|
509 } b;
|
|
510 } ll;
|
|
511
|
|
512 union cc {
|
|
513 int a;
|
|
514 struct {
|
|
515 char a:1;
|
|
516 char b:4;
|
|
517 char c:7;
|
|
518 char d:4;
|
|
519 char e:4;
|
|
520 char f:4;
|
|
521 } b;
|
|
522 } cc;
|
|
523
|
|
524 union ii {
|
|
525 int a;
|
|
526 struct {
|
|
527 int a:1;
|
|
528 int b:4;
|
|
529 int c:4;
|
|
530 int d:4;
|
|
531 int e:4;
|
|
532 int f:4;
|
|
533 } b;
|
|
534 } ii;
|
|
535
|
|
536 int m1 = -1;
|
|
537 int p1 = 1;
|
|
538 int zero = 0;
|
|
539
|
|
540 main5()
|
|
541 {
|
|
542 ii.b.a = -1;
|
|
543 printf("00:%d\n",ii.b.a);
|
|
544
|
|
545 ll1.b.v = m1;
|
|
546 printf("01:%llx\n",ll1.b.v);
|
|
547 printf("02:%08x %08x %08x %08x %08x %08x %08x %08x\n",
|
|
548 ll1.a[0],ll1.a[1],ll1.a[2],ll1.a[3],
|
|
549 ll1.a[4],ll1.a[5],ll1.a[6],ll1.a[7]
|
|
550 );
|
|
551 ll1.b.v = zero;
|
|
552 ll1.b.w = m1;
|
|
553 printf("02:%08x %08x %08x %08x %08x %08x %08x %08x\n",
|
|
554 ll1.a[0],ll1.a[1],ll1.a[2],ll1.a[3],
|
|
555 ll1.a[4],ll1.a[5],ll1.a[6],ll1.a[7]
|
|
556 );
|
|
557 ll1.b.w = zero;
|
|
558 ll1.b.x = m1;
|
|
559 printf("02:%08x %08x %08x %08x %08x %08x %08x %08x\n",
|
|
560 ll1.a[0],ll1.a[1],ll1.a[2],ll1.a[3],
|
|
561 ll1.a[4],ll1.a[5],ll1.a[6],ll1.a[7]
|
|
562 );
|
|
563
|
|
564 ll0.b.v = m1;
|
|
565 printf("01:%llx\n",ll0.b.v);
|
|
566 printf("02:%08x %08x %08x %08x %08x %08x %08x %08x\n",
|
|
567 ll0.a[0],ll0.a[1],ll0.a[2],ll0.a[3],
|
|
568 ll0.a[4],ll0.a[5],ll0.a[6],ll0.a[7]
|
|
569 );
|
|
570 ll0.b.v = zero;
|
|
571 ll0.b.w = m1;
|
|
572 printf("02:%08x %08x %08x %08x %08x %08x %08x %08x\n",
|
|
573 ll0.a[0],ll0.a[1],ll0.a[2],ll0.a[3],
|
|
574 ll0.a[4],ll0.a[5],ll0.a[6],ll0.a[7]
|
|
575 );
|
|
576 ll0.b.w = zero;
|
|
577 ll0.b.x = m1;
|
|
578 printf("02:%08x %08x %08x %08x %08x %08x %08x %08x\n",
|
|
579 ll0.a[0],ll0.a[1],ll0.a[2],ll0.a[3],
|
|
580 ll0.a[4],ll0.a[5],ll0.a[6],ll0.a[7]
|
|
581 );
|
|
582
|
|
583 ll.b.v = m1;
|
|
584 printf("1:%llx\n",ll.b.v);
|
|
585 printf("2:%08x %08x %08x %08x %08x %08x %08x %08x\n",
|
|
586 ll.a[0],ll.a[1],ll.a[2],ll.a[3],
|
|
587 ll.a[4],ll.a[5],ll.a[6],ll.a[7]
|
|
588 );
|
|
589 ll.b.v = zero;
|
|
590 ll.b.w = m1;
|
|
591 printf("2:%08x %08x %08x %08x %08x %08x %08x %08x\n",
|
|
592 ll.a[0],ll.a[1],ll.a[2],ll.a[3],
|
|
593 ll.a[4],ll.a[5],ll.a[6],ll.a[7]
|
|
594 );
|
|
595 ll.b.w = zero;
|
|
596 ll.b.x = m1;
|
|
597 printf("2:%08x %08x %08x %08x %08x %08x %08x %08x\n",
|
|
598 ll.a[0],ll.a[1],ll.a[2],ll.a[3],
|
|
599 ll.a[4],ll.a[5],ll.a[6],ll.a[7]
|
|
600 );
|
|
601
|
|
602 printf("char a:1; char b:4; char c:7; char d:4; char e:4; char f:4;\n");
|
|
603 cc.b.a = m1;
|
|
604 printf("a:%08x\n",cc.a);
|
|
605 cc.b.b = m1;
|
|
606 printf("b:%08x\n",cc.a);
|
|
607 cc.b.c = m1;
|
|
608 printf("c:%08x\n",cc.a);
|
|
609 cc.b.d = m1;
|
|
610 printf("d:%08x\n",cc.a);
|
|
611 cc.b.e = m1;
|
|
612 printf("e:%08x\n",cc.a);
|
|
613 cc.b.f = m1;
|
|
614 printf("f:%08x\n",cc.a);
|
|
615 printf("3:%d %d\n",cc.b.c,cc.b.d);
|
|
616 cc.a = m1;
|
|
617 printf("f:%08x\n",cc.a);
|
|
618 cc.b.a = zero;
|
|
619 printf("a:%08x\n",cc.a);
|
|
620 cc.b.b = zero;
|
|
621 printf("b:%08x\n",cc.a);
|
|
622 cc.b.c = zero;
|
|
623 printf("c:%08x\n",cc.a);
|
|
624 cc.b.d = zero;
|
|
625 printf("d:%08x\n",cc.a);
|
|
626 cc.b.e = zero;
|
|
627 printf("e:%08x\n",cc.a);
|
|
628 cc.b.f = zero;
|
|
629 printf("f:%08x\n",cc.a);
|
|
630 printf("3:%d %d\n",cc.b.c,cc.b.d);
|
|
631 cc.a = zero;
|
|
632 printf("f:%08x\n",cc.a);
|
|
633 cc.b.a = p1;
|
|
634 printf("a:%08x\n",cc.a);
|
|
635 cc.b.b = p1;
|
|
636 printf("b:%08x\n",cc.a);
|
|
637 cc.b.c = p1;
|
|
638 printf("c:%08x\n",cc.a);
|
|
639 cc.b.d = p1;
|
|
640 printf("d:%08x\n",cc.a);
|
|
641 cc.b.e = p1;
|
|
642 printf("e:%08x\n",cc.a);
|
|
643 cc.b.f = p1;
|
|
644 printf("f:%08x\n",cc.a);
|
|
645 printf("3:%d %d\n",cc.b.c,cc.b.d);
|
|
646 cc.a = m1;
|
|
647 printf("f:%08x\n",cc.a);
|
|
648 cc.b.a = p1;
|
|
649 printf("a:%08x\n",cc.a);
|
|
650 cc.b.b = p1;
|
|
651 printf("b:%08x\n",cc.a);
|
|
652 cc.b.c = p1;
|
|
653 printf("c:%08x\n",cc.a);
|
|
654 cc.b.d = p1;
|
|
655 printf("d:%08x\n",cc.a);
|
|
656 cc.b.e = p1;
|
|
657 printf("e:%08x\n",cc.a);
|
|
658 cc.b.f = p1;
|
|
659 printf("f:%08x\n",cc.a);
|
|
660 printf("3:%d %d\n",cc.b.c,cc.b.d);
|
|
661
|
|
662 ii.b.a = m1;
|
|
663 printf("6:%08x\n",ii.a);
|
|
664 ii.b.d = m1;
|
|
665 printf("6:%08x\n",ii.a);
|
|
666 printf("5:%d %d\n",ii.b.a,ii.b.d);
|
|
667 }
|
|
668
|
|
669
|
338
|
670 main3l( int a )
|
|
671 {
|
|
672 // int b:9; // nor local variable
|
|
673 long long b,i;
|
|
674 i = 7;
|
|
675
|
|
676
|
|
677 g.pte.lpn = -333;
|
|
678 printf("main3l-0: %d\n",b);
|
|
679 b = g.pte.lpn--;
|
|
680 printf("main3l-1: %d\n",b);
|
|
681 b = g.pte.lpn++;
|
|
682 printf("main3l-2: %d\n",b);
|
|
683 b = --g.pte.lpn;
|
|
684 printf("main3l-3: %d\n",b);
|
|
685 b = ++g.pte.lpn;
|
|
686 printf("main3l-4: %d\n",b);
|
|
687 b = (g.pte.lpn += 3);
|
|
688 printf("main3l-5: %d\n",b);
|
|
689 b = (g.pte.lpn -= 3);
|
|
690 printf("main3l-6: %d\n",b);
|
|
691 b = (g.pte.lpn *= 3);
|
|
692 printf("main3l-7: %d\n",b);
|
|
693 b = (g.pte.lpn /= 3);
|
|
694 printf("main3l-8: %d\n",b);
|
|
695 b = (g.pte.lpn %= 3);
|
|
696 printf("main3l-9: %d\n",b);
|
|
697 b = (g.pte.lpn |= 3);
|
|
698 printf("main3l-10: %d\n",b);
|
|
699 b = (g.pte.lpn &= 3);
|
|
700 printf("main3l-12: %d\n",b);
|
|
701 b = (g.pte.lpn ^= 3);
|
|
702 printf("main3l-13: %d\n",b);
|
|
703 b = (g.pte.lpn <<= 3);
|
|
704 printf("main3l-14: %d\n",b);
|
|
705 b = (g.pte.lpn >>= 3);
|
|
706 printf("main3l-15: %d\n",b);
|
|
707
|
|
708 g.pte.lpn = -333;
|
|
709 printf("main3l-16: %d\n",b);
|
|
710 b = g.pte.lpn--;
|
|
711 printf("main3l-17: %d\n",b);
|
|
712 b = g.pte.lpn++;
|
|
713 printf("main3l-18: %d\n",b);
|
|
714 b = --g.pte.lpn;
|
|
715 printf("main3l-19: %d\n",b);
|
|
716 b = ++g.pte.lpn;
|
|
717 printf("main3l-20: %d\n",b);
|
|
718 b = (g.pte.lpn += i);
|
|
719 printf("main3l-21: %d\n",b);
|
|
720 b = (g.pte.lpn -= i);
|
|
721 printf("main3l-22: %d\n",b);
|
|
722 b = (g.pte.lpn *= i);
|
|
723 printf("main3l-23: %d\n",b);
|
|
724 b = (g.pte.lpn /= i);
|
|
725 printf("main3l-24: %d\n",b);
|
|
726 b = (g.pte.lpn %= i);
|
|
727 printf("main3l-25: %d\n",b);
|
|
728 b = (g.pte.lpn |= i);
|
|
729 printf("main3l-26: %d\n",b);
|
|
730 b = (g.pte.lpn &= i);
|
|
731 printf("main3l-27: %d\n",b);
|
|
732 b = (g.pte.lpn ^= i);
|
|
733 printf("main3l-28: %d\n",b);
|
|
734 b = (g.pte.lpn <<= i);
|
|
735 printf("main3l-29: %d\n",b);
|
|
736 b = (g.pte.lpn >>= i);
|
|
737 printf("main3l-30: %d\n",b);
|
|
738
|
|
739 return --b;
|
|
740 }
|
|
741
|
365
|
742
|
|
743 main6()
|
|
744 {
|
|
745 int i =0;
|
|
746 g.pte.api = 0;
|
|
747 printf("main5: %d %d\n",i++,g.pte.api);
|
|
748 g.pte.api = 1;
|
|
749 printf("main5: %d %d\n",i++,g.pte.api);
|
|
750 g.pte.api = 2;
|
|
751 printf("main5: %d %d\n",i++,g.pte.api);
|
|
752 g.pte.api = 3;
|
|
753 printf("main5: %d %d\n",i++,g.pte.api);
|
|
754 g.pte.api = 4;
|
|
755 printf("main5: %d %d\n",i++,g.pte.api);
|
|
756 g.pte.api = 5;
|
|
757 printf("main5: %d %d\n",i++,g.pte.api);
|
|
758 g.pte.api = 6;
|
|
759 printf("main5: %d %d\n",i++,g.pte.api);
|
|
760 g.pte.api = 7;
|
|
761 printf("main5: %d %d\n",i++,g.pte.api);
|
|
762 g.pte.api = 8;
|
|
763 printf("main5: %d %d\n",i++,g.pte.api);
|
|
764 g.pte.api = 9;
|
|
765 printf("main5: %d %d\n",i++,g.pte.api);
|
|
766 g.pte.api = 10;
|
|
767 printf("main5: %d %d\n",i++,g.pte.api);
|
|
768 g.pte.api = 11;
|
|
769 printf("main5: %d %d\n",i++,g.pte.api);
|
|
770 g.pte.api = 12;
|
|
771 printf("main5: %d %d\n",i++,g.pte.api);
|
|
772 g.pte.api = 13;
|
|
773 printf("main5: %d %d\n",i++,g.pte.api);
|
|
774 g.pte.api = 14;
|
|
775 printf("main5: %d %d\n",i++,g.pte.api);
|
|
776 g.pte.api = 15;
|
|
777 printf("main5: %d %d\n",i++,g.pte.api);
|
|
778 g.pte.api = 16;
|
|
779 printf("main5: %d %d\n",i++,g.pte.api);
|
|
780 g.pte.api = 17;
|
|
781 printf("main5: %d %d\n",i++,g.pte.api);
|
|
782 g.pte.api = 18;
|
|
783 printf("main5: %d %d\n",i++,g.pte.api);
|
|
784 g.pte.api = 19;
|
|
785 printf("main5: %d %d\n",i++,g.pte.api);
|
|
786 g.pte.api = 20;
|
|
787 printf("main5: %d %d\n",i++,g.pte.api);
|
|
788 g.pte.api = 21;
|
|
789 printf("main5: %d %d\n",i++,g.pte.api);
|
|
790 g.pte.api = 22;
|
|
791 printf("main5: %d %d\n",i++,g.pte.api);
|
|
792 g.pte.api = 23;
|
|
793 printf("main5: %d %d\n",i++,g.pte.api);
|
|
794 g.pte.api = 24;
|
|
795 printf("main5: %d %d\n",i++,g.pte.api);
|
|
796 g.pte.api = 25;
|
|
797 printf("main5: %d %d\n",i++,g.pte.api);
|
|
798 g.pte.api = 26;
|
|
799 printf("main5: %d %d\n",i++,g.pte.api);
|
|
800 g.pte.api = 27;
|
|
801 printf("main5: %d %d\n",i++,g.pte.api);
|
|
802 g.pte.api = 28;
|
|
803 printf("main5: %d %d\n",i++,g.pte.api);
|
|
804 g.pte.api = 29;
|
|
805 printf("main5: %d %d\n",i++,g.pte.api);
|
|
806 g.pte.api = 30;
|
|
807 printf("main5: %d %d\n",i++,g.pte.api);
|
|
808 g.pte.api = 31;
|
|
809 printf("main5: %d %d\n",i++,g.pte.api);
|
|
810 g.pte.api = 32;
|
|
811 printf("main5: %d %d\n",i++,g.pte.api);
|
|
812 g.pte.api = 33;
|
|
813 printf("main5: %d %d\n",i++,g.pte.api);
|
|
814 g.pte.api = 34;
|
|
815 printf("main5: %d %d\n",i++,g.pte.api);
|
|
816 g.pte.api = 35;
|
|
817 printf("main5: %d %d\n",i++,g.pte.api);
|
|
818 g.pte.api = 36;
|
|
819 printf("main5: %d %d\n",i++,g.pte.api);
|
|
820 g.pte.api = 37;
|
|
821 printf("main5: %d %d\n",i++,g.pte.api);
|
|
822 g.pte.api = 38;
|
|
823 printf("main5: %d %d\n",i++,g.pte.api);
|
|
824 g.pte.api = 39;
|
|
825 printf("main5: %d %d\n",i++,g.pte.api);
|
|
826 g.pte.api = 40;
|
|
827 printf("main5: %d %d\n",i++,g.pte.api);
|
|
828 g.pte.api = 41;
|
|
829 printf("main5: %d %d\n",i++,g.pte.api);
|
|
830 g.pte.api = 42;
|
|
831 printf("main5: %d %d\n",i++,g.pte.api);
|
|
832 g.pte.api = 43;
|
|
833 printf("main5: %d %d\n",i++,g.pte.api);
|
|
834 g.pte.api = 44;
|
|
835 printf("main5: %d %d\n",i++,g.pte.api);
|
|
836 g.pte.api = 45;
|
|
837 printf("main5: %d %d\n",i++,g.pte.api);
|
|
838 g.pte.api = 46;
|
|
839 printf("main5: %d %d\n",i++,g.pte.api);
|
|
840 g.pte.api = 47;
|
|
841 printf("main5: %d %d\n",i++,g.pte.api);
|
|
842 g.pte.api = 48;
|
|
843 printf("main5: %d %d\n",i++,g.pte.api);
|
|
844 g.pte.api = 49;
|
|
845 printf("main5: %d %d\n",i++,g.pte.api);
|
|
846 g.pte.api = 50;
|
|
847 printf("main5: %d %d\n",i++,g.pte.api);
|
|
848 g.pte.api = 51;
|
|
849 printf("main5: %d %d\n",i++,g.pte.api);
|
|
850 g.pte.api = 52;
|
|
851 printf("main5: %d %d\n",i++,g.pte.api);
|
|
852 g.pte.api = 53;
|
|
853 printf("main5: %d %d\n",i++,g.pte.api);
|
|
854 g.pte.api = 54;
|
|
855 printf("main5: %d %d\n",i++,g.pte.api);
|
|
856 g.pte.api = 55;
|
|
857 printf("main5: %d %d\n",i++,g.pte.api);
|
|
858 g.pte.api = 56;
|
|
859 printf("main5: %d %d\n",i++,g.pte.api);
|
|
860 g.pte.api = 57;
|
|
861 printf("main5: %d %d\n",i++,g.pte.api);
|
|
862 g.pte.api = 58;
|
|
863 printf("main5: %d %d\n",i++,g.pte.api);
|
|
864 g.pte.api = 59;
|
|
865 printf("main5: %d %d\n",i++,g.pte.api);
|
|
866 g.pte.api = 60;
|
|
867 printf("main5: %d %d\n",i++,g.pte.api);
|
|
868 g.pte.api = 61;
|
|
869 printf("main5: %d %d\n",i++,g.pte.api);
|
|
870 g.pte.api = 62;
|
|
871 printf("main5: %d %d\n",i++,g.pte.api);
|
|
872 g.pte.api = 63;
|
|
873 printf("main5: %d %d\n",i++,g.pte.api);
|
|
874 }
|
|
875
|
|
876 main7()
|
|
877 {
|
|
878 int i;
|
|
879 for (i=-2;i<2;i++) {
|
|
880 g.pte.api = i;
|
|
881 if (g.pte.api) {
|
|
882 printf("main 7:1 %d yes\n",i);
|
|
883 } else {
|
|
884 printf("main 7:1 %d no\n",i);
|
|
885 }
|
|
886 if (g.pte.api==1) {
|
|
887 printf("main 7:2 %d yes\n",i);
|
|
888 } else {
|
|
889 printf("main 7:2 %d no\n",i);
|
|
890 }
|
|
891 if (g.pte.api==-1) {
|
|
892 printf("main 7:3 %d yes\n",i);
|
|
893 } else {
|
|
894 printf("main 7:3 %d no\n",i);
|
|
895 }
|
|
896 }
|
|
897 for (i=-2;i<2;i++) {
|
|
898 g.sg.v = i;
|
|
899 if (g.sg.v) {
|
|
900 printf("main 7:4 %d yes\n",i);
|
|
901 } else {
|
|
902 printf("main 7:4 %d no\n",i);
|
|
903 }
|
|
904 if (g.sg.v==1) {
|
|
905 printf("main 7:5 %d yes\n",i);
|
|
906 } else {
|
|
907 printf("main 7:5 %d no\n",i);
|
|
908 }
|
|
909 if (g.sg.v==-1) {
|
|
910 printf("main 7:6 %d yes\n",i);
|
|
911 } else {
|
|
912 printf("main 7:6 %d no\n",i);
|
|
913 }
|
|
914 }
|
|
915 }
|
|
916
|
|
917 /* end */
|