Boot loader

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.
User avatar
mathematician
Member
Member
Posts: 437
Joined: Fri Dec 15, 2006 5:26 pm
Location: Church Stretton Uk

Post by mathematician »

The DMA chips used in the PC are theoretically capable of memory to memory transfer, but the PC's architecture has other uses for DMA channel 0, which makes memory-memory transfer impossible in practice.
pcmattman
Member
Member
Posts: 2566
Joined: Sun Jan 14, 2007 9:15 pm
Libera.chat IRC: miselin
Location: Sydney, Australia (I come from a land down under!)
Contact:

Post by pcmattman »

My question is, why use DMA when you can just directly access the memory itself?
User avatar
mathematician
Member
Member
Posts: 437
Joined: Fri Dec 15, 2006 5:26 pm
Location: Church Stretton Uk

Post by mathematician »

Well, if you're in real mode, and you want to move something beyond the 1mb barrier, you have either got to use DMA or else switch into "unreal mode", as it is called. Except that you can't use DMA; at least not on the PC.
User avatar
djsilence
Member
Member
Posts: 70
Joined: Wed Oct 01, 2008 11:18 am
Location: Ukraine, Kiev
Contact:

Re: Boot loader

Post by djsilence »

HI!

I've got a question: if I am in unreal mode then can int 13h read file which size is more than 64kb? I heard that I can load files more than 64kb in size,but need the code has some changes? (I mean file reading function)?

Thanks!
Don't think a ****, but in ukrainian schools English is TOO BAD!
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:

Re: Boot loader

Post by Combuster »

The bios will still use real-mode-safe code, and not use any of the advantages of unreal mode. That includes wrapping around a 64k limit.

Also, the bios doesn't know what a file is: You tell it to read sectors. If you read only one sector at a time you can easily load several MB of data because you read less than 64k for each individual call.
"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 ]
JohnnyTheDon
Member
Member
Posts: 524
Joined: Sun Nov 09, 2008 2:55 am
Location: Pennsylvania, USA

Re: Boot loader

Post by JohnnyTheDon »

One option is the EDD hard disk extensions, which can write to a 64-bit (or 32-bit) address and read more than 128 sectors in one shot.
quok
Member
Member
Posts: 490
Joined: Wed Oct 18, 2006 10:43 pm
Location: Kansas City, KS, USA

Re: Boot loader

Post by quok »

JohnnyTheDon wrote:One option is the EDD hard disk extensions, which can write to a 64-bit (or 32-bit) address and read more than 128 sectors in one shot.
Sorry, no. The EDD spec limits you to reading/writing 127 sectors, as does the implementation in many BIOSes, specifically ones by Phoenix. You're best off just using blocks of no more than 32K at a shot.
User avatar
Love4Boobies
Member
Member
Posts: 2111
Joined: Fri Mar 07, 2008 5:36 pm
Location: Bucharest, Romania

Re: Boot loader

Post by Love4Boobies »

The point is that while only 127 sectors (and note that there are 4096-byte sectors - just check) may be read at once, the extended read function provided by the fixed disk subset of EDD can be used to load stuff above the first MiB of RAM (64-bit flat addresses, anyone?). So it's just a matter of using the function more than once for big files.
"Computers in the future may weigh no more than 1.5 tons.", Popular Mechanics (1949)
[ Project UDI ]
JohnnyTheDon
Member
Member
Posts: 524
Joined: Sun Nov 09, 2008 2:55 am
Location: Pennsylvania, USA

Re: Boot loader

Post by JohnnyTheDon »

Sorry, no. The EDD spec limits you to reading/writing 127 sectors
Not in EDD 3. There is an extended version of the DAP (Length > 16h) that accepts larger lengths than 127. I'm looking for the spec now, its been a while since I was messing with the BIOS.
User avatar
Love4Boobies
Member
Member
Posts: 2111
Joined: Fri Mar 07, 2008 5:36 pm
Location: Bucharest, Romania

Re: Boot loader

Post by Love4Boobies »

Device address packet, EDD 3.0 wrote: Number of blocks to transfer. This field has a maximum value of 127 (7Fh). A block count of 0 means no data is transferred. If a value greater than 127 is supplied, the request is rejected with CF=1 and AH=01.
"Computers in the future may weigh no more than 1.5 tons.", Popular Mechanics (1949)
[ Project UDI ]
quok
Member
Member
Posts: 490
Joined: Wed Oct 18, 2006 10:43 pm
Location: Kansas City, KS, USA

Re: Boot loader

Post by quok »

Love4Boobies wrote:
Device address packet, EDD 3.0 wrote: Number of blocks to transfer. This field has a maximum value of 127 (7Fh). A block count of 0 means no data is transferred. If a value greater than 127 is supplied, the request is rejected with CF=1 and AH=01.
Yeah, you beat me to it. That can be found on page 4 of the EDD 3.0 Rev 0.8 document, which equates to section 4.2, table 1. I've seen a rev 0.9 but I don't think it changes anything with regards to the device address packet. There's also supposedly work going on with EDD 4.0, but the draft of it that I've seen only changes int 13h func 48h, and not in ways that I remember.

Additionally, from section 4.2, table 1:
Packet size in bytes. Shall be 16 (10h) or greater. If the packet size is less than 16
the request is rejected with CF=1h and AH=01h. Packet sizes greater than 16 are
not rejected, the additional bytes beyond 16 shall be ignored.
and specifically the extra bytes are at the bottom of the packet:
10h | Quad word | 64 bit flat address of the transfer buffer. The is the buffer which Read/Write
operations will use to transfer the data if the data at offset 4 is invalid.
User avatar
Love4Boobies
Member
Member
Posts: 2111
Joined: Fri Mar 07, 2008 5:36 pm
Location: Bucharest, Romania

Re: Boot loader

Post by Love4Boobies »

quok wrote:There's also supposedly work going on with EDD 4.0, but the draft of it that I've seen only changes int 13h func 48h, and not in ways that I remember.
I saw that draft too, on T13's website. However, it hasn't been accepted as a standard (yet?) so whatever the differences are, they're not implemented in any firmware.
"Computers in the future may weigh no more than 1.5 tons.", Popular Mechanics (1949)
[ Project UDI ]
quok
Member
Member
Posts: 490
Joined: Wed Oct 18, 2006 10:43 pm
Location: Kansas City, KS, USA

Re: Boot loader

Post by quok »

Just in case anyone's now looking for the EDD 3.0 Rev 0.8 spec, it's available at:
http://www.phoenix.com/en/OEM-ODM/Custo ... ations.htm

There's also a lot of other BIOS related specs there, all free of charge from your friends at Phoenix.

And this link in general may be interesting for anyone that wants more white papers:
http://www.phoenix.com/en/OEM-ODM/Custo ... efault.htm
JohnnyTheDon
Member
Member
Posts: 524
Joined: Sun Nov 09, 2008 2:55 am
Location: Pennsylvania, USA

Re: Boot loader

Post by JohnnyTheDon »

You're right, I read an EDD 4.0 draft when I found the DAP length > 10h stuff. Sorry.
Post Reply