about execute assembly exapmles under freebsd

From: HHCHANG (b8701143_at_tmu.edu.tw)
Date: 04/24/05

  • Next message: Scott Mitchell: "Re: region code in cdrecord"
    To: <freebsd-hackers@freebsd.org>
    Date: Sun, 24 Apr 2005 16:15:12 +0800
    
    

    Hi,
    I couldn't execute assembly example under freebsd .
    The environment and tools I used were (in IBM X31 box):
    1.
    bash-2.05b# uname -a
    FreeBSD sexbear.localhost 5.3-STABLE FreeBSD 5.3-STABLE #3: Sun Feb 20 21:55:06 UTC 2005 ?root@sexbear.localhost:/usr/obj/usr/src/sys/SEXBEAR??i386
    2.
    bash-2.05b# as -v
    GNU assembler version 2.15 [FreeBSD] 2004-05-23 (i386-obrien-freebsd) using BFD version 2.15 [FreeBSD] 2004-05-23

    bash-2.05b# ld -v
    GNU ld version 2.15 [FreeBSD] 2004-05-23

    3.(compile and execute the example)
    bash-2.05b#
      as -gstabs -o cpuid.o cpuid.s
      ld -o cpuid cpuid.o
      cpuid (no output after executing the program)
      gdb cpuid
      (gdb) run
      Starting program: /usr/local/src/code/chap04/cpuid
      Program exited with code 0340.
      (gdb) break *_start
      (gdb) run
      Program exited with code 0340.
    ###################example in book###################################
    #cpuid.s Sample program to extract the processor Vendor ID
    .section .data
    output:
       .ascii "The processor Vendor ID is 'xxxxxxxxxxxx'\n"
    .section .text
    .globl _start
    _start:
       movl $0, %eax
       cpuid
       movl $output, %edi
       movl %ebx, 28(%edi)
       movl %edx, 32(%edi)
       movl %ecx, 36(%edi)
       movl $4, %eax
       movl $1, %ebx
       movl $output, %ecx
       movl $42, %edx
       int $0x80
       movl $1,
       %eax
       movl $0, %ebx
       int $0x80

    ###################example in book###################################

    I viewed the tutorial: http://www.int80h.org/bsdasm/.
    but I couldn't find any syntax error in the program.
    Could someone give me a hint where I could find the more information?
    Thanks~

    Regards,
    _______________________________________________
    freebsd-hackers@freebsd.org mailing list
    http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
    To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org"


  • Next message: Scott Mitchell: "Re: region code in cdrecord"

    Relevant Pages

    • about execute assembly exapmles under freebsd
      ... I couldn't execute assembly example under freebsd. ... cpuid ... gdb cpuid ...
      (freebsd-hackers)
    • Re: about execute assembly exapmles under freebsd
      ... FreeBSD by default arguments must be pushed in the stack. ... >I couldn't execute assembly example under freebsd. ... > ld -o cpuid cpuid.o ... > gdb cpuid ...
      (freebsd-hackers)
    • Re: x
      ... > well i use freebsd 5.3 i installed xorg and kde. ... > connect Xserver i execute kdm or xdm and it appear welcome freebsd ... > there are two desktop xterm and kde and i canīt work. ... Is the command 'startkde' in the .xinitrc file in your home directory? ...
      (freebsd-questions)
    • Re: chmod 111
      ... you can execute binaries even if the read permission is not ... Note that I said "binaries". ... GNU gdb 6.4-debian ...
      (Linux-Kernel)
    • Re: metapost or something? Coordinate system - transformation with cosine...
      ... types or functions declared in in other header files, ... Program received signal EXC_BAD_ACCESS, Could not access memory. ... tried to execute `3dldf'? ...
      (comp.text.tex)