Clean up includes so that osdep.h is included first and headers which it implies are not included manually. This commit was created with scripts/clean-includes. Backports commit b6a0aa053711e27e1a7825c1fca662beb05bee6f from qemu
This patch fixes exception handling for other helper functions. Backports commit 4054cdec0423c7190bfc733c27c303d513d531ab from qemu