Code-Schnipsel VI


In welcher Sprache wurde dieses Hallo Welt verfasst?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# Kompilieren mit "as -o hallo.o hallo.s; ld -o hallo hallo.o"
   .section .data
  s: .ascii "Hallo Welt!\n"
   .section .text
   .globl _start
  _start:
   movl $4,%eax      
# Syscall-ID 4 (= __NR_write)
   movl $1,%ebx      
# Ausgabe-Filedeskriptor STDOUT (= 1)
   movl $s,%ecx      
# Adresse des ersten Zeichens der Zeichenkette
   movl $12,%edx    
# Länge der Zeichenkette (12 Zeichen)
   int $0x80        
# Softwareinterrupt 0x80 um Syscall (write(1,s,12))auszuführen
   movl $1,%eax      
# Syscall-ID 1 (= __NR_exit)
   movl $0,%ebx      
# Rückgabewert 0 (= alles ok)
   int $0x80        
# Softwareinterrupt 0x80 um Syscall (exit(0)) auszuführen
Artikel teilen:
  • Add to favorites
  • email
  • Twitter
  • Posterous
  • Facebook
  • FriendFeed
  • Google Bookmarks
  • Digg
  • del.icio.us
  • Tumblr
  • Identi.ca
  • Webnews.de
  1. #1 von chrugail am Mai 30, 2009 - 01:45

    Als Hinweis:
    Linux, x86-Prozessor

  2. #2 von chrugail am Juni 6, 2009 - 13:29

    Assembler natürlich..

(wird nicht veröffentlicht)


Get Adobe Flash playerPlugin by wpburn.com wordpress themes