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.
Pulser
Post
by Pulser » Tue Jun 08, 2004 3:36 pm
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
Pype.Clicker
Member
Posts: 5964 Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:
Post
by Pype.Clicker » Tue Jun 08, 2004 3:56 pm
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.
Pulser
Post
by Pulser » Tue Jun 08, 2004 4:00 pm
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 :-\
Pype.Clicker
Member
Posts: 5964 Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:
Post
by Pype.Clicker » Tue Jun 08, 2004 4:01 pm
your data segment is indeed writable, but 0x08 is your *code* segment, which is not. mov ax,0x10; mov ds,ax will be better
Pulser
Post
by Pulser » Tue Jun 08, 2004 4:01 pm
Oops!!! My mistake :O