process.cc (11386:94c09b607a84) process.cc (11389:1e55f16160cb)
1/*
2 * Copyright (c) 2004-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;

--- 64 unchanged lines hidden (view full) ---

73}
74
75template<class IntType>
76void
77MipsLiveProcess::argsInit(int pageSize)
78{
79 int intSize = sizeof(IntType);
80
1/*
2 * Copyright (c) 2004-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;

--- 64 unchanged lines hidden (view full) ---

73}
74
75template<class IntType>
76void
77MipsLiveProcess::argsInit(int pageSize)
78{
79 int intSize = sizeof(IntType);
80
81 // Patch the ld_bias for dynamic executables.
82 updateBias();
83
81 // load object file into target memory
82 objFile->loadSections(initVirtMem);
83
84 typedef AuxVector<IntType> auxv_t;
85 std::vector<auxv_t> auxv;
86
87 ElfObject * elfObject = dynamic_cast<ElfObject *>(objFile);
88 if (elfObject)

--- 6 unchanged lines hidden (view full) ---

95 // address of the program header tables if they appear in the
96 // executable image.
97 auxv.push_back(auxv_t(M5_AT_PHDR, elfObject->programHeaderTable()));
98 DPRINTF(Loader, "auxv at PHDR %08p\n", elfObject->programHeaderTable());
99 // This is the size of a program header entry from the elf file.
100 auxv.push_back(auxv_t(M5_AT_PHENT, elfObject->programHeaderSize()));
101 // This is the number of program headers from the original elf file.
102 auxv.push_back(auxv_t(M5_AT_PHNUM, elfObject->programHeaderCount()));
84 // load object file into target memory
85 objFile->loadSections(initVirtMem);
86
87 typedef AuxVector<IntType> auxv_t;
88 std::vector<auxv_t> auxv;
89
90 ElfObject * elfObject = dynamic_cast<ElfObject *>(objFile);
91 if (elfObject)

--- 6 unchanged lines hidden (view full) ---

98 // address of the program header tables if they appear in the
99 // executable image.
100 auxv.push_back(auxv_t(M5_AT_PHDR, elfObject->programHeaderTable()));
101 DPRINTF(Loader, "auxv at PHDR %08p\n", elfObject->programHeaderTable());
102 // This is the size of a program header entry from the elf file.
103 auxv.push_back(auxv_t(M5_AT_PHENT, elfObject->programHeaderSize()));
104 // This is the number of program headers from the original elf file.
105 auxv.push_back(auxv_t(M5_AT_PHNUM, elfObject->programHeaderCount()));
106 // This is the base address of the ELF interpreter; it should be
107 // zero for static executables or contain the base address for
108 // dynamic executables.
109 auxv.push_back(auxv_t(M5_AT_BASE, getBias()));
103 //The entry point to the program
104 auxv.push_back(auxv_t(M5_AT_ENTRY, objFile->entryPoint()));
105 //Different user and group IDs
106 auxv.push_back(auxv_t(M5_AT_UID, uid()));
107 auxv.push_back(auxv_t(M5_AT_EUID, euid()));
108 auxv.push_back(auxv_t(M5_AT_GID, gid()));
109 auxv.push_back(auxv_t(M5_AT_EGID, egid()));
110 }

--- 61 unchanged lines hidden (view full) ---

172 }
173
174 ThreadContext *tc = system->getThreadContext(contextIds[0]);
175
176 setSyscallArg(tc, 0, argc);
177 setSyscallArg(tc, 1, argv_array_base);
178 tc->setIntReg(StackPointerReg, stack_min);
179
110 //The entry point to the program
111 auxv.push_back(auxv_t(M5_AT_ENTRY, objFile->entryPoint()));
112 //Different user and group IDs
113 auxv.push_back(auxv_t(M5_AT_UID, uid()));
114 auxv.push_back(auxv_t(M5_AT_EUID, euid()));
115 auxv.push_back(auxv_t(M5_AT_GID, gid()));
116 auxv.push_back(auxv_t(M5_AT_EGID, egid()));
117 }

--- 61 unchanged lines hidden (view full) ---

179 }
180
181 ThreadContext *tc = system->getThreadContext(contextIds[0]);
182
183 setSyscallArg(tc, 0, argc);
184 setSyscallArg(tc, 1, argv_array_base);
185 tc->setIntReg(StackPointerReg, stack_min);
186
180 tc->pcState(objFile->entryPoint());
187 tc->pcState(getStartPC());
181}
182
183
184MipsISA::IntReg
185MipsLiveProcess::getSyscallArg(ThreadContext *tc, int &i)
186{
187 assert(i < 6);
188 return tc->readIntReg(FirstArgumentReg + i++);

--- 23 unchanged lines hidden ---
188}
189
190
191MipsISA::IntReg
192MipsLiveProcess::getSyscallArg(ThreadContext *tc, int &i)
193{
194 assert(i < 6);
195 return tc->readIntReg(FirstArgumentReg + i++);

--- 23 unchanged lines hidden ---