mirror of https://github.com/FDOS/kernel.git
Define I386 and I186 more cleanly.
Add (UWORD) casts to silence the compiler. Optimize (head*sector) to secs_per_cyl Add BORLANDC to compiler list and simplify startup printf to one message. #pragma enable_message(130) for Watcom C causes it to behave a little more like Borland in terms of warnings. git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@776 6ac86273-5f31-0410-b378-82cca8765d1b
This commit is contained in:
parent
0e0abcd685
commit
de444743cc
16
hdr/portab.h
16
hdr/portab.h
|
@ -81,10 +81,6 @@ static unsigned short __inline SS(void)
|
||||||
asm mov ax, ss;
|
asm mov ax, ss;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(M_I286) /* /G3 doesn't set M_I386, but sets M_I286 TE */
|
|
||||||
#define I386
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#elif defined(__WATCOMC__) /* don't know a better way */
|
#elif defined(__WATCOMC__) /* don't know a better way */
|
||||||
|
|
||||||
#define I86
|
#define I86
|
||||||
|
@ -96,8 +92,10 @@ static unsigned short __inline SS(void)
|
||||||
#define _SS SS()
|
#define _SS SS()
|
||||||
unsigned short SS(void);
|
unsigned short SS(void);
|
||||||
#pragma aux SS = "mov dx,ss" value [dx];
|
#pragma aux SS = "mov dx,ss" value [dx];
|
||||||
|
/* enable Possible loss of precision warning for compatibility with Borland */
|
||||||
|
#pragma enable_message(130)
|
||||||
|
|
||||||
#if _M_IX86 >= 300
|
#if _M_IX86 >= 300 || defined(M_I386)
|
||||||
#define I386
|
#define I386
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -114,6 +112,14 @@ unsigned short SS(void);
|
||||||
We might even deal with a pre-ANSI compiler. This will certainly not compile.
|
We might even deal with a pre-ANSI compiler. This will certainly not compile.
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef I86
|
||||||
|
#if _M_IX86 >= 300 || defined(M_I386)
|
||||||
|
#define I386
|
||||||
|
#elif _M_IX86 >= 100 || defined(M_I286)
|
||||||
|
#define I186
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef MC68K
|
#ifdef MC68K
|
||||||
#define far /* No far type */
|
#define far /* No far type */
|
||||||
#define interrupt /* No interrupt type */
|
#define interrupt /* No interrupt type */
|
||||||
|
|
18
kernel/dsk.c
18
kernel/dsk.c
|
@ -387,7 +387,8 @@ STATIC WORD getbpb(ddt * pddt)
|
||||||
{
|
{
|
||||||
ULONG count;
|
ULONG count;
|
||||||
bpb *pbpbarray = &pddt->ddt_bpb;
|
bpb *pbpbarray = &pddt->ddt_bpb;
|
||||||
WORD head, /*track, */ sector, ret;
|
unsigned secs_per_cyl;
|
||||||
|
WORD ret;
|
||||||
|
|
||||||
/* pddt->ddt_descflags |= DF_NOACCESS;
|
/* pddt->ddt_descflags |= DF_NOACCESS;
|
||||||
* disabled for now - problems with FORMAT ?? */
|
* disabled for now - problems with FORMAT ?? */
|
||||||
|
@ -455,21 +456,22 @@ STATIC WORD getbpb(ddt * pddt)
|
||||||
count =
|
count =
|
||||||
pbpbarray->bpb_nsize == 0 ?
|
pbpbarray->bpb_nsize == 0 ?
|
||||||
pbpbarray->bpb_huge : pbpbarray->bpb_nsize;
|
pbpbarray->bpb_huge : pbpbarray->bpb_nsize;
|
||||||
head = pbpbarray->bpb_nheads;
|
secs_per_cyl = pbpbarray->bpb_nheads * pbpbarray->bpb_nsecs;
|
||||||
sector = pbpbarray->bpb_nsecs;
|
|
||||||
|
|
||||||
if (head == 0 || sector == 0)
|
if (secs_per_cyl == 0)
|
||||||
{
|
{
|
||||||
tmark(pddt);
|
tmark(pddt);
|
||||||
return failure(E_FAILURE);
|
return failure(E_FAILURE);
|
||||||
}
|
}
|
||||||
pddt->ddt_ncyl = (count + head * sector - 1) / (head * sector);
|
/* this field is problematic for partitions > 65535 cylinders,
|
||||||
|
in general > 512 GiB. However: we are not using it ourselves. */
|
||||||
|
pddt->ddt_ncyl = (UWORD)((count + (secs_per_cyl - 1)) / secs_per_cyl);
|
||||||
|
|
||||||
tmark(pddt);
|
tmark(pddt);
|
||||||
|
|
||||||
#ifdef DSK_DEBUG
|
#ifdef DSK_DEBUG
|
||||||
printf("BPB_NSECS = %04x\n", sector);
|
printf("BPB_NSECS = %04x\n", pbpbarray->bpb_nsecs);
|
||||||
printf("BPB_NHEADS = %04x\n", head);
|
printf("BPB_NHEADS = %04x\n", pbpbarray->bpb_nheads);
|
||||||
printf("BPB_HIDDEN = %08lx\n", pbpbarray->bpb_hidden);
|
printf("BPB_HIDDEN = %08lx\n", pbpbarray->bpb_hidden);
|
||||||
printf("BPB_HUGE = %08lx\n", pbpbarray->bpb_huge);
|
printf("BPB_HUGE = %08lx\n", pbpbarray->bpb_huge);
|
||||||
#endif
|
#endif
|
||||||
|
@ -891,7 +893,7 @@ STATIC int LBA_to_CHS(ULONG LBA_address, struct CHS *chs, const ddt * pddt)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
chs->Cylinder = LBA_address;
|
chs->Cylinder = (UWORD)LBA_address;
|
||||||
chs->Head = hsrem / pbpb->bpb_nsecs;
|
chs->Head = hsrem / pbpb->bpb_nsecs;
|
||||||
chs->Sector = hsrem % pbpb->bpb_nsecs + 1;
|
chs->Sector = hsrem % pbpb->bpb_nsecs + 1;
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -332,29 +332,33 @@ STATIC VOID signon()
|
||||||
{
|
{
|
||||||
printf("\r%S", MK_FP(FP_SEG(LoL), FP_OFF(LoL->os_release)));
|
printf("\r%S", MK_FP(FP_SEG(LoL), FP_OFF(LoL->os_release)));
|
||||||
|
|
||||||
printf("Kernel compatibility %d.%d", MAJOR_RELEASE, MINOR_RELEASE);
|
printf("Kernel compatibility %d.%d - ", MAJOR_RELEASE, MINOR_RELEASE);
|
||||||
|
|
||||||
#if defined(__TURBOC__)
|
printf(
|
||||||
printf(" - TURBOC");
|
#if defined(__BORLANDC__)
|
||||||
|
"BORLANDC"
|
||||||
|
#elif defined(__TURBOC__)
|
||||||
|
"TURBOC"
|
||||||
#elif defined(_MSC_VER)
|
#elif defined(_MSC_VER)
|
||||||
printf(" - MSC");
|
"MSC"
|
||||||
#elif defined(__WATCOMC__)
|
#elif defined(__WATCOMC__)
|
||||||
printf(" - WATCOMC");
|
"WATCOMC"
|
||||||
#elif defined(__GNUC__)
|
#elif defined(__GNUC__)
|
||||||
printf(" - GNUC"); /* this is hypothetical only */
|
"GNUC" /* this is hypothetical only */
|
||||||
#else
|
#else
|
||||||
|
#error Unknown compiler
|
||||||
generate some bullshit error here, as the compiler should be known
|
generate some bullshit error here, as the compiler should be known
|
||||||
#endif
|
#endif
|
||||||
#if defined (I386)
|
#if defined (I386)
|
||||||
printf(" - 80386 CPU required");
|
" - 80386 CPU required"
|
||||||
#elif defined (I186)
|
#elif defined (I186)
|
||||||
printf(" - 80186 CPU required");
|
" - 80186 CPU required"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef WITHFAT32
|
#ifdef WITHFAT32
|
||||||
printf(" - FAT32 support");
|
" - FAT32 support"
|
||||||
#endif
|
#endif
|
||||||
printf("\n\n%S", (void FAR *)copyright);
|
"\n\n%S", (void FAR *)copyright);
|
||||||
}
|
}
|
||||||
|
|
||||||
STATIC void kernel()
|
STATIC void kernel()
|
||||||
|
|
|
@ -89,7 +89,7 @@ int DosMkTmp(BYTE FAR * pathname, UWORD attr)
|
||||||
unsigned long tmp = randvar++;
|
unsigned long tmp = randvar++;
|
||||||
int i;
|
int i;
|
||||||
for(i = 7; i >= 0; tmp >>= 4, i--)
|
for(i = 7; i >= 0; tmp >>= 4, i--)
|
||||||
ptmp[i] = (tmp & 0xf) + 'A';
|
ptmp[i] = ((char)tmp & 0xf) + 'A';
|
||||||
|
|
||||||
/* DOS versions: > 5: characters A - P
|
/* DOS versions: > 5: characters A - P
|
||||||
< 5: hex digits */
|
< 5: hex digits */
|
||||||
|
@ -602,10 +602,11 @@ COUNT truename(const char FAR * src, char * dest, COUNT mode)
|
||||||
}
|
}
|
||||||
/* nothing found => continue normally */
|
/* nothing found => continue normally */
|
||||||
}
|
}
|
||||||
if ((mode & CDS_MODE_CHECK_DEV_PATH) && (result & IS_DEVICE) &&
|
if ((mode & CDS_MODE_CHECK_DEV_PATH) &&
|
||||||
!(result & IS_NETWORK) && dest[2] != '/' && !dir_exists(dest))
|
((result & (IS_DEVICE|IS_NETWORK)) == IS_DEVICE) &&
|
||||||
|
dest[2] != '/' && !dir_exists(dest))
|
||||||
return DE_PATHNOTFND;
|
return DE_PATHNOTFND;
|
||||||
|
|
||||||
tn_printf(("Physical path: \"%s\"\n", dest));
|
tn_printf(("Physical path: \"%s\"\n", dest));
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue