my pmode code resets the cpu

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
user4

my pmode code resets the cpu

Post by user4 »

hi, can anyone help me?
;after booted
   cli
   lgdt qword ptr gdtr
   mov eax,cr0
   or al,1
   mov cr0,eax
   jmp gdt1:do_pm
 do_pm:
   mov ax,gdt0
   mov ds,ax ;<-this line will reset
   mov es,ax
;    mov ax,gdt2
   mov ss,ax
   mov esp,5000h
   xor edi,edi
   xor esi,esi
   lea esi,msg_ined
   mov edi,0b8000h+(80*4+1)*2
   mov ecx,21
   cld
   rep movsb
 looop:
   jmp looop
 gdtr:
   dw gdtend-gdt-1
   dd gdt    ;base
 gdt:  
   dq 0      ;NULL descriptor
 gdt0 equ $-gdt
   dw 01fffh ;limit 32m
   dw 0      ;base addr L16
   db 0      ;base addr M8
   db 92h    ;(ds)data descriptor
   db 0cfh   ;G/D
   db 0      ;base addr H8
 gdt1 equ $-gdt
   dw 01fffh
   dw 0
   db 0
   db 9ah    ;(cs)code descriptor
   db 0cfh
   db 0
 gdt2 equ $-gdt
   dw 01fffh
   dw 0
   db 0
   db 96h    ;(ss)data descriptor
   db 0cfh
   db 0
 gdtend:
user4

Re: my pmode code resets the cpu

Post by user4 »

appreciations for your help.
(i am using tasm to complie)
Post Reply