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 via email to