Question: ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;DEFINITIONS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; % define LOAD _ ADDRESS 0 x 0 0 0 2 0 0 0 0 ; pretty much any number > 0
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;DEFINITIONS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
define LOADADDRESS x ; pretty much any number works
define CODESIZE ENDLOADADDRESSx ; everything beyond the HEADER is code
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;HEADER;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
BITS
org LOADADDRESS
ELFHEADER:
db xF"ELF" ; magic number to indicate ELF file
db x ; x for bit, x for bit
db x ; x for little endian, x for big endian
db x ; x for current version of ELF
db x ; x for FreeBSD, x for Linux doesnt seem to matter
db x ; ABI version ignored
times db x ; padding bytes
dw x ; executable file
dw xE ; AMD x
dd x ; version
dq START ; entry point for our program
dq x ; x offset from ELFHEADER to PROGRAMHEADER
dq x ; section header offset we don't have this
dd x ; unused flags
dw x ; byte size of ELFHEADER
dw x ; byte size of each program header entry
dw x ; number of program header entries we have one
dw x ; size of each section header entry none
dw x ; number of section header entries none
dw x ; index in section header table for section names waste
PROGRAMHEADER:
dd x ; x for loadable program segment
dd x ; readwriteexecute flags
dq x ; offset of code start in file image xx
dq LOADADDRESSx ; virtual address of segment in memory
dq x ; physical address of segment in memory ignored
dq CODESIZE ; size bytes of segment in file image
dq CODESIZE ; size bytes of segment in memory
dq x ; alignment doesnt matter, only segment
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;INCLUDES;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
include "syscalls.asm" ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;INSTRUCTIONS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
START:
; delete the input file
mov rdi,SYSARGCSTARTPOINTER ; command line arg
mov alSYSUNLINK
syscall
mov alSYSEXIT
syscall
END:why erro is here
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
