m5op_arm.S revision 9686
112268Sradhika.jagtap@arm.com/*
212268Sradhika.jagtap@arm.com * Copyright (c) 2010 ARM Limited
312268Sradhika.jagtap@arm.com * All rights reserved
412268Sradhika.jagtap@arm.com *
512268Sradhika.jagtap@arm.com * The license below extends only to copyright in the software and shall
612268Sradhika.jagtap@arm.com * not be construed as granting a license to any other intellectual
712268Sradhika.jagtap@arm.com * property including but not limited to intellectual property relating
812268Sradhika.jagtap@arm.com * to a hardware implementation of the functionality of the software
912268Sradhika.jagtap@arm.com * licensed hereunder.  You may use the software subject to the license
1012268Sradhika.jagtap@arm.com * terms below provided that you ensure that this notice is replicated
1112268Sradhika.jagtap@arm.com * unmodified and in its entirety in all distributions of the software,
1212268Sradhika.jagtap@arm.com * modified or unmodified, in source code or in binary form.
1312268Sradhika.jagtap@arm.com *
1412268Sradhika.jagtap@arm.com * Copyright (c) 2003-2006 The Regents of The University of Michigan
1512268Sradhika.jagtap@arm.com * All rights reserved.
1612268Sradhika.jagtap@arm.com *
1712268Sradhika.jagtap@arm.com * Redistribution and use in source and binary forms, with or without
1812268Sradhika.jagtap@arm.com * modification, are permitted provided that the following conditions are
1912268Sradhika.jagtap@arm.com * met: redistributions of source code must retain the above copyright
2012268Sradhika.jagtap@arm.com * notice, this list of conditions and the following disclaimer;
2112268Sradhika.jagtap@arm.com * redistributions in binary form must reproduce the above copyright
2212268Sradhika.jagtap@arm.com * notice, this list of conditions and the following disclaimer in the
2312268Sradhika.jagtap@arm.com * documentation and/or other materials provided with the distribution;
2412268Sradhika.jagtap@arm.com * neither the name of the copyright holders nor the names of its
2512268Sradhika.jagtap@arm.com * contributors may be used to endorse or promote products derived from
2612268Sradhika.jagtap@arm.com * this software without specific prior written permission.
2712268Sradhika.jagtap@arm.com *
2812268Sradhika.jagtap@arm.com * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
2912268Sradhika.jagtap@arm.com * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
3012268Sradhika.jagtap@arm.com * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
3112268Sradhika.jagtap@arm.com * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
3212268Sradhika.jagtap@arm.com * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
3312268Sradhika.jagtap@arm.com * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
3412268Sradhika.jagtap@arm.com * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
3512268Sradhika.jagtap@arm.com * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
3612268Sradhika.jagtap@arm.com * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
3712268Sradhika.jagtap@arm.com * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
3812268Sradhika.jagtap@arm.com * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3912268Sradhika.jagtap@arm.com *
4012268Sradhika.jagtap@arm.com * Authors: Nathan Binkert
4112268Sradhika.jagtap@arm.com *          Ali Saidi
4212268Sradhika.jagtap@arm.com *          Chander Sudanthi
4312268Sradhika.jagtap@arm.com *          Andreas Sandberg
4412268Sradhika.jagtap@arm.com */
4512268Sradhika.jagtap@arm.com.syntax unified
4612268Sradhika.jagtap@arm.com#ifdef __thumb__
4712268Sradhika.jagtap@arm.com.thumb
4812268Sradhika.jagtap@arm.com#endif
4912268Sradhika.jagtap@arm.com
5012268Sradhika.jagtap@arm.com#include "m5ops.h"
5112268Sradhika.jagtap@arm.com
5212268Sradhika.jagtap@arm.com.text
5312268Sradhika.jagtap@arm.com
5412268Sradhika.jagtap@arm.com.macro simple_op name, func, subfunc
5512268Sradhika.jagtap@arm.com        .align 2
5612268Sradhika.jagtap@arm.com        .globl \name
5712268Sradhika.jagtap@arm.com\name:
5812268Sradhika.jagtap@arm.com        /* First, try to trap into m5 using the m5-kvm hypercall
5912268Sradhika.jagtap@arm.com         * hack. The bxj will become a branch to the fallback code
6012268Sradhika.jagtap@arm.com         * if it is executed in the normal m5 environment.
6112268Sradhika.jagtap@arm.com         */
6212268Sradhika.jagtap@arm.com        push {lr}
6312268Sradhika.jagtap@arm.com#ifdef __thumb__
6412268Sradhika.jagtap@arm.com        adr lr, 1f+1
6512268Sradhika.jagtap@arm.com#else
6612268Sradhika.jagtap@arm.com        adr lr, 1f
6712268Sradhika.jagtap@arm.com#endif
6812268Sradhika.jagtap@arm.com        ldr ip, =((((\func) & 0xFF) << 8) | ((\subfunc) & 0xFF))
69        bxj lr
70        pop {pc}
71
72        /* Old-style m5 pseudo instruction using CP1 accesses */
731:
74#ifdef __thumb__
75        .short 0xEE00 | \func
76        .short 0x0110 | (\subfunc << 12)
77#else
78        .long (0xEE000110 | (\func << 16) | (\subfunc << 12))
79#endif
80        pop {pc}
81.endm
82
83#define SIMPLE_OP(name, func, subfunc) simple_op name, func, subfunc
84
85SIMPLE_OP(arm, arm_func, 0)
86SIMPLE_OP(quiesce, quiesce_func, 0)
87SIMPLE_OP(quiesceNs, quiescens_func, 0)
88SIMPLE_OP(quiesceCycle, quiescecycle_func, 0)
89SIMPLE_OP(quiesceTime, quiescetime_func, 0)
90SIMPLE_OP(rpns, rpns_func, 0)
91SIMPLE_OP(wakeCPU, wakecpu_func, 0)
92SIMPLE_OP(m5_exit, exit_func, 0)
93SIMPLE_OP(m5_initparam, initparam_func, 0)
94SIMPLE_OP(m5_loadsymbol, loadsymbol_func, 0)
95SIMPLE_OP(m5_reset_stats, resetstats_func, 0)
96SIMPLE_OP(m5_dump_stats, dumpstats_func, 0)
97SIMPLE_OP(m5_dumpreset_stats, dumprststats_func, 0)
98SIMPLE_OP(m5_checkpoint, ckpt_func, 0)
99SIMPLE_OP(m5_readfile, readfile_func, 0)
100SIMPLE_OP(m5_writefile, writefile_func, 0)
101SIMPLE_OP(m5_debugbreak, debugbreak_func, 0)
102SIMPLE_OP(m5_switchcpu, switchcpu_func, 0)
103SIMPLE_OP(m5_addsymbol, addsymbol_func, 0)
104SIMPLE_OP(m5_panic, panic_func, 0)
105SIMPLE_OP(m5_work_begin, work_begin_func, 0)
106SIMPLE_OP(m5_work_end, work_end_func, 0)
107
108SIMPLE_OP(m5a_bsm, annotate_func, an_bsm)
109SIMPLE_OP(m5a_esm, annotate_func, an_esm)
110SIMPLE_OP(m5a_begin, annotate_func, an_begin)
111SIMPLE_OP(m5a_end, annotate_func, an_end)
112SIMPLE_OP(m5a_q, annotate_func, an_q)
113SIMPLE_OP(m5a_rq, annotate_func, an_rq)
114SIMPLE_OP(m5a_dq, annotate_func, an_dq)
115SIMPLE_OP(m5a_wf, annotate_func, an_wf)
116SIMPLE_OP(m5a_we, annotate_func, an_we)
117SIMPLE_OP(m5a_ws, annotate_func, an_ws)
118SIMPLE_OP(m5a_sq, annotate_func, an_sq)
119SIMPLE_OP(m5a_aq, annotate_func, an_aq)
120SIMPLE_OP(m5a_pq, annotate_func, an_pq)
121SIMPLE_OP(m5a_l, annotate_func, an_l)
122SIMPLE_OP(m5a_identify, annotate_func, an_identify)
123SIMPLE_OP(m5a_getid, annotate_func, an_getid)
124