Page 1 of 1
Help Long Mode at 0x100000
Posted: Sat Dec 29, 2007 9:19 pm
by orange
I create my own boot loader and setting up 64 bit long mode environment and load my 64 bit kernel into 0x7E00 and move up to 0x100000 and then jump to 0x100000 to execute it.
but something crazy happen. some of code doesn't works correctly
mov rax,'T E S T '
mov [0xB8000],rax
That code dosn't works. i just get blank screen!!!
can u tell me why this happens???
and how to resolve my problem??
Thanks
Orange.
Posted: Sat Dec 29, 2007 9:52 pm
by blound
did you set the right mode before?
Posted: Sat Dec 29, 2007 10:03 pm
by orange
blound wrote:did you set the right mode before?
Yes has set environment to long mode, and it works correctly but when i load to disk to boot, i get problem when jump to 0x100000
before i get an error when jump to 0x100000 becouse i map paging just 1Mb, then i increase to 8 mb and jump successfull to 0x100000.
but some of code doesn't works correctly. i try to access memory video
mov rax,'T E S T '
mov [0xB8000],rax
that code dosn't works
Posted: Sat Dec 29, 2007 10:09 pm
by Dex
First are you using a emulator ?, does it work before moving address ?.
As i have seen people have problems with qemu and this code.
Also have you implemented A20 ?.
Posted: Sat Dec 29, 2007 10:22 pm
by orange
Dex wrote:First are you using a emulator ?, does it work before moving address ?.
As i have seen people have problems with qemu and this code.
Also have implemented A20 ?.
Yes i m using emulator.. vmware. and boot with real machine i still get same problem.
Before activating long mode... In 32 Protected mode session i try jump to 0x100000 ... well that is good, i can see text on my screen.
Then when i activate long mode i still can see text on my screen
But when i move up my code to 0x100000, i can't see text any more.
no exception, no error mesage just blank!!!
Posted: Sat Dec 29, 2007 10:29 pm
by orange
Dex wrote:Also have you implemented A20 ?.
yes i have implemented A20, without it i can't jump to 0x100000
i'm very sure successfuly jump to 0x100000 an execute any code on it. i just confuse when i can access video memory.
Thanks
Orange
Posted: Sat Dec 29, 2007 10:46 pm
by Dex
Have you tryed the same code for paging in pmode ?
Have you tryed jumping to 0x100000 and then back to see if you come back OK.
Or get some beep code (let me know if you need it ) convert it to 64bit and see if it beeps.
Posted: Sat Dec 29, 2007 11:01 pm
by orange
Dex wrote:Have you tryed the same code for paging in pmode ?
Yes...
Dex wrote:
Have you tryed jumping to 0x100000 and then back to see if you come back OK.
No... and i will try... thnk's
Dex wrote:
Or get some beep code (let me know if you need it ) convert it to 64bit and see if it beeps.
Ok i will try to use beep code.. please can u give me your beep code...
But when i add Halt instruction "HLT", wmware give me a emessage "CPU halted" that is make me sure i m on 0x100000, and suscced execute my kernel
Code: Select all
mov rax,'T E S T '
mov [0xB8000],rax
hlt
Text still not on screen, but hlt work
that is more make me confuse
Posted: Sun Dec 30, 2007 4:34 am
by Craze Frog
What happens if you try this?
Posted: Sun Dec 30, 2007 3:12 pm
by Dex
Here the beep code
Code: Select all
;----------------------------------------------------;
; Beep ;
;----------------------------------------------------;
Beep:
pushad
mov [Hz],0x200
call Sound
call Delay
call NoSound
popad
ret
;----------------------------------------------------;
; Sound ;
;----------------------------------------------------;
Sound:
mov bx,[Hz]
mov ax,0x34dd
mov dx,0x0012
cmp dx,bx
jnc Done1
div bx
mov bx,ax
in al,0x61
test al,3
jnz A99
or al,3
out 0x61,al
mov al,0xb6
out 0x43,al
A99:
mov al,bl
out 0x42,al
mov al,bh
out 0x42,al
Done1:
ret
;----------------------------------------------------;
; NoSound ;
;----------------------------------------------------;
NoSound:
in al,0x61
and al,11111100b
out 0x61,al
ret
;----------------------------------------------------;
; DeLay ;
;----------------------------------------------------;
DeLay:
mov cx,[ms]
jcxz A2
A1:
call DelayOneMS
loop A1
A2:
ret
;----------------------------------------------------;
; DeLaYoneMS ;
;----------------------------------------------------;
DeLaYoneMS:
push ecx
mov cx,[OneMS]
B1:
loop B1
pop ecx
ret
OneMS dw 40000
Hz dw 0
MS dw 20
But if the HLT works, it all points to some problem with mapping the 1 for 1 address of paging.
Also if you have a floppy drive you can put the motor on/off (light on and off) .
With this code
Code: Select all
;----------------------------------------------------;
; Fdd motor off ;
;----------------------------------------------------;
Fdd_motor_off:
mov dx,0x3F2
mov al,0
out dx,al
ret
;----------------------------------------------------;
; Fdd Motor On ;
;----------------------------------------------------;
FddMotorOn:
mov dx,0x3F2
mov al,00011100b
out dx,al
ret
Posted: Tue Jan 08, 2008 5:24 am
by orange
Thank's for your help guys:)))
i have resolve my problem... i found BUG in my assembler. The RAX register doesn't point to 0xB8000 so that i can't see text on screen.
after i change with other assembler, then i see text on screen.
and thank's four your beeb dex, i use your code for samething else...
i don't know why my first assembler generate mistake code.
Posted: Tue Jan 08, 2008 11:29 am
by Combuster
orange wrote:i found BUG in my assembler.
I bet there isn't. Compiler bugs are rare, and assemblers which are an magnitude more simple, the chance one exists is
very unlikely to the point where it neglegible.
If its indeed a bug, tell us how to reproduce it.
Posted: Wed Jan 09, 2008 1:26 pm
by Dex
orange wrote:i have resolve my problem... i found BUG in my assembler. The RAX register doesn't point to 0xB8000 so that i can't see text on screen.
after i change with other assembler, then i see text on screen.
When you say bug in the assembler, which was fixed when you changed it, do you mean you changed assember to say fasm to nasm, or do you mean you change from one ver to another of the same assembler ? .
If you changed to a differant assembler, could you name it, as it would help others, as i have seen this problem posted before.
Thanks.
PS: If you do not want to name it in public, you can PM me the name.
Posted: Sat Jan 26, 2008 11:49 pm
by orange
ok sorry long time i can't online coz i verry bussy...
first i use FASM to compile my OS.. then i use YASM and til now My OS run correctly.
now i get One problem... since 64bit doesn't support hardware multitasking.
Can u give me reference how to build software mutlitasking...
))
thank's
Posted: Sun Jan 27, 2008 3:49 am
by Combuster
orange wrote:Can u give me reference how to build software mutlitasking...
Have a
look around