diff options
| author | ptitSeb <sebastien.chev@gmail.com> | 2021-04-05 16:47:26 +0200 |
|---|---|---|
| committer | ptitSeb <sebastien.chev@gmail.com> | 2021-04-05 16:47:26 +0200 |
| commit | a9d633ab2d7b7b8a8101d5a0e693d008804614f5 (patch) | |
| tree | ffd12b3ce7c8340ecd98089b03244d2e10fc1714 | |
| parent | 765a9d8325a27f5bde4085147aee287abc32b28c (diff) | |
| download | box64-a9d633ab2d7b7b8a8101d5a0e693d008804614f5.tar.gz box64-a9d633ab2d7b7b8a8101d5a0e693d008804614f5.zip | |
Fixed _start preparation
| -rwxr-xr-x | src/main.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/src/main.c b/src/main.c index d85bdcad..c843544f 100755 --- a/src/main.c +++ b/src/main.c @@ -1025,14 +1025,11 @@ int main(int argc, const char **argv, const char **env) { // emulate! printf_log(LOG_DEBUG, "Start x64emu on Main\n"); - SetRSI(emu, my_context->argc); - SetRDX(emu, (uint64_t)my_context->argv); - SetRCX(emu, (uint64_t)my_context->envv); + // Stack is ready, with stacked: NULL env NULL argv argc SetRIP(emu, my_context->ep); - PushExit(emu); - //*(uint64_t*)GetRSP(emu) = my_context->argc; - Push64(emu, my_context->argc); ResetFlags(emu); + PushExit(emu); // push to pop it just after + SetRDX(emu, Pop64(emu)); // RDX is exit function Run(emu, 0); // Get EAX int ret = GetEAX(emu); |