Page 1 of 1

Did anyone noticed the message?

Posted: Sat Jul 24, 2004 11:00 pm
by breath
I posted "I get reboots just after "or al, 1 / mov cr0, eax"" some time before and still got no answer. Maybe I did something wrong with message posting?

RE:Did anyone noticed the message?

Posted: Sat Jul 24, 2004 11:00 pm
by GT
Post came through fine, apparently everyone's just clueless.  :)

Do you see the same behavior when you comment out the call to enable A20?

RE:Did anyone noticed the message?

Posted: Sat Jul 24, 2004 11:00 pm
by DIGO_RP
did you create a gdt corretly? be carefull with a segment register...
you cannot use any kind o bios interrupt in pmode...
try cli ... enter to protected mode ... do something, then get back to real mode... sti
i had many problem selecting segments Data code stack...
I know in Tasm
like... mov ax,@data
        mov ds,ax
        mov es,ax
this little thing help´s me a lot!!!

you may are doing a correct reference to a wrong memory region "variables" "GDT"... etc I don´t know what kind asm you are using... but in TASM ... the above code help´s me alot :-)

if you want I have a small tutorial in pascal with asm it enter on pmode show some words and get back to real mode...
just tell me...

:-)

RE:Did anyone noticed the message?

Posted: Sat Jul 24, 2004 11:00 pm
by ASHLEY4
I have tested your code and get a reboot on all my pc's with your code, but by adding the code line "mov ds,ax" it works on all my pc,does it fix it on your's ?.
[code]
org 0x7C00 ; Expecting to be loaded at 7C00 by BIOS

bits 16

real:
cli
xor ax, ax
mov ds, ax    ;<--- IT WORK WITH THIS IN ;-)
mov ss, ax
mov sp, 0x7C00 ; Temp stack just under myself

call real_open_A20 ; For 32 bit address space
call real_init_gdt ; Load GDTR

mov eax, cr0
or al, 0x1 ; cr0 |= PE
mov cr0, eax
; If I place 'jmp $' here all computers stop here normally
jmp 0x10: protected

real_open_A20:
.l1: in al, 0x64
test al, 0x2
jnz .l1
mov al, 0xD1
out 0x64, al
.l2: in al, 0x64
test al, 0x2
jnz .l2
mov al, 0xDF
out 0x60, al
ret

real_init_gdt:
lgdt [.gdtr]
ret
.gdt0 dw 0x0000, 0x0000, 0x0000, 0x0000
.data dw 0xFFFF, 0x0000, 0x9200, 0x00CF
.code dw 0xFFFF, 0x0000, 0x9800, 0x00CF
.gdtr dw $ - .gdt0 - 1
dd .gdt0

bits 32

protected:
; Wherever I place 'jmp $' after the 'protected' label,
; on some computers I get reboot to hell.
; (In that case CS:IP is never points to 'jmp $'
; - something happens before)
mov ax, 0x8
mov ds, ax
mov es, ax
mov fs, ax
mov gs, ax
mov ss, ax
mov esp, 0x7C00
mov byte [gs:0xB8000],'T'   ; <-- added this to test pmode
jmp $

times 512 - 2 - ($ - $$) db 0 ; Fill the rest of sector
dw 0xAA55 ; Bootable sector sign

times 1474560 - ($ - $$) db 0 ; Fill the rest of floppy

[/code]

Hope this help's
ASHLEY4.

RE:Did anyone noticed the message?

Posted: Sat Jul 24, 2004 11:00 pm
by ASHLEY4
You wait for a hour for a bus, than two come a long together, i just wasted one hour testing your code .

ASHLEY4.