m5op_arm.S revision 9660
112837Sgabeblack@google.com/*
212837Sgabeblack@google.com * Copyright (c) 2010 ARM Limited
312837Sgabeblack@google.com * All rights reserved
412837Sgabeblack@google.com *
512837Sgabeblack@google.com * The license below extends only to copyright in the software and shall
612837Sgabeblack@google.com * not be construed as granting a license to any other intellectual
712837Sgabeblack@google.com * property including but not limited to intellectual property relating
812837Sgabeblack@google.com * to a hardware implementation of the functionality of the software
912837Sgabeblack@google.com * licensed hereunder.  You may use the software subject to the license
1012837Sgabeblack@google.com * terms below provided that you ensure that this notice is replicated
1112837Sgabeblack@google.com * unmodified and in its entirety in all distributions of the software,
1212837Sgabeblack@google.com * modified or unmodified, in source code or in binary form.
1312837Sgabeblack@google.com *
1412837Sgabeblack@google.com * Copyright (c) 2003-2006 The Regents of The University of Michigan
1512837Sgabeblack@google.com * All rights reserved.
1612837Sgabeblack@google.com *
1712837Sgabeblack@google.com * Redistribution and use in source and binary forms, with or without
1812837Sgabeblack@google.com * modification, are permitted provided that the following conditions are
1912837Sgabeblack@google.com * met: redistributions of source code must retain the above copyright
2012837Sgabeblack@google.com * notice, this list of conditions and the following disclaimer;
2112837Sgabeblack@google.com * redistributions in binary form must reproduce the above copyright
2212837Sgabeblack@google.com * notice, this list of conditions and the following disclaimer in the
2312837Sgabeblack@google.com * documentation and/or other materials provided with the distribution;
2412837Sgabeblack@google.com * neither the name of the copyright holders nor the names of its
2512837Sgabeblack@google.com * contributors may be used to endorse or promote products derived from
2612837Sgabeblack@google.com * this software without specific prior written permission.
2712837Sgabeblack@google.com *
2812837Sgabeblack@google.com * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
2912837Sgabeblack@google.com * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
3012837Sgabeblack@google.com * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
3112837Sgabeblack@google.com * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
3212837Sgabeblack@google.com * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
3313273Sgabeblack@google.com * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
3412957Sgabeblack@google.com * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
3512957Sgabeblack@google.com * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
3613053Sgabeblack@google.com * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
3712842Sgabeblack@google.com * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
3812837Sgabeblack@google.com * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3912837Sgabeblack@google.com *
4012957Sgabeblack@google.com * Authors: Nathan Binkert
4112957Sgabeblack@google.com *          Ali Saidi
4212957Sgabeblack@google.com *          Chander Sudanthi
4313207Sgabeblack@google.com *          Andreas Sandberg
4412957Sgabeblack@google.com */
4512957Sgabeblack@google.com.syntax unified
4612957Sgabeblack@google.com#ifdef __thumb__
4712837Sgabeblack@google.com.thumb
4812837Sgabeblack@google.com#endif
4912837Sgabeblack@google.com
5012837Sgabeblack@google.com#include "m5ops.h"
5113245Sgabeblack@google.com
5213245Sgabeblack@google.com.text
5313245Sgabeblack@google.com
5413245Sgabeblack@google.com.macro simple_op name, func, subfunc
5513245Sgabeblack@google.com        .globl \name
5613245Sgabeblack@google.com\name:
5713245Sgabeblack@google.com        /* First, try to trap into m5 using the m5-kvm hypercall
5813245Sgabeblack@google.com         * hack. The bxj will become a branch to the fallback code
5913245Sgabeblack@google.com         * if it is executed in the normal m5 environment.
6013245Sgabeblack@google.com         */
6113245Sgabeblack@google.com        push {lr}
6213245Sgabeblack@google.com        ldr lr, =1f
6313245Sgabeblack@google.com        ldr ip, =((((\func) & 0xFF) << 8) | ((\subfunc) & 0xFF))
6413245Sgabeblack@google.com        bxj lr
6513245Sgabeblack@google.com        pop {pc}
6613245Sgabeblack@google.com
6712837Sgabeblack@google.com        /* Old-style m5 pseudo instruction using CP1 accesses */
6812837Sgabeblack@google.com1:
6912837Sgabeblack@google.com#ifdef __thumb__
7012837Sgabeblack@google.com        .short 0xEE00 | \func
7112837Sgabeblack@google.com        .short 0x0110 | (\subfunc << 12)
7212837Sgabeblack@google.com#else
7312837Sgabeblack@google.com#define INST(op, ra, rb, func) \
7412837Sgabeblack@google.com        .long (0xEE000110 | (\func << 16) | (\subfunc << 12)
7512837Sgabeblack@google.com#endif
7612837Sgabeblack@google.com        pop {pc}
7712837Sgabeblack@google.com.endm
7812957Sgabeblack@google.com
7913207Sgabeblack@google.com#define SIMPLE_OP(name, func, subfunc) simple_op name, func, subfunc
8012842Sgabeblack@google.com
8112842Sgabeblack@google.comSIMPLE_OP(arm, arm_func, 0)
8212938Sgabeblack@google.comSIMPLE_OP(quiesce, quiesce_func, 0)
8312957Sgabeblack@google.comSIMPLE_OP(quiesceNs, quiescens_func, 0)
8412957Sgabeblack@google.comSIMPLE_OP(quiesceCycle, quiescecycle_func, 0)
8512957Sgabeblack@google.comSIMPLE_OP(quiesceTime, quiescetime_func, 0)
8613202Sgabeblack@google.comSIMPLE_OP(rpns, rpns_func, 0)
8713202Sgabeblack@google.comSIMPLE_OP(wakeCPU, wakecpu_func, 0)
8812938Sgabeblack@google.comSIMPLE_OP(m5_exit, exit_func, 0)
8912938Sgabeblack@google.comSIMPLE_OP(m5_initparam, initparam_func, 0)
9012938Sgabeblack@google.comSIMPLE_OP(m5_loadsymbol, loadsymbol_func, 0)
9112938Sgabeblack@google.comSIMPLE_OP(m5_reset_stats, resetstats_func, 0)
9212944Sgabeblack@google.comSIMPLE_OP(m5_dump_stats, dumpstats_func, 0)
9313091Sgabeblack@google.comSIMPLE_OP(m5_dumpreset_stats, dumprststats_func, 0)
9413091Sgabeblack@google.comSIMPLE_OP(m5_checkpoint, ckpt_func, 0)
9512944Sgabeblack@google.comSIMPLE_OP(m5_readfile, readfile_func, 0)
9612944Sgabeblack@google.comSIMPLE_OP(m5_writefile, writefile_func, 0)
9712944Sgabeblack@google.comSIMPLE_OP(m5_debugbreak, debugbreak_func, 0)
9812957Sgabeblack@google.comSIMPLE_OP(m5_switchcpu, switchcpu_func, 0)
9913059Sgabeblack@google.comSIMPLE_OP(m5_addsymbol, addsymbol_func, 0)
10013059Sgabeblack@google.comSIMPLE_OP(m5_panic, panic_func, 0)
10113059Sgabeblack@google.comSIMPLE_OP(m5_work_begin, work_begin_func, 0)
10213059Sgabeblack@google.comSIMPLE_OP(m5_work_end, work_end_func, 0)
10313059Sgabeblack@google.com
10413290Sgabeblack@google.comSIMPLE_OP(m5a_bsm, annotate_func, an_bsm)
10513290Sgabeblack@google.comSIMPLE_OP(m5a_esm, annotate_func, an_esm)
10612957Sgabeblack@google.comSIMPLE_OP(m5a_begin, annotate_func, an_begin)
10713207Sgabeblack@google.comSIMPLE_OP(m5a_end, annotate_func, an_end)
10813053Sgabeblack@google.comSIMPLE_OP(m5a_q, annotate_func, an_q)
10913053Sgabeblack@google.comSIMPLE_OP(m5a_rq, annotate_func, an_rq)
11013053Sgabeblack@google.comSIMPLE_OP(m5a_dq, annotate_func, an_dq)
11113053Sgabeblack@google.comSIMPLE_OP(m5a_wf, annotate_func, an_wf)
11212957Sgabeblack@google.comSIMPLE_OP(m5a_we, annotate_func, an_we)
11313207Sgabeblack@google.comSIMPLE_OP(m5a_ws, annotate_func, an_ws)
11413273Sgabeblack@google.comSIMPLE_OP(m5a_sq, annotate_func, an_sq)
11512837Sgabeblack@google.comSIMPLE_OP(m5a_aq, annotate_func, an_aq)
11612837Sgabeblack@google.comSIMPLE_OP(m5a_pq, annotate_func, an_pq)
11712837Sgabeblack@google.comSIMPLE_OP(m5a_l, annotate_func, an_l)
11812837Sgabeblack@google.comSIMPLE_OP(m5a_identify, annotate_func, an_identify)
11912837Sgabeblack@google.comSIMPLE_OP(m5a_getid, annotate_func, an_getid)
12012837Sgabeblack@google.com