kolibrios/kernel/branches/Kolibri-acpi/sec_loader/trunk/boot/PrimaryLoader.txt
Sergey Semyonov (Serge) 8f992ed021 acpi branch
git-svn-id: svn://kolibrios.org@1635 a494cfbc-eb01-0410-851d-a64ba20cac60
2010-10-01 09:21:55 +00:00

92 lines
4.4 KiB
Plaintext

; Copyright (c) 2008-2009, diamond
; All rights reserved.
;
; Redistribution and use in source and binary forms, with or without
; modification, are permitted provided that the following conditions are met:
; * Redistributions of source code must retain the above copyright
; notice, this list of conditions and the following disclaimer.
; * Redistributions in binary form must reproduce the above copyright
; notice, this list of conditions and the following disclaimer in the
; documentation and/or other materials provided with the distribution.
; * Neither the name of the <organization> nor the
; names of its contributors may be used to endorse or promote products
; derived from this software without specific prior written permission.
;
; THIS SOFTWARE IS PROVIDED BY Alexey Teplov aka <Lrz> ''AS IS'' AND ANY
; EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
; DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
; DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
; (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
; ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
;*****************************************************************************
Ñïåöèôèêàöèÿ íà ïåðâè÷íûé çàãðóç÷èê KordOS.
Çàãðóç÷èê äîëæåí ïðåäîñòàâëÿòü ñëåäóþùèå ñåðâèñû:
1. Ïðè çàãðóçêå êîìïüþòåðà, ïîëó÷èâ óïðàâëåíèå îò BIOS'à, çàãðóæàòü
ôàéë loader èç ïàïêè kord ïî àäðåñó 1000:0000.
Ðàçìåð ôàéëà loader íå ïðåâîñõîäèò 30000h = 192 Kb.
2. Ïðè ýòîì óñòàíàâëèâàòü ñëåäóþùèå ðåãèñòðû:
ax èäåíòèôèöèðóåò óñòðîéñòâî:
al = òèï:
'f' - ôëîïèê
'h' - HDD
'c' - CD/DVD
'u' - USB ôëåøêà
'?' - íåèçâåñòíîå óñòðîéñòâî
ah = íîìåð óñòðîéñòâà (ñðåäè âñåõ óñòðîéñòâ ôèêñèðîâàííîãî òèïà)
bx = òèï ôàéëîâîé ñèñòåìû:
'12' = FAT12
'16' = FAT16
'32' = FAT32
'nt' = NTFS
'is' = ISO-9660
ds:si = far-óêàçàòåëü íà callback-ñåðâèñ
3. Ïðåäîñòàâëÿòü callback-ñåðâèñ äëÿ âòîðè÷íîãî çàãðóç÷èêà - far-ïðîöåäóðó:
íà âõîäå: ax = çàïðàøèâàåìàÿ ôóíêöèÿ
íà âûõîäå: CF=1, åñëè ôóíêöèÿ íå ïîääåðæèâàåòñÿ; CF=0 èíà÷å
Çàãðóç÷èê ìîæåò ðàçðóøàòü âñå ðåãèñòðû, âêëþ÷àÿ ñåãìåíòíûå,
çà èñêëþ÷åíèåì ss è sp.
4. Âñåãäà äîëæíà ïîääåðæèâàòüñÿ callback-ôóíêöèÿ 1:
íàçíà÷åíèå: ïðî÷èòàòü ôàéë, ðàñïîëîæåííûé íà çàãðóçî÷íîì óñòðîéñòâå
íà âõîäå: ax = 1, ds:di = óêàçàòåëü íà èíôîðìàöèîííóþ ñòðóêòóðó:
dw:dw far-óêàçàòåëü íà áóôåð,
ïåðâîå ñëîâî - ñìåùåíèå, âòîðîå - ñåãìåíò
dw ìàêñèìàëüíîå ÷èñëî 4Kb-áëîêîâ äëÿ ÷òåíèÿ (0x1000 áàéò)
äîëæíî áûòü íåíóëåâûì è ñòðîãî ìåíüøå 0x100
ASCIIZ èìÿ ôàéëà â ôîðìàòå "<ïàïêà1>/<ïàïêà2>/<ôàéë>"
Åñëè èìÿ ôàéëà ñîäåðæèò ñèìâîëû èç ñòàðøåé ïîëîâèíû
ASCIIZ-òàáëèöû èëè íå ÿâëÿåòñÿ 8.3-èìåíåì (â ñìûñëå, îäíà èç êîìïîíåíò
èìåíè ôàéëà èìååò èìÿ äëèííåå 8 ñèìâîëîâ èëè ðàñøèðåíèå äëèííåå 3),
çàãðóç÷èê ìîæåò íå íàéòè òàêîé ôàéë, äàæå åñëè îí åñòü
(à ìîæåò è íàéòè).
íà âûõîäå: bx = ñòàòóñ:
0 = óñïåøíî
1 = ôàéë îêàçàëñÿ ñëèøêîì áîëüøèì, áóôåð çàïîëíåí öåëèêîì
è åñòü åù¸ äàííûå ôàéëà
2 = ôàéë íå íàéäåí
3 = ïðîèçîøëà îøèáêà ÷òåíèÿ
dx:ax = ðàçìåð ôàéëà èëè FFFF:FFFF, åñëè ôàéë íå íàéäåí
5. Âñåãäà äîëæíà ïîääåðæèâàòüñÿ callback-ôóíêöèÿ 2:
íàçíà÷åíèå: ïðîäîëæèòü ÷òåíèå ôàéëà, ÷àñòè÷íî çàãðóæåííîãî ôóíêöèåé 1
íà âõîäå: ax = 2, ds:di = óêàçàòåëü íà èíôîðìàöèîííóþ ñòðóêòóðó:
dw:dw far-óêàçàòåëü íà áóôåð,
ïåðâîå ñëîâî - ñìåùåíèå, âòîðîå - ñåãìåíò
dw ìàêñèìàëüíîå ÷èñëî 4Kb-áëîêîâ äëÿ ÷òåíèÿ (0x1000 áàéò)
äîëæíî áûòü íåíóëåâûì è ñòðîãî ìåíüøå 0x100
íà âûõîäå: bx = ñòàòóñ:
0 = óñïåøíî
1 = ôàéë îêàçàëñÿ ñëèøêîì áîëüøèì, áóôåð çàïîëíåí öåëèêîì
è åñòü åù¸ äàííûå ôàéëà
3 = ïðîèçîøëà îøèáêà ÷òåíèÿ
dx:ax = ðàçìåð ôàéëà
Ôóíêöèþ ìîæíî âûçûâàòü òîëüêî â ñëó÷àå, êîãäà ïîñëåäíèé âûçîâ ôóíêöèè
1 è âñå ïîñëåäóþùèå âûçîâû ôóíêöèè 2 âåðíóëè bx=1 (èíûìè ñëîâàìè,
òîëüêî äëÿ ïðîäîëæåíèÿ çàãðóçêè ôàéëà, êîòîðûé óæå áûë ÷àñòè÷íî
çàãðóæåí, íî åù¸ íå çàãðóæåí ïîëíîñòüþ).
Çàãðóç÷èê ìîæåò áûòü óâåðåí, ÷òî äàííûå â îáëàñòÿõ ïàìÿòè 0-9000 è
60000-A0000 íå áóäóò ìîäèôèöèðîâàíû ÿäðîì.