ipc: add immediate xfer timeout

Sort of works.

There's a problem with immediate_xfer_timeout's string transfer registering
faults in the echo receiver's buffers (which shouldn't happen as those buffers
were mapped by the immediately preceding string transfer) in the "flush only
receive buffers" iteration. Thus the call fails in the send phase, which is
entirely wrong.

Also, the first iteration (flush send only) somehow doesn't flush those
buffers.
testbench: string: fix strlen-after-flush in faulting_echo()

Oops.
testbench: string: replace flush_page() with flush_byte_range()

This solves the problem where the previous call to flush_page() would unmap
also parts of string_test_thread()'s receive buffer, causing a send-phase xfer
timeout where only a receive-phase one should've happened.

Other ad-hoc unmapping primitives should be replaced with calls to
flush_byte_range(). Also, for_page_range() should get its own unit test.
testbench: string: clean up, remove todo from immediate_xfer_timeout
testbench: string: measure time taken in faulting_echo()

And its derivative, delayed_faulting_echo(). The millisecond timer makes this
a bit finicky.
testbench: string: de-wack faulting_echo()

It'd end up accessing seed_bins past array end, for instance, and could
produce a zero seed that way. It could also cause over three 4 KiB page faults
on the send side if echostr was allocated more than 1023 bytes into a page.

Also it wouldn't flush the entirety of replybuf.
testbench: string: test long and short delay in finite_xfer_timeout

Regardless of whether the xfer timeout is hit while waiting for the first
pagefault, or subsequent ones, it should abort IPC at that point regardless of
what the pager does.
add WARN_ON() to <ukernel/bug.h>, document BUG_ON() better

It's like a big assert() that accepts format strings and doesn't go away.
thread: remove the useless yield() function

It dates from the time when scheduling and threads weren't yet separated.
document the post_exn_call hook, rework callsites & receivers

Call sites for post_exn_ok() are in ipc_{send,recv}_half() (obviously), and
post_exn_fail() is found wherever IPC operations get interrupted. On the
receive side, pagefault replies now go through the hook, and the reply
handlers for exceptions and breath-of-life call thread_wake() explicitly.
testbench: sched: remove copypasta of time_in_us()

Perhaps the testbench will one day be compiled separately from the
microkernel. For now there's no need to consider such things.
clean up warnings appearing under NDEBUG
add assert debugging aid to kmain.c

Most likely, barring tail-call elimination, this is an address within the
function that called the function where the failing assert() appeared in.
thread: replace read_global_timer() with ksystemclock()

2013 is for 64-bit microseconds. Pass it on.
ipc: add finite transfer timeouts

In detail:

  - ipc_xfer_timeout() was added. it interrupts an ongoing IPC, pushing both
    sides into the scheduler and releasing all associated resources.
  - ipc_user() got a new parameter, xferto_abs; it is the value that
    ksystemclock() should have or exceed before the ongoing IPC in the "from"
    side is interrupted with a xfer timeout code, or zero when not applicable.
    callsites updated accordingly.
  - when non-zero, xferto_abs comes from send_xfer_fault() which accepts it as
    a new parameter. that is passed by set_prexfer_fault_state() which also
    accepts it as a new parameter; ultimately it comes from
    eval_xfer_timeout(), which is called by do_typed_transfer().
  - prexfer_ipc_hook() now handles three callsites of post_exn_fail(), though
    just one is hit by testbench. there is likewise a new panic() call in that
    function, which should be likewise uncovered by testbench before it's
    removed.
  - a callsite for ipc_xfer_timeout() was added to ipc_recv_half(). it's
    uncertain whether this is hit by testbench right now.
  - schedule_next_thread() now calls ipc_xfer_timeout() when an ongoing IPC is
    present. the if-clause could be in timeout_ipc(), but this way lets us
    have some extra asserts afterward so for now that's cool.

Smaller changes:
  - updated header comment for thread_ipc_fail()
  - other miscellanea, a couple of TODOs maybe