# ;; arch.s # retrieve the architecture from uname(2) # #include .file "arch.s" .data _eoln: .string "\n" utsname: sysname: .space 65,0 nodename: .space 65,0 release: .space 65,0 version: .space 65,0 machine: .space 65,0 domainname: .space 65,0 .text .globl arch # first argument goes into %rdi == ptr to 6 quads... # each of the quads should receive memory pointer --- but let's see! arch: lea utsname,%rdi # use utsname to store the result of uname(2) --- read the man page # to see what is being done mov $__NR_uname,%rax # syscall is uname syscall lea machine,%rsi # mov $1,%rdi call writestr lea _eoln,%rsi # now put an end-of-line mov $1,%rdi call writestr mov $0, %rdi # and exit with a zero status mov $__NR_exit,%rax # syscall = 60 is exit syscall