call.py revision 5081
14390Sktlim@umich.edu# Copyright (c) 2007 The Hewlett-Packard Development Company
23005Sstever@eecs.umich.edu# All rights reserved.
33005Sstever@eecs.umich.edu#
43005Sstever@eecs.umich.edu# Redistribution and use of this software in source and binary forms,
53005Sstever@eecs.umich.edu# with or without modification, are permitted provided that the
63005Sstever@eecs.umich.edu# following conditions are met:
73005Sstever@eecs.umich.edu#
83005Sstever@eecs.umich.edu# The software must be used only for Non-Commercial Use which means any
93005Sstever@eecs.umich.edu# use which is NOT directed to receiving any direct monetary
103005Sstever@eecs.umich.edu# compensation for, or commercial advantage from such use.  Illustrative
113005Sstever@eecs.umich.edu# examples of non-commercial use are academic research, personal study,
123005Sstever@eecs.umich.edu# teaching, education and corporate research & development.
133005Sstever@eecs.umich.edu# Illustrative examples of commercial use are distributing products for
143005Sstever@eecs.umich.edu# commercial advantage and providing services using the software for
153005Sstever@eecs.umich.edu# commercial advantage.
163005Sstever@eecs.umich.edu#
173005Sstever@eecs.umich.edu# If you wish to use this software or functionality therein that may be
183005Sstever@eecs.umich.edu# covered by patents for commercial use, please contact:
193005Sstever@eecs.umich.edu#     Director of Intellectual Property Licensing
203005Sstever@eecs.umich.edu#     Office of Strategy and Technology
213005Sstever@eecs.umich.edu#     Hewlett-Packard Company
223005Sstever@eecs.umich.edu#     1501 Page Mill Road
233005Sstever@eecs.umich.edu#     Palo Alto, California  94304
243005Sstever@eecs.umich.edu#
253005Sstever@eecs.umich.edu# Redistributions of source code must retain the above copyright notice,
263005Sstever@eecs.umich.edu# this list of conditions and the following disclaimer.  Redistributions
273005Sstever@eecs.umich.edu# in binary form must reproduce the above copyright notice, this list of
283005Sstever@eecs.umich.edu# conditions and the following disclaimer in the documentation and/or
292997SN/A# other materials provided with the distribution.  Neither the name of
302997SN/A# the COPYRIGHT HOLDER(s), HEWLETT-PACKARD COMPANY, nor the names of its
312997SN/A# contributors may be used to endorse or promote products derived from
322997SN/A# this software without specific prior written permission.  No right of
332997SN/A# sublicense is granted herewith.  Derivatives of the software and
342997SN/A# output created using the software may be prepared, but only for
354444Ssaidi@eecs.umich.edu# Non-Commercial Uses.  Derivatives of the software may be shared with
362997SN/A# others provided: (i) the others agree to abide by the list of
372997SN/A# conditions herein which includes the Non-Commercial Use restrictions;
382997SN/A# and (ii) such Derivatives of the software include the above copyright
393170Sstever@eecs.umich.edu# notice to acknowledge the contribution from this software where
402998SN/A# applicable, this list of conditions and the disclaimer below.
414444Ssaidi@eecs.umich.edu#
422998SN/A# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
432998SN/A# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
442998SN/A# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
452998SN/A# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
462998SN/A# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
474390Sktlim@umich.edu# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
482997SN/A# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
492998SN/A# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
50# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
51# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
52# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
53#
54# Authors: Gabe Black
55
56microcode = '''
57def macroop CALL_NEAR_I
58{
59    # Make the default data size of calls 64 bits in 64 bit mode
60    .adjust_env oszIn64Override
61
62    limm t1, imm
63    rdip t7
64    subi rsp, rsp, dsz
65    st t7, ss, [0, t0, rsp]
66    wrip t7, t1
67};
68
69def macroop CALL_NEAR_R
70{
71    # Make the default data size of calls 64 bits in 64 bit mode
72    .adjust_env oszIn64Override
73
74    rdip t1
75    subi rsp, rsp, dsz
76    st t1, ss, [0, t0, rsp]
77    wripi reg, 0
78};
79
80def macroop CALL_NEAR_M
81{
82    # Make the default data size of calls 64 bits in 64 bit mode
83    .adjust_env oszIn64Override
84
85    rdip t7
86    ld t1, seg, sib, disp
87    subi rsp, rsp, dsz
88    st t7, ss, [0, t0, rsp]
89    wripi t1, 0
90};
91
92def macroop CALL_NEAR_P
93{
94    # Make the default data size of calls 64 bits in 64 bit mode
95    .adjust_env oszIn64Override
96
97    rdip t7
98    ld t1, seg, riprel, disp
99    subi rsp, rsp, dsz
100    st t7, ss, [0, t0, rsp]
101    wripi t1, 0
102};
103'''
104#let {{
105#    class CALL(Inst):
106#	"GenFault ${new UnimpInstFault}"
107#}};
108