Entering PMode - problem ...
Posted: Wed Jun 25, 2008 6:03 am
I have written something to enter PMode, but it doesn't want to work 
The following piece of code is loaded at address 0x7E00:0x0000, and far-jumped by stage1
The error is (bochsout.txt)
... I don't get it !
The following piece of code is loaded at address 0x7E00:0x0000, and far-jumped by stage1
Code: Select all
#define ABS(x) $(x-_stage2)
#define MSG(x) movw ABS(x), %si
.text
.code16
.org 0
_stage2:
cli
pushw %cs
popw %ds
movw $0x9000, %ax
movw %ax, %ss
movw $0xFFFF, %sp
sti
movw ABS(stage2_msg), %si
call print_scr
cli
lgdt gdt_desc-_stage2
movl %cr0, %eax
orl $0x1, %eax
movl %eax, %cr0
ljmp $8, $_stage3
hlt
.code32
_stage3:
movw $0x10, %ax
movw %ax, %ds
movw %ax, %es
movw %ax, %ss
movl $0x90000, %esp
STOP:
cli
hlt
/*
* Print to screen via BIOS Teletype
*
*/
print_scr:
pushw %ax
pushw %bx
print_scr_1:
lodsb
orb %al, %al
jz print_scr_end
xorw %bx, %bx
movb $0x0E, %ah
int $0x10
jmp print_scr_1
print_scr_end:
popw %bx
popw %ax
ret
/*
* Data area
*
*/
stage2_msg: .string "\n\nBL2: Stage2 Loaded !\r\nBL2: Loading GDT\r\n"
/*
* Descriptors
*
*/
gdt_data: /* { */
.long 0x0
.long 0x0
/* Code descriptor */
.word 0xFFFF, 0x0
.byte 0x0, 0x9A, 0xCF, 0x0
/* Data Descriptor */
.word 0xFFFF, 0x0
.byte 0x0, 0x92, 0xCF, 0x0
gdt_end:
/* } */
gdt_desc:
.word gdt_end-gdt_data-1
.long gdt_data-_stage2+0x7E00
.org 0x200Code: Select all
00018375019e[CPU ] jump_protected: gate type 0 unsupported