BHXSpecter

Untitled

Dec 5th, 2011
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ;  Executable name : EATSYSCALL
  2. ; Version : 1.0
  3. ; created date: 1/7/2009
  4. ; last update: 1/7/2009
  5. ; Description : A simple assembly app for Linux, using NASM 2.05,
  6. ;              demonstrating the use of Linux INT 80H syscalls
  7. ;           to display text.
  8. ;
  9. ;  Build using these commands:
  10. ;   nasm -f elf -g -F stabs eatsyscall.asm
  11. ;   ld -o eatsyscall eatsyscall.o
  12. ;
  13.  
  14. SECTION .data   ; Section containing intialized data
  15.    
  16. EatMsg: db "Eat at Joe's!", 10
  17. EatLen: equ $-EatMsg
  18.  
  19. SECTION .bss     ; Section containing uninitialized data
  20. SECTION .text     ; Section containing code
  21.  
  22. global _start         ; Linker needs this to find the entry point!
  23.  
  24. _start:
  25.         nop                  ; This no-op keeps gdb happy (see text)
  26.         mov eax, 4       ; Specify sys_write syscall
  27.         mov ebx, 1       ; specify file descriptor 1: Standard Output
  28.         mov ecx, EatMsg   ; pass offset of the message
  29.         mov edx, EatLen    ; pass the length of the message
  30.         int 80H                    ; make syscall to output the text to stdout
  31.        
  32.         mov eax, 1             ; Specify exit syscall
  33.         mov ebx, 0             ; return a code of zero
  34.         int 80H                    ; make syscall to terminate the program
  35.  
Advertisement
Add Comment
Please, Sign In to add comment