Bootloader doesn't work well with laptop Turion64

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.
Post Reply
User avatar
jerryleecooper
Member
Member
Posts: 233
Joined: Mon Aug 06, 2007 6:32 pm
Location: Canada

Bootloader doesn't work well with laptop Turion64

Post by jerryleecooper »

Hello. My bootloader can't load my kernel completely on my laptop.
The setup: A Turion 64, non x2, plain mono core laptop, with an usb floppy drive. The kernel is on the floppy.
It's not FAT12, The floppy is binary "formatted", there's the bootloader, and right after there's the kernel. The bootloader display the welcome screen and when loading each sector, display a dot. The problem, is that after 2 dots, it stop.
So, is it possible that my computer is not legacy-friendly?
I added some waiting routines, for waiting for the motor. But it's not working, still only 2 sectors is loading, and then it's stopping.
Reading the floppy on Virtual PC works as expected.
In my bltr I set ds es fs to be 0x0, is that correct?
Also ss is at 0x8000 and sp 0xf000.
Probably my laptop can't really boot from a floppy, but if it could, it would be cool, because I don't want to use cds right now.
User avatar
Dex
Member
Member
Posts: 1444
Joined: Fri Jan 27, 2006 12:00 am
Contact:

Post by Dex »

My OS can boot and read/write to a usb floppy drive (even from pmode), if you want you can test it to see if it works with your setup.

That will let you know if the problem with your software or setup etc.

PS: Emulators are only a guide to how it will work on real hardware, eg: my floppy did not work on some emuator, but worked fine on all real hardware, it turns out that they were reading 0 from the info in the Bpb, so that when trying to work out the offset and size of stuff for fat12 it would div by 0.
User avatar
jerryleecooper
Member
Member
Posts: 233
Joined: Mon Aug 06, 2007 6:32 pm
Location: Canada

Post by jerryleecooper »

To make it work on usb floppy drives, did you need to make something special, or just the normal floppy driver worked "right out the box"?
I will try with another bootloader, one that loads from fat drives, probably my laptop wants floppies to be formated. :?
User avatar
Dex
Member
Member
Posts: 1444
Joined: Fri Jan 27, 2006 12:00 am
Contact:

Post by Dex »

If the boot sector works with a normal floppy drive, it will work under emulation of a floppy, but if you go to Pmode or do a certain int call emulations stops.
I have two floppy functions in DexOS for read/write floppy, one is a Pmode and another that go to and from pmode to realmode to call int 13h.
The int 13h call one work with USB as every time you go back to realmode it is still emulating floppy.

I use bootprog to load DexOS you can get code here: http://alexfru.chat.ru/epm.html#bootprog
User avatar
jerryleecooper
Member
Member
Posts: 233
Joined: Mon Aug 06, 2007 6:32 pm
Location: Canada

Post by jerryleecooper »

Thank you for your help.
I have found the problem I think. I made a different version of my bootloader by removing the 512bytes adding to bx each times it loads a sector, and now it loads all sectors. But of course my new bootloader is unusable. So, the problem I see is that my bootloader put my kernel at 1mb, but my turion doesn't like that I think. My es value is at 0xffff and bx value is at 0x10, so I get 1mb from where int 13 is supposed to load the sectors, but it doesn't seem to be able to load more than 0xffff:0x410.
All the real computers I tried my os on before where intel based, my own computer, an amd, on which I never tried my os which now pose me some trouble, because it's a rebel, a troublemaker.

...Will read some AMD documents... :?
User avatar
Dex
Member
Member
Posts: 1444
Joined: Fri Jan 27, 2006 12:00 am
Contact:

Post by Dex »

If i get you right, you can not load to above 1MB from realmode, you need to load it below 0xA0000, them move it up when enter pmode or use unrealmode.
Plue you will need to think about setting A20.
User avatar
jerryleecooper
Member
Member
Posts: 233
Joined: Mon Aug 06, 2007 6:32 pm
Location: Canada

Post by jerryleecooper »

Yes, it seems I don't have the a20 gate enabled (disabled?). Im using some code Ive found somewhere in the wiki. :oops:
I saw somewhere 20 different way to enable a20, so. putting them all in my bootloader is not the way to go.
I will make a second stage, that will be a fat12 reader a20 enabler/disabler and I don't want to use grub. I will make a version of my kernel that will support it one day.
User avatar
jerryleecooper
Member
Member
Posts: 233
Joined: Mon Aug 06, 2007 6:32 pm
Location: Canada

Post by jerryleecooper »

I have found in the system info window in windows that my ati radeon 200m is mapped at 0x100000-0x1fffff, inclusively. Is this mapping a choice from Windows or something decided by my computer? :?
I know there's an int to search for available memory but I wanted to have v86 before using it, I didn't think I needed to have to use it in my BootLoader!? :shock:

edit: the small text contain eroneous information, but I kept it to show progress.
Last edited by jerryleecooper on Wed Sep 05, 2007 6:35 pm, edited 1 time in total.
User avatar
jerryleecooper
Member
Member
Posts: 233
Joined: Mon Aug 06, 2007 6:32 pm
Location: Canada

Post by jerryleecooper »

What I said about my radeon is not valid, it's the io is mapped at these addresses. I think I have found the problem. The bios from my laptop can't address more than one megabyte, even when then a20 gate is enabled (disabled?) , that, or I don't know how to enable the a20 gate on my laptop. I tried this:

Code: Select all

cli
	in al, 0x92
    or al, 2
    out 0x92, al
And same symptom, stops after 2 dots. = 0x100000+(512*2) = 0x100400
User avatar
Brynet-Inc
Member
Member
Posts: 2426
Joined: Tue Oct 17, 2006 9:29 pm
Libera.chat IRC: brynet
Location: Canada
Contact:

Post by Brynet-Inc »

I think some systems might have this BIOS service available :?:

Code: Select all

INT 15 AX=2400 disable A20
INT 15 AX=2401 enable A20
INT 15 AX=2402 query status A20
INT 15 AX=2403 query A20 support (kbd or port 92)

Return:
  If successful: CF clear, AH = 00h
  On error: CF set, AH = status
  Status: 01h keyboard controller is in secure mode
          86h function not supported
  For AX=2402 the status (0: disabled, 1: enabled) is returned in AL
  For AX=2403 the status (bit 0: kbd, bit 1: port 92) is returned in BX
Source: http://www.win.tue.nl/~aeb/linux/kbd/A20.html
Image
Twitter: @canadianbryan. Award by smcerm, I stole it. Original was larger.
User avatar
jerryleecooper
Member
Member
Posts: 233
Joined: Mon Aug 06, 2007 6:32 pm
Location: Canada

Post by jerryleecooper »

Ive just tried these, they do'n't work :( I mean, they work, but they don't enable my kernel to load. But your post gave me an idea. Since the int 13h can't access memory at more than 1 mb, I just need to load each sectors in a place it can access, and copy them where I want to have them. It will make my bootloader bulletproof. But now, I need to pray that I can access the memory, which I hope.

Thank you for your help. :D
Last edited by jerryleecooper on Wed Sep 05, 2007 8:17 pm, edited 1 time in total.
User avatar
jerryleecooper
Member
Member
Posts: 233
Joined: Mon Aug 06, 2007 6:32 pm
Location: Canada

Post by jerryleecooper »

I tried it, and the only thing I suceeded at was to reproduce the problem I have with booting the laptop into virtual pc. Now virtual pc don't boot, exactly the same thing my laptop do. :twisted:

Looks like it's not possible to address more than 1mb+64k in real mode. :oops:


edit: I will just copy the holy kernel somewhere into 640kb and move it when it will execute. But it's in binary format, I use -Ttext 0x100000 and I don't know what's the consequences in doing so.
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Post by Combuster »

jerryleecooper wrote:Looks like it's not possible to address more than 1mb+64k in real mode. :oops:
It is, use Unreal Mode
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
Post Reply