Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F137055996
D9455.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
3 KB
Referenced Files
None
Subscribers
None
D9455.diff
View Options
Index: head/sys/boot/i386/btx/lib/btxv86.h
===================================================================
--- head/sys/boot/i386/btx/lib/btxv86.h
+++ head/sys/boot/i386/btx/lib/btxv86.h
@@ -23,6 +23,14 @@
#include <sys/types.h>
#include <machine/psl.h>
+/*
+ * Memory buffer space for real mode IO.
+ * Just one page is not much, but the space is rather limited.
+ * See ../btx/btx.S for details.
+ */
+#define V86_IO_BUFFER 0x8000
+#define V86_IO_BUFFER_SIZE 0x1000
+
#define V86_ADDR 0x10000 /* Segment:offset address */
#define V86_CALLF 0x20000 /* Emulate far call */
#define V86_FLAGS 0x40000 /* Return flags */
Index: head/sys/boot/i386/libi386/bioscd.c
===================================================================
--- head/sys/boot/i386/libi386/bioscd.c
+++ head/sys/boot/i386/libi386/bioscd.c
@@ -309,9 +309,6 @@
return (0);
}
-/* Max number of sectors to bounce-buffer at a time. */
-#define CD_BOUNCEBUF 8
-
/* return negative value for an error, otherwise blocks read */
static int
bc_read(int unit, daddr_t dblk, int blks, caddr_t dest)
@@ -339,8 +336,9 @@
* physical memory so we have to arrange a suitable
* bounce buffer.
*/
- x = min(CD_BOUNCEBUF, (unsigned)blks);
- bbuf = alloca(x * BIOSCD_SECSIZE);
+ x = V86_IO_BUFFER_SIZE / BIOSCD_SECSIZE;
+ x = min(x, (unsigned)blks);
+ bbuf = PTOV(V86_IO_BUFFER);
maxfer = x;
} else {
bbuf = NULL;
Index: head/sys/boot/i386/libi386/biosdisk.c
===================================================================
--- head/sys/boot/i386/libi386/biosdisk.c
+++ head/sys/boot/i386/libi386/biosdisk.c
@@ -666,9 +666,6 @@
return (0);
}
-/* Max number of sectors to bounce-buffer if the request crosses a 64k boundary */
-#define FLOPPY_BOUNCEBUF 18
-
static int
bd_edd_io(struct disk_devdesc *dev, daddr_t dblk, int blks, caddr_t dest,
int write)
@@ -732,7 +729,7 @@
bd_io(struct disk_devdesc *dev, daddr_t dblk, int blks, caddr_t dest, int write)
{
u_int x, sec, result, resid, retry, maxfer;
- caddr_t p, xp, bbuf, breg;
+ caddr_t p, xp, bbuf;
/* Just in case some idiot actually tries to read/write -1 blocks... */
if (blks < 0)
@@ -754,17 +751,12 @@
* as we need to. Use the bottom half unless there is a break
* there, in which case we use the top half.
*/
- x = min(FLOPPY_BOUNCEBUF, (unsigned)blks);
- bbuf = alloca(x * 2 * BD(dev).bd_sectorsize);
- if (((u_int32_t)VTOP(bbuf) & 0xffff0000) ==
- ((u_int32_t)VTOP(bbuf + x * BD(dev).bd_sectorsize) & 0xffff0000)) {
- breg = bbuf;
- } else {
- breg = bbuf + x * BD(dev).bd_sectorsize;
- }
+ x = V86_IO_BUFFER_SIZE / BD(dev).bd_sectorsize;
+ x = min(x, (unsigned)blks);
+ bbuf = PTOV(V86_IO_BUFFER);
maxfer = x; /* limit transfers to bounce region size */
} else {
- breg = bbuf = NULL;
+ bbuf = NULL;
maxfer = 0;
}
@@ -779,14 +771,14 @@
x = min(x, maxfer); /* fit bounce buffer */
/* where do we transfer to? */
- xp = bbuf == NULL ? p : breg;
+ xp = bbuf == NULL ? p : bbuf;
/*
* Put your Data In, Put your Data out,
* Put your Data In, and shake it all about
*/
if (write && bbuf != NULL)
- bcopy(p, breg, x * BD(dev).bd_sectorsize);
+ bcopy(p, bbuf, x * BD(dev).bd_sectorsize);
/*
* Loop retrying the operation a couple of times. The BIOS
@@ -820,7 +812,7 @@
return(-1);
}
if (!write && bbuf != NULL)
- bcopy(breg, p, x * BD(dev).bd_sectorsize);
+ bcopy(bbuf, p, x * BD(dev).bd_sectorsize);
p += (x * BD(dev).bd_sectorsize);
dblk += x;
resid -= x;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Nov 22, 1:43 AM (22 h, 3 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
25863890
Default Alt Text
D9455.diff (3 KB)
Attached To
Mode
D9455: loader: disk io should not use alloca()
Attached
Detach File
Event Timeline
Log In to Comment