Skip to content

Asm:int

INT is an assembly language instruction for x86 processors that generates a software interrupt. It takes the interrupt number formatted as a byte value.

When written in assembly language, the instruction is written like this:

INT X

where X is the software interrupt that should be generated (0-255).

More detail: Interrupt

Linux system call example

.data

message:
    .string "Hello world\n"
    length  = . - message

.text
    .global _start

_start:
#system call 04: sys_write
    movl    $length, %edx
    movl    $message, %ecx
    movl    $1, %ebx
    movl    $4, %eax
    int     $0x80

#system call 01: sys_exit
    movl    $0, %ebx
    movl    $1, %eax
    int     $0x80

아래와 같이 컴파일 한다.

$ as -o main.o main.s
$ ld -s -o a.out main.o

Favorite site