diff options
| Commit | 07e489dc05a71fc5d96478c02a64ff93f7279551 (patch) | |
|---|---|---|
| Author | 2020-12-19 15:38:35 +0200 | |
| Committer | 2020-12-19 15:38:35 +0200 | |
| Files | a9849f590180dfa72a3faa921b6fa379747292f1 | |
| IPL-07e489dc05a71fc5d96478c02a64ff93f7279551.tar IPL-07e489dc05a71fc5d96478c02a64ff93f7279551.tar.gz IPL-07e489dc05a71fc5d96478c02a64ff93f7279551.zip | ||
| Parent | 366b31402d3596300be0ef33da6c2dfd3f3054dc (diff) | |
Fix usage of registers in assembler demo
1 files changed, 7 insertions, 3 deletions
| -rw-r--r-- | demo/asm/add_answer.asm | 10 |
diff --git a/demo/asm/add_answer.asm b/demo/asm/add_answer.asm index 2864c3c..3bcda83 100644 --- a/demo/asm/add_answer.asm +++ b/demo/asm/add_answer.asm @@ -19,12 +19,16 @@ add_answer: push rcx
push rdx
push rsi
-; Handle Win64 calling convention
+; "Handle" Win64 calling convention
; push rdi ; used by System V
push rcx ; used by Win64
push 1
mov rdi, rsp
+ ; Make sure that we commit the stack space we are going to use with the
+ ; registers
+ sub rsp, 24
+
mov [rdi - 8], byte 42
mov r8, [rdi + 8]
@@ -33,9 +37,9 @@ add_answer: mov rcx, r8
add rcx, r9
- mov [rdi + 16], rcx
+ mov [rdi - 16], rcx
- mov eax, [rdi + 16]
+ mov eax, [rdi - 16]
mov rsp, r15
pop r15
pop rbp
|
