1    /*
2     * Some or all of this work - Copyright (c) 2006 - 2021, 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     * Bug 269:
30     *
31     * SUMMARY: The sequence of evaluating Named object operands passed to method is violated
32     */
33    Method (M022, 0, Serialized)
34    {
35        Name (I000, 0x01)
36        Name (I001, 0x00)
37        Name (P000, Package (0x04)
38        {
39            0x01,
40            0x02,
41            0x03,
42            0x04
43        })
44        I001 = 0x00
45        Method (MADD, 2, NotSerialized)
46        {
47            Local0 = (Arg0 + Arg1)
48            Return (Local0)
49        }
50
51        Method (M001, 0, NotSerialized)
52        {
53            Method (M002, 0, NotSerialized)
54            {
55                Method (M003, 0, NotSerialized)
56                {
57                    Method (M004, 0, NotSerialized)
58                    {
59                        Method (M005, 0, NotSerialized)
60                        {
61                            Method (M006, 0, NotSerialized)
62                            {
63                                Method (M007, 0, NotSerialized)
64                                {
65                                    Method (M008, 0, NotSerialized)
66                                    {
67                                        If (I001)
68                                        {
69                                            CopyObject (P000, I000) /* \M022.I000 */
70                                        }
71
72                                        Return (0x00)
73                                    }
74
75                                    I000 = 0x80000000
76                                    Return (MADD (I000, M008 ()))
77                                }
78
79                                I000 = 0x07000000
80                                Return (MADD (I000, M007 ()))
81                            }
82
83                            I000 = 0x00600000
84                            Return (MADD (I000, M006 ()))
85                        }
86
87                        I000 = 0x00050000
88                        Return (MADD (I000, M005 ()))
89                    }
90
91                    I000 = 0x4000
92                    Return (MADD (I000, M004 ()))
93                }
94
95                I000 = 0x0300
96                Return (MADD (I000, M003 ()))
97            }
98
99            I000 = 0x20
100            Return (MADD (I000, M002 ()))
101        }
102
103        CH03 (__METHOD__, 0x00, __LINE__, 0x00, 0x00)
104        Local0 = MADD (I000, M001 ())
105        If ((Local0 != 0x87654321))
106        {
107            ERR (__METHOD__, ZFFF, __LINE__, 0x00, 0x00, Local0, C00E)
108        }
109
110        If ((I000 != 0x80000000))
111        {
112            ERR (__METHOD__, ZFFF, __LINE__, 0x00, 0x00, Local0, C00E)
113        }
114
115        Debug = "Result:"
116        Debug = Local0
117        Debug = "i000:"
118        Debug = I000 /* \M022.I000 */
119        CH03 (__METHOD__, 0x00, __LINE__, 0x00, 0x00)
120    }
121