Skip to content

Commit a9a7ada

Browse files
committed
Fix GET_DEC/GET_UDEC/GET_HEX macro with esp address expressions
1 parent ea1eeca commit a9a7ada

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

Windows/include/io.inc

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -477,6 +477,8 @@ section .text
477477
section .data
478478
%%tmp dd 0
479479
%%read_tmp dd 0
480+
%%addr_expr_tmp dd 0
481+
%%eax_tmp dd 0
480482

481483
section .text
482484
%%after_data:
@@ -521,6 +523,10 @@ section .text
521523
%error "Incorrect parameter (string)"
522524
%else
523525
; may be, address expression?
526+
mov [%%eax_tmp], eax
527+
lea eax, %2
528+
mov [%%addr_expr_tmp], eax
529+
mov eax, [%%eax_tmp]
524530
pushf
525531
push eax
526532
push ecx
@@ -572,7 +578,7 @@ section .text
572578

573579
%else
574580
; may be, address expression? postprocessing
575-
lea eax, %2
581+
mov eax, [%%addr_expr_tmp]
576582
%if %1 = 1
577583
mov cl, byte [%%read_tmp]
578584
mov byte [eax], cl

Windows/include/io64.inc

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -628,6 +628,8 @@ section .text
628628
section .data
629629
%%read_tmp dq 0
630630
%%tmp dq 0
631+
%%addr_expr_tmp dd 0
632+
%%rax_tmp dd 0
631633
section .text
632634
%%after_data:
633635
IS_GPR %2
@@ -676,6 +678,10 @@ section .text
676678
%else
677679
; may be, address expression?
678680
; we will have to do postprocessing after scanf
681+
mov [%%rax_tmp], rax
682+
lea rax, %2
683+
mov [%%addr_expr_tmp], rax
684+
mov rax, [%%rax_tmp]
679685
pushfq
680686
push rax
681687
push rcx
@@ -743,7 +749,7 @@ section .text
743749
popfq
744750
%else
745751
; may be, address expression? postprocessing
746-
lea rax, %2
752+
mov rax, [%%addr_expr_tmp]
747753
%if %1 = 1
748754
mov cl, byte [%%read_tmp]
749755
mov byte [rax], cl

0 commit comments

Comments
 (0)