/****************************************************************************/
-#include <stdio.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <sys/mman.h>
-#include <unistd.h>
+#include "qemu/osdep.h"
#include "qemu.h"
#include "flat.h"
-#define ntohl(x) be32_to_cpu(x)
-#include <target_flat.h>
+#include "target_flat.h"
//#define DEBUG
int ret;
buf = lock_user(VERIFY_WRITE, ptr, len, 0);
+ if (!buf) {
+ return -EFAULT;
+ }
ret = pread(fd, buf, len, offset);
+ if (ret < 0) {
+ ret = -errno;
+ }
unlock_user(buf, ptr, len);
return ret;
}
#endif /* CONFIG_BINFMT_SHARED_FLAT */
-int load_flt_binary(struct linux_binprm * bprm, struct target_pt_regs * regs,
- struct image_info * info)
+int load_flt_binary(struct linux_binprm *bprm, struct image_info *info)
{
struct lib_info libinfo[MAX_SHARED_LIBS];
- abi_ulong p = bprm->p;
+ abi_ulong p;
abi_ulong stack_len;
abi_ulong start_addr;
abi_ulong sp;