Move workaround about page aligned data buffer directly to vm86_datacall,

it is impossible to use this func otherwise, i.e. all vesa calls are
potentially broken. Max arg size limited to 1024 for now, bump it, if needed.
This commit is contained in:
Andrey A. Chernov 1998-09-29 20:36:31 +00:00
parent ecee3646ce
commit 0e4c0f17f3

View File

@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: vm86.c,v 1.15 1998/08/16 00:05:05 bde Exp $
* $Id: vm86.c,v 1.16 1998/09/29 09:06:00 bde Exp $
*/
#include "opt_vm86.h"
@ -626,16 +626,36 @@ vm86_datacall(intnum, vmf, buffer, buflen, segment, offset)
int buflen;
u_short *segment, *offset;
{
int ret, internb;
u_int page;
u_short off;
#define MAX_DATA_SIZE 1024
static u_char mapped_to_page1[MAX_DATA_SIZE * 2];
static u_char *buf;
if (buflen < 0 || buflen > MAX_DATA_SIZE)
return(-1);
page = (u_int)buffer & PG_FRAME;
*offset = (u_int)buffer & PAGE_MASK;
if ((*offset + buflen) & PG_FRAME)
return (-1); /* XXX fixme! */
if ((*offset + buflen) & PG_FRAME) {
if (buf == NULL) {
buf = mapped_to_page1;
off = (u_int)buf & PAGE_MASK;
if ((off + MAX_DATA_SIZE) & PG_FRAME)
buf += PAGE_SIZE - off;
}
page = (u_int)buf & PG_FRAME;
bcopy((void *)buffer, (void *)buf, (size_t)buflen);
internb = 1;
} else
internb = 0;
*segment = 0x100;
page = vtophys(page);
vmf->vmf_trapno = page | (intnum & PAGE_MASK);
return (vm86_bioscall(vmf));
ret = vm86_bioscall(vmf);
if (internb)
bcopy((void *)buf, (void *)buffer, (size_t)buflen);
return ret;
}
#if 0