Commit Graph

171 Commits

Author SHA1 Message Date
Tee-Kiah Chia
6a29f57715 int2f: fix call interface around syscall_MUX14( ) (inthndlr.c)
The issues are similar to those surrounding int2F_12_hanndler( )
(see https://github.com/FDOS/kernel/issues/11).
2019-12-09 06:23:12 -05:00
Tee-Kiah Chia
c07577cbfb (Mostly) fix gcc-ia16 code for non-stack-switching int21 funcs. 2019-12-09 06:23:12 -05:00
Tee-Kiah Chia
0114ab3be4 int2f: fix call interface around int2F_12_handler( )
This changes the interface between reloc_call_int2f_handler
(int2f.asm) and int2F_12_handler( ) (inthndlr.c) so that

  - int2F_12_handler( ) will not try to output values to its
    caller by passing "back" input parameter values
  - reloc_call_int2f_handler will switch to an internal
    stack before calling int2F_12_handler( ), so that SS ==
    DGROUP as expected by the latter.

This partly addresses https://github.com/FDOS/kernel/issues/11 .

(The call to syscall_MUX14( ) in int2f.asm seems to have
similar issues, and should probably also be updated.)
2019-12-09 06:23:12 -05:00
Andrew Bird
0dc6a02450 int2f: Allow 1217h function to return new CDS entry
DOS provides the interrupt 2f/12xx functions for use by
filesystem redirectors in order that they do not need to access
structures and variables using undocumented methods. Interrupt
2f/1217 is a function used by a redirector to get the CDS entry
corresponding to a drive without iterating the CDS array found
via SYSVARS LOL.
    FreeDOS currently validates the flags in CDS entry before
deciding whether to return the entry to the caller. This behaviour
prevents a redirector receiving the CDS entry corresponding to
an as yet unassigned drive so preventing any new drive mapping.

    I've tested the following flavours of DOS and only FreeDOS
does this.

 # DOS variants returning new CDS entries okay
    DR-DOS
        6.00-930319 7.00 7.01 7.02-971119 7.02-980123 7.03 8.00
    MS-DOS
        3.10 3.20 3.21 3.30-Nec 3.30 3.31 4.01 5.00 6.00 6.20 6.21 6.22
        7.00 7.10
    PC-DOS
        3.00-Compaq 3.00 3.10-850307 3.10-850422 3.10-Compaq 3.20-851230
        3.20-860221 3.30 3.31-Compaq 4.00 4.01 5.00 5.02 6.10 6.30 7.00
        7.10 7.2K

 # DOS variants that return error rather than new CDS entry
    FR-DOS
        1.00 1.10 1.20

    This patch introduces an unvalidated version of get_cds() and calls
it only for the int2f/1217h call, other uses remain as before.
2019-12-02 15:09:23 -05:00
Mondgestein
a2ad348ed8 Function 30h (Get DOS Version): Get DOS version from PSP
- Upon creation, initialize the PSP version field
    to os_setver_minor / os_setver_major.
  - When calling Function 30h, return the contents
    of the current PSP's version field to the caller.
2019-12-02 12:06:22 -05:00
lpproj
6be00f83c1 Fix func 36h (Get free disk space) fails in some redirectors:
- David Maxey's PHANTOM (Undocumented DOS 2nd edition)
  - Novell CD-ROM extension NWCDEX (DR DOS 7.03)
2019-11-08 18:41:50 -05:00
C. Masloch
61647299c6 dosfns.c: only copy to current_ldt if pointer is valid 2019-11-08 18:19:11 -05:00
C. Masloch
6fbb1d0043 inthndlr.c: in Int21.43FF, dispatch DosMkRmdir on CL not AH 2019-11-08 18:19:11 -05:00
Tee-Kiah Chia
6f9648672e EXEC (func 0x4b): fix: do not crash if exMinAlloc == 0xffff
Some ancient NE programs set exMinAlloc to 0xffff to signify
that they should not be run as normal MZ programs at all:

00000000  4d 5a 40 00 01 00 00 00  04 00 ff ff ff ff 00 00
00000010  00 00 00 00 00 00 00 00  40 00 00 00 00 00 00 00
00000020  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
00000030  00 00 00 00 00 00 00 00  00 00 00 00 40 00 00 00
00000040  4e 45 04 00 9b 00 07 00  00 00 00 00 06 40 02 00
...

The kernel should reject these programs, rather than try to
run them (and crash the system).
2019-11-05 12:49:41 -05:00
Andrew Bird
d5b5505013 FCB: Rename return value lost
Two variables named 'result' were defined, at the outer level a
UBYTE to hold the function return value and the inner a COUNT to
hold returns from 'truename()'. The overall function return value
was always FCB_SUCCESS due to shadowing, however removing the
inner variable definition as a fix does not work due to sign
issues and intermixing of the variable uses, so rename the inner
variable.

Tested this patch using FDPP platform
1/ Simple rename of file with conditions for success (ok)
2/ Simple rename of file with conditions for failure - source missing (ok)
3/ Simple rename of file with conditions for failure - target exists (ok)

Fixes #16
2018-10-20 20:45:24 -04:00
Bart Oldeman
e6d427834f Implement suggested instead of minimal fix for ludivmul.
See https://sourceforge.net/p/freedos/bugs/106/
(Gerd Grosse)
2018-09-06 10:30:04 -04:00
Bart Oldeman
eda671d079 Fix division for some large numbers such as 0xFFFF01FF/0x10101FF
See also https://sourceforge.net/p/freedos/bugs/106/
(Gerd Grosse)
2018-09-06 10:12:41 -04:00
Bart Oldeman
fa36d8aa25 Fix comments (Gerd Grosse, https://sourceforge.net/p/freedos/bugs/106/) 2018-09-06 10:07:00 -04:00
Bart Oldeman
5ff361314c ia16-elf-gcc: eliminate DOSDATA, DOSTEXT and C use of TGROUP.
Now that it understands relocations those are no longer necessary.
2018-07-12 14:27:03 -04:00
Bart Oldeman
1bb9496c48 ia16-elf-gcc: eliminate _EnableA20 and _DisableA20 wrappers. 2018-07-12 12:14:47 -04:00
Bart Oldeman
25071a8df2 ia16-elf-gcc: eliminate wrapper for init_call_p_0 and make it "noreturn". 2018-07-12 11:47:41 -04:00
Bart Oldeman
8ee8135d4f ia16-elf-gcc port: use CDECL = __attribute__((cdecl)) instead of varargs. 2018-07-12 10:56:26 -04:00
Tee-Kiah Chia
49d1939ed7 ia16-elf-gcc: remove need for far function wrappers 2018-07-08 18:10:18 +08:00
Tee-Kiah Chia
fd770f50df ia16-elf-gcc: remove some DOSDATA(.) & DOSTEXT(.) uses; replace
with actual __far declarations which ia16-elf-gcc now supports
2018-04-21 10:36:42 +08:00
Tee-Kiah Chia
fdbea16132 ia16-elf-gcc: use special .msdos_mz_{hdr, reloc} section names
recognized by my recent (post-20 Mar 2018) binutils-ia16 patches
2018-04-21 00:13:05 +08:00
Bart Oldeman
a3a3c2cfe9 Fix ret in LSHLU/LSHRU long shift macros, since they already pop of stack. 2018-02-22 12:51:20 -05:00
Bart Oldeman
a70f31bf61 ia16-elf-gcc: enable and fix basic warnings; don't do strict ptr aliasing for now 2018-01-11 17:50:31 -05:00
Bart Oldeman
d7a05ab6cd For GCC builds use GNU make instead of wmake throughout.
This eliminates all build-dependencies on Open Watcom.
2018-01-11 17:50:31 -05:00
Bart Oldeman
89d97b18de Fix ASMCFUNC (FAR) functions for ia16-elf-gcc.
We need to use make the functions vararg (,...) to make them cdecl.
For FAR functions we need wrappers.
2018-01-11 17:50:31 -05:00
Bart Oldeman
9b5b2e7d60 Create init varieties for unsigned long helper functions.
An INITPATCH is used to make sure the correct symbols are used.
The GCC kernel now shows the copyright string and boots a little further.
2018-01-11 17:50:31 -05:00
Bart Oldeman
97003a8aca Introduce popargs and arg macros to distinguish PASCAL/STDCALL conventions.
GCC has -mrtd but the args are pushed in reverse versus PASCAL. So asm
routines have to use macros to obtain the stack arguments.
For the complex call_nls assembly, revert the arguments in C using a
preprocessor macro.
2018-01-11 17:50:31 -05:00
Bart Oldeman
f6d62165e0 ia16-elf-gcc: introduce DOSTEXT and DOSDATA macros.
Using DOSTEXT(x) accesses x in LGROUP and DOSDATA(x) in DGROUP.
This is necessary since ia16-elf-gcc does not understand data
in far segments.

For non-macro'ed symbols, FP_SEG needs to be replaced by explicit
segment references.
2018-01-11 17:50:31 -05:00
Bart Oldeman
71a7d0d264 ia16-elf-gcc: provide GNU LD linker script and symbols to link kernel.
The resulting kernel and sys.com do not work yet (kernel prints 123 only).
Some functions in sys.com are placeholders.
2018-01-11 17:50:31 -05:00
Bart Oldeman
7bf4b77233 ia16-elf-gcc port: compile all asm files with -f elf.
Because ia16-elf-gcc and the GNU linker do not understand OMF we
need to use ELF everywhere.
This also means we cannot use "wrt", "seg" and "call/jmp far".
Most wrt's are superfluous, and seg and call/jmp far can be
replaced by explicit ?GROUP references (to be defined in the
linker script).
2018-01-11 17:50:31 -05:00
Bart Oldeman
fbdbc4c25c C source code changes so the kernel can compile with ia16-elf-gcc.
Use "make all COMPILER=gcc".
Linking does not work yet with these changes.
2018-01-11 17:50:31 -05:00
Bart Oldeman
705268267c Use DOSTEXTFAR and DOSFAR for kbdType and internal_data. 2018-01-11 17:50:31 -05:00
Bart Oldeman
0b26c3f18f NLS: clean up to use the struct more and fewer relocations. 2018-01-11 17:50:31 -05:00
Bart Oldeman
fdac78cc67 Fix compilation with TC2 (no // comments; a global variable needs ASM) 2017-12-22 13:14:11 -05:00
Bart Oldeman
33d707ba7f Fix compilation with MSVC 1.52c.
Needs one more file from the c library, BSS_INIT all uninitialized
globals in config.c and a define of SEEK_SET.
2017-12-22 13:13:37 -05:00
Stas Sergeev
8187fd8153 disk: fix sectors count truncation for CHS [fixes #10]
LBA_to_CHS() uses geometry taken from BIOS, but LBA_Transfer()
was using the geometry from VBR. This caused "count" variable
to underflow over unsigned long, then corrupting the entire
DOS memory with the large read.

This patch makes LBA_to_CHS() to return the geometry to caller,
so that the calculus do always match.

Thanks to @ecm-pushbx and @andrewbird for helping to
nail this down.
2017-09-22 23:03:47 -04:00
Stas Sergeev
0b541ffd81 implement CHAIN directive for config.sys 2016-10-07 00:22:56 +03:00
Stas Sergeev
baad0b69dd remove trailing spaces in config.c 2016-10-06 23:01:14 +03:00
Stas Sergeev
68693a71c5 add missing ASM to fix build
Without this I am getting undefined reference to
_ReturnAnyDosVersionExpected
2016-10-06 07:23:59 -04:00
lpproj
cab8092ad6 Fix memory break in NUL device 2016-02-06 13:43:34 +09:00
lpproj
e024f72a4c Fix initial DTA 2016-02-06 13:32:36 +09:00
KJD
c9300387e7 Implement Int 2F/AX=120Bh based on RBIL description 2016-01-16 20:56:29 -05:00
KJD
ad3d7802f6 Implement Int 2F/AX=120Ah based on RBIL description - untested! 2016-01-16 16:46:22 -05:00
KJD
618e682a3b From Evelyn, CPU unsupported message missing loading error msg address (pop si) 2016-01-15 22:34:38 -05:00
lpproj
a87e233849 Copy FCB-format filename from PriPathName
(some redirectors require FCB-format filename stored in SDA+22Bh DirEntBuffer)
2015-09-22 12:19:27 +09:00
lpproj
9f254f2bee Fix memory break on loading country information (in config.sys) 2015-09-22 12:15:26 +09:00
lpproj
bc4615093a Fix an error at opening a character device prefixed with invalid drive letter (e.g. "@:NUL")
(some application use it for opening character device driver)
2015-09-22 12:06:43 +09:00
lpproj
2394f842ce Fix incompletion on loading huge (more than 65280 bytes) binary device driver 2015-09-22 12:02:57 +09:00
lpproj
5756cf8d26 On creating child PSP (func 0x55), copy command line parameters from the parent
(required for some device loaders)
2015-09-22 11:58:25 +09:00
KJD
234ed1181f Improve support for older BPB based volumes lacking extended fields.
Based on lpproj's nec98:Fix for DOS 3.x partitions
5fab40fc63
On loading BPB check signature if extended fields (serial#, volume, and fstype) are available, use dummy values if not.
Return error if attempt to set BPB serial# and not part of BPB.
2015-05-27 23:54:45 -04:00
lpproj
2efc2e8f69 Increase size of nlsDBCSHardcoded (to sizeof struct nlsDBCS) 2015-03-29 22:46:57 +09:00
lpproj
6d9a39d646 Write correct length of DBCS table on loading country.sys 2015-03-29 22:37:46 +09:00
lpproj
effd87fafb Return current country code (func 0x38) 2015-03-29 15:16:59 +09:00
lpproj
504fd16746 Enable to load DBCS table from COUNTRY.SYS 2014-11-22 11:42:05 +09:00
lpproj
0246178809 Fix pointer of DBCS table (int 0x21, func 0x6300) 2014-11-22 11:41:07 +09:00
lpproj
08c05b1d7a Fix build break on DOSish buildenv 2014-11-22 11:40:26 +09:00
KJD
8ca06cf20a Fix FCB parse filename (int21h func 29h) - update filename separators and terminators and remove extra handling of spaces, invert lead separator parsing to match description in MS Encyclopedia pages 269 and 1263-1264. 2014-11-04 23:01:35 -05:00
KJD
ed84760c0e use absolute not relative disk read/writes;
fix for syslinux DOS installer
partial fix, still need to confirm if other uses should also be absolute
2014-07-03 20:06:47 -04:00
KJD
8be4c2974a merge creation date & time from old dev branch 2014-07-03 20:01:57 -04:00
KJD
23eb8ff825 fix reading from NULL; sentinel lost due to conversion to char from int 2013-12-29 11:04:56 -05:00
KJD
4b08676a48 when updating MCB to add UMB chain, redetermine top of memory again in case changed (e.g. device driver relocated EBDA) to avoid corrupt MCB chain. Revert checking for switches only on pass==0, causes error due to portion of command line not skipped when reevaluated on next pass. Allow undocumented -1 for /E: switches option for use calculated EBDA size when moving. 2013-07-17 22:58:44 -04:00
KJD
087a0fee4e update comments, swap order to ensure ram_top adjusted by actual size of ebda moved, not just calculated size 2013-07-14 19:35:54 -04:00
Kenneth J. Davis
99461450aa remove unneeded printfs and properly handle multiple options on memdisk specified last line 2012-11-10 16:10:39 -05:00
Kenneth J. Davis
3a69192e7d allow user to more easily override preexisting options specified in last cfg line on memdisk line 2012-11-10 13:50:11 -05:00
Kenneth J. Davis
1fd28ea850 remove some debug printfs 2012-11-09 19:39:09 -05:00
Kenneth J. Davis
a9c0702807 rework memdisk command line processing so only last line skips memdisk options (less likely to skip options unexpectly) 2012-11-09 19:32:55 -05:00
Kenneth J. Davis
69f76c377e memdisk rework to not require fd=, better handling of memdisk options inbetween config commands 2012-11-07 01:47:42 -05:00
Kenneth J. Davis
9c7e161526 memdisk support spaces between line markers }{ and treat initrd and/or BOOT_IMAGE options as eol and eof indicator 2012-11-05 23:37:36 -05:00
Kenneth J. Davis
0053674575 memdisk support - handle whitespace better, support lower case FD= as well 2012-11-05 22:22:14 -05:00
Kenneth J. Davis
f3bc7e882a display error for unsupported CPU from C. Masloch 2012-10-15 12:41:25 -04:00
KJD
a260927440 Tell version info without booting kernel 2012-10-15 06:41:07 -04:00
KJD
c431157156 FreeDOS kernel current - 2041+svn1709 2012-10-14 20:08:06 -04:00