Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

BITS 32 global start make st section.bss ;USE32 ; make start visible to linker ;

ID: 3869424 • Letter: B

Question

BITS 32 global start make st section.bss ;USE32 ; make start visible to linker ; Needed for buffer BUFFLEN equ 1 buff: resb BUFFLEN ; Length of buffer ; text inside the buffer section .text asm code .text;as start: ;program entry point nop ; Urban legend to keep GDB happy... Read: ; Reads from stdin mov edx, BUFFLEN mov ecx, buff mov eax, 3 mov ebx, 0 mov esi, eax int 0x80 ; max length ; buffer ; Specify sys read call ; Specify stdin ; Copy sys_read return value, why? Reasons... ; Execute cmp eax, 1 ; compare eax to one Write: ; Write to stdout jne Exit ;int 0x80 ; Jump to Exit if cmp is not equal to zero ; Execute mov ebx, 1 mov ecx, buff mov edx, esi mov eax, 4 int 0x80 ; Specify stdouft ; Puts what is in buffer to into ecx ; Passes the number of bytes of data in the buffer ; sys write ; Execute jmp Read int 0x80 ; Unconditional jmp to Read Exit: mov eax, 1 int 0x80 ; Exit system call number ; Execute

Explanation / Answer

mov eax, 1

int 0x80

these code is used to exit the system call. that is it exit from the program