;================================================================================= ; shared library example. ; ; The LSCR Project. ;================================================================================= format ELF include '../../include/symbols.inc' include '../../include/structs.inc' public test_proc section '.text' executable test_proc: pushad call @f @@: pop ebp sub ebp, RVA @b ; @b-rva @b is the GOT address mov eax, SYS_UNAME ; get system information lea ebx, [ebp+RVA utsname] int 0x80 lea ecx, [ebp+RVA utsname.sysname] ; print all the available entries mov edx, -1 @@: inc edx cmp [ecx+edx], byte 0 jne @b mov [ecx+edx], byte 0x20 inc edx mov eax, SYS_WRITE mov ebx, STDOUT int 0x80 lea ecx, [ebp+RVA utsname.nodename] mov edx, -1 @@: inc edx cmp [ecx+edx], byte 0 jne @b mov [ecx+edx], byte 0x20 inc edx mov eax, SYS_WRITE mov ebx, STDOUT int 0x80 lea ecx, [ebp+RVA utsname.release] mov edx, -1 @@: inc edx cmp [ecx+edx], byte 0 jne @b mov [ecx+edx], byte 0x20 inc edx mov eax, SYS_WRITE mov ebx, STDOUT int 0x80 lea ecx, [ebp+RVA utsname.version] mov edx, -1 @@: inc edx cmp [ecx+edx], byte 0 jne @b mov [ecx+edx], byte 0x20 inc edx mov eax, SYS_WRITE mov ebx, STDOUT int 0x80 lea ecx, [ebp+RVA utsname.machine] mov edx, -1 @@: inc edx cmp [ecx+edx], byte 0 jne @b mov [ecx+edx], byte 0xa inc edx mov eax, SYS_WRITE mov ebx, STDOUT int 0x80 popad ret section '.bss' writeable utsname old_utsname