DEBUG: source and symbol printing updates.

kernel/debugger/debugger.s:
	debug_printsymbol:
	- refactor: extract debug_printsource;

	add debug_printsymbol_short;

	all three methods: preserve background color.

	debugger_print_mutex:
	- print all mutex bits, not just first 8;
	- print mutex number and name in 'bold' if locked (not just ':');
	- print the short version of debug symbol;
	- fix printing the release address;

kernel/print.s:
	add method getcolor;
	add method nprintbin, printing cl lowest bits.

kernel/schedule.s:
	task_print: use new method debug_printsymbol_short.
[minor] task list: print time improvement

kernel/print.s:
	sPRINTCHAR: optimize and pad with zero;
	sprint: pad with zero;

kernel/schedule.s:
	print_task: right-justify task running time.
CloudNet: fix rebooting too many nodes

	SUMMARY

		This fixes the case where after sending a reboot packet to a
		node, all succeeding nodes are also considered in need of a
		reboot.

kernel/net/cloudnet.s:
	cluster_reboot_node: preserve registers.
[minor] NET: unlock mutex sooner on dropped packet

kernel/net/net.s:
	release the NET mutex before printing the error message,
	as this will invoke a VM escalation reserving the mutex
	for longer than is necessary. (not sure whether this has
	any effect)
SHELL: improve commandline history

kernel/shell.s:
	in the case of entering a commandline present in the history,
	set the history index so that arrow-up will start the history
	traversal at that command.
DOC: txt2html <dl> updates; Doc shell cmds;

DOC/Debugging.txt:
	minor fixes;

	document most of the shell commands (idea was only useful commands
	for debugging but I ended up listing most of them).

kernel/shell.s:
	move ''sha1'' and ''base64'' to experimental section;

util/txt2html.pl:
	better definition list parsing;
	surround def list with <dl> tag pair;

	simplify paragraph matching code: no piece of text,
	as separated by 2 \n, will be made a paragraph if it
	begins with < and ends with >. Note that this MIGHT
	result in something like this not being made into
	a paragraph:

		''foo'' test ''bar''
MUTEX: record task index.

	SUMMARY

		In an ongoing effort to debug the cause of the occasional
		"failed to acquire lock NET", seemingly occurring mostly
		after resuming the host from hibernation, now the mutexes
		do not only record the address that acquired and freed
		them, but also the scheduler task index.

		So far, it appears that in all cases where NET cannot be
		locked (due to it already being locked), the MEM mutex
		is also locked at the same clock value, which should not
		happen within a single task - hence adding this code to
		check for the execution context.

kernel/lib/mem.s:
	malloc_: cleanup - use MUTEX_SPINLOCK and STACKTRACE.

kernel/debugger/debugger.s:
	debugger_print_mutex: print the PID of the locking/unlocking task.

kernel/mutex.s:
	add mutex_(un)lock_task recording the task index.
	update MUTEX_LOCK, MUTEX_UNLOCK and MUTEX_SPINLOCK to record the task
	index.

kernel/schedule.s:
	make scheduler_current_task_idx global so that the mutex code
	can access it.
CloudNet: add unknown nodes on rx ping

kernel/net/cloudnet.s:
	When receiving a ping from an unknown node - i.e., a node who's
	response to the 'Hello' packet was missed - send a hello packet
	to it, and have the cluster packet handler deal with the response.
NET: cleanup packet handler rx queue

kernel/net/net.s:
	make the rx queue code a bit more straightforward, only having
	a single place for both locking and unlocking the mutex.

	The only functional difference should be that the packet queue handler
	is notified of a new packet while the NET mutex is locked. However,
	the scheduler won't immediately execute the task so it should make
	no difference in most cases. When the task gets queued too soon,
	the mutex lock will fail and it will wait to be rescheduled as usual.

kernel/print.s:
	make printlnc global.
MUTEX: record sequence; move print code.

kernel/debugger/debugger.s:
	move the mutex print code to mutex.s.

kernel/mutex.s:
	receive the mutex print code;
	record a sequence counter for the lock/unlock operations
	to aid in debugging.
MUTEX: remove unused macros.
Debugger: fix print relative symbol short offset

kernel/debugger/debugger.s:
	debug_printsymbol_short: attempts to print the shortest hex string
	possible for a relative offset. Correct for 0-based ''bsr''.
MUTEX: refacor register lock/unlock

kernel/mutex.s:
	add methods mutex_(un)lock_register. Saves 5kb in code.
	Also has the advantage of recording source lines properly
	in the non-pushf/popf cases due to macro expansion alignment.
MUTEX: refactor macros into methods.

	SUMMARY

		The macros are kept as the main API yet they now call
		methods. No functional change.

kernel/kernel.s:
	include mutex.s after kapi.s since mutex methods call YIELD.
	This was not necessary before as the macros would be invoked
	after both files were included.

kernel/mutex.s:
	remove most global exports required for macros;
	export methods mutex_(un|spin|)lock;
	define mutex names using an array of string pointers as methods
	have no access to the macro parameters; update the mutex_print
	and related method accordingly.

	move the code in the MUTEX_(UN|SPIN|)LOCK macros to the methods.

	append '$' to method names mutex_fail and mutex_record_(un)lock
	indicating they are local. Minor adjustments/optimisations due to
	their calling context (eax contains the mutex bit index).

	(the total code size saved, including previous commits, is about
	8800 bytes).
MUTEX: cleanup, flag preservation.

	SUMMARY

		Analyzed all invocations of MUTEX_SPINLOCK_ and MUTEX_UNLOCK_
		to determine the effects of CF. No action is ever taken based
		on the resulting CF, except in the mutex.s code itself.
		Replacing MUTEX_SPINLOCK_ invocations with MUTEX_SPINLOCK is
		determined to be safe;
		Replacing the MUTEX_UNLOCK_ with MUTEX_UNLOCK was not safe in
		all cases as CF needed to be preserved across the call.
		Therefore mutex_unlock is modified to preserves the flags.

		The main reason to do this has to do with GAS and the
		source-line table: aligning the call stack with macro
		invocations allows to show the source file and line
		for each lock/unlock rather than having to look up the
		location in a disassembly.

kernel/mutex.s:
	muteX_unlock: preserve flags.
	mutex_record_unlock$: preserve flags.
	mutex_print: don't print clock (lines too wide, sequence more accurate)
	remove macro MUTEX_UNLOCK_
	remove macro MUTEX_SPINLOCK_

kernel/debugger/export.s:
kernel/lib/mem.s:
kernel/net/net.s:
kernel/net/socket.s:
kernel/net/tcp.s:
	MUTEX_SPINLOCK_ -> MUTEX_SPINLOCK
	MUTEX_UNLOCK_ -> MUTEX_UNLOCK

kernel/net/socket.s:
	minor reordering in net_sock_deliver_accept and net_sock_deliver_udp;
	disable net_socket_deliver as it is not called (referenced in some
	commented out code though).
	document CF undefined where appropriate;