| 2168 | } |
| 2169 | |
| 2170 | bool Executor::ExtendParameterStack(char* oldBase, unsigned int oldSize, VMCmd *current) |
| 2171 | { |
| 2172 | // printf("Old base: %p-%p\r\n", oldBase, oldBase + oldSize); |
| 2173 | // printf("New base: %p-%p\r\n", genParams.data, genParams.data + genParams.max); |
| 2174 | |
| 2175 | SetUnmanagableRange(genParams.data, genParams.max); |
| 2176 | |
| 2177 | NULLC::MarkMemory(1); |
| 2178 | |
| 2179 | ExPriv::oldBase = oldBase; |
| 2180 | ExPriv::newBase = genParams.data; |
| 2181 | ExPriv::oldSize = oldSize; |
| 2182 | |
| 2183 | symbols = exLinker->exSymbols.data; |
| 2184 | |
| 2185 | ExternVarInfo *vars = exLinker->exVariables.data; |
| 2186 | ExternTypeInfo *types = exLinker->exTypes.data; |
| 2187 | // Fix global variables |
| 2188 | for(unsigned int i = 0; i < exLinker->exVariables.size(); i++) |
| 2189 | FixupVariable(genParams.data + vars[i].offset, types[vars[i].type]); |
| 2190 | |
| 2191 | int offset = exLinker->globalVarSize; |
| 2192 | int n = 0; |
| 2193 | fcallStack.push_back(current); |
| 2194 | // Fixup local variables |
| 2195 | for(; n < (int)fcallStack.size(); n++) |
| 2196 | { |
| 2197 | int address = int(fcallStack[n]-cmdBase); |
| 2198 | int funcID = -1; |
| 2199 | |
| 2200 | int debugMatch = 0; |
| 2201 | for(unsigned int i = 0; i < exFunctions.size(); i++) |
| 2202 | { |
| 2203 | if(address >= exFunctions[i].address && address < (exFunctions[i].address + exFunctions[i].codeSize)) |
| 2204 | { |
| 2205 | funcID = i; |
| 2206 | debugMatch++; |
| 2207 | } |
| 2208 | } |
| 2209 | assert(debugMatch < 2); |
| 2210 | |
| 2211 | if(funcID != -1) |
| 2212 | { |
| 2213 | int alignOffset = (offset % 16 != 0) ? (16 - (offset % 16)) : 0; |
| 2214 | // printf("In function %s (with offset of %d)\r\n", symbols + exFunctions[funcID].offsetToName, alignOffset); |
| 2215 | offset += alignOffset; |
| 2216 | |
| 2217 | unsigned int offsetToNextFrame = exFunctions[funcID].bytesToPop; |
| 2218 | // Check every function local |
| 2219 | for(unsigned int i = 0; i < exFunctions[funcID].localCount; i++) |
| 2220 | { |
| 2221 | // Get information about local |
| 2222 | ExternLocalInfo &lInfo = exLinker->exLocals[exFunctions[funcID].offsetToFirstLocal + i]; |
| 2223 | if(exFunctions[funcID].funcCat == ExternFuncInfo::COROUTINE && lInfo.offset >= exFunctions[funcID].bytesToPop) |
| 2224 | break; |
| 2225 | // printf("Local %s %s (with offset of %d+%d)\r\n", symbols + types[lInfo.type].offsetToName, symbols + lInfo.offsetToName, offset, lInfo.offset); |
| 2226 | FixupVariable(genParams.data + offset + lInfo.offset, types[lInfo.type]); |
| 2227 | if(lInfo.offset + lInfo.size > offsetToNextFrame) |
nothing calls this directly
no test coverage detected