Strange behaviour in assembly language program
Sergey 'DoubleF' Zaharchenko
doublef at tele-kom.ru
Wed Mar 3 06:06:56 PST 2004
On Wed, 3 Mar 2004 06:23:28 +0000
Daniela <dgw at liwest.at> probably wrote:
> In this situation, I can only use a single-byte instruction to push 4 bytes,
> everything else costs me too much space. The only one I know of, is PUSHA,
> but it pushes too many bytes.
Quoting from dev-handbook:
> But assembly language programmers like to shave off cycles. The above
> example requires a call/ret combination. We can eliminate it by
> pushing an extra dword:
>
> open:
> push dword mode
> push dword flags
> push dword path
> mov eax, 5
> push eax ; Or any other dword
> int 80h
> add esp, byte 16
>
> The 5 that we have placed in EAX identifies the kernel function, in
> this case open.
The last time I wrote `push ebp \n mov ebp, esp' the push took 1
byte :). `push <your_favorite_reg>' will work, as the kernel doesn't
really care for the value of the dword.
--
DoubleF
"I'd love to go out with you, but I have to floss my cat."
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-questions/attachments/20040303/1048c97e/attachment.bin
More information about the freebsd-questions
mailing list