process.cc (6180:1a8950d566ff) process.cc (6227:a17798f2a52c)
1/*
2 * Copyright (c) 2003-2004 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;

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

95 }
96
97 // Calculate how much space we need for arg & env & auxv arrays.
98 int argv_array_size = intSize * (argv.size() + 1);
99 int envp_array_size = intSize * (envp.size() + 1);
100 int auxv_array_size = intSize * 2 * (auxv.size() + 1);
101
102 int arg_data_size = 0;
1/*
2 * Copyright (c) 2003-2004 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;

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

95 }
96
97 // Calculate how much space we need for arg & env & auxv arrays.
98 int argv_array_size = intSize * (argv.size() + 1);
99 int envp_array_size = intSize * (envp.size() + 1);
100 int auxv_array_size = intSize * 2 * (auxv.size() + 1);
101
102 int arg_data_size = 0;
103 for (int i = 0; i < argv.size(); ++i) {
103 for (vector<string>::size_type i = 0; i < argv.size(); ++i) {
104 arg_data_size += argv[i].size() + 1;
105 }
106 int env_data_size = 0;
104 arg_data_size += argv[i].size() + 1;
105 }
106 int env_data_size = 0;
107 for (int i = 0; i < envp.size(); ++i) {
107 for (vector<string>::size_type i = 0; i < envp.size(); ++i) {
108 env_data_size += envp[i].size() + 1;
109 }
110
111 int space_needed =
112 argv_array_size +
113 envp_array_size +
114 auxv_array_size +
115 arg_data_size +

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

143 panic("Unknown int size");
144
145 initVirtMem->writeBlob(stack_min, (uint8_t*)&argc, intSize);
146
147 copyStringArray(argv, argv_array_base, arg_data_base, initVirtMem);
148 copyStringArray(envp, envp_array_base, env_data_base, initVirtMem);
149
150 //Copy the aux stuff
108 env_data_size += envp[i].size() + 1;
109 }
110
111 int space_needed =
112 argv_array_size +
113 envp_array_size +
114 auxv_array_size +
115 arg_data_size +

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

143 panic("Unknown int size");
144
145 initVirtMem->writeBlob(stack_min, (uint8_t*)&argc, intSize);
146
147 copyStringArray(argv, argv_array_base, arg_data_base, initVirtMem);
148 copyStringArray(envp, envp_array_base, env_data_base, initVirtMem);
149
150 //Copy the aux stuff
151 for(int x = 0; x < auxv.size(); x++)
152 {
151 for (vector<auxv_t>::size_type x = 0; x < auxv.size(); x++) {
153 initVirtMem->writeBlob(auxv_array_base + x * 2 * intSize,
154 (uint8_t*)&(auxv[x].a_type), intSize);
155 initVirtMem->writeBlob(auxv_array_base + (x * 2 + 1) * intSize,
156 (uint8_t*)&(auxv[x].a_val), intSize);
157 }
158
159 ThreadContext *tc = system->getThreadContext(contextIds[0]);
160

--- 67 unchanged lines hidden ---
152 initVirtMem->writeBlob(auxv_array_base + x * 2 * intSize,
153 (uint8_t*)&(auxv[x].a_type), intSize);
154 initVirtMem->writeBlob(auxv_array_base + (x * 2 + 1) * intSize,
155 (uint8_t*)&(auxv[x].a_val), intSize);
156 }
157
158 ThreadContext *tc = system->getThreadContext(contextIds[0]);
159

--- 67 unchanged lines hidden ---