diff options
author | Gabe Black <gblack@eecs.umich.edu> | 2007-03-05 11:00:44 +0000 |
---|---|---|
committer | Gabe Black <gblack@eecs.umich.edu> | 2007-03-05 11:00:44 +0000 |
commit | 6a19b64de2044e5b166a9883be6531166cd69900 (patch) | |
tree | e463581d5611ac0a2223a292cc4d1231f3de6b1f /src/sim/process.hh | |
parent | 5498d5298577c07189ff3f7026eba5c1ee09cc1b (diff) | |
parent | ba042842c61339e33c0b684f9854e8fe818160fe (diff) | |
download | gem5-6a19b64de2044e5b166a9883be6531166cd69900.tar.xz |
Merge zizzer.eecs.umich.edu:/bk/newmem
into ahchoo.blinky.homelinux.org:/home/gblack/m5/newmem-x86
--HG--
extra : convert_revision : b585cea2221377eb2fceea8976c46a17c0034f51
Diffstat (limited to 'src/sim/process.hh')
-rw-r--r-- | src/sim/process.hh | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/src/sim/process.hh b/src/sim/process.hh index 1226db81b..dd64fa607 100644 --- a/src/sim/process.hh +++ b/src/sim/process.hh @@ -41,9 +41,11 @@ #if !FULL_SYSTEM +#include <string> #include <vector> #include "base/statistics.hh" +#include "mem/translating_port.hh" #include "sim/host.hh" #include "sim/sim_object.hh" @@ -58,9 +60,27 @@ namespace TheISA class RemoteGDB; } +//This needs to be templated for cases where 32 bit pointers are needed. +template<class AddrType> void -copyStringArray(std::vector<std::string> &strings, Addr array_ptr, - Addr data_ptr, TranslatingPort* memPort, int ptr_size = sizeof(Addr)); +copyStringArray(std::vector<std::string> &strings, + AddrType array_ptr, AddrType data_ptr, + TranslatingPort* memPort) +{ + AddrType data_ptr_swap; + for (int i = 0; i < strings.size(); ++i) { + data_ptr_swap = htog(data_ptr); + memPort->writeBlob(array_ptr, (uint8_t*)&data_ptr_swap, + sizeof(AddrType)); + memPort->writeString(data_ptr, strings[i].c_str()); + array_ptr += sizeof(AddrType); + data_ptr += strings[i].size() + 1; + } + // add NULL terminator + data_ptr = 0; + + memPort->writeBlob(array_ptr, (uint8_t*)&data_ptr, sizeof(AddrType)); +} class Process : public SimObject { |