syscall.isa revision 4712
14712Sgblack@eecs.umich.edu// -*- mode:c++ -*- 24712Sgblack@eecs.umich.edu 34712Sgblack@eecs.umich.edu// Copyright (c) 2007 The Hewlett-Packard Development Company 44712Sgblack@eecs.umich.edu// All rights reserved. 54712Sgblack@eecs.umich.edu// 64712Sgblack@eecs.umich.edu// Redistribution and use of this software in source and binary forms, 74712Sgblack@eecs.umich.edu// with or without modification, are permitted provided that the 84712Sgblack@eecs.umich.edu// following conditions are met: 94712Sgblack@eecs.umich.edu// 104712Sgblack@eecs.umich.edu// The software must be used only for Non-Commercial Use which means any 114712Sgblack@eecs.umich.edu// use which is NOT directed to receiving any direct monetary 124712Sgblack@eecs.umich.edu// compensation for, or commercial advantage from such use. Illustrative 134712Sgblack@eecs.umich.edu// examples of non-commercial use are academic research, personal study, 144712Sgblack@eecs.umich.edu// teaching, education and corporate research & development. 154712Sgblack@eecs.umich.edu// Illustrative examples of commercial use are distributing products for 164712Sgblack@eecs.umich.edu// commercial advantage and providing services using the software for 174712Sgblack@eecs.umich.edu// commercial advantage. 184712Sgblack@eecs.umich.edu// 194712Sgblack@eecs.umich.edu// If you wish to use this software or functionality therein that may be 204712Sgblack@eecs.umich.edu// covered by patents for commercial use, please contact: 214712Sgblack@eecs.umich.edu// Director of Intellectual Property Licensing 224712Sgblack@eecs.umich.edu// Office of Strategy and Technology 234712Sgblack@eecs.umich.edu// Hewlett-Packard Company 244712Sgblack@eecs.umich.edu// 1501 Page Mill Road 254712Sgblack@eecs.umich.edu// Palo Alto, California 94304 264712Sgblack@eecs.umich.edu// 274712Sgblack@eecs.umich.edu// Redistributions of source code must retain the above copyright notice, 284712Sgblack@eecs.umich.edu// this list of conditions and the following disclaimer. Redistributions 294712Sgblack@eecs.umich.edu// in binary form must reproduce the above copyright notice, this list of 304712Sgblack@eecs.umich.edu// conditions and the following disclaimer in the documentation and/or 314712Sgblack@eecs.umich.edu// other materials provided with the distribution. Neither the name of 324712Sgblack@eecs.umich.edu// the COPYRIGHT HOLDER(s), HEWLETT-PACKARD COMPANY, nor the names of its 334712Sgblack@eecs.umich.edu// contributors may be used to endorse or promote products derived from 344712Sgblack@eecs.umich.edu// this software without specific prior written permission. No right of 354712Sgblack@eecs.umich.edu// sublicense is granted herewith. Derivatives of the software and 364712Sgblack@eecs.umich.edu// output created using the software may be prepared, but only for 374712Sgblack@eecs.umich.edu// Non-Commercial Uses. Derivatives of the software may be shared with 384712Sgblack@eecs.umich.edu// others provided: (i) the others agree to abide by the list of 394712Sgblack@eecs.umich.edu// conditions herein which includes the Non-Commercial Use restrictions; 404712Sgblack@eecs.umich.edu// and (ii) such Derivatives of the software include the above copyright 414712Sgblack@eecs.umich.edu// notice to acknowledge the contribution from this software where 424712Sgblack@eecs.umich.edu// applicable, this list of conditions and the disclaimer below. 434712Sgblack@eecs.umich.edu// 444712Sgblack@eecs.umich.edu// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 454712Sgblack@eecs.umich.edu// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 464712Sgblack@eecs.umich.edu// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 474712Sgblack@eecs.umich.edu// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 484712Sgblack@eecs.umich.edu// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 494712Sgblack@eecs.umich.edu// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 504712Sgblack@eecs.umich.edu// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 514712Sgblack@eecs.umich.edu// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 524712Sgblack@eecs.umich.edu// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 534712Sgblack@eecs.umich.edu// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 544712Sgblack@eecs.umich.edu// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 554712Sgblack@eecs.umich.edu// 564712Sgblack@eecs.umich.edu// Authors: Gabe Black 574712Sgblack@eecs.umich.edu 584712Sgblack@eecs.umich.edu//////////////////////////////////////////////////////////////////// 594712Sgblack@eecs.umich.edu// 604712Sgblack@eecs.umich.edu// "Format" which describes an instruction whose only purpose is to 614712Sgblack@eecs.umich.edu// call a syscall in SE mode. 624712Sgblack@eecs.umich.edu// 634712Sgblack@eecs.umich.edu 644712Sgblack@eecs.umich.eduoutput header {{ 654712Sgblack@eecs.umich.edu class SyscallInst : public X86ISA::X86StaticInst 664712Sgblack@eecs.umich.edu { 674712Sgblack@eecs.umich.edu public: 684712Sgblack@eecs.umich.edu /// Constructor 694712Sgblack@eecs.umich.edu SyscallInst(const char *_mnemonic, ExtMachInst _machInst, 704712Sgblack@eecs.umich.edu OpClass __opClass) : 714712Sgblack@eecs.umich.edu X86ISA::X86StaticInst(_mnemonic, _machInst, __opClass) 724712Sgblack@eecs.umich.edu { 734712Sgblack@eecs.umich.edu } 744712Sgblack@eecs.umich.edu 754712Sgblack@eecs.umich.edu std::string generateDisassembly(Addr pc, 764712Sgblack@eecs.umich.edu const SymbolTable *symtab) const; 774712Sgblack@eecs.umich.edu }; 784712Sgblack@eecs.umich.edu}}; 794712Sgblack@eecs.umich.edu 804712Sgblack@eecs.umich.eduoutput decoder {{ 814712Sgblack@eecs.umich.edu std::string SyscallInst::generateDisassembly(Addr PC, 824712Sgblack@eecs.umich.edu const SymbolTable *symtab) const 834712Sgblack@eecs.umich.edu { 844712Sgblack@eecs.umich.edu std::stringstream response; 854712Sgblack@eecs.umich.edu 864712Sgblack@eecs.umich.edu printMnemonic(response, mnemonic); 874712Sgblack@eecs.umich.edu ccprintf(response, " "); 884712Sgblack@eecs.umich.edu printReg(response, _srcRegIdx[0], machInst.opSize); 894712Sgblack@eecs.umich.edu return response.str(); 904712Sgblack@eecs.umich.edu } 914712Sgblack@eecs.umich.edu}}; 924712Sgblack@eecs.umich.edu 934712Sgblack@eecs.umich.edudef template SyscallExecute {{ 944712Sgblack@eecs.umich.edu Fault %(class_name)s::execute(%(CPU_exec_context)s *xc, 954712Sgblack@eecs.umich.edu Trace::InstRecord *traceData) const 964712Sgblack@eecs.umich.edu { 974712Sgblack@eecs.umich.edu Fault fault = NoFault; 984712Sgblack@eecs.umich.edu %(op_decl)s; 994712Sgblack@eecs.umich.edu %(op_rd)s; 1004712Sgblack@eecs.umich.edu %(code)s; 1014712Sgblack@eecs.umich.edu return fault; 1024712Sgblack@eecs.umich.edu } 1034712Sgblack@eecs.umich.edu}}; 1044712Sgblack@eecs.umich.edu 1054712Sgblack@eecs.umich.edudef format SyscallInst(code, *opt_flags) {{ 1064712Sgblack@eecs.umich.edu iop = InstObjParams(name, Name, 'SyscallInst', code, opt_flags) 1074712Sgblack@eecs.umich.edu header_output = BasicDeclare.subst(iop) 1084712Sgblack@eecs.umich.edu decoder_output = BasicConstructor.subst(iop) 1094712Sgblack@eecs.umich.edu decode_block = BasicDecode.subst(iop) 1104712Sgblack@eecs.umich.edu exec_output = SyscallExecute.subst(iop) 1114712Sgblack@eecs.umich.edu}}; 1124712Sgblack@eecs.umich.edu 113