%macro scall 4 mov rax, %1 mov rdi, %2 mov rsi, %3 mov rdx, %4 syscall %endmacro section .data msg1 db 10,"Contents of GDTR: " msg1len equ $-msg1 msg2 db 10,"------Exiting from the program!!-------" msg2len equ $-msg2 msg3 db " : " msg3len equ $-msg3 cnt2 db 04H newline db 10 section .bss g: resd 1 resw 1 value resb 4 section .text global _start _start: ;------gdtr contents--------- scall 1,1,msg1,msg1len sgdt[g] mov bx,word[g+4] ;BASE call conversion mov bx,word[g+2] ;LIMIT call conversion mov bx,word[g] scall 1,1,msg3,msg3len call conversion scall 1,1,newline,1 scall 1,1,msg2,msg2len mov rax,60 mov rdi,0 syscall ;----------HEX to ASCII conversion------------- conversion: mov rdi,value mov byte[cnt2],4H aup: rol bx,04 mov cl,bl and cl,0fH cmp cl,09H jbe ANEXT add cl,30H ANEXT: add cl,30H mov byte[rdi],cl inc rdi dec byte[cnt2] JNZ aup scall 1,1,value,4 ret
To embed this project on your website, copy the following code and paste it into your website's HTML: