public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: Florian Michel <florian__michel@web.de>
To: gcc-help@gcc.gnu.org
Subject: AMD 64 Problem with assembling
Date: Sat, 09 Jul 2005 21:23:00 -0000	[thread overview]
Message-ID: <285526835@web.de> (raw)


Hello,

I have a question concerning successfully assembling and linking the following assembly program on a linux AMD 64 machine:

#cpuid2.s View the CPUID Vendor ID string using C library calls
.section .datatext
output:
.asciz "The processor Vendor ID is '%s'\n"
.section .bss
.lcomm buffer, 12
.section .text
.globl main
main:
movl $0, %eax
cpuid
movl $buffer, %edi
movl %ebx, (%edi)
movl %edx, 4(%edi)
movl %ecx, 8(%edi)
push $buffer
push $output
call printf
addl $8, %esp
push $0
call exit

This part of a book on assembly programming I am reading.

Compile and Link: gcc -o cpuid2 cpuid2.s
When running cpuid2 it crashes with a segmentation fault.
Which switches do I have to add to call gcc?

Thanks a lot!

Greetings,
Florian

             reply	other threads:[~2005-07-09 21:23 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-07-09 21:23 Florian Michel [this message]
2005-07-10 16:29 ` Ian Lance Taylor

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=285526835@web.de \
    --to=florian__michel@web.de \
    --cc=gcc-help@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).