dsk.c (reported by Nagy Daniel), inthndlr and int25/26 fixes by Tom Ehlert.

git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@180 6ac86273-5f31-0410-b378-82cca8765d1b
This commit is contained in:
Bart Oldeman 2001-03-27 20:27:43 +00:00
parent d233a1d304
commit ac1d293d9c
6 changed files with 99 additions and 143 deletions

View File

@ -1,3 +1,7 @@
2001 Mar 28 - Build 2023
-------- Bart Oldeman (bart.oldeman@bristol.ac.uk)
+ Fixes Bug fix release 2023b: dsk.c (reported by Nagy Daniel), inthndlr and
int25/26 fixes by Tom Ehlert.
2001 Mar 27 - Build 2023
-------- Bart Oldeman (bart.oldeman@bristol.ac.uk)
+ Fixes Bug fix release 2023a: fixed stack segment bug in entry.asm.

View File

@ -40,6 +40,9 @@ static BYTE *RcsId = "$Id$";
/*
* $Log$
* Revision 1.13 2001/03/27 20:27:27 bartoldeman
* dsk.c (reported by Nagy Daniel), inthndlr and int25/26 fixes by Tom Ehlert.
*
* Revision 1.12 2001/03/25 17:11:54 bartoldeman
* Fixed sys.com compilation. Updated to 2023. Also: see history.txt.
*
@ -765,10 +768,6 @@ INIT static VOID Lastdrive(BYTE * pLine)
UmbState of confidence, 1 is sure, 2 maybe, 4 unknown and 0 no way.
*/
#ifdef __TURBOC__
void __int__(int); /* TC 2.01 requires this. :( -- ror4 */
#endif
#define int3() __int__(3);
INIT static VOID Dosmem(BYTE * pLine)
{
@ -782,7 +781,6 @@ INIT static VOID Dosmem(BYTE * pLine)
*pTmp = toupper(*pTmp);
printf("DOS called with %s\n", szBuf);
int3();
for (pTmp = szBuf ; ; )
{
@ -1006,7 +1004,6 @@ INIT BOOL LoadDevice(BYTE * pLine, COUNT top, COUNT mode)
szBuf, dev_seg);
#endif
int3();
if (DosExec(3, &eb, szBuf) == SUCCESS)
{
@ -1037,7 +1034,6 @@ INIT BOOL LoadDevice(BYTE * pLine, COUNT top, COUNT mode)
*/
pTmp = pLine;
int3();
if (DosLoadedInHMA)
if (stristr(szBuf, "HIMEM.SYS") != NULL)
{

View File

@ -33,6 +33,9 @@ static BYTE *dskRcsId = "$Id$";
/*
* $Log$
* Revision 1.13 2001/03/27 20:27:43 bartoldeman
* dsk.c (reported by Nagy Daniel), inthndlr and int25/26 fixes by Tom Ehlert.
*
* Revision 1.12 2001/03/24 22:13:05 bartoldeman
* See history.txt: dsk.c changes, warning removal and int21 entry handling.
*
@ -328,14 +331,14 @@ static WORD(*dispatch[NENTRY]) () =
ULONG StartSector(WORD ptDrive, unsigned BeginCylinder,
unsigned BeginSector,
unsigned BeginHead,
unsigned BeginSector,
ULONG peStartSector,
ULONG ptAccuOff)
{
iregs regs;
unsigned cylinders,heads,sectors;
unsigned heads,sectors;
ULONG startPos;
ULONG oldStartPos;
@ -489,7 +492,7 @@ COUNT processtable(int table_type,COUNT ptDrive, BYTE ptHead, UWORD ptCylinder,
BYTE *p;
int partition_chain = 0;
int ret;
ULONG newStartPos;
/* ULONG newStartPos;*/
UWORD partMask;
int loop;
@ -749,7 +752,7 @@ WORD _dsk_init(rqptr rp)
/* Process primary a 2nd time */
for (HardDrive = 0; HardDrive < nHardDisk; HardDrive++)
{
processtable(PRIMARY, (HardDrive | 0x80), 0, 0l, 1, 0l,foundPartitions[HardDrive]);
processtable(PRIMARY2, (HardDrive | 0x80), 0, 0l, 1, 0l,foundPartitions[HardDrive]);
}
rp->r_nunits = nUnits;
@ -801,8 +804,8 @@ STATIC WORD RWzero(rqptr rp, WORD t)
{
COUNT partidx = miarray[rp->r_unit].mi_partidx;
head = dos_partition[partidx].peBeginHead;
sector = dos_partition[partidx].peBeginSector;
track = dos_partition[partidx].peBeginCylinder;
sector = dos_partition[partidx].peBeginSector;
}
else
{
@ -877,13 +880,13 @@ static WORD blk_Media(rqptr rp)
STATIC WORD bldbpb(rqptr rp)
{
ULONG count, i;
byteptr trans;
WORD local_word;
ULONG count/*, i*/;
/* byteptr trans;*/
/* WORD local_word;*/
/*TE*/
bpb *pbpbarray;
struct media_info *pmiarray;
WORD head,track,sector,ret;
WORD head,/*track,*/sector,ret;
ret = RWzero( rp, 0);

View File

@ -28,8 +28,8 @@
; $Id$
;
; $Log$
; Revision 1.7 2001/03/27 02:56:58 bartoldeman
; Fixed bugs in entry.asm: stack segment and int 2A/82 Ralf Brown compliant.
; Revision 1.8 2001/03/27 20:27:43 bartoldeman
; dsk.c (reported by Nagy Daniel), inthndlr and int25/26 fixes by Tom Ehlert.
;
; Revision 1.6 2001/03/24 22:13:05 bartoldeman
; See history.txt: dsk.c changes, warning removal and int21 entry handling.
@ -84,8 +84,7 @@
segment HMA_TEXT
extern _int21_syscall:wrt HGROUP
extern _int21_service:wrt HGROUP
extern _int25_handler:wrt HGROUP
extern _int26_handler:wrt HGROUP
extern _int2526_handler:wrt HGROUP
extern _set_stack:wrt HGROUP
extern _restore_stack:wrt HGROUP
extern _error_tos:wrt DGROUP
@ -399,15 +398,20 @@ reloc_call_int27_handler:
jmp reloc_call_int21_handler ; terminate through int 21h
;
; I really do need to get rid of this because it's the only thing stopping
; us from being ROMABLE.
;
stkframe dd 0
reloc_call_low_int26_handler:
sti
pushf
push ax
mov ax,026h
jmp int2526
reloc_call_low_int25_handler:
sti
pushf
push ax
mov ax,025h
int2526:
push cx
push dx
push bx
@ -418,24 +422,41 @@ reloc_call_low_int25_handler:
push ds
push es
mov word [cs:stkframe], sp ; save stack frame
mov word [cs:stkframe+2], ss
mov cx, sp ; save stack frame
mov dx, ss
cld
mov ax, DGROUP
mov ds, ax
mov bx, DGROUP
mov ds, bx
mov word [_api_sp], _disk_api_tos
mov word [_api_ss], ds
; save away foreground process' stack
push word [_usr_ss]
push word [_usr_sp]
call _set_stack
mov word [_usr_ss],ss
mov word [_usr_sp],sp
push word [cs:stkframe+2]
push word [cs:stkframe]
call _int25_handler
; setup our local stack
cli
mov ss,bx
mov sp,_disk_api_tos
sti
push dx ; SS:SP -> user stack
push cx
push ax ; was set on entry = 25,26
call _int2526_handler
add sp, byte 4
call _restore_stack
; restore foreground stack here
cli
mov ss,word [_usr_ss]
mov sp,word [_usr_sp]
pop word [_usr_sp]
pop word [_usr_ss]
pop es
pop ds
@ -453,52 +474,6 @@ reloc_call_low_int25_handler:
; flag image on the stack.
reloc_call_low_int26_handler:
sti
pushf
push ax
push cx
push dx
push bx
push sp
push bp
push si
push di
push ds
push es
mov word [cs:stkframe], sp ; save stack frame
mov word [cs:stkframe+2], ss
cld
mov ax, DGROUP
mov ds, ax
mov word [_api_sp], _disk_api_tos
mov word [_api_ss], ds
call _set_stack
push word [cs:stkframe+2]
push word [cs:stkframe]
call _int26_handler
add sp, 4
call _restore_stack
pop es
pop ds
pop di
pop si
pop bp
pop bx ; pop off sp value
pop bx
pop dx
pop cx
pop ax
popf
retf
CONTINUE equ 00h
RETRY equ 01h

View File

@ -36,6 +36,9 @@ BYTE *RcsId = "$Id$";
/*
* $Log$
* Revision 1.16 2001/03/27 20:27:43 bartoldeman
* dsk.c (reported by Nagy Daniel), inthndlr and int25/26 fixes by Tom Ehlert.
*
* Revision 1.15 2001/03/25 17:11:54 bartoldeman
* Fixed sys.com compilation. Updated to 2023. Also: see history.txt.
*
@ -230,6 +233,8 @@ VOID FAR int21_entry(iregs UserRegs)
/* Normal entry. This minimizes user stack usage by avoiding local */
/* variables needed for the rest of the handler. */
/* this here works on the users stack !! and only very few functions
are allowed */
VOID int21_syscall(iregs FAR * irp)
{
Int21AX = irp->AX;
@ -260,12 +265,16 @@ VOID int21_syscall(iregs FAR * irp)
irp->BL = os_major;
irp->BH = os_minor;
irp->DL = rev_number;
irp->DH = version_flags;
irp->DH = version_flags; /* bit3:runs in ROM,bit 4: runs in HMA*/
break;
case 0x02: /* andrew schulman: get/set extended control break
should be done */
case 0x03: /* DOS 7 does not set AL */
case 0x07: /* neither here */
default:
irp->AX = -DE_INVLDFUNC;
irp->FLAGS |= FLG_CARRY;
default: /* set AL=0xFF as error, NOT carry */
irp->AL = 0xff;
break;
/* Toggle DOS-C rdwrblock trace dump */
@ -305,14 +314,12 @@ VOID int21_syscall(iregs FAR * irp)
irp->BX = cu_psp;
break;
/* Normal DOS function - switch stacks */
/* Normal DOS function - DO NOT ARRIVE HERE */
default:
int21_service(user_r);
break;
}
}
static int debug_cnt;
VOID int21_service(iregs FAR * r)
{
@ -330,16 +337,6 @@ VOID int21_service(iregs FAR * r)
p->ps_stack = (BYTE FAR *) r;
switch(r->AH)
{
case 0x2a: /*DosGetDate */
case 0x2b: /*DosSetDate */
case 0x2c: /*DosGetTime */
case 0x2d: /*DosSetDate */
break;
default:
debug_cnt++; /* debuggable statement */
}
@ -1864,21 +1861,21 @@ struct int25regs
cs;
};
/* this function is called from an assembler wrapper function */
/*
I'm probably either
A) totally braindamaged
B) chasing a compiler bug, which I can't find.
LEAVE THIS CODE EXACTLY AS IS OR FDOS WON'T BOOT
/*
this function is called from an assembler wrapper function
*/
VOID int2526_handler(WORD mode, struct int25regs FAR * r)
{
ULONG blkno;
UWORD nblks;
BYTE FAR *buf;
UBYTE drv = r->ax;
UBYTE drv;
if (mode == 0x26) mode = DSKWRITE;
else mode = DSKREAD;
drv = r->ax;
if (drv >= (lastdrive - 1))
{
r->ax = 0x202;
@ -1892,45 +1889,22 @@ VOID int2526_handler(WORD mode, struct int25regs FAR * r)
buf = MK_FP(r->ds, r->bx);
if (mode == DSKREAD)
{
if (nblks == 0xFFFF)
{
/*struct HugeSectorBlock FAR *lb = MK_FP(r->ds, r->bx);*/
blkno = ((struct HugeSectorBlock FAR *)buf)->blkno;
nblks = ((struct HugeSectorBlock FAR *)buf)->nblks;
buf = ((struct HugeSectorBlock FAR *)buf)->buf;
}
else
{
buf = MK_FP(r->ds, r->bx);
}
} else {
if (nblks == 0xFFFF)
{
struct HugeSectorBlock FAR *lb = MK_FP(r->ds, r->bx);
blkno = lb->blkno;
nblks = lb->nblks;
buf = lb->buf;
}
else
{
buf = MK_FP(r->ds, r->bx);
}
}
if (nblks == 0xFFFF)
{
/*struct HugeSectorBlock FAR *lb = MK_FP(r->ds, r->bx);*/
blkno = ((struct HugeSectorBlock FAR *)buf)->blkno;
nblks = ((struct HugeSectorBlock FAR *)buf)->nblks;
buf = ((struct HugeSectorBlock FAR *)buf)->buf;
}
InDOS++;
if (mode == DSKREAD)
{
r->ax=dskxfer(drv, blkno, buf, nblks, mode);
} else {
r->ax=dskxfer(drv, blkno, buf, nblks, DSKWRITE);
if (r->ax <= 0)
setinvld(drv);
}
r->ax=dskxfer(drv, blkno, buf, nblks, mode);
if (mode == DSKWRITE)
if (r->ax <= 0)
setinvld(drv);
if (r->ax > 0)
{
@ -1945,9 +1919,10 @@ VOID int2526_handler(WORD mode, struct int25regs FAR * r)
--InDOS;
}
/*
VOID int25_handler(struct int25regs FAR * r) { int2526_handler(DSKREAD,r); }
VOID int26_handler(struct int25regs FAR * r) { int2526_handler(DSKWRITE,r); }
*/

View File

@ -34,6 +34,9 @@ static BYTE *Proto_hRcsId = "$Id$";
/*
* $Log$
* Revision 1.11 2001/03/27 20:27:43 bartoldeman
* dsk.c (reported by Nagy Daniel), inthndlr and int25/26 fixes by Tom Ehlert.
*
* Revision 1.10 2001/03/22 04:55:36 bartoldeman
* Fix prototypes.
*
@ -365,8 +368,8 @@ VOID INRPT FAR int23_handler(int es, int ds, int di, int si, int bp, int sp, int
VOID INRPT FAR int24_handler(void);
VOID INRPT FAR low_int25_handler(void);
VOID INRPT FAR low_int26_handler(void);
VOID int25_handler();
VOID int26_handler();
/* VOID int25_handler();
VOID int26_handler();*/
VOID INRPT FAR int27_handler(int es, int ds, int di, int si, int bp, int sp, int bx, int dx, int cx, int ax, int ip, int cs, int flags);
VOID INRPT FAR int28_handler(void);
VOID INRPT FAR int2a_handler(void);