News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

Stack misaligned

Started by mineiro, April 22, 2022, 07:33:05 AM

Previous topic - Next topic

mineiro

Hello sir John;
How are you? I hope fine.
Symptom: Stack misaligned using invoke in procedures "buffer_insert_text" and "control_g".
Test: If the first two invokes in the first two procedures are commented out then the stack in later functions aligns to multiples of 16 and works ok.
This is why I included them in this test case, same functions in different procedures are conflicting.
Before refining this test case, I noticed that the listing while assembling was generating correct opcodes but the resulting object file was stack misaligned.
In this test case the listing (opcodes) is a bit ghost. Could you take a look, please? Thank you in advance.


;uasm -elf64 main.asm
.X64
gpointer typedef qword
gint typedef dword

gtk_list_store_set proto :vararg
gtk_tree_model_get proto :vararg

GtkTreeIter struct   sizeof gpointer
stamp       gint     0
user_data   gpointer 0
user_data2  gpointer 0
user_data3  gpointer 0
GtkTreeIter ends   

.DATA   

WedgNewProject_iter GtkTreeIter    <>

.CODE


add_to_WTVListTemplate PROC _str:gpointer ,_Desc:gpointer, _FulFile:gpointer
local store:gpointer
local l_str:gpointer
local l_Desc:gpointer
local l_FulFile:gpointer
        invoke gtk_list_store_set,store, addr WedgNewProject_iter, 0, l_str,1,l_Desc,2,l_FulFile, -1
RET
add_to_WTVListTemplate ENDP

on_WTVListTemplatechanged proc
local lTreeModel:gpointer
local lTreeIter:GtkTreeIter
local lValue:gpointer
local lDesc:gpointer
local lFile:gpointer
        invoke gtk_tree_model_get,lTreeModel, addr lTreeIter,0,addr lValue,1,addr lDesc,2,addr lFile,-1
ret
on_WTVListTemplatechanged endp 

buffer_insert_text PROC
local _store:gpointer
local tree_iter:GtkTreeIter
    invoke gtk_list_store_set,_store,addr tree_iter,0,CStr("File"),-1
ret
buffer_insert_text ENDP


control_g PROC
local model:gpointer
local iter:gpointer
local value:gpointer
    invoke gtk_tree_model_get,model,addr iter,0,addr value,-1
ret
control_g ENDP

end

ps: tested with uasm v2.50 and 2.55
I'd rather be this ambulant metamorphosis than to have that old opinion about everything

johnsa

I'll have a look at this. Could you possibly add this to Github issues page ? - if not I can create an issue for it. Thanks!

mineiro

Unfortunately I don't have a github account, sorry to say that I can't post an issue.
Thanks.
I'd rather be this ambulant metamorphosis than to have that old opinion about everything