summaryrefslogtreecommitdiff
path: root/sys/src/boot
diff options
context:
space:
mode:
authorment <thement@ibawizard.net>2011-06-08 23:04:30 +0200
committerment <thement@ibawizard.net>2011-06-08 23:04:30 +0200
commit748551ea060ffc9d6020201778f4769065e69e2b (patch)
tree2b0b4e828745c704f90b5d9c82b99fcc5c06f3f5 /sys/src/boot
parent474df964241d6c844237a9625eae904ac61aedc4 (diff)
boot/pc: PBS now calculates rootdir offset itself
Diffstat (limited to 'sys/src/boot')
-rw-r--r--sys/src/boot/pc/pbs.s43
1 files changed, 35 insertions, 8 deletions
diff --git a/sys/src/boot/pc/pbs.s b/sys/src/boot/pc/pbs.s
index 6b11eded9..07c189e1c 100644
--- a/sys/src/boot/pc/pbs.s
+++ b/sys/src/boot/pc/pbs.s
@@ -76,6 +76,7 @@ _start0x5A:
MTSR(rAX, rES)
LWI(0x100, rCX)
+ MW(rSI,rBX) /* address of partition record -> rBX */
LWI(RELOC, rSI)
MW(rSI, rSP)
LWI(_magic(SB), rDI)
@@ -97,10 +98,38 @@ TEXT start16(SB), $0
STI
LWI(hello(SB), rSI)
CALL16(print16(SB))
- LWI(crnl(SB), rSI)
- CALL16(print16(SB))
- LW(_volid(SB), rAX) /* Xrootlo */
- LW(_volid+2(SB), rBX) /* Xroothi */
+
+ PUSHR(rDX)
+ PUSHR(rBX)
+
+ LB(_nfats(SB), rCL) /* # of fats */
+ LW(_fatsize(SB), rAX) /* fat size */
+ MUL(rCX) /* DX:AX = #sectors */
+ JNE _fatszok /* zero? it's FAT32 */
+
+ LW(_fatsz32+2(SB), rBX) /* hi word */
+ IMUL(rCX, rBX) /* ... in sectors */
+ LW(_fatsz32(SB), rAX) /* lo word */
+ MUL(rCX) /* ... in sectors */
+ ADD(rBX, rDX) /* DX:AX = #sectors */
+
+_fatszok:
+ POPR(rBX) /* address of partition record */
+
+ LXW(8, xBX, rCX) /* lo partition LBA */
+ ADD(rCX, rAX)
+ LXW(10, xBX, rCX) /* hi partition LBA */
+ ADC(rCX, rDX)
+
+ CLR(rBX)
+ LW(_nresrv(SB), rCX) /* # of reserved */
+ ADD(rCX, rAX)
+ ADC(rDX, rBX)
+
+ SW(rAX, _volid(SB)) /* save for later use */
+ SW(rDX, _volid+2(SB))
+ POPR(rDX)
+
PUSHR(rBP)
LW(_sectsize(SB), rCX)
SUB(rCX, rSP)
@@ -270,7 +299,5 @@ TEXT ioerror(SB), $0
BYTE $'e'; BYTE $'r'; BYTE $'r'; BYTE $0
TEXT hello(SB), $0
- BYTE $'p'; BYTE $'b'; BYTE $'s'; BYTE $0
-
-TEXT crnl(SB), $0
- BYTE $'\r'; BYTE $'\n'; BYTE $0
+ BYTE $'p'; BYTE $'b'; BYTE $'s'; BYTE $'\r';
+ BYTE $'\n'; BYTE $0