Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does "int 0x80" mean in assembly code?

Tags:

x86

assembly

Can someone explain what the following assembly code does?

 int 0x80   
like image 739
Josh Curren Avatar asked Nov 30 '09 02:11

Josh Curren


People also ask

What does int 0x80 do in assembly?

int 0x80 Definition int 0x80 is the assembly language instruction that is used to invoke system calls in Linux on x86 (i.e., Intel-compatible) processors. An assembly language is a human-readable notation for the machine language that a specific type of processor (also called a central processing unit or CPU) uses.

What does int mean in assembly?

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).

What is syscall int 0x80?

sysenter is an instruction most frequently used to invoke system calls in 32 bit modes of operation. It is similar to syscall , a bit more difficult to use though, but that is the kernel's concern. int 0x80 is a legacy way to invoke a system call and should be avoided.

What is the EAX register?

EAX register, a 32-bit processor register of x86 CPUs. Environmental Audio Extensions, a number of digital signal processing presets for audio, found in Sound Blaster sound cards.


1 Answers

int means interrupt, and the number 0x80 is the interrupt number. An interrupt transfers the program flow to whomever is handling that interrupt, which is interrupt 0x80 in this case. In Linux, 0x80 interrupt handler is the kernel, and is used to make system calls to the kernel by other programs.

The kernel is notified about which system call the program wants to make, by examining the value in the register %eax (AT&T syntax, and EAX in Intel syntax). Each system call have different requirements about the use of the other registers. For example, a value of 1 in %eax means a system call of exit(), and the value in %ebx holds the value of the status code for exit().

like image 133
Polat Tuzla Avatar answered Sep 18 '22 04:09

Polat Tuzla