From f10b2f3c88f50a5e2b6fe4a23d6e446878b40b72 Mon Sep 17 00:00:00 2001 From: Kwarde Date: Tue, 24 Jun 2025 15:06:21 +0200 Subject: [PATCH] Save/restore rdi to r10 instead of stack in strcat(),puts() --- console.asm | 6 ++---- string.asm | 6 ++---- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/console.asm b/console.asm index 27649b9..77a16f1 100644 --- a/console.asm +++ b/console.asm @@ -27,11 +27,9 @@ puts: push rbp mov rbp, rsp - push rdi - sub rsp, 8 + mov r10, rdi call print - add rsp, 8 - pop rdi + mov rdi, r10 mov rax, 1 mov rdi, 1 mov rsi, NL diff --git a/string.asm b/string.asm index aa17097..ce91a5a 100644 --- a/string.asm +++ b/string.asm @@ -54,13 +54,11 @@ strcat: push rbp mov rbp, rsp - push rdi - sub rsp, 8 + mov r10, rdi call strlen add rdi, rax call strcpy - add rsp, 8 - pop rax + mov rax, r10 leave ret