Created
July 8, 2011 14:56
Revisions
-
softboysxp created this gist
Jul 8, 2011 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,36 @@ # cpuid.s # An x86_64 OS X port of the cpuid example found in Ch. 4 of Professional Assembly Language # # $ as -o cpuid.o cpuid.s # $ ld -o cpuid cpuid.o # $ ./cpuid # GenuineIntel # $ .data output: .asciz "\0\0\0\0\0\0\0\0\0\0\0\0\n" len: .long len - output .text .globl start start: xor %rax, %rax cpuid leaq output(%rip), %rsi movl %ebx, (%esi) movl %edx, 4(%esi) movl %ecx, 8(%esi) movq len(%rip), %rdx # leaq output(%rip), %rsi # %rsi already contains address of output movq $0x1, %rdi # STDOUT movq $0x02000004, %rax # write syscall movq $0x0, %rdi movq $0x02000001, %rax # exit syscall