# ;; 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,%ebx # use utsname to store the result of uname(2) --- read the man page # to see what is being done mov $__NR_uname,%eax # syscall is uname int $0x80 lea machine,%ecx # mov $1,%ebx call writestr lea _eoln,%ecx # now put an end-of-line mov $1,%ebx call writestr mov $0, %ebx # and exit with a zero status mov $__NR_exit,%eax # syscall = 60 is exit int $0x80