From: dtrg Date: Mon, 23 Apr 2007 23:24:03 +0000 (+0000) Subject: Now fetches argc, argv, env correctly from the host OS. X-Git-Tag: release-6-0-pre-2~10 X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=9b920e59cb5d2383997a281b4c6b68e790be7f07;p=ack.git Now fetches argc, argv, env correctly from the host OS. --- diff --git a/plat/linux386/boot.s b/plat/linux386/boot.s index 86ce05b49..1fb7cc561 100644 --- a/plat/linux386/boot.s +++ b/plat/linux386/boot.s @@ -15,7 +15,32 @@ begtext: ! This code is placed at the beginning of the ELF executable and is the ! first thing that runs. - + ! + ! On entry, the stack looks like this: + ! + ! sp+.. NULL + ! sp+8+(4*argc) env (X quads) + ! sp+4+(4*argc) NULL + ! sp+4 argv (argc quads) + ! sp argc + ! + ! The ACK actually expects: + ! + ! sp+8 argc + ! sp+4 argv + ! sp env + + mov eax, (esp) ! eax = argc + lea ebx, 4(esp) ! ebx = argv + lea ecx, (esp)(eax*4) + add ecx, 12 ! environ + + push ecx ! environ + push ebx ! argc + push eax ! argv + push eax ! dummy, representing the return argument + xor ebp, ebp + jmp __m_a_i_n ! This provides an emergency exit routine used by EM.