• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /barrelfish-2018-10-04/lib/acpica/tests/aslts/src/runtime/collections/exceptions/exc_operand/exc_operand2/
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 *  Buffer
31 *
32 * (verify exceptions caused by the imprope use of Buffer type objects)
33 */
34
35Name(z095, 95)
36
37Name(b100, Buffer(){0x61})
38
39// Expected exceptions:
40//
41// 47 - AE_AML_OPERAND_TYPE
42// Note: Buffer can be used with Index
43Method(m4b3, 1, Serialized)
44{
45	Name(ts, "m4b3")
46
47	Name(b000, Buffer(){0x62})
48
49	// Local Named Object
50	Method(m000, 1, Serialized)
51	{
52		Name(b000, Buffer(){0x63})
53
54		if (y083) {
55			Store (DerefOf(b000), Local1)
56			CH06(arg0, 0, 47)
57		}
58
59		Store (Index(b000, 0), Local1)
60		CH03(ts, z095, 0, 0, 0)
61	}
62
63	// Global Named Object
64	Method(m001, 1)
65	{
66		if (y083) {
67			Store (DerefOf(b100), Local1)
68			CH06(arg0, 1, 47)
69		}
70
71		Store (Index(b100, 0), Local1)
72		CH03(ts, z095, 1, 0, 0)
73	}
74
75	// Argument
76	Method(m002, 2)
77	{
78		Store (DerefOf(arg1), Local1)
79		CH06(arg0, 2, 47)
80
81		Release(arg1)
82		CH06(arg0, 3, 47)
83
84		Reset(arg1)
85		CH06(arg0, 4, 47)
86
87		Signal(arg1)
88		CH06(arg0, 5, 47)
89
90		Store(Acquire(arg1, 0), Local1)
91		CH06(arg0, 6, 47)
92
93		Store (Index(arg1, 0), Local1)
94		CH03(ts, z095, 2, 0, 0)
95
96		Store(Wait(arg1, 0), Local1)
97		CH06(arg0, 7, 47)
98
99		Store (Match(arg1, MTR, 0, MTR, 0, 0), Local1)
100		CH06(arg0, 8, 47)
101	}
102
103	// Local
104	Method(m003, 1)
105	{
106		Store(Buffer(){0x63}, Local0)
107
108		Store (DerefOf(Local0), Local1)
109		CH06(arg0, 9, 47)
110
111		Release(Local0)
112		CH06(arg0, 10, 47)
113
114		Reset(Local0)
115		CH06(arg0, 11, 47)
116
117		Signal(Local0)
118		CH06(arg0, 12, 47)
119
120		Store(Acquire(Local0, 0), Local1)
121		CH06(arg0, 13, 47)
122
123		Store (Index(Local0, 0), Local1)
124		CH03(ts, z095, 3, 0, 0)
125
126		Store(Wait(Local0, 0), Local1)
127		CH06(arg0, 14, 47)
128
129		Store (Match(Local0, MTR, 0, MTR, 0, 0), Local1)
130		CH06(arg0, 15, 47)
131	}
132
133	// An element of Package
134	Method(m004, 1, Serialized)
135	{
136		Name(p000, Package(){Buffer(){0x63}})
137
138		// DeRefOf(Index(Package, Ind, Dest))
139
140		Store (DerefOf(DeRefOf(Index(p000, 0, Local0))), Local1)
141		CH06(arg0, 18, 47)
142
143		Store (Index(DeRefOf(Index(p000, 0, Local0)), 0), Local1)
144		CH03(ts, z095, 5, 0, 0)
145
146		Store (Match(DeRefOf(Index(p000, 0, Local0)), MTR, 0, MTR, 0, 0), Local1)
147		CH06(arg0, 19, 47)
148	}
149
150	// Reference to Object
151	Method(m005, 2)
152	{
153		Store(arg0, Debug)
154		Store(arg1, Debug)
155
156		Store(ObjectType(arg1), Local0)
157		if (LNotEqual(Local0, 3)) {
158			err(arg0, z095, 20, 0, 0, Local0, 3)
159			return (1)
160		}
161
162		Store (DerefOf(arg1), Local1)
163		CH03(ts, z095, 6, 0, 0)
164
165		Store (DerefOf(DerefOf(arg1)), Local1)
166		CH06(arg0, 21, 47)
167
168		Store (Index(DerefOf(arg1), 0), Local1)
169		CH03(ts, z095, 7, 0, 0)
170
171		Store (Match(DerefOf(arg1), MTR, 0, MTR, 0, 0), Local1)
172		CH06(arg0, 22, 47)
173
174		return (0)
175	}
176
177	// Result of Method invocation
178	Method(m006, 1, Serialized)
179	{
180		Name(i000, 0) // Label to check m000 invocations
181
182		Method(m000, 1)
183		{
184			Store(arg0, i000)
185			Store(Buffer(){0x63}, Local0)
186			Return (Local0)
187		}
188
189		Method(CH00, 2)
190		{
191			if (LNotEqual(i000, arg1)) {
192				err(arg0, z095, 23, 0, 0, i000, arg1)
193			}
194		}
195
196		Store (DerefOf(m000(1)), Local1)
197		CH06(arg0, 24, 47)
198		CH00(arg0, 1)
199
200		Release(m000(2))
201		CH06(arg0, 25, 47)
202		if (y600) {
203			CH00(arg0, 2)
204		}
205
206		Reset(m000(3))
207		CH06(arg0, 26, 47)
208		if (y600) {
209			CH00(arg0, 3)
210		}
211
212		Signal(m000(4))
213		CH06(arg0, 27, 47)
214		if (y600) {
215			CH00(arg0, 4)
216		}
217
218		Store(Acquire(m000(5), 0), Local1)
219		CH06(arg0, 28, 47)
220		if (y600) {
221			CH00(arg0, 5)
222		}
223
224		CH03(ts, z095, 12, 0, 0)
225		Store (Index(m000(6), 0), Local1)
226		if (y900) {
227			CH03(ts, z095, 8, 0, 0)
228			CH00(arg0, 6)
229		} else {
230			CH04(ts, 0, 85, z095, 0x123, 0, 0) // AE_INDEX_TO_NOT_ATTACHED
231		}
232
233		Store(Wait(m000(7), 0), Local1)
234		CH06(arg0, 29, 47)
235		if (y600) {
236			CH00(arg0, 7)
237		}
238
239		Store (Match(m000(8), MTR, 0, MTR, 0, 0), Local1)
240		CH06(arg0, 30, 47)
241		CH00(arg0, 8)
242	}
243
244	// Reference to Object as Result of Method invocation
245	Method(m007, 1, Serialized)
246	{
247		Name(b000, Buffer(){0x63})
248
249		Name(i000, 0) // Label to check m000 invocations
250
251		Method(m000, 2)
252		{
253			Store(arg0, i000)
254			if (LEqual(arg1, 0)) {
255				Store(Refof(b100), Local0)
256			} elseif (LEqual(arg1, 1)) {
257				Store(Refof(b000), Local0)
258			}
259			Return (Local0)
260		}
261
262		Method(CH00, 2)
263		{
264			if (LNotEqual(i000, arg1)) {
265				err(arg0, z095, 31, 0, 0, i000, arg1)
266			}
267		}
268
269		Name(lpN0, 2)
270		Name(lpC0, 0)
271
272		While (lpN0) {
273			Multiply(3, lpC0, Local0)
274
275			Store(0, i000)
276
277			Store (DerefOf(m000(1, lpC0)), Local1)
278			CH03(ts, z095, Add(9, lpC0), 0, 0)
279			CH00(arg0, 1)
280
281			Store (DerefOf(DerefOf(m000(2, lpC0))), Local1)
282			CH06(arg0, Add(32, Local0), 47)
283			CH00(arg0, 2)
284
285			Store (Index(DerefOf(m000(3, lpC0)), 0), Local1)
286			CH06(arg0, Add(33, Local0), 47)
287			CH00(arg0, 3)
288
289			Store (Match(DerefOf(m000(4, lpC0)), MTR, 0, MTR, 0, 0), Local1)
290			CH06(arg0, Add(34, Local0), 47)
291			CH00(arg0, 4)
292
293			Decrement(lpN0)
294			Increment(lpC0)
295		}
296	}
297
298	CH03(ts, z095, 11, 0, 0)
299
300	// Local Named Object
301	m000(ts)
302
303	// Global Named Object
304	m001(ts)
305
306	// Argument
307	m002(ts, Buffer(){0x62})
308
309	// Local
310	m003(ts)
311
312	// An element of Package
313	m004(ts)
314
315
316	// Reference to Local Named Object
317
318	m005(Concatenate(ts, "-m005-RefLocName"), RefOf(b000))
319
320	Store(RefOf(b000), Local0)
321	m005(Concatenate(ts, "-m005-RefLocName2"), Local0)
322
323	CondRefOf(b000, Local0)
324	m005(Concatenate(ts, "-m005-CondRefLocName"), Local0)
325
326	m005(Concatenate(ts, "-m005-RefGlobName"), RefOf(b100))
327
328	Store(RefOf(b100), Local0)
329	m005(Concatenate(ts, "-m005-RefGlobName2"), Local0)
330
331	CondRefOf(b100, Local0)
332	m005(Concatenate(ts, "-m005-CondRefGlobName"), Local0)
333
334
335	// Reference to Local
336
337	Store(Buffer(){0x62}, Local0)
338
339	m005(Concatenate(ts, "-m005-RefLocal"), RefOf(Local0))
340
341	Store(RefOf(Local0), Local1)
342	m005(Concatenate(ts, "-m005-RefLocal2"), Local1)
343
344	CondRefOf(Local0, Local1)
345	m005(Concatenate(ts, "-m005-CondRefLocal"), Local1)
346
347
348	// Reference to Arg
349
350	m005(Concatenate(ts, "-m005-RefArg"), RefOf(arg0))
351
352	Store(RefOf(arg0), Local0)
353	m005(Concatenate(ts, "-m005-RefArg2"), Local0)
354
355	CondRefOf(arg0, Local0)
356	m005(Concatenate(ts, "-m005-CondRefArg"), Local0)
357
358
359	// Index to Package
360
361	Name(p000, Package(){Buffer(){0x62}})
362
363	if (y113) {
364		m005(Concatenate(ts, "-m005-Index"), Index(p000, 0))
365	}
366
367	Store(Index(p000, 0), Local0)
368	m005(Concatenate(ts, "-m005-Index2"), Local0)
369
370	if (y113) {
371		m005(Concatenate(ts, "-m005-Index3"), Index(p000, 0, Local0))
372	}
373
374	Index(p000, 0, Local0)
375	m005(Concatenate(ts, "-m005-Index4"), Local0)
376
377	Store(Index(p000, 0, Local0), Local1)
378	m005(Concatenate(ts, "-m005-Index5"), Local1)
379
380	// Result of Method invocation
381	m006(ts)
382
383	// Reference to Object as Result of Method invocation
384	if (y500) {
385		m007(ts)
386	}
387}
388