process_impl.hh revision 8737
14130Ssaidi@eecs.umich.edu/* 24130Ssaidi@eecs.umich.edu * Copyright (c) 2001-2005 The Regents of The University of Michigan 34130Ssaidi@eecs.umich.edu * All rights reserved. 44130Ssaidi@eecs.umich.edu * 54130Ssaidi@eecs.umich.edu * Redistribution and use in source and binary forms, with or without 64130Ssaidi@eecs.umich.edu * modification, are permitted provided that the following conditions are 74130Ssaidi@eecs.umich.edu * met: redistributions of source code must retain the above copyright 84130Ssaidi@eecs.umich.edu * notice, this list of conditions and the following disclaimer; 94130Ssaidi@eecs.umich.edu * redistributions in binary form must reproduce the above copyright 104130Ssaidi@eecs.umich.edu * notice, this list of conditions and the following disclaimer in the 114130Ssaidi@eecs.umich.edu * documentation and/or other materials provided with the distribution; 124130Ssaidi@eecs.umich.edu * neither the name of the copyright holders nor the names of its 134130Ssaidi@eecs.umich.edu * contributors may be used to endorse or promote products derived from 144130Ssaidi@eecs.umich.edu * this software without specific prior written permission. 154130Ssaidi@eecs.umich.edu * 164130Ssaidi@eecs.umich.edu * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 174130Ssaidi@eecs.umich.edu * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 184130Ssaidi@eecs.umich.edu * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 194130Ssaidi@eecs.umich.edu * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 204130Ssaidi@eecs.umich.edu * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 214130Ssaidi@eecs.umich.edu * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 224130Ssaidi@eecs.umich.edu * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 234130Ssaidi@eecs.umich.edu * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 244130Ssaidi@eecs.umich.edu * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 254130Ssaidi@eecs.umich.edu * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 264130Ssaidi@eecs.umich.edu * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 274130Ssaidi@eecs.umich.edu * 284130Ssaidi@eecs.umich.edu * Authors: Nathan Binkert 294130Ssaidi@eecs.umich.edu * Steve Reinhardt 304130Ssaidi@eecs.umich.edu */ 316654Snate@binkert.org 324130Ssaidi@eecs.umich.edu#ifndef __SIM_PROCESS_IMPL_HH__ 334130Ssaidi@eecs.umich.edu#define __SIM_PROCESS_IMPL_HH__ 3410904Sandreas.sandberg@arm.com 3510904Sandreas.sandberg@arm.com// 3610904Sandreas.sandberg@arm.com// The purpose of this code is to fake the loader & syscall mechanism 3710904Sandreas.sandberg@arm.com// when there's no OS: thus there's no reason to use it in FULL_SYSTEM 3810904Sandreas.sandberg@arm.com// mode when we do have an OS. 399827Sakash.bagdia@arm.com// 409827Sakash.bagdia@arm.com#include "config/full_system.hh" 419827Sakash.bagdia@arm.com 429827Sakash.bagdia@arm.com#if !FULL_SYSTEM 439827Sakash.bagdia@arm.com 449802Snilay@cs.wisc.edu#include <string> 454130Ssaidi@eecs.umich.edu#include <vector> 468882Sgblack@eecs.umich.edu 478882Sgblack@eecs.umich.edu#include "mem/se_translating_port_proxy.hh" 487876Sgblack@eecs.umich.edu#include "sim/byteswap.hh" 494130Ssaidi@eecs.umich.edu 509826Sandreas.hansson@arm.com//This needs to be templated for cases where 32 bit pointers are needed. 519826Sandreas.hansson@arm.comtemplate<class AddrType> 529835Sandreas.hansson@arm.comvoid 539826Sandreas.hansson@arm.comcopyStringArray(std::vector<std::string> &strings, 549826Sandreas.hansson@arm.com AddrType array_ptr, AddrType data_ptr, 559826Sandreas.hansson@arm.com SETranslatingPortProxy* memProxy) 569826Sandreas.hansson@arm.com{ 578801Sgblack@eecs.umich.edu AddrType data_ptr_swap; 584167Sbinkertn@umich.edu for (std::vector<std::string>::size_type i = 0; i < strings.size(); ++i) { 594167Sbinkertn@umich.edu data_ptr_swap = TheISA::htog(data_ptr); 60 memProxy->writeBlob(array_ptr, (uint8_t*)&data_ptr_swap, 61 sizeof(AddrType)); 62 memProxy->writeString(data_ptr, strings[i].c_str()); 63 array_ptr += sizeof(AddrType); 64 data_ptr += strings[i].size() + 1; 65 } 66 // add NULL terminator 67 data_ptr = 0; 68 69 memProxy->writeBlob(array_ptr, (uint8_t*)&data_ptr, sizeof(AddrType)); 70} 71 72 73#endif // !FULL_SYSTEM 74 75#endif 76