fpu: early save/restore in interrupt/exception context

Since we cannot guarantee that the fpu will not be used in interrupts and
exceptions, we must save it earlier rather than later.

This was discovered with an fpu-based memcpy, but can be triggered in other
ways.

Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
elf: allow elf_resolve_pltgot() to use the fpu

elf_resolve_pltgot() can be called from anywhere, including with dirty fpu
state.  Ensure the fpu is not clobbered during its execution.

Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
rwlock: helpers for WITH_LOCK and friends

Implement facades for rwlock so it can be used with WITH_LOCK, specifying
whether we want a read lock or a write lock:

  rwlock my_rwlock;

  WITH_LOCK(my_rwlock.for_read()) {
    read stuff
  }

  WITH_LOCK(my_rwlock.for_write()) {
    write stuff
  }

Signed-off-by: Avi Kivity <avi@cloudius-systems.com>