Terraspace / UASM

UASM - Macro Assembler
http://www.terraspace.co.uk/uasm.html
Other
220 stars 49 forks source link

Spurious "add RSP, 8" added to code #54

Closed gwoltman closed 7 years ago

gwoltman commented 7 years ago

This is the code:

TITLE   cpuidhlp

_TEXT SEGMENT fpu_init proc mov rax, 1 ret fpu_init ENDP _TEXT ENDS END

Compiling with HJWasm 2.30 with -c and -win64 assembles properly (same as Microsoft's ml64) Compiling with Uasm 2.37 with -c and -win64 assembles as:

public fpu_init _text SEGMENT PARA 'CODE' ; section number 1 fpuinit PROC mov rax, 1 ; 0000 48: C7. C0, 00000001 add rsp, 8 ; 0007 48: 83. C4, 08 ret ; 000B C3 fpu_init ENDP _text ENDS

gwoltman commented 7 years ago

I've added "OPTION PROC:NONE" to my source code. All is well.

john-terraspace commented 7 years ago

I will investigate this one now. The option proc:none workaround should be ok, but with no parameters specified and no locals there should be no reason for the add rsp,8 epilogue to be generated.

From: gwoltman [mailto:notifications@github.com] Sent: 06 July 2017 05:23 PM To: Terraspace/UASM UASM@noreply.github.com Cc: Subscribed subscribed@noreply.github.com Subject: [Terraspace/UASM] Spurious "add RSP, 8" added to code (#54)

This is the code:

TITLE cpuidhlp

_TEXT SEGMENT fpu_init proc mov rax, 1 ret fpu_init ENDP _TEXT ENDS END

Compiling with HJWasm 2.30 with -c and -win64 assembles properly (same as Microsoft's ml64) Compiling with Uasm 2.37 with -c and -win64 assembles as:

public fpu_init _text SEGMENT PARA 'CODE' ; section number 1 fpuinit PROC mov rax, 1 ; 0000 48: C7. C0, 00000001 add rsp, 8 ; 0007 48: 83. C4, 08 ret ; 000B C3 fpu_init ENDP _text ENDS

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/Terraspace/UASM/issues/54 , or mute the thread https://github.com/notifications/unsubscribe-auth/AQGQVEaD6K2ROiSasWyE3lQ0HkC7a_QKks5sLQnigaJpZM4OP34r .

john-terraspace commented 7 years ago

This issue is now fixed in 2.38

The add rsp,8 is correct, it was missing a sub rsp,8 in the prologue to ensure that RSP is always aligned 16.

From: gwoltman [mailto:notifications@github.com] Sent: 06 July 2017 05:23 PM To: Terraspace/UASM UASM@noreply.github.com Cc: Subscribed subscribed@noreply.github.com Subject: [Terraspace/UASM] Spurious "add RSP, 8" added to code (#54)

This is the code:

TITLE cpuidhlp

_TEXT SEGMENT fpu_init proc mov rax, 1 ret fpu_init ENDP _TEXT ENDS END

Compiling with HJWasm 2.30 with -c and -win64 assembles properly (same as Microsoft's ml64) Compiling with Uasm 2.37 with -c and -win64 assembles as:

public fpu_init _text SEGMENT PARA 'CODE' ; section number 1 fpuinit PROC mov rax, 1 ; 0000 48: C7. C0, 00000001 add rsp, 8 ; 0007 48: 83. C4, 08 ret ; 000B C3 fpu_init ENDP _text ENDS

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/Terraspace/UASM/issues/54 , or mute the thread https://github.com/notifications/unsubscribe-auth/AQGQVEaD6K2ROiSasWyE3lQ0HkC7a_QKks5sLQnigaJpZM4OP34r .

gwoltman commented 7 years ago

Fix verified in 2.38 pre-release