MCPcopy Create free account
hub / github.com/GJDuck/e9patch / push

Method push

src/e9tool/e9metadata.cpp:248–275  ·  view source on GitHub ↗

* Emulate a register push. */

Source from the content-addressed store, hash-verified

246 * Emulate a register push.
247 */
248 void push(Register reg, bool caller_save = false)
249 {
250 reg = getCanonicalReg(reg);
251 assert(getInfo(reg) == nullptr);
252
253 intptr_t reg_offset = 0;
254 switch (reg)
255 {
256 case REGISTER_FLAGS:
257 rsp_offset += sizeof(int64_t);
258 reg_offset = rsp_offset;
259 break;
260 case REGISTER_RSP:
261 reg_offset = RSP_SLOT;
262 break;
263 case REGISTER_RIP:
264 reg_offset = RIP_SLOT;
265 break;
266 default:
267 rsp_offset += getRegSize(reg);
268 reg_offset = rsp_offset;
269 }
270 RegInfo rinfo(reg_offset, getRegSize(reg), (int)pushed.size());
271 rinfo.saved = true;
272 rinfo.caller_save = caller_save;
273 info.insert({reg, rinfo});
274 pushed.push_back(reg);
275 }
276
277 /*
278 * Emulate the call.

Callers 1

sendSaveRegToStackFunction · 0.45

Calls 3

getCanonicalRegFunction · 0.85
getRegSizeFunction · 0.85
sizeMethod · 0.45

Tested by

no test coverage detected