Small cleanups; initialize a VDISK in inithma.c.

git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@409 6ac86273-5f31-0410-b378-82cca8765d1b
This commit is contained in:
Bart Oldeman 2002-08-03 02:37:59 +00:00
parent e77a22ead9
commit 31661b437d
3 changed files with 22 additions and 42 deletions

View File

@ -581,8 +581,10 @@ void DosDefinePartition(struct DriveParamS *driveParam,
pddt->ddt_WriteVerifySupported = driveParam->WriteVerifySupported; pddt->ddt_WriteVerifySupported = driveParam->WriteVerifySupported;
pddt->ddt_ncyl = driveParam->chs.Cylinder; pddt->ddt_ncyl = driveParam->chs.Cylinder;
#ifdef DEBUG
if (pddt->ddt_LBASupported) if (pddt->ddt_LBASupported)
DebugPrintf(("LBA enabled for drive %c:\n", 'A' + nUnits)); DebugPrintf(("LBA enabled for drive %c:\n", 'A' + nUnits));
#endif
pddt->ddt_offset = StartSector; pddt->ddt_offset = StartSector;
@ -761,8 +763,8 @@ ErrorReturn:
converts physical into logical representation of partition entry converts physical into logical representation of partition entry
*/ */
ConvPartTableEntryToIntern(struct PartTableEntry * pEntry, BOOL ConvPartTableEntryToIntern(struct PartTableEntry * pEntry,
UBYTE FAR * pDisk) UBYTE FAR * pDisk)
{ {
int i; int i;
@ -797,7 +799,7 @@ ConvPartTableEntryToIntern(struct PartTableEntry * pEntry,
return TRUE; return TRUE;
} }
ScanForPrimaryPartitions(struct DriveParamS * driveParam, int scan_type, BOOL ScanForPrimaryPartitions(struct DriveParamS * driveParam, int scan_type,
struct PartTableEntry * pEntry, ULONG startSector, struct PartTableEntry * pEntry, ULONG startSector,
int partitionsToIgnore, int extendedPartNo) int partitionsToIgnore, int extendedPartNo)
{ {
@ -1249,7 +1251,7 @@ void ReadAllPartitionTables(void)
setvec(0x1e, (intvec)int1e_table); setvec(0x1e, (intvec)int1e_table);
/* Setup media info and BPBs arrays for floppies */ /* Setup media info and BPBs arrays for floppies */
for (Unit = 0; Unit < nUnits; Unit++) for (Unit = 0; Unit < 2; Unit++)
{ {
pddt = DynAlloc("ddt", 1, sizeof(ddt)); pddt = DynAlloc("ddt", 1, sizeof(ddt));
@ -1267,6 +1269,9 @@ void ReadAllPartitionTables(void)
fmemcpy(&pddt->ddt_bpb, &pddt->ddt_defbpb, sizeof(bpb)); fmemcpy(&pddt->ddt_bpb, &pddt->ddt_defbpb, sizeof(bpb));
} }
/* Initial number of disk units */
nUnits = 2;
/* /*
this is a quick patch - see if B: exists this is a quick patch - see if B: exists
test for A: also, need not exist test for A: also, need not exist
@ -1364,9 +1369,6 @@ COUNT dsk_init()
/* Reset the drives */ /* Reset the drives */
BIOS_drive_reset(0); BIOS_drive_reset(0);
/* Initial number of disk units */
nUnits = 2;
ReadAllPartitionTables(); ReadAllPartitionTables();
return nUnits; return nUnits;

View File

@ -87,6 +87,7 @@ VOID ASMCFUNC FAR _DisableA20(VOID);
void FAR * ASMCFUNC DetectXMSDriver(VOID); void FAR * ASMCFUNC DetectXMSDriver(VOID);
int ASMCFUNC init_call_XMScall(void FAR * driverAddress, UWORD ax, int ASMCFUNC init_call_XMScall(void FAR * driverAddress, UWORD ax,
UWORD dx); UWORD dx);
STATIC void InstallVDISK(void);
#ifdef DEBUG #ifdef DEBUG
#ifdef __TURBOC__ #ifdef __TURBOC__
@ -239,14 +240,19 @@ int MoveKernelToHMA()
DosLoadedInHMA = TRUE; DosLoadedInHMA = TRUE;
} }
/* report the fact we are running high thorugh int 21, ax=3306 */ /*
on finalize, will install a VDISK
*/
InstallVDISK();
/* report the fact we are running high through int 21, ax=3306 */
version_flags |= 0x10; version_flags |= 0x10;
return TRUE; return TRUE;
} }
/* not necessary anymore : BO */
/* /*
now protect against HIMEM/FDXMS/... by simulating a VDISK now protect against HIMEM/FDXMS/... by simulating a VDISK
FDXMS should detect us and not give HMA access to ohers FDXMS should detect us and not give HMA access to ohers
@ -254,8 +260,7 @@ int MoveKernelToHMA()
so: we install this after all drivers have been loaded so: we install this after all drivers have been loaded
*/ */
#if 0 STATIC void InstallVDISK(void)
void InstallVDISK(VOID)
{ {
static struct { /* Boot-Sektor of a RAM-Disk */ static struct { /* Boot-Sektor of a RAM-Disk */
UBYTE dummy1[3]; /* HIMEM.SYS uses 3, but FDXMS uses 2 */ UBYTE dummy1[3]; /* HIMEM.SYS uses 3, but FDXMS uses 2 */
@ -278,38 +283,12 @@ void InstallVDISK(VOID)
if (!DosLoadedInHMA) if (!DosLoadedInHMA)
return; return;
if (HMAclaimed)
return;
fmemcpy(MK_FP(0xffff, 0x0010), &VDISK_BOOT_SEKTOR, fmemcpy(MK_FP(0xffff, 0x0010), &VDISK_BOOT_SEKTOR,
sizeof(VDISK_BOOT_SEKTOR)); sizeof(VDISK_BOOT_SEKTOR));
setvec(0x19, MK_FP(0xffff, 0x0010)); /* let INT 19 point to VDISK */
*(WORD FAR *) MK_FP(0xffff, 0x002e) = 1024 + 64; *(WORD FAR *) MK_FP(0xffff, 0x002e) = 1024 + 64;
} }
#endif
/*
this should be called, after each device driver
has been loaded with FALSE
and on finished CONFIG processing with TRUE.
will try to grab HMA;
on finalize, will install a VDISK
*/
#if 0 /* not necessary anymore */
void HMAconfig(int finalize)
{
ClaimHMA();
if (finalize)
InstallVDISK();
}
#endif
/* /*
this allocates some bytes from the HMA area this allocates some bytes from the HMA area
@ -346,7 +325,6 @@ void MoveKernel(unsigned NewKernelSegment)
UBYTE FAR *HMASource; UBYTE FAR *HMASource;
unsigned len; unsigned len;
int3();
if (CurrentKernelSegment == 0) if (CurrentKernelSegment == 0)
CurrentKernelSegment = FP_SEG(_HMATextEnd); CurrentKernelSegment = FP_SEG(_HMATextEnd);

View File

@ -39,15 +39,15 @@ UWORD init_oem(void)
{ {
UWORD top_k = 0; UWORD top_k = 0;
#ifndef __TURBOC__ #ifdef __TURBOC__
__int__(0x12);
top_k = _AX;
#elif defined(I86)
asm asm
{ {
int 0x12; int 0x12;
mov top_k, ax; mov top_k, ax;
} }
#else
__int__(0x12);
top_k = _AX;
#endif #endif
return top_k; return top_k;
} }