Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- org 7c00h
- use16
- cli
- lgdt[gdt]
- lidt[idt]
- mov eax,cr0
- or al,1
- mov cr0,eax
- jmp code32-table1:kernel
- use32
- kernel:
- mov ax,data32-table1
- mov gs,ax
- mov fs,ax
- mov ds,ax
- mov es,ax
- mov ss,ax
- mov esp,9fffch
- mov eax,isr_fdc
- mov [table2+49*8],ax
- mov word[table2+49*8+2],code32-table1
- mov word[table2+49*8+4],8e00h
- shr eax,16
- mov [table2+49*8+6],ax
- int 49
- jmp $
- isr_fdc:
- mov dx,3f2h
- mov al,1ch
- out dx,al
- call readmsr
- mov dx,3f7h
- mov al,0
- out dx,al
- call readmsr
- mov dx,3f5h
- mov al,0fh
- out dx,al
- mov al,0
- out dx,al
- mov al,0
- out dx,al
- call readmsr
- mov al,6
- out 0ah,al
- mov al,0ffh
- out 0ch,al
- mov ax,start
- out 4,al
- mov al,ah
- out 4,al
- mov al,0ffh
- out 0ch,al
- out 5,al
- mov al,1
- out 5,al
- mov al,code32-table1
- out 81h,al
- mov al,2
- out 0ah,al
- call readmsr
- mov dx,3f5h
- mov al,66h
- out dx,al
- mov al,0
- out dx,al
- mov al,0
- out dx,al
- mov al,0
- out dx,al
- mov al,2
- out dx,al
- mov al,2
- out dx,al
- mov al,18
- out dx,al
- mov al,27
- out dx,al
- mov al,0ffh
- out dx,al
- call readmsr
- mov dx,3f5h
- mov al,8
- out dx,al
- read_int_status:
- mov dx,3f5h
- in al,dx
- test al,20h
- jz read_int_status
- iret
- readmsr:
- mov dx,3f4h
- in al,dx
- and al,0c0h
- cmp al,80h
- jne readmsr
- ret
- gdt:
- dw end_gdt-table1-1
- dd table1
- table1:
- dq 0
- code32:
- dw 0ffffh
- dw 0
- db 0
- db 9ah
- db 0cfh
- db 0
- data32:
- dw 0ffffh
- dw 0
- db 0
- db 92h
- db 0cfh
- db 0
- end_gdt:
- idt:
- dw end_idt-(50*8)-1
- dd table2
- table2:
- dd 50*2
- end_idt:
- times 510-($-$$) db 0
- dw 0aa55h
- start:
- mov di,0b800h
- mov es,di
- mov di,0
- mov byte[es:di],42h
- times 512-($-start) db 0
Advertisement
Add Comment
Please, Sign In to add comment