• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /barrelfish-2018-10-04/lib/acpica/tests/aslts/src/runtime/collections/functional/reference/
1/*
2 * Some or all of this work - Copyright (c) 2006 - 2016, Intel Corp.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without modification,
6 * are permitted provided that the following conditions are met:
7 *
8 * Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer.
10 * Redistributions in binary form must reproduce the above copyright notice,
11 * this list of conditions and the following disclaimer in the documentation
12 * and/or other materials provided with the distribution.
13 * Neither the name of Intel Corporation nor the names of its contributors
14 * may be used to endorse or promote products derived from this software
15 * without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
21 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
25 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
26 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28
29/*
30 * The common methods of the Reference tests
31 *
32 *
33 * Methods used for to verify particular References:
34 *
35 *    m1a0, m1a1, m1a2
36 */
37
38/*
39SEE: Investigate and report all y<XXX>.
40SEE: see everywhere "index of checking" and z0XX - through all ref files: corresponds?!!!!!!!!!
41SEE: add into m1a6 and all m000 the checking like these:
42     Store(\i900, Debug)
43     Store(\d900.i900, Debug)
44*/
45
46Name(z076, 76)
47
48// Check Boolen (CondRefOf) and the type of value
49// arg0 - reference to the value of arbitrary type
50// arg1 - expected type of value
51// arg2 - returned Boolen
52// arg3 - index of checking (inside the file)
53Method(m1a0, 4)
54{
55	Store(m1a4(arg2, arg3), Local7)
56
57	SET0(c081, 0, arg3)
58
59	if (Local7) {
60
61	Store(ObjectType(arg0), Local0)
62	if (LNotEqual(Local0, arg1)) {
63		err(c080, z076, 0, 0, 0, Local0, arg1)
64	} else {
65		if (c089) {
66
67			// Flag of Reference, object otherwise
68			if (c082) {
69				// Test of exceptions
70				m1a8(arg0, 0, 0)
71			}
72			if (c085) {
73				// Create the chain of references to LocalX,
74				// then dereference them.
75
76				Store(RefOf(arg0), Local0)
77				Store(RefOf(Local0), Local1)
78				Store(RefOf(Local1), Local2)
79				Store(RefOf(Local2), Local3)
80				Store(RefOf(Local3), Local4)
81				Store(RefOf(Local4), Local5)
82				Store(RefOf(Local5), Local6)
83				Store(RefOf(Local6), Local7)
84
85				Store(DerefOf(Local7), Local6)
86				Store(DerefOf(Local6), Local5)
87				Store(DerefOf(Local5), Local4)
88				Store(DerefOf(Local4), Local3)
89				Store(DerefOf(Local3), Local2)
90				Store(DerefOf(Local2), Local1)
91				Store(DerefOf(Local1), Local0)
92				Store(DerefOf(Local0), Local7)
93
94				// Create the chain of references to LocalX,
95				// then dereference them.
96
97				Store(m1a5(Local7), Local0)
98			}
99		} /* if(c089) */
100
101		// ATTENTION: exactly the same in m1a0 and m1a2
102		// (but, dont replace it by call to Method)
103
104		Method(m002, 1)
105		{
106			Store(0xabcd001a, arg0)
107		}
108
109		// Run verification of references (write/read)
110
111		if (LEqual(c083, 1)) {
112			Store(0xabcd001a, c08a)
113			Store(c08a, Arg0)
114		} elseif (LEqual(c083, 2)) {
115			Store(0xabcd001b, c08a)
116			CopyObject(c08a, Arg0)
117		} elseif (LEqual(c083, 3)) {
118			Store(0xabcd001c, c08a)
119			Store(c08a, Arg0)
120			Store(0xabcd001d, c08a)
121			CopyObject(c08a, Arg0)
122		}
123
124		// Do RefOf(ArgX) checkings
125
126		Store(0, Local7)
127
128		if (LEqual(c08b, 1)) {
129			Store(RefOf(arg0), Local0)
130			Store(ObjectType(Local0), Local1)
131			if (LNotEqual(Local1, arg1)) {
132				err(c080, z076, 1, 0, 0, Local1, arg1)
133			} else {
134				Store(1, Local7)
135			}
136		} elseif (LEqual(c08b, 2)) {
137			Store(CondRefOf(arg0, Local0), Local1)
138			if (LNotEqual(Local1, Ones)) {
139				err(c080, z076, 2, 0, 0, Local1, arg1)
140			} else {
141				Store(ObjectType(Local0), Local1)
142				if (LNotEqual(Local1, arg1)) {
143					err(c080, z076, 3, 0, 0, Local1, arg1)
144				} else {
145					Store(1, Local7)
146				}
147			}
148		}
149
150		if (Local7) {
151
152			// Obtain RefOf_Reference to ArgX
153
154			Store(RefOf(arg0), Local0)
155
156			Store(ObjectType(Local0), Local1)
157			if (LNotEqual(Local1, arg1)) {
158				err(c080, z076, 4, 0, 0, Local1, arg1)
159			} else {
160
161				// Check DerefOf
162
163				Store(ObjectType(DerefOf(Local0)), Local1)
164				if (LNotEqual(Local1, arg1)) {
165					err(c080, z076, 5, 0, 0, Local1, arg1)
166				}
167
168				// Check that writing into M2-ArgX-RefOf_Reference
169				// changes the original object (M1-ArgX):
170
171				m002(Local0)
172				Store(ObjectType(arg0), Local1)
173				if (LNotEqual(Local1, c009)) {
174					err(c080, z076, 6, 0, 0, Local1, c009)
175				} elseif (LNotEqual(arg0, 0xabcd001a)) {
176					err(c080, z076, 7, 0, 0, arg0, 0xabcd001a)
177				} else {
178
179					// Check that M1-LocalX-RefOf_Reference remains
180					// up to date after writing into M2-ArgX in M2 and
181					// thus updating the contents of the object
182					// referenced by M1-LocalX.
183
184					Store(ObjectType(Local0), Local1)
185					if (LNotEqual(Local1, c009)) {
186						err(c080, z076, 8, 0, 0, Local1, c009)
187					} else {
188						Store(SizeOf(Local0), Local1)
189						if (LNotEqual(Local1, ISZ0)) {
190							err(c080, z076, 9, 0, 0, Local1, ISZ0)
191						}
192					}
193				}
194			}
195		} /* if (c08b) */
196
197		/* ATTENTION: exactly the same in m1a0 and m1a2 */
198	}
199	} /* if(Local7) */
200
201	RST0()
202}
203
204// Verifying reference to the Object nested inside Packages
205// arg0 - reference to the Object (may be to Package)
206// arg1 - type of the value referred by arg0
207// arg2 - nesting level of the Packages
208//        (Package always is a 0-th element
209//         of previous Package)
210// arg3 - index of the Object inside the last Package
211// arg4 - type of the Object
212// arg5 - the benchmark value of Object for verification
213// arg6 - index of checking (inside the file)
214Method(m1a2, 7, Serialized)
215{
216	SET0(c081, 0, arg6)
217
218	Name(lpN0, 0)
219	Name(lpC0, 0)
220
221	Store(ObjectType(arg0), Local0)
222	if (LNotEqual(Local0, arg1)) {
223		err(c080, z076, 10, 0, 0, Local0, arg1)
224	} else {
225
226		if (c089) {
227			// Flag of Reference, object otherwise
228			if (c082) {
229				// Test of exceptions
230				m1a8(arg0, 0, 0)
231			}
232			if (c085) {
233				// Create the chain of references to LocalX,
234				// then dereference them.
235
236				Store(RefOf(arg0), Local0)
237				Store(RefOf(Local0), Local1)
238				Store(RefOf(Local1), Local2)
239				Store(RefOf(Local2), Local3)
240				Store(RefOf(Local3), Local4)
241				Store(RefOf(Local4), Local5)
242				Store(RefOf(Local5), Local6)
243				Store(RefOf(Local6), Local7)
244
245				Store(DerefOf(Local7), Local6)
246				Store(DerefOf(Local6), Local5)
247				Store(DerefOf(Local5), Local4)
248				Store(DerefOf(Local4), Local3)
249				Store(DerefOf(Local3), Local2)
250				Store(DerefOf(Local2), Local1)
251				Store(DerefOf(Local1), Local0)
252				Store(DerefOf(Local0), Local7)
253
254				// Create the chain of references to LocalX,
255				// then dereference them.
256
257				Store(m1a5(Local7), Local0)
258
259			} else {
260				Store(arg0, Local0)
261			}
262		} else {
263			Store(arg0, Local0)
264		} /* if(c089) */
265
266		if (c084) {
267
268			// run verification of references (reading)
269
270			if (c089) {
271				// Flag of Reference, object otherwise
272
273				/*
274				 * 17.2.5.9.1   ArgX Objects
275				 *
276				 * 1) Read from ArgX parameters
277				 *    ObjectReference - Automatic dereference, return
278				 *                      the target of the reference.
279				 *                      Use of DeRefOf returns the same.
280				 */
281				if (c087) {
282					// "Use of DeRefOf returns the same"
283					Store(DerefOf(Local0), Local2)
284				} else {
285					// Automatic dereference
286					Store(Local0, Local2)
287				}
288			} else {
289				Store(Local0, Local2)
290			} /* if(c089) */
291
292			Store(arg2, lpN0)
293
294			While (lpN0) {
295
296				if (LEqual(lpN0, 1)) {
297					Store(Index(Local2, arg3), Local1)
298				} else {
299					Store(Index(Local2, 0), Local1)
300				}
301				Store(DerefOf(Local1), Local2)
302
303				Decrement(lpN0)
304				Increment(lpC0)
305			}
306
307			Store(ObjectType(Local2), Local0)
308
309			if (LNotEqual(Local0, arg4)) {
310				err(c080, z076, 11, 0, 0, Local0, arg4)
311			} else {
312				if (LNotEqual(Local2, arg5)) {
313					err(c080, z076, 12, 0, 0, Local2, arg5)
314				}
315			}
316		} /* if(c084) */
317
318		// ATTENTION: exactly the same in m1a0 and m1a2
319		// (but, dont replace it by call to Method)
320
321		Method(m002, 1)
322		{
323			Store(0xabcd001a, arg0)
324		}
325
326		// Run verification of references (write/read)
327
328		if (LEqual(c083, 1)) {
329			Store(0xabcd001a, c08a)
330			Store(c08a, Arg0)
331		} elseif (LEqual(c083, 2)) {
332			Store(0xabcd001b, c08a)
333			CopyObject(c08a, Arg0)
334		} elseif (LEqual(c083, 3)) {
335			Store(0xabcd001c, c08a)
336			Store(c08a, Arg0)
337			Store(0xabcd001d, c08a)
338			CopyObject(c08a, Arg0)
339		}
340
341		// Do RefOf(ArgX) checkings
342
343		Store(0, Local7)
344
345		if (LEqual(c08b, 1)) {
346			Store(RefOf(arg0), Local0)
347			Store(ObjectType(Local0), Local1)
348			if (LNotEqual(Local1, arg1)) {
349				err(c080, z076, 13, 0, 0, Local1, arg1)
350			} else {
351				Store(1, Local7)
352			}
353		} elseif (LEqual(c08b, 2)) {
354			Store(CondRefOf(arg0, Local0), Local1)
355			if (LNotEqual(Local1, Ones)) {
356				err(c080, z076, 14, 0, 0, Local1, arg1)
357			} else {
358				Store(ObjectType(Local0), Local1)
359				if (LNotEqual(Local1, arg1)) {
360					err(c080, z076, 15, 0, 0, Local1, arg1)
361				} else {
362					Store(1, Local7)
363				}
364			}
365		}
366
367		if (Local7) {
368
369			// Obtain RefOf_Reference to ArgX
370
371			Store(RefOf(arg0), Local0)
372
373			Store(ObjectType(Local0), Local1)
374			if (LNotEqual(Local1, arg1)) {
375				err(c080, z076, 16, 0, 0, Local1, arg1)
376			} else {
377
378				// Check DerefOf
379
380				Store(ObjectType(DerefOf(Local0)), Local1)
381				if (LNotEqual(Local1, arg1)) {
382					err(c080, z076, 17, 0, 0, Local1, arg1)
383				}
384
385				// Check that writing into M2-ArgX-RefOf_Reference
386				// changes the original object (M1-ArgX):
387
388				m002(Local0)
389				Store(ObjectType(arg0), Local1)
390				if (LNotEqual(Local1, c009)) {
391					err(c080, z076, 18, 0, 0, Local1, c009)
392				} elseif (LNotEqual(arg0, 0xabcd001a)) {
393					err(c080, z076, 19, 0, 0, arg0, 0xabcd001a)
394				} else {
395
396					// Check that M1-LocalX-RefOf_Reference remains
397					// up to date after writing into M2-ArgX in M2 and
398					// thus updating the contents of the object
399					// referenced by M1-LocalX.
400
401					Store(ObjectType(Local0), Local1)
402					if (LNotEqual(Local1, c009)) {
403						err(c080, z076, 20, 0, 0, Local1, c009)
404					} else {
405						Store(SizeOf(Local0), Local1)
406						if (LNotEqual(Local1, ISZ0)) {
407							err(c080, z076, 21, 0, 0, Local1, ISZ0)
408						}
409					}
410				}
411			}
412		} /* if (c08b) */
413
414		/* ATTENTION: exactly the same in m1a0 and m1a2 */
415
416	}
417
418	RST0()
419}
420
421// Check only Boolen (CondRefOf)
422// arg0 - returned Boolen
423// arg1 - index of checking (inside the file)
424Method(m1a4, 2)
425{
426	SET0(c081, 0, arg1)
427
428	Store(1, Local7)
429
430	Store(ObjectType(arg0), Local0)
431
432	if (LNotEqual(Local0, c009)) {
433		err(c080, z076, 22, 0, 0, Local0, c009)
434		Store(0, Local7)
435	} elseif (LNotEqual(arg0, Ones)) {
436		err(c080, z076, 23, 0, 0, arg0, Ones)
437		Store(0, Local7)
438	}
439
440	RST0()
441
442	return (Local7)
443}
444
445// Create the chain of references to LocalX, then dereference them
446Method(m1a5, 1)
447{
448	Store(RefOf(arg0), Local0)
449	Store(RefOf(Local0), Local1)
450	Store(RefOf(Local1), Local2)
451	Store(RefOf(Local2), Local3)
452	Store(RefOf(Local3), Local4)
453	Store(RefOf(Local4), Local5)
454	Store(RefOf(Local5), Local6)
455	Store(RefOf(Local6), Local7)
456
457	Store(DerefOf(Local7), Local6)
458	Store(DerefOf(Local6), Local5)
459	Store(DerefOf(Local5), Local4)
460	Store(DerefOf(Local4), Local3)
461	Store(DerefOf(Local3), Local2)
462	Store(DerefOf(Local2), Local1)
463	Store(DerefOf(Local1), Local0)
464	Store(DerefOf(Local0), Local7)
465
466	return (Local7)
467}
468
469/*
470 * Set Global variables assignment applied in the tests
471 *
472 * arg0 - c080 - name of test
473 * arg1 - c083 - run verification of references (write/read)
474 * arg2 - c084 - run verification of references (reading)
475 * arg3 - c085 - create the chain of references to LocalX, then dereference them
476 * arg4 - c087 - apply DeRefOf to ArgX-ObjectReference
477 * arg5 - c081 - absolute index of file initiating the checking
478 */
479Method(m1ad, 6)
480{
481	Store(ObjectType(arg0), Local0)
482	if (LEqual(Local0, c00a)) {
483		Store(arg0, c080)
484	}
485	Store(arg1, c083)
486	Store(arg2, c084)
487	Store(arg3, c085)
488	Store(arg4, c087)
489	if (arg5) {
490		Store(arg5, c081)
491	}
492}
493
494// Test skipped message
495Method(m1ae, 3)
496{
497	Concatenate("Test ", arg0, Local0)
498	Concatenate(Local0, " skipped due to the following issue:", Debug)
499
500	Concatenate("   ", arg1, Debug)
501
502	Store(ObjectType(arg2), Local0)
503	if (LEqual(Local0, c00a)) {
504		Concatenate("   ", arg2, Debug)
505	}
506}
507
508
509