flat assembler
Message board for the users of flat assembler.

Index > Linux > sub rsp,16 vs sub esp,16

Author
Thread Post new topic Reply to topic
mattst88



Joined: 12 May 2006
Posts: 260
Location: South Carolina
mattst88 16 May 2007, 01:23
When allocating space on the stack, is it safe to use sub esp,16? Is there a chance for over/underflow?

The benefit is that it is one byte smaller.

_________________
My x86 Instruction Reference -- includes SSE, SSE2, SSE3, SSSE3, SSE4 instructions.
Assembly Programmer's Journal
Post 16 May 2007, 01:23
View user's profile Send private message Visit poster's website Reply with quote
Feryno



Joined: 23 Mar 2005
Posts: 514
Location: Czech republic, Slovak republic
Feryno 16 May 2007, 08:07
Hello mattst88
on my Fedora Core 3 x64 and kernel 2.6.xx.xx (I can't remember exactly the number now) the stack is usally above 100000000h (I think it is something like 00007FFFFFFFFxxxh) so every subtraction from ESP causes destroying the upper dword of rsp and losing the stack pointer completely.
Perhaps in your Linux it doesn't matter, but my personal suggestion is to use RSP for keeping compactibility between various kernels and configurations.
Post 16 May 2007, 08:07
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
mattst88



Joined: 12 May 2006
Posts: 260
Location: South Carolina
mattst88 16 May 2007, 13:28
OK, I'll stick with rsp. Smile

Thanks for your reply.
Post 16 May 2007, 13:28
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.