process_impl.hh (14010:0e1e887507c0) | process_impl.hh (14020:c9bf7a011602) |
---|---|
1/* 2 * Copyright (c) 2001-2005 The Regents of The University of Michigan 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are 7 * met: redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer; --- 28 unchanged lines hidden (view full) --- 37 38#include "mem/se_translating_port_proxy.hh" 39 40//This needs to be templated for cases where 32 bit pointers are needed. 41template<class AddrType> 42void 43copyStringArray(std::vector<std::string> &strings, 44 AddrType array_ptr, AddrType data_ptr, | 1/* 2 * Copyright (c) 2001-2005 The Regents of The University of Michigan 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are 7 * met: redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer; --- 28 unchanged lines hidden (view full) --- 37 38#include "mem/se_translating_port_proxy.hh" 39 40//This needs to be templated for cases where 32 bit pointers are needed. 41template<class AddrType> 42void 43copyStringArray(std::vector<std::string> &strings, 44 AddrType array_ptr, AddrType data_ptr, |
45 SETranslatingPortProxy& memProxy) | 45 PortProxy& memProxy) |
46{ 47 AddrType data_ptr_swap; 48 for (std::vector<std::string>::size_type i = 0; i < strings.size(); ++i) { 49 data_ptr_swap = TheISA::htog(data_ptr); 50 memProxy.writeBlob(array_ptr, &data_ptr_swap, sizeof(AddrType)); 51 memProxy.writeString(data_ptr, strings[i].c_str()); 52 array_ptr += sizeof(AddrType); 53 data_ptr += strings[i].size() + 1; 54 } 55 // add NULL terminator 56 data_ptr = 0; 57 58 memProxy.writeBlob(array_ptr, &data_ptr, sizeof(AddrType)); 59} 60 61#endif | 46{ 47 AddrType data_ptr_swap; 48 for (std::vector<std::string>::size_type i = 0; i < strings.size(); ++i) { 49 data_ptr_swap = TheISA::htog(data_ptr); 50 memProxy.writeBlob(array_ptr, &data_ptr_swap, sizeof(AddrType)); 51 memProxy.writeString(data_ptr, strings[i].c_str()); 52 array_ptr += sizeof(AddrType); 53 data_ptr += strings[i].size() + 1; 54 } 55 // add NULL terminator 56 data_ptr = 0; 57 58 memProxy.writeBlob(array_ptr, &data_ptr, sizeof(AddrType)); 59} 60 61#endif |