make sytem calls safer/clean up headers

wrap some libc functions that do system calls (terminal output)
wrap read/write with syscall guard
define real_read/write (next dynamic linker find for read/write)
guard system calls in remaining code
introduce native_internhal.h
throw out some debug statements that break things
clean up includes a bit
fix race in thread_yield, cpu_switch_context_exit

call *context only with interrupts disabled, use isr trampoline for
this if necessary
disable interrupts for sighnd ctx switch
cope with SIGIO behaviour

SIGIO appears to be edge triggered, therefore we need to read
continuously until no more data is available
Merge branch 'native_fixes' into working