summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
authorOtto Moerbeek <otto@cvs.openbsd.org>2020-02-28 12:26:31 +0000
committerOtto Moerbeek <otto@cvs.openbsd.org>2020-02-28 12:26:31 +0000
commit22b24c78fbf33541deced70a7116caa365481b35 (patch)
tree088c19d9fee10eb12a2ccaf7598154ffd5b105f1 /sys/arch
parenta5edc01af21c48fbfa9293f1aaff2f6ad1414eab (diff)
Adapt biosboot(8) so it can read boot(8) from an ffs2 filesystem.
To do this, installboot(8) patches an extra value into biosboot(8). Code originally from Pedro Martelletto with a twist from myself and kettenis@; ok jsing@ kettenis@
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/amd64/stand/biosboot/biosboot.S10
-rw-r--r--sys/arch/i386/stand/biosboot/biosboot.S10
2 files changed, 16 insertions, 4 deletions
diff --git a/sys/arch/amd64/stand/biosboot/biosboot.S b/sys/arch/amd64/stand/biosboot/biosboot.S
index 0042a89ee36..143f6ccfbec 100644
--- a/sys/arch/amd64/stand/biosboot/biosboot.S
+++ b/sys/arch/amd64/stand/biosboot/biosboot.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: biosboot.S,v 1.7 2011/07/05 17:38:54 krw Exp $ */
+/* $OpenBSD: biosboot.S,v 1.8 2020/02/28 12:26:30 otto Exp $ */
/*
* Copyright (c) 2003 Tobias Weingartner
@@ -108,6 +108,9 @@
* While this can be calculated as
* howmany(di_size, fs_bsize) it takes us too
* many code bytes to do it.
+ * blkincr uint8 the increment used to parse di_db[]. set to four by
+ * installboot for ffs2 (due to 64-bit blocks) and should
+ * be zero for ffs1.
*
* All of these are patched directly into the code where they are used
* (once only, each), to save space.
@@ -121,7 +124,7 @@
*/
.globl inodeblk, inodedbl, fs_bsize_p, fsbtodb, p_offset, nblocks
- .globl fs_bsize_s, force_chs
+ .globl fs_bsize_s, force_chs, blkincr
.type inodeblk, @function
.type inodedbl, @function
.type fs_bsize_p, @function
@@ -130,6 +133,7 @@
.type p_offset, @function
.type nblocks, @function
.type force_chs, @function
+ .type blkincr, @function
/* Clobbers %ax, maybe more */
@@ -460,6 +464,8 @@ load_blocks:
/* Get the next filesystem block number into %eax */
lodsl /* %eax = *(%si++), make sure 0x66 0xad */
+blkincr = .+2
+ addw $0x00, %si /* adjust %si if needed (for ffs2) */
pushal /* Save all 32-bit registers */
diff --git a/sys/arch/i386/stand/biosboot/biosboot.S b/sys/arch/i386/stand/biosboot/biosboot.S
index 36ccd54d53f..f6d3f6a4b21 100644
--- a/sys/arch/i386/stand/biosboot/biosboot.S
+++ b/sys/arch/i386/stand/biosboot/biosboot.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: biosboot.S,v 1.41 2011/07/05 17:38:54 krw Exp $ */
+/* $OpenBSD: biosboot.S,v 1.42 2020/02/28 12:26:30 otto Exp $ */
/*
* Copyright (c) 2003 Tobias Weingartner
@@ -108,6 +108,9 @@
* While this can be calculated as
* howmany(di_size, fs_bsize) it takes us too
* many code bytes to do it.
+ * blkincr uint8 the increment used to parse di_db[]. set to four by
+ * installboot for ffs2 (due to 64-bit blocks) and should
+ * be zero for ffs1.
*
* All of these are patched directly into the code where they are used
* (once only, each), to save space.
@@ -121,7 +124,7 @@
*/
.globl inodeblk, inodedbl, fs_bsize_p, fsbtodb, p_offset, nblocks
- .globl fs_bsize_s, force_chs
+ .globl fs_bsize_s, force_chs, blkincr
.type inodeblk, @function
.type inodedbl, @function
.type fs_bsize_p, @function
@@ -130,6 +133,7 @@
.type p_offset, @function
.type nblocks, @function
.type force_chs, @function
+ .type blkincr, @function
/* Clobbers %ax, maybe more */
@@ -460,6 +464,8 @@ load_blocks:
/* Get the next filesystem block number into %eax */
lodsl /* %eax = *(%si++), make sure 0x66 0xad */
+blkincr = .+2
+ addw $0x00, %si /* adjust %si if needed (for ffs2) */
pushal /* Save all 32-bit registers */