Implement ATA IRQ; Fix CDROM access.

Wait for IRQ after ATAPI packet command as per spec.

Add pushf/cli/popf to PRINT_START/END, since some IRQs assume ds=es=valid.

Add cmd_pic to show pic masks.
WIP: ISO9660: read tree, file contents.

ata.s: atapi_read12$ now takes buffer argument in edi.

Implement sample read CDROM - prints files for all directories,
and file contents for HELLO.TXT.
Implement mounting iso9660; ATAPI fixes.

ata.s:
  ATAPI improvements: ignore ERR when appropriate. Simplify API, only
  need to supply al, not edx. Remove obsolete code.

debug.s:
  improve MORE command - enable interrupts, require enter key.
  DEBUG_DWORD|WORD|BYTE [some expr] do not generate compiler error.

fat.s:
  do not print file contents on read;
  add class label for printing in mtab_print$.

fs.s:
  mtab: print filesystem name;
  fs_api structure: add filesystem label (first non-method field);
  fs_handle: record parent handles.
  fs_open: for each directory traversed the filesystem potentially
    allocates buffers; all these buffers are now recorded as a
    filesystem handle is allocated for each directory.
    Also, fs_api_open is called for the root directory aswell.
    TODO: fs_close: release parent handles.
  use ptr_array for fs_classes as the label is now stored in the
    filesystem 'driver'.
  fs_handle_read: fix buffer allocation: use 2k in case atapi.

iso9660.s:
  implement proper filesystem mounting, directory traversal
  and file reading.

partition.s:
  fdisk on an atapi device now prints the capacity.

print.s:
  fix PRINTCHARC_ macro;
  remove .text32 from STRINGPTR and STRINGNULL macros, they now
  return to .data.

sfs.s:
  add filesystem label to class.

shell.s:
  add newline_if - aligns commandline to beginning of line if
    a command does not end it's output with a newline.
  cmd_cat now prints the file contents itself rather than as a side
    effect of reading the file.
  add cdrom command - mount hdc on /c and cat the HELLO.TXT in the root.
  add listfs command to pre-existing fs_list_filesystems.

util/iso9660.cpp:
  print offsets of directory extents for debug comparison with iso9660.s.
Add (experimental) scheduling.

idt.s:
  Implement IRQ proxies: after each IRQ the schedule method is called.
    (Disabling scheduling is done by setting IRQ_PROXIES to 0).
  Print EFLAGS in exception handler.

schedule.s:
  Add schedule method - referred to from idt.s
  Implement XCHG mutex (tested LOCK CMPXCHG aswell).

  Add schedule_task method: takes a method pointer and a buffer size,
  returns a buffer where the caller can store parameters to be passed
  to the task. At current no separate stack or other context is supplied.

  A nice debug feature is a 'ticker tape' showing what the scheduler
  is up to.

  [sidenode: it was suprisingly simple, only a dozen or so lines of code
   to 'piggyback' onto IRQ handlers!]

[Note: code that makes use of scheduling is yet to be committed:
 net.s' net_rx_packet schedules net_rx_packet_task.
 Commit delayed due to some bugs in TCP.]
'mem' command more accurate.

The 'Allocated' it used to report is from the global heap,
which does not indicate the memory that is allocated with malloc.
That number is now called 'reserved', and 'allocated' indicates
the amount of memory that is truly allocated.
PIT: implement setting frequency; add doc.

Implement setting the frequency - at current still 18.2 Hz.
Add methods to calculate accurate frequency and period,
using fixed point arithmetic.
The pit_isr now also counts 'time' with 32:32 bit accuracy
in [clock_ms].

Add intel's 82c54 timer documentation.
Restore PIC mask after realmode call.

Not all interrupt lines were restored, only the
hardcoded ones: keyboard and PIT.
Cleanup scheduling.

Use the lock not for executing tasks but for accessing the scheduled
task lists.

Cleanup, remove defunct code. Use malloc/mfree for the argument buffer.

Use spinlock in schedule_task. Schedule list accesses should be quick.
RTL8139 ISR restore ds, es.
Network scheduling; HTTP file serving.

nic.s:
  add 'default' parameter to route add to affect metric.

net.s:
 o net_rx_packet schedules an interruptible task. Now requests can be sent
   in the packet handler, such as the ping handler which does ARP requests
   if needed.
 o fix tcp checksum for odd payload lengths.
 o fix sending spurious TCP FIN.
 o improve arp status printing.
 o fix arp lookup for gateway/non-gateway access: added metric to routes.
 o response timeouts (arp, ping) are now properly timed due to new PIT
   timing. Currently delays are 2 seconds.
 o add simple HTTP protocol parser: retrieves resource from HTTP GET.
 o add secure file loading from /c/www/ (issue 'cdrom' to mount).
 o print DNS result even if questions/answer_rr don't match.
 o measure ping response times. (at current PIT is at 18.2 Hz so the resolution
   is 55 ms (rounded), but with PIT at 1KHz millisecond resolution is observed
   to match that of the Host os pinging the same distant IP).

root/www/index.html:
  first file served!
Scheduler loads ds, es.

The es register during protected mode switching is not yet equal
to ds, yet the scheduler is running due to the PIT timer. Fixed.
Fix ATA timing; Fix ARP race condition.

ata.s:
  not using pause loop but hlt loop (256 ticks). TODO: specify time.
  This fixes long hdd mount time and atapi errors in VMWare.

net.s:
  the ARP response arrived before the ARP table was updated to reflect
  the request had been sent, on VMWare. Reversed order by first updating
  the table and then sending the request.
Minor: Hide cursor on return to textmode.
Improve root automounting; minor fixes.

sector1.s:
  pass on boot partition.

realmode.s:
  retrieve ata drive from cdrom disk emulation information.
  macro renames.
  add printhex4_16 alias, printcharc_16 method (should reduce kernel size).

idt.s:
  add SCHEDULE_IRET.
  call debug_printsymbol on stack print.

debugger.s:
  add debug symbol lookup and print.
  move macro so vim recognizes the filetype properly.

kernel.s:
  print both relocation and load address as they may not be the same
  depending on using SEL_flatCS or SEL_compatCS.
  enable scheduler by clearing schedule_sem.
  use ata drive to modify root automount command. moved mount to last action
    before shell.

pmode.s:
  affected by macro renames.
  preserve bp on stack print.
  fix rm_entry: ds isn't cs on return to realmode.
  improve debug.

schedule.s:
  add scheduling disabling.
    [adding a keyboard task made this necessary, as the keyboard is enabled
     before malloc is initialized.]
  scheduling disabled by default, activated by kernel.
  change spinlock on schedule_task to pushf/sti/hlt/popf.

string.s:
  fix strtok read past the null terminator if that char was nonzero.

gdt.s:
  affected by macro renames.
Various filesystem fixes.

fs.s:
  improve mount/partition printing: print filesystem type label,
    dont print -1 partition.

  fs_handle_read:
    preserve ebx.

  fs_close:
    fix label jump on invalid handle.
    free file buffer if handle has one.

  fs_update_path:
    fix reference to cd_cwd$ as the base for edi - now uses edi copy on stack.
    fix changing the source string, which appended a '/' to satisfy strtok.
    activate dead debug code on FS_DEBUG flag.
Add keyboard handler.

keyboard.s:
  remove old stosw debug code. set es to SEL_compatDS.
  add tracking of control and alt keys.
  keyboard method: add KB_GET_MUTATORS keyboard function, and return mutators
    in high word of ax. This is still experimental, as the mutators are not
    stored in the keybuffer.
  add keyboard task, scheduled by the ISR. It prints the stack on control-C.

shell.s:
  remove cdrom command - kernel automounts the boot cdrom.
  do not register control/alt-key combinations as character input.
  cmd_cat: print file between fs_read and fs_close.
  add cmd_breakpoint.

hwdebug.s:
  add generic breakpoint method. currently supported: byte, word, dword
    memory writes.

debugger.s:
  debug_getsymbol: fix CF when no symbol table.
Add kernel symbol table.

Add perl script to translate objdump -t symbol table to efficient binary
format. See debugger.s:debug_getsymbol, added two commits ago.

Symbol table is stored in the iso image aswell as in the bootloader ramdisk.
At current there is no support to load the second ramdisk image.
At current the ISO9660 driver does not support reading more than one
sector at a time.

An .incbin has been succesfully tested though this is not practical.
Fix root automount / VMWare bootdrive detection.

VMWare doesnt like 0x7f indicating to terminate all emulation.
Using boot drive (0x00 generally) instead. QEmu also accepts this.
Implement root fs.

Contents of root filesystem are:
 - all mountpoints directly descendent of root
 - /dev, containing pci devices (same source as for the 'dev' command).