From d519f3db40f4eba45b808850fb2bb48f7a4ea0b6 Mon Sep 17 00:00:00 2001 From: Bart Oldeman Date: Tue, 9 Jun 2009 12:23:14 +0000 Subject: [PATCH] This change was missed, as the changelog mentioned it was in 2035a already: r_si/r_di contents added as documented in PC-DOS Technical Update. I also moved the CharReqHdr filling in to just before execrh, and made the command table a static const so it is outside the SDA (OW places it in CONST2). git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@1427 6ac86273-5f31-0410-b378-82cca8765d1b --- kernel/ioctl.c | 71 ++++++++++++++++++++++++++------------------------ 1 file changed, 37 insertions(+), 34 deletions(-) diff --git a/kernel/ioctl.c b/kernel/ioctl.c index efb44ea..c04b889 100644 --- a/kernel/ioctl.c +++ b/kernel/ioctl.c @@ -54,47 +54,33 @@ static BYTE *RcsId = */ +/* this is a file scope static because with Turbo C 2.01 "static const" does + * not work correctly inside the function */ +STATIC const UBYTE cmd [] = { + 0, 0, + /* 0x02 */ C_IOCTLIN, + /* 0x03 */ C_IOCTLOUT, + /* 0x04 */ C_IOCTLIN, + /* 0x05 */ C_IOCTLOUT, + /* 0x06 */ C_ISTAT, + /* 0x07 */ C_OSTAT, + /* 0x08 */ C_REMMEDIA, + 0, 0, 0, + /* 0x0c */ C_GENIOCTL, + /* 0x0d */ C_GENIOCTL, + /* 0x0e */ C_GETLDEV, + /* 0x0f */ C_SETLDEV, + /* 0x10 */ C_IOCTLQRY, + /* 0x11 */ C_IOCTLQRY, +}; + int DosDevIOctl(lregs * r) { - static UBYTE cmd [] = { - 0, 0, - /* 0x02 */ C_IOCTLIN, - /* 0x03 */ C_IOCTLOUT, - /* 0x04 */ C_IOCTLIN, - /* 0x05 */ C_IOCTLOUT, - /* 0x06 */ C_ISTAT, - /* 0x07 */ C_OSTAT, - /* 0x08 */ C_REMMEDIA, - 0, 0, 0, - /* 0x0c */ C_GENIOCTL, - /* 0x0d */ C_GENIOCTL, - /* 0x0e */ C_GETLDEV, - /* 0x0f */ C_SETLDEV, - /* 0x10 */ C_IOCTLQRY, - /* 0x11 */ C_IOCTLQRY, - }; - struct dhdr FAR *dev; if (r->AL > 0x11) return DE_INVLDFUNC; - /* commonly used, shouldn't harm to do front up */ - CharReqHdr.r_command = cmd[r->AL]; - if (r->AL == 0x0C || r->AL == 0x0D || r->AL >= 0x10) /* generic or query */ - { - CharReqHdr.r_cat = r->CH; /* category (major) code */ - CharReqHdr.r_fun = r->CL; /* function (minor) code */ - CharReqHdr.r_io = MK_FP(r->DS, r->DX); /* parameter block */ - } - else - { - CharReqHdr.r_count = r->CX; - CharReqHdr.r_trans = MK_FP(r->DS, r->DX); - } - CharReqHdr.r_length = sizeof(request); - CharReqHdr.r_status = 0; - switch (r->AL) { case 0x0b: @@ -249,6 +235,23 @@ int DosDevIOctl(lregs * r) return DE_INVLDFUNC; } + CharReqHdr.r_command = cmd[r->AL]; + if (r->AL == 0x0C || r->AL == 0x0D || r->AL >= 0x10) /* generic or query */ + { + CharReqHdr.r_cat = r->CH; /* category (major) code */ + CharReqHdr.r_fun = r->CL; /* function (minor) code */ + CharReqHdr.r_si = r->SI; /* contents of SI and DI */ + CharReqHdr.r_di = r->DI; + CharReqHdr.r_io = MK_FP(r->DS, r->DX); /* parameter block */ + } + else + { + CharReqHdr.r_count = r->CX; + CharReqHdr.r_trans = MK_FP(r->DS, r->DX); + } + CharReqHdr.r_length = sizeof(request); + CharReqHdr.r_status = 0; + execrh(&CharReqHdr, dev); if (CharReqHdr.r_status & S_ERROR)