global _start _start: %macro disp 2 mov rax,1 mov rdi,1 mov rsi,%1 mov rdx,%2 syscall %endm %macro exit 0 mov rax,60 mov rdi,0 syscall %endm smsw eax mov [cr0_data],eax bt eax,00 jc protected_mode disp msg,len exit protected_mode: disp msg1,len1 mov ax,[cr0_data+2] call display mov ax,[cr0_data] call display disp msg6,len6 disp msg2,len2 str [tr_data] mov ax,[tr_data] call display disp msg6,len6 disp msg3,len3 sldt [ldt_data] mov ax,[ldt_data] call display disp msg6,len6 disp msg4,len4 sgdt [gdt_data] mov ax,[gdt_data+4] call display mov ax,[gdt_data+2] call display mov ax,[gdt_data] call display disp msg6,len6 disp msg5,len5 sidt [idt_data] mov ax,[idt_data+4] call display mov ax,[idt_data+2] call display mov ax,[idt_data] call display exit display: mov rsi,disparr+3; mov rcx,4; a2: mov rdx,0; mov rbx,10h; div rbx; cmp dl,09h; jbe a1; add dl,07h; a1: add dl,30h; mov [rsi],dl; dec rsi dec rcx; jnz a2 mov rax,1; mov rdi,1; mov rsi,disparr; mov rdx,4 syscall ret section .data msg db "In real Mode" len equ $-msg msg1 db "Content of Cr0:" len1 equ $-msg1 msg2 db "Content of TR:" len2 equ $-msg2 msg3 db "Content of ldt:" len3 equ $-msg3 msg4 db "Content of gdt:" len4 equ $-msg4 msg5 db "Content of Idt:" len5 equ $-msg5 msg6 db "",0ah len6 equ $-msg6 section .bss disparr resb 32 cr0_data resb 32 tr_data resb 32 ldt_data resb 32 gdt_data resb 32 idt_data resb 32
To embed this project on your website, copy the following code and paste it into your website's HTML: