Implement ACPI shutdown and triplefault-reboot.
txt2html / site update

Makefile:
	more elegant rules

util/txt2html.pl:
	add regexp for <code>, nested lists (3 levels), numbered lists,
	[text|link], anchors and anchor refs, and wrap everything in
	<html>, adding UTF-8 character encoding.
Long overdue: boot from harddisk

bootloader/bootloader.s:
	preparereadsector$ (reset drive): jump to fail label after
	3 retries instead of assuming success.

	BOOTLOADER_FOLLOWS_MBR flag: bootloader is consecutive to the MBR,
	instead of the first bootable partition.

	on fail, keypress will reboot, allowing qemu's -boot once=X.
	TODO: automatic reboot after delay using BDA daily timer.

	don't add "Hello!" string if it is not printed.

	Save the bootloader's size in sectors at offset 444 (the word before
	the MBR partition table). It is/can be used by fdisk to extract the
	bootloader from boot.img and find the location of the RAMDISK 'FAT'.

bootloader/sector1.s:
	fix boot drive: copy bootloader registers from stack segment, not ds.

	kernel image follows bootloader: don't load it from
	the first bootable partition.

	load_sector: don't check al (transferred sectors) as VMWare does not
	return the proper value (1) but 0x50.

	lba_to_chs: fix sector bitmask (6 bits, not 5)

16/print.s:
	printhex8: realmode, so use cx, not ecx. (no real change).

.tcshrc:
	cleanup qemu aliases.

	add alias qemu-nonetc, which excludes the iso, making sure that boot is
	from hdd.

kernel/realmode.s:
	use proper register for printing kernel size.

kernel/ata.s:
	ata_get_hs_geometry: update error printing.

	ata_list_drive:
		reduce debug level for printing type/status.

		add checks for some undocumented values returned by VMWare
		and QEMU when booting from HDD, or when boot order is
		different: VMWare returns -1 for ATA if the disk is not
		bootable, and 0x1414 for CDROM. QEMU returns 4 when booted
		from disk.
		Print debug warning when the type is unexpected and defaulting
		to ATAPI.

	cmd_disks_print$:
		fix printing disk number: don't print consecutive, but by
		bus+drive.

	ata_print_bits$ (for status reg): nicer printing.

	atapi_drq_reason_mismatch: print reason (CMDIN/DATAOUT etc).

	ata_isr: separate [ata_irq] counter for the two IRQ's.

	atapi_packet_command: wait for proper IRQ:
		store the ata bus as the irq index in a static
		var (can't use stack for now),
		and pass it along to ata_wait_irq.

			NOTE: method is not reentrant!

	ata_wait_irq: take eax (0 or 1) as index into [ata_irq].

kernel/partition.s:

		NOTE: Work in progress - contains debug!

	disk_read_partition_tables: set proper geometry before calling
	load_partition_tables (which verifies the table).

	disk_ptables_print: use PT_* labels for clarity (no real change).
	  don't increment LBA returned from chs_to_lba.

	fdisk_print_usage$: nicer format.
	fdisk_cmd_init: fix printing issues.

	fdisk_cmd_init$:
		- copy the boot image to the beginning of the partition,
		  using the bootloader boot sector
		- reserve 10 Mb at the beginning of the disk.

	disk_br_verify$: (verify boot record) the LBA returned from
	chs_to_lba was incremented, even though this is an error.
	For now, allow CHS to be one less than the LBA_START to allow
	mounting of existing partitions.

		TODO: improve fdisk to allow correction for this.

	lba_to_chs: don't check for LBA=0, because this is allowed:
	  LBA=0 = sector 1.

kernel/fs.s:
	fs_read: propagate read error CF to return.
ACPI: add event ISR

kernel/acpi.s:
	enable some events, install IRQ handler.
Add task switch stats; add 3D webnav.

	SUMMARY
		cloudnet daemon has a main delay calling 'sleep',
		which caused hundreds of task switches per second.
		sleep now lets the scheduler take care of this.

		add statistics for task switches.

		add HTML5 Canvas 3D navgeo - intended to show the
		cluster structure at some point.

kernel/defines.s:
	declare stats data section

kernel/shell.s:
	add 'stats' commands.

kernel/schedule.s:
	keep track of global and per-task task switches.

kernel/net/httpd.s:
	declare www expression ${kernel.stats.ts} for task_switches.

kernel/mutex.s:
	use KAPI_CALL for task_wait_io in YIELD_SEM.

kernel/pit.s:
	sleep: use the timeout arg of task_wait_io (YIELD timeout=...)
	and have scheduler take care of 'sleep'.
	'sleep' was inefficient as it requires a task switch on each
	PIT IRQ.

root/www/scene_pack.js:
	concatenated version of uncommitted javascript for 3D matrix
	operations, perspective projection, quad and tri mesh ordering
	and rendering, face culling, etc.

root/www/index.html:
	add a demonstration of 3D web navigation.

	add kernel task switch statistics.

.tcshrc:
	add alias 'vm' for 'adm vm'.
TCP: check for dup ACK on FIN tx

kernel/net/tcp.s:
	when the connection initiator (client) closes it's transmission line
	after the recipient (server) closes it's side of the connection,
	a duplicate ACK will be received for the packet where the server
	terminates the connection:

		S>C FIN ACK seq=A   ack=B
		C>S ACK     seq=B   ack=A+1
		C>S FIN ACK seq=B   ack=A+1 (dup ACK for TX FIN)
		S>C ACK     seq=A+1 ack=B+1

	On receiving an ACK for the TX FIN, the TX buffer is freed.

	This commit adds a check to not free the buffer again.

	(NOTE: the duplicate ACK is expected as nothing more is transmitted S>C)