aboutsummaryrefslogtreecommitdiff
path: root/src/error.S
blob: 8075c2612f94a5f796e5546304605a62fd8bb14b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#include "helpers/function.S"
#include "SDL/error.S"

#ifndef __STDC_VERSION__

.section .rodata

  sdl_error_format: .string "%s: %s\n"

.section .text

  //! @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

    sub $8, %rsp
    push %rdi
 
    call SDL_GetError@PLT
    mov %rax, %rdx
 
    mov (%rsp), %rsi
    lea sdl_error_format(%rip), %rdi
    call printf@PLT

  function_end

#endif