# Display information concerning the system being used
#
# gcc uname.s -o uname
############################################################


.section .bss
        .lcomm sysInfo, 400

.section .data
output:
        .asciz "DomainName: %s\nMachine: %s\nVersion: %s\nRelease: %s\nNodeName: %s\nSysName: %s\n"

.section .text
.globl main
main:
        # sys_newuname(&sysInfo)
        movl $122, %eax
        movl $sysInfo, %ebx
        int $0x80

        # get the address of 'struct new_utsname'
        movl $sysInfo, %eax

        # push the fields in 'struct new_utsname'
        pushl %eax
        addl $65, %eax
        pushl %eax
        addl $65, %eax
        pushl %eax
        addl $65, %eax
        pushl %eax
        addl $65, %eax
        pushl %eax
        addl $65, %eax
        pushl %eax

        pushl $output
        call printf
        addl $20, %esp

        # sys_exit(0)
        movl $1, %eax
        movl $0, %ebx
        int $0x80
