Skip to content

Instantly share code, notes, and snippets.

@selfsigned
Last active April 27, 2023 15:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save selfsigned/3c48bdfa5e51f4898017a92865853d1a to your computer and use it in GitHub Desktop.
Save selfsigned/3c48bdfa5e51f4898017a92865853d1a to your computer and use it in GitHub Desktop.
00105b24 <syscall_handler>:
105b24: 55 push %ebp
105b25: 89 e5 mov %esp,%ebp
105b27: 51 push %ecx
105b28: 52 push %edx
105b29: 50 push %eax
105b2a: 83 e4 f0 and $0xfffffff0,%esp
105b2d: 83 ec 40 sub $0x40,%esp
105b30: 8d 45 04 lea 0x4(%ebp),%eax
105b33: 89 44 24 2c mov %eax,0x2c(%esp)
105b37: 8b 44 24 2c mov 0x2c(%esp),%eax
105b3b: 8b 00 mov (%eax),%eax
105b3d: c7 44 24 32 00 00 00 movl $0x0,0x32(%esp)
105b44: 00
105b45: c7 44 24 36 00 00 00 movl $0x0,0x36(%esp)
105b4c: 00
105b4d: c7 44 24 3a 00 00 00 movl $0x0,0x3a(%esp)
105b54: 00
105b55: 66 c7 44 24 3e 00 00 movw $0x0,0x3e(%esp)
105b5c: c6 44 24 32 03 movb $0x3,0x32(%esp)
105b61: 83 ec 08 sub $0x8,%esp
105b64: 50 push %eax
105b65: 68 e4 fc 10 00 push $0x10fce4
105b6a: 83 ec 10 sub $0x10,%esp
105b6d: 89 e0 mov %esp,%eax
105b6f: 8b 54 24 52 mov 0x52(%esp),%edx
105b73: 89 10 mov %edx,(%eax)
105b75: 8b 54 24 56 mov 0x56(%esp),%edx
105b79: 89 50 04 mov %edx,0x4(%eax)
105b7c: 8b 54 24 5a mov 0x5a(%esp),%edx
105b80: 89 50 08 mov %edx,0x8(%eax)
105b83: 0f b7 54 24 5e movzwl 0x5e(%esp),%edx
105b88: 66 89 50 0c mov %dx,0xc(%eax)
105b8c: fc cld
105b8d: e8 55 d6 ff ff call 1031e7 <vga_printf>
105b92: 83 c4 20 add $0x20,%esp
105b95: 90 nop
105b96: 8d 65 f4 lea -0xc(%ebp),%esp
105b99: 58 pop %eax
105b9a: 5a pop %edx
105b9b: 59 pop %ecx
105b9c: 5d pop %ebp
105b9d: cf iret
typedef struct __attribute__((packed)) int_frame {
// used for syscalls
uint32_t eax;
uint32_t code;
uint32_t eip;
uint32_t cs;
uint32_t eflags;
uint32_t sp;
uint32_t ss;
} int_frame;
#define INTERRUPT \
__attribute__((target("general-regs-only"))) __attribute__((interrupt))
INTERRUPT static void syscall_handler(int_frame *frame) {
DEBUG_MSG("INT 0x80 (syscall) called with eax %u", frame->eax);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment