Page 2 of 2

Re:Pmode + Kernel

Posted: Tue Jun 08, 2004 3:36 pm
by Pulser

Code: Select all

  
      cli                     ; Disable interrupts
        lgdt [gdtDesc]          ; Load our GDT
        mov eax, cr0            ; EAX -> CR0
        or eax, 1               ; Set first bet to 1
        mov cr0, eax            ; CR0 -> EAX
        jmp 0x08:proMode        ; Clear the instruction pipeline
                                                                                     
[bits 32]                       ; Assemble 32 bit instructions
proMode:                        ; This is where we jump too
        mov ax, 0x08            ; AX -> 0x08
        mov ds, ax              ; DS -> AX (0x08)
        mov ss, ax              ; SS -> AX (0x08)
        mov esp, 0x90000        ; Setup stack at 0x90000
        jmp 0x1000:0x0000       ; Jump to our kernel
        jmp $                   ; Hang if we get here
Ok, I've got to an error in bochs, saying:

Code: Select all

00000711223e[CPU0 ] load_seg_reg(): not writable data segment
00000711223e[CPU0 ] exception(): 3rd (13) exception with no resolution, shutdown status is 00h, resetting
But my data segment has got write access... has it not? Any informaton would be great thanks :)

Re:Pmode + Kernel

Posted: Tue Jun 08, 2004 3:56 pm
by Pype.Clicker

Code: Select all

   cli                    ; Disable interrupts
        lgdt [gdtDesc]          ; Load our GDT
        mov eax, cr0            ; EAX -> CR0
        or eax, 1              ; Set first bet to 1
        mov cr0, eax            ; CR0 -> EAX
        jmp 0x08:proMode        ; Clear the instruction pipeline
hey !? you're doing things the wrong way!
wait ... no ... that's just the comments that stupidly says the opposite of what's being done.

Re:Pmode + Kernel

Posted: Tue Jun 08, 2004 4:00 pm
by Pulser
Lol are u referring to the "->"? I use "->" Instead of "new value" not as in "goes into" :) Or is something else wrong? Rest looks fine to me :-\

Re:Pmode + Kernel

Posted: Tue Jun 08, 2004 4:01 pm
by Pype.Clicker
your data segment is indeed writable, but 0x08 is your *code* segment, which is not. mov ax,0x10; mov ds,ax will be better :)

Re:Pmode + Kernel

Posted: Tue Jun 08, 2004 4:01 pm
by Pulser
Oops!!! My mistake :O