From ba84097e38b02b3a213fbfc37f0ee2312ce6aa20 Mon Sep 17 00:00:00 2001 From: Felix Morgner Date: Fri, 20 Feb 2026 12:50:05 +0100 Subject: refactor: simplify error logging --- src/error.S | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'src/error.S') diff --git a/src/error.S b/src/error.S index 50597dd..8075c26 100644 --- a/src/error.S +++ b/src/error.S @@ -3,20 +3,25 @@ #ifndef __STDC_VERSION__ +.section .rodata + + sdl_error_format: .string "%s: %s\n" + .section .text - //! @function _print_sdl_error(char const * format) + //! @function _print_sdl_error(char const * prefix) + //! + //! @param (%rdi) prefix The prefix to be printed in front of the error message function_begin _print_sdl_error - push %rdi sub $8, %rsp + push %rdi call SDL_GetError@PLT - mov %rax, %rsi + mov %rax, %rdx - add $8, %rsp - pop %rdi - + mov (%rsp), %rsi + lea sdl_error_format(%rip), %rdi call printf@PLT function_end -- cgit v1.2.3