> The SDA of MS seems fairly well documented in RBIL, but I'd be
> pretty surprised if all DOS clones (particularly Virtual Machines
> like DOSBox) are compliant so it may not be a good idea to pursue. 
> I suspect FreeDOS would be pretty close to compliant, but I'm not even sure 
> about that.

After thinking a bit about this, I'm fairly certain that FreeDOS is
NOT (sufficiantly) SDA compliant.

Even assuming that all static state of the FreeDOS kernel is contained
in the SDA, there is more 'state' in a DOS machine then that. at least
5 problem cases come to mind:

(1) DOS_MEM_ALLOC()

is basically

   a) segment = find_first_free_segment(size_wanted)

   b) mark_segment_as_used(segment)
      build_mcb_chain(segment, size_wanted)

now if the normal processing gets interrupted between a) and b) by a
TSR, and the TSR also calls DOS_MEM_ALLOC, both the TSR and the old instance
will get the same segment and treat it as their own to use. BAD things
will happen...



(2) DOS_FILE_OPEN(filename)
is basically

   a) file_number = find_first_closed_file()

   b) mark_file_as_used(file_number)
      initialize_file_table(file_number, filename, ...)

now if the normal processing gets interrupted between a) and b) by a
TSR, and the TSR also calls DOS_FILE_OPEN, both the TSR and the old instance
will get the same filenumber and treat it as their own to use. BAD things
will happen...

(3,4) DOS_FILE_WRITE()
   the problem is with the internal (and /or some external) cache.

   basically

   a) buffer = locate_LRU_buffer()

   b) clean_buffer_if_dirty(buffer)
      init_buffer(buffer, sectornumber)

now if the normal processing gets interrupted between a) and b) by a
TSR, and the TSR also calls DOS_FILE_WRITE, both the TSR and the old instance
will use the same buffer for differenrt sectors. usually not a good
idea.


(5) INT_13_WRITE_SECTOR(LBA, buffer, count)

    basically

  a)disk_controller_position(LBA)
    disk_controller_initiate_write()
    disk_controller_send_data(buffer,count)
    disk_controller_wait_while_busy()
    return disk_controller_status == STATUS_OK
  b)

  if the TSR interrupts anywhere and calls INT_13_WRITE (or
  INT_13_READ) between a) and b) data will be lost.


some of the problems above might be handled by placing CLI/STI at
proper locations. some are more difficult.

but I'm pretty certain that FreeDOS hasn't a lot of CLI/STI's
sprinkled at clever positions.


I have absolutely no idea how this situation is for MSDOS and DRDOS.
as MS 'invented' the SDA, they might have put some (and probably
more) into the proper places. at least I would think so.

Tom






_______________________________________________
Freedos-devel mailing list
Freedos-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freedos-devel

Reply via email to