add qemu user

This commit is contained in:
Mario Fetka
2011-12-23 16:31:28 +01:00
parent 3f307b6882
commit 1986cc7b0f
33 changed files with 13038 additions and 538 deletions

View File

@@ -65,8 +65,7 @@ AUX 0.14.1/0020-linux-user-implement-reboot-syscall.patch 1403 RMD160 456a111c96
AUX 0.14.1/0021-implement-prlimit64-syscall.patch 4175 RMD160 c31cd2e670c0fe3a8b2df462b1fb4b1e7c55cb9b SHA1 1bf72cfe09bb4bfb5101cd96fdade15bfe538926 SHA256 79d7e395b46430775f8f82b19890d2f73681d9fdfac46b807b3d148e83facf91
AUX 0.14.1/0022-fixing-smp-races.patch 1224 RMD160 bcb627e31d677dd787c252d40da3faf45742e4bf SHA1 0b92b6b92eb8ebe92b465e0c5266ef74cf52e917 SHA256 cbb12a0cee1a123fc209b563968ee0c8b2111727adbf8b00644a24f23fbbce15
AUX 0.14.1/0023-linux-user-add-binfmt-wrapper-for-argv-0-handling.patch 11904 RMD160 0165cdaf6a7307838993285f95c228d005ade149 SHA1 04d8c700314decb3759d530c27b5ba72d8c1c4d9 SHA256 cc2340c63ec2a216bc5d460d7419bf84f3869015fcfd73096530b43ce357ab45
AUX 0.14.1/0024-fix-glibc-install-locales.patch 17811 RMD160 563366d547aeec28faf2602c48c09eaafbb44381 SHA1 ac8585ee6b334969fb79a6fd4844e8a415b6c717 SHA256 2a18ba91c190dc457fe1683af23d9b7814eee1ed5ba44362187756706d26c99c
AUX 0.14.1/0025-add-syscall-numbers-from-2.6.39.2.patch 17282 RMD160 8d5ff85efb34788680125a878495d86ec8c6f0d6 SHA1 7ee7fa50a7b7e862bff0c0221080349bc03d710f SHA256 c61c5fc6e9e849bb14548e5f80ec5abcf52c92b78d9c079a359d9d4b0cb55f1d
AUX 0.14.1/0025-add-syscall-numbers-from-2.6.39.2.patch 18328 RMD160 61a90462ad0109f2951d4ebb540c716861905220 SHA1 99834573cdc443c4118b6280c5e26433caa95624 SHA256 5aed07e1b71643d880eaa7432dfb99cc08958d275985d23b779cb796f1a73b18
AUX qemu-0.10.3-nopl-fix.patch 1118 RMD160 849e4b88ca7985dc3faae0a225181205043f0265 SHA1 70cf0727a7cbdd79243ae6768f34c07c6e9c5aec SHA256 24656137f1f38aed2c2661ebd20d9a6d86eaf9768c3e239b971f01418b396028
AUX qemu-0.11.0-mips64-user-fix.patch 313 RMD160 db016e0a48990a435dd6cf6e807145b33ada4908 SHA1 2ea913b1bcd29734a6d4011794bdb4aa3599a184 SHA256 b4173fc177bd0d0ba67f5551a3512047a19a9b2c0a122f968e32fbd834848d2f
AUX qemu-arm-eabi-0.10.5.patch 21422 RMD160 a2ab6384938b08764324a4239fc30718161a3977 SHA1 2c7cec113b02e9f91226887257b393a3dfba2234 SHA256 b47327d7eab124617941e5403c5d4d0af2b21ce2278d5524677c521be462aa57
@@ -76,8 +75,10 @@ AUX qemu-ifup 554 RMD160 9769d79ab6456bdd7e3e689005f629e2a67b858d SHA1 dde2b27ac
DIST qemu-0.10.6.tar.gz 3664559 RMD160 1321a10777d2e0c6b53887d0525a28cc1b36ec9b SHA1 9432738ba513e07c981097468945b2e3ad9cb81e SHA256 8725298d4fd937ae41d942d0dd4a22fc02561d8c57a9fdcdbfa56427915757c7
DIST qemu-0.11.1.tar.gz 3830070 RMD160 4da00fa6c01d7ff6af0ee781bc9260da577ea7d3 SHA1 7b983cd18f44c6e7627532b662f010389d3bcdff SHA256 2ecd2fc0af2ce5d96067ae82cc98a08275c596de53fc929484bedee1d6e7893a
DIST qemu-0.12.5.tar.gz 4291741 RMD160 c4eba2e649b428e8dd432718443e986057e692d7 SHA1 596a673f3a6697ea8fd90f4f23981241cc13bdc3 SHA256 a6a7b30b53591e160b5c7fd9319985673174e9ea47b182dbe63bc99357741f58
DIST qemu-0.14.1.tar.gz 5439697 RMD160 0601ff4e613fea0a6ce80907e2bfa11704048b36 SHA1 1a5003a03004b62b52562d1cbb8f50c5f135e0b8 SHA256 33ceae3fbe516f2cbb151dc98d16c8ccfec74b1056674ad715e75a2f7fed45c3
EBUILD qemu-0.10.6.ebuild 5000 RMD160 093eeeda7f4872bddeb83688daba67623eb26d01 SHA1 e5c5abf287914b222483cb32853bbcd658fa8fb6 SHA256 117e429849e1f55c17dd76837cb11c974ffccc19eba1b6ae5f33996a18c463c7
EBUILD qemu-0.11.1.ebuild 5090 RMD160 9889a49d89c968b9710a159004c0467a82e711f7 SHA1 f3389454f0508c9c9b903d35b2472d429a85a954 SHA256 6963ebb2f42ef4bee899e5c9554eb4b91de11e798c4f632111ae9b6850d801da
EBUILD qemu-0.12.5.ebuild 5128 RMD160 7f1ca4fe533772771d753fdb45565cc62b1e1031 SHA1 bb9960710ea99fb224a5381aec95d11f0b3a4f8c SHA256 b097d506303e4856cb5819642f113162a17644fbc46ae3c483ed1b4fb297b632
EBUILD qemu-0.14.1.ebuild 6140 RMD160 19c6177eddfbc169a6d185cd5f2cc6694919fa0e SHA1 406288d3fd6d19987b844354f9ce5dfe95c5f60d SHA256 4493e9517e939665d3f926edca6c1dc7ef3dbdf097537ccfca72eb0456cf621e
MISC ChangeLog 11259 RMD160 6e119249ab4ffddf3dc6ef8da9fce0949fc91ad2 SHA1 0914e40152b37c48c175db6b9079eb7990814237 SHA256 db076339aadcd5266d3998d3314a1e1fb54cea58457f5c43cea5a40f3fe4999c
MISC metadata.xml 910 RMD160 da1d7ba61d401bb22fc22be931b27be432d6d103 SHA1 6ffb7c25e19589933bd016d80a16284ae8df436c SHA256 6a27d48cbcc5a90f1464e302252ea10813317ddcb7bdd2e1e5cb927760a5640d

View File

@@ -1,460 +0,0 @@
From bf858897b76926b56e948dbe7a1a491b68dccda7 Mon Sep 17 00:00:00 2001
From: Richard Henderson <rth@twiddle.net>
Date: Tue, 27 Jul 2010 17:25:38 +0000
Subject: linux-user: Re-use load_elf_image for the main binary.
This requires moving the PT_INTERP extraction and GUEST_BASE
handling into load_elf_image. Key this off a non-null pointer
argument to receive the interpreter name.
Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
---
diff --git a/linux-user/elfload.c b/linux-user/elfload.c
index 0a3d084..a53285a 100644
--- a/linux-user/elfload.c
+++ b/linux-user/elfload.c
@@ -829,9 +829,6 @@ struct exec
#define ZMAGIC 0413
#define QMAGIC 0314
-/* max code+data+bss+brk space allocated to ET_DYN executables */
-#define ET_DYN_MAP_SIZE (128 * 1024 * 1024)
-
/* Necessary parameters */
#define TARGET_ELF_EXEC_PAGESIZE TARGET_PAGE_SIZE
#define TARGET_ELF_PAGESTART(_v) ((_v) & ~(unsigned long)(TARGET_ELF_EXEC_PAGESIZE-1))
@@ -1169,7 +1166,7 @@ static abi_ulong create_elf_tables(abi_ulong p, int argc, int envc,
On return: INFO values will be filled in, as necessary or available. */
static void load_elf_image(const char *image_name, int image_fd,
- struct image_info *info,
+ struct image_info *info, char **pinterp_name,
char bprm_buf[BPRM_BUF_SIZE])
{
struct elfhdr *ehdr = (struct elfhdr *)bprm_buf;
@@ -1229,6 +1226,67 @@ static void load_elf_image(const char *image_name, int image_fd,
if (load_addr == -1) {
goto exit_perror;
}
+ } else if (pinterp_name != NULL) {
+ /* This is the main executable. Make sure that the low
+ address does not conflict with MMAP_MIN_ADDR or the
+ QEMU application itself. */
+#if defined(CONFIG_USE_GUEST_BASE)
+ /*
+ * In case where user has not explicitly set the guest_base, we
+ * probe here that should we set it automatically.
+ */
+ if (!have_guest_base && !reserved_va) {
+ unsigned long host_start, real_start, host_size;
+
+ /* Round addresses to page boundaries. */
+ loaddr &= qemu_host_page_mask;
+ hiaddr = HOST_PAGE_ALIGN(hiaddr);
+
+ if (loaddr < mmap_min_addr) {
+ host_start = HOST_PAGE_ALIGN(mmap_min_addr);
+ } else {
+ host_start = loaddr;
+ if (host_start != loaddr) {
+ errmsg = "Address overflow loading ELF binary";
+ goto exit_errmsg;
+ }
+ }
+ host_size = hiaddr - loaddr;
+ while (1) {
+ /* Do not use mmap_find_vma here because that is limited to the
+ guest address space. We are going to make the
+ guest address space fit whatever we're given. */
+ real_start = (unsigned long)
+ mmap((void *)host_start, host_size, PROT_NONE,
+ MAP_ANONYMOUS | MAP_PRIVATE | MAP_NORESERVE, -1, 0);
+ if (real_start == (unsigned long)-1) {
+ goto exit_perror;
+ }
+ if (real_start == host_start) {
+ break;
+ }
+ /* That address didn't work. Unmap and try a different one.
+ The address the host picked because is typically right at
+ the top of the host address space and leaves the guest with
+ no usable address space. Resort to a linear search. We
+ already compensated for mmap_min_addr, so this should not
+ happen often. Probably means we got unlucky and host
+ address space randomization put a shared library somewhere
+ inconvenient. */
+ munmap((void *)real_start, host_size);
+ host_start += qemu_host_page_size;
+ if (host_start == loaddr) {
+ /* Theoretically possible if host doesn't have any suitably
+ aligned areas. Normally the first mmap will fail. */
+ errmsg = "Unable to find space for application";
+ goto exit_errmsg;
+ }
+ }
+ qemu_log("Relocating guest address space from 0x"
+ TARGET_ABI_FMT_lx " to 0x%lx\n", loaddr, real_start);
+ guest_base = real_start - loaddr;
+ }
+#endif
}
load_bias = load_addr - loaddr;
@@ -1290,6 +1348,33 @@ static void load_elf_image(const char *image_name, int image_fd,
info->brk = vaddr_em;
}
}
+ } else if (eppnt->p_type == PT_INTERP && pinterp_name) {
+ char *interp_name;
+
+ if (*pinterp_name) {
+ errmsg = "Multiple PT_INTERP entries";
+ goto exit_errmsg;
+ }
+ interp_name = malloc(eppnt->p_filesz);
+ if (!interp_name) {
+ goto exit_perror;
+ }
+
+ if (eppnt->p_offset + eppnt->p_filesz <= BPRM_BUF_SIZE) {
+ memcpy(interp_name, bprm_buf + eppnt->p_offset,
+ eppnt->p_filesz);
+ } else {
+ retval = pread(image_fd, interp_name, eppnt->p_filesz,
+ eppnt->p_offset);
+ if (retval != eppnt->p_filesz) {
+ goto exit_perror;
+ }
+ }
+ if (interp_name[eppnt->p_filesz - 1] != 0) {
+ errmsg = "Invalid PT_INTERP entry";
+ goto exit_errmsg;
+ }
+ *pinterp_name = interp_name;
}
}
@@ -1336,7 +1421,7 @@ static void load_elf_interp(const char *filename, struct image_info *info,
memset(bprm_buf + retval, 0, BPRM_BUF_SIZE - retval);
}
- load_elf_image(filename, fd, info, bprm_buf);
+ load_elf_image(filename, fd, info, NULL, bprm_buf);
return;
exit_perror:
@@ -1480,291 +1565,31 @@ int load_elf_binary(struct linux_binprm * bprm, struct target_pt_regs * regs,
{
struct image_info interp_info;
struct elfhdr elf_ex;
- abi_ulong load_addr, load_bias;
- int load_addr_set = 0;
- int i;
- struct elf_phdr * elf_ppnt;
- struct elf_phdr *elf_phdata;
- abi_ulong k, elf_brk;
- int retval;
char *elf_interpreter = NULL;
- abi_ulong elf_entry;
- int status;
- abi_ulong start_code, end_code, start_data, end_data;
- abi_ulong elf_stack;
- status = 0;
- load_addr = 0;
- load_bias = 0;
- elf_ex = *((struct elfhdr *) bprm->buf); /* exec-header */
+ info->start_mmap = (abi_ulong)ELF_START_MMAP;
+ info->mmap = 0;
+ info->rss = 0;
- /* First of all, some simple consistency checks */
- if (!elf_check_ident(&elf_ex)) {
- return -ENOEXEC;
- }
- bswap_ehdr(&elf_ex);
- if (!elf_check_ehdr(&elf_ex)) {
- return -ENOEXEC;
- }
+ load_elf_image(bprm->filename, bprm->fd, info,
+ &elf_interpreter, bprm->buf);
+
+ /* ??? We need a copy of the elf header for passing to create_elf_tables.
+ If we do nothing, we'll have overwritten this when we re-use bprm->buf
+ when we load the interpreter. */
+ elf_ex = *(struct elfhdr *)bprm->buf;
bprm->p = copy_elf_strings(1, &bprm->filename, bprm->page, bprm->p);
bprm->p = copy_elf_strings(bprm->envc,bprm->envp,bprm->page,bprm->p);
bprm->p = copy_elf_strings(bprm->argc,bprm->argv,bprm->page,bprm->p);
if (!bprm->p) {
- retval = -E2BIG;
- }
-
- /* Now read in all of the header information */
- elf_phdata = (struct elf_phdr *)
- malloc(elf_ex.e_phnum * sizeof(struct elf_phdr));
- if (elf_phdata == NULL) {
- return -ENOMEM;
- }
-
- i = elf_ex.e_phnum * sizeof(struct elf_phdr);
- if (elf_ex.e_phoff + i <= BPRM_BUF_SIZE) {
- memcpy(elf_phdata, bprm->buf + elf_ex.e_phoff, i);
- } else {
- retval = pread(bprm->fd, (char *) elf_phdata, i, elf_ex.e_phoff);
- if (retval != i) {
- perror("load_elf_binary");
- exit(-1);
- }
- }
- bswap_phdr(elf_phdata, elf_ex.e_phnum);
-
- elf_brk = 0;
- elf_stack = ~((abi_ulong)0UL);
- start_code = ~((abi_ulong)0UL);
- end_code = 0;
- start_data = 0;
- end_data = 0;
-
- elf_ppnt = elf_phdata;
- for(i=0;i < elf_ex.e_phnum; i++) {
- if (elf_ppnt->p_type == PT_INTERP) {
- if (elf_ppnt->p_offset + elf_ppnt->p_filesz <= BPRM_BUF_SIZE) {
- elf_interpreter = bprm->buf + elf_ppnt->p_offset;
- } else {
- elf_interpreter = alloca(elf_ppnt->p_filesz);
- retval = pread(bprm->fd, elf_interpreter, elf_ppnt->p_filesz,
- elf_ppnt->p_offset);
- if (retval != elf_ppnt->p_filesz) {
- perror("load_elf_binary");
- exit(-1);
- }
- }
- }
- elf_ppnt++;
- }
-
- /* OK, This is the point of no return */
- info->end_data = 0;
- info->end_code = 0;
- info->start_mmap = (abi_ulong)ELF_START_MMAP;
- info->mmap = 0;
- elf_entry = (abi_ulong) elf_ex.e_entry;
-
-#if defined(CONFIG_USE_GUEST_BASE)
- /*
- * In case where user has not explicitly set the guest_base, we
- * probe here that should we set it automatically.
- */
- if (!(have_guest_base || reserved_va)) {
- /*
- * Go through ELF program header table and find the address
- * range used by loadable segments. Check that this is available on
- * the host, and if not find a suitable value for guest_base. */
- abi_ulong app_start = ~0;
- abi_ulong app_end = 0;
- abi_ulong addr;
- unsigned long host_start;
- unsigned long real_start;
- unsigned long host_size;
- for (i = 0, elf_ppnt = elf_phdata; i < elf_ex.e_phnum;
- i++, elf_ppnt++) {
- if (elf_ppnt->p_type != PT_LOAD)
- continue;
- addr = elf_ppnt->p_vaddr;
- if (addr < app_start) {
- app_start = addr;
- }
- addr += elf_ppnt->p_memsz;
- if (addr > app_end) {
- app_end = addr;
- }
- }
-
- /* If we don't have any loadable segments then something
- is very wrong. */
- assert(app_start < app_end);
-
- /* Round addresses to page boundaries. */
- app_start = app_start & qemu_host_page_mask;
- app_end = HOST_PAGE_ALIGN(app_end);
- if (app_start < mmap_min_addr) {
- host_start = HOST_PAGE_ALIGN(mmap_min_addr);
- } else {
- host_start = app_start;
- if (host_start != app_start) {
- fprintf(stderr, "qemu: Address overflow loading ELF binary\n");
- abort();
- }
- }
- host_size = app_end - app_start;
- while (1) {
- /* Do not use mmap_find_vma here because that is limited to the
- guest address space. We are going to make the
- guest address space fit whatever we're given. */
- real_start = (unsigned long)mmap((void *)host_start, host_size,
- PROT_NONE, MAP_ANONYMOUS | MAP_PRIVATE | MAP_NORESERVE, -1, 0);
- if (real_start == (unsigned long)-1) {
- fprintf(stderr, "qemu: Virtual memory exausted\n");
- abort();
- }
- if (real_start == host_start) {
- break;
- }
- /* That address didn't work. Unmap and try a different one.
- The address the host picked because is typically
- right at the top of the host address space and leaves the
- guest with no usable address space. Resort to a linear search.
- We already compensated for mmap_min_addr, so this should not
- happen often. Probably means we got unlucky and host address
- space randomization put a shared library somewhere
- inconvenient. */
- munmap((void *)real_start, host_size);
- host_start += qemu_host_page_size;
- if (host_start == app_start) {
- /* Theoretically possible if host doesn't have any
- suitably aligned areas. Normally the first mmap will
- fail. */
- fprintf(stderr, "qemu: Unable to find space for application\n");
- abort();
- }
- }
- qemu_log("Relocating guest address space from 0x" TARGET_ABI_FMT_lx
- " to 0x%lx\n", app_start, real_start);
- guest_base = real_start - app_start;
+ fprintf(stderr, "%s: %s\n", bprm->filename, strerror(E2BIG));
+ exit(-1);
}
-#endif /* CONFIG_USE_GUEST_BASE */
/* Do this so that we can load the interpreter, if need be. We will
change some of these later */
- info->rss = 0;
bprm->p = setup_arg_pages(bprm->p, bprm, info);
- info->start_stack = bprm->p;
-
- /* Now we do a little grungy work by mmaping the ELF image into
- * the correct location in memory. At this point, we assume that
- * the image should be loaded at fixed address, not at a variable
- * address.
- */
-
- for(i = 0, elf_ppnt = elf_phdata; i < elf_ex.e_phnum; i++, elf_ppnt++) {
- int elf_prot = 0;
- int elf_flags = 0;
- abi_ulong error;
-
- if (elf_ppnt->p_type != PT_LOAD)
- continue;
-
- if (elf_ppnt->p_flags & PF_R) elf_prot |= PROT_READ;
- if (elf_ppnt->p_flags & PF_W) elf_prot |= PROT_WRITE;
- if (elf_ppnt->p_flags & PF_X) elf_prot |= PROT_EXEC;
- elf_flags = MAP_PRIVATE | MAP_DENYWRITE;
- if (elf_ex.e_type == ET_EXEC || load_addr_set) {
- elf_flags |= MAP_FIXED;
- } else if (elf_ex.e_type == ET_DYN) {
- /* Try and get dynamic programs out of the way of the default mmap
- base, as well as whatever program they might try to exec. This
- is because the brk will follow the loader, and is not movable. */
- /* NOTE: for qemu, we do a big mmap to get enough space
- without hardcoding any address */
- error = target_mmap(0, ET_DYN_MAP_SIZE,
- PROT_NONE, MAP_PRIVATE | MAP_ANON,
- -1, 0);
- if (error == -1) {
- perror("mmap");
- exit(-1);
- }
- load_bias = TARGET_ELF_PAGESTART(error - elf_ppnt->p_vaddr);
- }
-
- error = target_mmap(TARGET_ELF_PAGESTART(load_bias + elf_ppnt->p_vaddr),
- (elf_ppnt->p_filesz +
- TARGET_ELF_PAGEOFFSET(elf_ppnt->p_vaddr)),
- elf_prot,
- (MAP_FIXED | MAP_PRIVATE | MAP_DENYWRITE),
- bprm->fd,
- (elf_ppnt->p_offset -
- TARGET_ELF_PAGEOFFSET(elf_ppnt->p_vaddr)));
- if (error == -1) {
- perror("mmap");
- exit(-1);
- }
-
-#ifdef LOW_ELF_STACK
- if (TARGET_ELF_PAGESTART(elf_ppnt->p_vaddr) < elf_stack)
- elf_stack = TARGET_ELF_PAGESTART(elf_ppnt->p_vaddr);
-#endif
-
- if (!load_addr_set) {
- load_addr_set = 1;
- load_addr = elf_ppnt->p_vaddr - elf_ppnt->p_offset;
- if (elf_ex.e_type == ET_DYN) {
- load_bias += error -
- TARGET_ELF_PAGESTART(load_bias + elf_ppnt->p_vaddr);
- load_addr += load_bias;
- }
- }
- k = elf_ppnt->p_vaddr;
- if (k < start_code)
- start_code = k;
- if (start_data < k)
- start_data = k;
- k = elf_ppnt->p_vaddr + elf_ppnt->p_filesz;
- if ((elf_ppnt->p_flags & PF_X) && end_code < k)
- end_code = k;
- if (end_data < k)
- end_data = k;
- k = elf_ppnt->p_vaddr + elf_ppnt->p_memsz;
- if (k > elf_brk) {
- elf_brk = TARGET_PAGE_ALIGN(k);
- }
-
- /* If the load segment requests extra zeros (e.g. bss), map it. */
- if (elf_ppnt->p_filesz < elf_ppnt->p_memsz) {
- abi_ulong base = load_bias + elf_ppnt->p_vaddr;
- zero_bss(base + elf_ppnt->p_filesz,
- base + elf_ppnt->p_memsz, elf_prot);
- }
- }
-
- elf_entry += load_bias;
- elf_brk += load_bias;
- start_code += load_bias;
- end_code += load_bias;
- start_data += load_bias;
- end_data += load_bias;
-
- info->load_bias = load_bias;
- info->load_addr = load_addr;
- info->entry = elf_entry;
- info->start_brk = info->brk = elf_brk;
- info->end_code = end_code;
- info->start_code = start_code;
- info->start_data = start_data;
- info->end_data = end_data;
- info->personality = PER_LINUX;
-
- free(elf_phdata);
-
- if (qemu_log_enabled()) {
- load_symbols(&elf_ex, bprm->fd, load_bias);
- }
-
- close(bprm->fd);
if (elf_interpreter) {
load_elf_interp(elf_interpreter, &interp_info, bprm->buf);
@@ -1796,6 +1621,7 @@ int load_elf_binary(struct linux_binprm * bprm, struct target_pt_regs * regs,
if (elf_interpreter) {
info->load_addr = interp_info.load_addr;
info->entry = interp_info.entry;
+ free(elf_interpreter);
}
#ifdef USE_ELF_CORE_DUMP
--
cgit v0.8.3.4

View File

@@ -1,22 +1,7 @@
Removed s390x pieces.
commit d979e8eb544da31df78bc76358a73f0d1c823c17
Author: Peter Maydell <peter.maydell@linaro.org>
Date: Mon Jun 27 17:44:51 2011 +0100
linux-user: Add syscall numbers from kernel 2.6.39.2
Add syscall numbers for new syscall numbers; this brings us
into line with Linux 2.6.39.2.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
diff --git a/linux-user/alpha/syscall_nr.h b/linux-user/alpha/syscall_nr.h
index e3127df..f6284db 100644
--- a/linux-user/alpha/syscall_nr.h
+++ b/linux-user/alpha/syscall_nr.h
@@ -411,4 +411,25 @@
diff -uNr qemu-0.14.1.orig/linux-user/alpha/syscall_nr.h qemu-0.14.1/linux-user/alpha/syscall_nr.h
--- qemu-0.14.1.orig/linux-user/alpha/syscall_nr.h 2011-11-24 22:21:09.636856616 +0100
+++ qemu-0.14.1/linux-user/alpha/syscall_nr.h 2011-11-24 22:22:04.528478368 +0100
@@ -411,7 +411,28 @@
#define TARGET_NR_signalfd 476
#define TARGET_NR_timerfd 477
#define TARGET_NR_eventfd 478
@@ -43,10 +28,12 @@ index e3127df..f6284db 100644
+#define TARGET_NR_open_by_handle_at 498
+#define TARGET_NR_clock_adjtime 499
+#define TARGET_NR_syncfs 500
diff --git a/linux-user/arm/syscall_nr.h b/linux-user/arm/syscall_nr.h
index 79a216a..7f05879 100644
--- a/linux-user/arm/syscall_nr.h
+++ b/linux-user/arm/syscall_nr.h
/* The following aliases are defined in order to match up with the
standard i386 syscalls implemented in syscalls.c. */
#define TARGET_NR_chown32 TARGET_NR_chown
diff -uNr qemu-0.14.1.orig/linux-user/arm/syscall_nr.h qemu-0.14.1/linux-user/arm/syscall_nr.h
--- qemu-0.14.1.orig/linux-user/arm/syscall_nr.h 2011-11-24 22:21:09.627597287 +0100
+++ qemu-0.14.1/linux-user/arm/syscall_nr.h 2011-11-24 22:21:41.762101277 +0100
@@ -365,3 +365,16 @@
#define TARGET_NR_dup3 (358)
#define TARGET_NR_pipe2 (359)
@@ -64,20 +51,18 @@ index 79a216a..7f05879 100644
+#define TARGET_NR_open_by_handle_at (371)
+#define TARGET_NR_clock_adjtime (372)
+#define TARGET_NR_syncfs (373)
diff --git a/linux-user/cris/syscall_nr.h b/linux-user/cris/syscall_nr.h
index 6132817..98f1a0b 100644
--- a/linux-user/cris/syscall_nr.h
+++ b/linux-user/cris/syscall_nr.h
diff -uNr qemu-0.14.1.orig/linux-user/cris/syscall_nr.h qemu-0.14.1/linux-user/cris/syscall_nr.h
--- qemu-0.14.1.orig/linux-user/cris/syscall_nr.h 2011-11-24 22:21:09.625282454 +0100
+++ qemu-0.14.1/linux-user/cris/syscall_nr.h 2011-11-24 22:21:41.762101277 +0100
@@ -333,3 +333,5 @@
#define TARGET_NR_dup3 330
#define TARGET_NR_pipe2 331
#define TARGET_NR_inotify_init1 332
+#define TARGET_NR_preadv 333
+#define TARGET_NR_pwritev 334
diff --git a/linux-user/i386/syscall_nr.h b/linux-user/i386/syscall_nr.h
index 3ef71ce..74abfca 100644
--- a/linux-user/i386/syscall_nr.h
+++ b/linux-user/i386/syscall_nr.h
diff -uNr qemu-0.14.1.orig/linux-user/i386/syscall_nr.h qemu-0.14.1/linux-user/i386/syscall_nr.h
--- qemu-0.14.1.orig/linux-user/i386/syscall_nr.h 2011-11-24 22:21:09.632226952 +0100
+++ qemu-0.14.1/linux-user/i386/syscall_nr.h 2011-11-24 22:21:41.764416110 +0100
@@ -335,3 +335,15 @@
#define TARGET_NR_dup3 330
#define TARGET_NR_pipe2 331
@@ -94,10 +79,9 @@ index 3ef71ce..74abfca 100644
+#define TARGET_NR_open_by_handle_at 342
+#define TARGET_NR_clock_adjtime 343
+#define TARGET_NR_syncfs 344
diff --git a/linux-user/m68k/syscall_nr.h b/linux-user/m68k/syscall_nr.h
index 1c0ba07..4d0937e 100644
--- a/linux-user/m68k/syscall_nr.h
+++ b/linux-user/m68k/syscall_nr.h
diff -uNr qemu-0.14.1.orig/linux-user/m68k/syscall_nr.h qemu-0.14.1/linux-user/m68k/syscall_nr.h
--- qemu-0.14.1.orig/linux-user/m68k/syscall_nr.h 2011-11-24 22:21:09.629912120 +0100
+++ qemu-0.14.1/linux-user/m68k/syscall_nr.h 2011-11-24 22:21:41.764416110 +0100
@@ -328,3 +328,19 @@
#define TARGET_NR_dup3 326
#define TARGET_NR_pipe2 327
@@ -118,11 +102,10 @@ index 1c0ba07..4d0937e 100644
+#define TARGET_NR_open_by_handle_at 341
+#define TARGET_NR_clock_adjtime 342
+#define TARGET_NR_syncfs 343
diff --git a/linux-user/main.c b/linux-user/main.c
index 289054b..48f0443 100644
--- a/linux-user/main.c
+++ b/linux-user/main.c
@@ -1985,6 +1985,33 @@ static const uint8_t mips_syscall_args[] = {
diff -uNr qemu-0.14.1.orig/linux-user/main.c qemu-0.14.1/linux-user/main.c
--- qemu-0.14.1.orig/linux-user/main.c 2011-11-24 22:21:09.632226952 +0100
+++ qemu-0.14.1/linux-user/main.c 2011-11-24 22:21:41.766730943 +0100
@@ -1922,6 +1922,33 @@
MIPS_SYS(sys_epoll_pwait, 6)
MIPS_SYS(sys_ioprio_set, 3)
MIPS_SYS(sys_ioprio_get, 2)
@@ -156,10 +139,9 @@ index 289054b..48f0443 100644
};
#undef MIPS_SYS
diff --git a/linux-user/microblaze/syscall_nr.h b/linux-user/microblaze/syscall_nr.h
index 3e641cd..f1fe0e7 100644
--- a/linux-user/microblaze/syscall_nr.h
+++ b/linux-user/microblaze/syscall_nr.h
diff -uNr qemu-0.14.1.orig/linux-user/microblaze/syscall_nr.h qemu-0.14.1/linux-user/microblaze/syscall_nr.h
--- qemu-0.14.1.orig/linux-user/microblaze/syscall_nr.h 2011-11-24 22:21:09.629912120 +0100
+++ qemu-0.14.1/linux-user/microblaze/syscall_nr.h 2011-11-24 22:21:41.766730943 +0100
@@ -364,6 +364,16 @@
#define TARGET_NR_sendmsg 360 /* new */
#define TARGET_NR_recvmsg 361 /* new */
@@ -179,10 +161,9 @@ index 3e641cd..f1fe0e7 100644
+#define TARGET_NR_clock_adjtime 373
+#define TARGET_NR_syncfs 374
diff --git a/linux-user/mips/syscall_nr.h b/linux-user/mips/syscall_nr.h
index 0595308..fbdc348 100644
--- a/linux-user/mips/syscall_nr.h
+++ b/linux-user/mips/syscall_nr.h
diff -uNr qemu-0.14.1.orig/linux-user/mips/syscall_nr.h qemu-0.14.1/linux-user/mips/syscall_nr.h
--- qemu-0.14.1.orig/linux-user/mips/syscall_nr.h 2011-11-24 22:21:09.632226952 +0100
+++ qemu-0.14.1/linux-user/mips/syscall_nr.h 2011-11-24 22:21:41.766730943 +0100
@@ -332,3 +332,16 @@
#define TARGET_NR_dup3 (TARGET_NR_Linux + 327)
#define TARGET_NR_pipe2 (TARGET_NR_Linux + 328)
@@ -200,10 +181,9 @@ index 0595308..fbdc348 100644
+#define TARGET_NR_open_by_handle_at (TARGET_NR_Linux + 340)
+#define TARGET_NR_clock_adjtime (TARGET_NR_Linux + 341)
+#define TARGET_NR_syncfs (TARGET_NR_Linux + 342)
diff --git a/linux-user/mips64/syscall_nr.h b/linux-user/mips64/syscall_nr.h
index ee1d134..36d27b5 100644
--- a/linux-user/mips64/syscall_nr.h
+++ b/linux-user/mips64/syscall_nr.h
diff -uNr qemu-0.14.1.orig/linux-user/mips64/syscall_nr.h qemu-0.14.1/linux-user/mips64/syscall_nr.h
--- qemu-0.14.1.orig/linux-user/mips64/syscall_nr.h 2011-11-24 22:21:09.627597287 +0100
+++ qemu-0.14.1/linux-user/mips64/syscall_nr.h 2011-11-24 22:21:41.769045776 +0100
@@ -291,3 +291,16 @@
#define TARGET_NR_dup3 (TARGET_NR_Linux + 286)
#define TARGET_NR_pipe2 (TARGET_NR_Linux + 287)
@@ -221,10 +201,9 @@ index ee1d134..36d27b5 100644
+#define TARGET_NR_open_by_handle_at (TARGET_NR_Linux + 299)
+#define TARGET_NR_clock_adjtime (TARGET_NR_Linux + 300)
+#define TARGET_NR_syncfs (TARGET_NR_Linux + 301)
diff --git a/linux-user/mipsn32/syscall_nr.h b/linux-user/mipsn32/syscall_nr.h
index 60a99dd..4e1aca3 100644
--- a/linux-user/mipsn32/syscall_nr.h
+++ b/linux-user/mipsn32/syscall_nr.h
diff -uNr qemu-0.14.1.orig/linux-user/mipsn32/syscall_nr.h qemu-0.14.1/linux-user/mipsn32/syscall_nr.h
--- qemu-0.14.1.orig/linux-user/mipsn32/syscall_nr.h 2011-11-24 22:21:09.634541784 +0100
+++ qemu-0.14.1/linux-user/mipsn32/syscall_nr.h 2011-11-24 22:21:41.769045776 +0100
@@ -295,3 +295,17 @@
#define TARGET_NR_dup3 (TARGET_NR_Linux + 290)
#define TARGET_NR_pipe2 (TARGET_NR_Linux + 291)
@@ -243,10 +222,9 @@ index 60a99dd..4e1aca3 100644
+#define TARGET_NR_open_by_handle_at (TARGET_NR_Linux + 304)
+#define TARGET_NR_clock_adjtime (TARGET_NR_Linux + 305)
+#define TARGET_NR_syncfs (TARGET_NR_Linux + 306)
diff --git a/linux-user/ppc/syscall_nr.h b/linux-user/ppc/syscall_nr.h
index cc84a4c..0673b7d 100644
--- a/linux-user/ppc/syscall_nr.h
+++ b/linux-user/ppc/syscall_nr.h
diff -uNr qemu-0.14.1.orig/linux-user/ppc/syscall_nr.h qemu-0.14.1/linux-user/ppc/syscall_nr.h
--- qemu-0.14.1.orig/linux-user/ppc/syscall_nr.h 2011-11-24 22:21:09.627597287 +0100
+++ qemu-0.14.1/linux-user/ppc/syscall_nr.h 2011-11-24 22:21:41.769045776 +0100
@@ -332,3 +332,33 @@
#define TARGET_NR_dup3 316
#define TARGET_NR_pipe2 317
@@ -281,10 +259,9 @@ index cc84a4c..0673b7d 100644
+#define TARGET_NR_open_by_handle_at 346
+#define TARGET_NR_clock_adjtime 347
+#define TARGET_NR_syncfs 348
diff --git a/linux-user/sh4/syscall_nr.h b/linux-user/sh4/syscall_nr.h
index 262b236..6173a7c 100644
--- a/linux-user/sh4/syscall_nr.h
+++ b/linux-user/sh4/syscall_nr.h
diff -uNr qemu-0.14.1.orig/linux-user/sh4/syscall_nr.h qemu-0.14.1/linux-user/sh4/syscall_nr.h
--- qemu-0.14.1.orig/linux-user/sh4/syscall_nr.h 2011-11-24 22:21:09.634541784 +0100
+++ qemu-0.14.1/linux-user/sh4/syscall_nr.h 2011-11-24 22:21:41.769045776 +0100
@@ -334,3 +334,35 @@
#define TARGET_NR_dup3 330
#define TARGET_NR_pipe2 331
@@ -321,10 +298,9 @@ index 262b236..6173a7c 100644
+#define TARGET_NR_open_by_handle_at 360
+#define TARGET_NR_clock_adjtime 361
+#define TARGET_NR_syncfs 362
diff --git a/linux-user/sparc/syscall_nr.h b/linux-user/sparc/syscall_nr.h
index 5d1ac21..be503f2 100644
--- a/linux-user/sparc/syscall_nr.h
+++ b/linux-user/sparc/syscall_nr.h
diff -uNr qemu-0.14.1.orig/linux-user/sparc/syscall_nr.h qemu-0.14.1/linux-user/sparc/syscall_nr.h
--- qemu-0.14.1.orig/linux-user/sparc/syscall_nr.h 2011-11-24 22:21:09.629912120 +0100
+++ qemu-0.14.1/linux-user/sparc/syscall_nr.h 2011-11-24 22:21:41.769045776 +0100
@@ -285,3 +285,15 @@
#define TARGET_NR_pipe2 321
#define TARGET_NR_inotify_init1 322
@@ -341,10 +317,9 @@ index 5d1ac21..be503f2 100644
+#define TARGET_NR_open_by_handle_at 333
+#define TARGET_NR_clock_adjtime 334
+#define TARGET_NR_syncfs 335
diff --git a/linux-user/sparc64/syscall_nr.h b/linux-user/sparc64/syscall_nr.h
index bdca2a7..70988b2 100644
--- a/linux-user/sparc64/syscall_nr.h
+++ b/linux-user/sparc64/syscall_nr.h
diff -uNr qemu-0.14.1.orig/linux-user/sparc64/syscall_nr.h qemu-0.14.1/linux-user/sparc64/syscall_nr.h
--- qemu-0.14.1.orig/linux-user/sparc64/syscall_nr.h 2011-11-24 22:21:09.632226952 +0100
+++ qemu-0.14.1/linux-user/sparc64/syscall_nr.h 2011-11-24 22:21:41.771360608 +0100
@@ -322,3 +322,15 @@
#define TARGET_NR_pipe2 321
#define TARGET_NR_inotify_init1 322
@@ -361,10 +336,9 @@ index bdca2a7..70988b2 100644
+#define TARGET_NR_open_by_handle_at 333
+#define TARGET_NR_clock_adjtime 334
+#define TARGET_NR_syncfs 335
diff --git a/linux-user/x86_64/syscall_nr.h b/linux-user/x86_64/syscall_nr.h
index 568a901..947e961 100644
--- a/linux-user/x86_64/syscall_nr.h
+++ b/linux-user/x86_64/syscall_nr.h
diff -uNr qemu-0.14.1.orig/linux-user/x86_64/syscall_nr.h qemu-0.14.1/linux-user/x86_64/syscall_nr.h
--- qemu-0.14.1.orig/linux-user/x86_64/syscall_nr.h 2011-11-24 22:21:09.625282454 +0100
+++ qemu-0.14.1/linux-user/x86_64/syscall_nr.h 2011-11-24 22:21:41.771360608 +0100
@@ -293,3 +293,15 @@
#define TARGET_NR_dup3 292
#define TARGET_NR_pipe2 293

View File

@@ -0,0 +1,201 @@
# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/app-emulation/qemu/qemu-0.14.0.ebuild,v 1.3 2011/02/20 22:07:37 zmedico Exp $
EAPI="2"
if [[ ${PV} = *9999* ]]; then
EGIT_REPO_URI="git://git.qemu.org/qemu.git"
GIT_ECLASS="git"
fi
inherit eutils flag-o-matic ${GIT_ECLASS} linux-info toolchain-funcs
if [[ ${PV} = *9999* ]]; then
SRC_URI=""
KEYWORDS=""
else
SRC_URI="http://download.savannah.gnu.org/releases/qemu/${P}.tar.gz"
KEYWORDS="~amd64 ~ppc ~ppc64 ~x86"
fi
DESCRIPTION="QEMU emulator and ABI wrapper"
HOMEPAGE="http://www.qemu.org"
LICENSE="GPL-2"
SLOT="0"
# xen is disabled until the deps are fixed
IUSE="+aio alsa bluetooth brltty curl esd fdt hardened jpeg ncurses \
png pulseaudio qemu-ifup sasl sdl ssl static vde"
COMMON_TARGETS="i386 x86_64 arm cris m68k microblaze mips mipsel ppc ppc64 sh4 sh4eb sparc sparc64"
IUSE_SOFTMMU_TARGETS="${COMMON_TARGETS} mips64 mips64el ppcemb"
IUSE_USER_TARGETS="${COMMON_TARGETS} alpha armeb ppc64abi32 sparc32plus"
for target in ${IUSE_SOFTMMU_TARGETS}; do
IUSE="${IUSE} +qemu_softmmu_targets_${target}"
done
for target in ${IUSE_USER_TARGETS}; do
IUSE="${IUSE} +qemu_user_targets_${target}"
done
RESTRICT="test"
RDEPEND="
!app-emulation/qemu-kvm
!app-emulation/qemu-softmmu
!app-emulation/qemu-user
!app-emulation/qemu-kvm-spice
sys-apps/pciutils
>=sys-apps/util-linux-2.16.0
sys-libs/zlib
aio? ( dev-libs/libaio )
alsa? ( >=media-libs/alsa-lib-1.0.13 )
bluetooth? ( net-wireless/bluez )
brltty? ( app-accessibility/brltty )
curl? ( net-misc/curl )
esd? ( media-sound/esound )
fdt? ( >=sys-apps/dtc-1.2.0 )
jpeg? ( virtual/jpeg )
ncurses? ( sys-libs/ncurses )
png? ( media-libs/libpng )
pulseaudio? ( media-sound/pulseaudio )
qemu-ifup? ( sys-apps/iproute2 net-misc/bridge-utils )
sasl? ( dev-libs/cyrus-sasl )
sdl? ( >=media-libs/libsdl-1.2.11[X] )
ssl? ( net-libs/gnutls )
vde? ( net-misc/vde )
"
DEPEND="${RDEPEND}
app-text/texi2html
>=sys-kernel/linux-headers-2.6.29
ssl? ( dev-util/pkgconfig )
"
pkg_setup() {
use qemu_softmmu_targets_x86_64 || ewarn "You disabled default target QEMU_SOFTMMU_TARGETS=x86_64"
}
src_prepare() {
# prevent docs to get automatically installed
sed -i '/$(DESTDIR)$(docdir)/d' Makefile || die
# Alter target makefiles to accept CFLAGS set via flag-o
sed -i 's/^\(C\|OP_C\|HELPER_C\)FLAGS=/\1FLAGS+=/' \
Makefile Makefile.target || die
# append CFLAGS while linking
sed -i 's/$(LDFLAGS)/$(QEMU_CFLAGS) $(CFLAGS) $(LDFLAGS)/' rules.mak || die
EPATCH_SOURCE="${FILESDIR}/0.14.1" EPATCH_SUFFIX="patch" \
EPATCH_FORCE="yes" epatch
epatch "${FILESDIR}/qemu-chroot.patch"
}
src_configure() {
local conf_opts audio_opts user_targets
for target in ${IUSE_SOFTMMU_TARGETS} ; do
use "qemu_softmmu_targets_${target}" && \
softmmu_targets="${softmmu_targets} ${target}-softmmu"
done
for target in ${IUSE_USER_TARGETS} ; do
use "qemu_user_targets_${target}" && \
user_targets="${user_targets} ${target}-linux-user"
done
if [ -z "${softmmu_targets}" ]; then
conf_opts="${conf_opts} --disable-system"
else
einfo "Building the following softmmu targets: ${softmmu_targets}"
fi
if [ ! -z "${user_targets}" ]; then
einfo "Building the following user targets: ${user_targets}"
conf_opts="${conf_opts} --enable-linux-user"
else
conf_opts="${conf_opts} --disable-linux-user"
fi
# Fix QA issues. QEMU needs executable heaps and we need to mark it as such
conf_opts="${conf_opts} --extra-ldflags=-Wl,-z,execheap"
# Add support for static builds
use static && conf_opts="${conf_opts} --static"
# Fix the $(prefix)/etc issue
conf_opts="${conf_opts} --sysconfdir=/etc"
#config options
conf_opts="${conf_opts} $(use_enable aio linux-aio)"
conf_opts="${conf_opts} $(use_enable bluetooth bluez)"
conf_opts="${conf_opts} $(use_enable brltty brlapi)"
conf_opts="${conf_opts} $(use_enable curl)"
conf_opts="${conf_opts} $(use_enable fdt)"
conf_opts="${conf_opts} $(use_enable hardened user-pie)"
conf_opts="${conf_opts} $(use_enable jpeg vnc-jpeg)"
conf_opts="${conf_opts} $(use_enable ncurses curses)"
conf_opts="${conf_opts} $(use_enable png vnc-png)"
conf_opts="${conf_opts} $(use_enable sasl vnc-sasl)"
conf_opts="${conf_opts} $(use_enable sdl)"
conf_opts="${conf_opts} $(use_enable ssl vnc-tls)"
conf_opts="${conf_opts} $(use_enable vde)"
conf_opts="${conf_opts} --disable-xen"
conf_opts="${conf_opts} --disable-darwin-user --disable-bsd-user"
# audio options
audio_opts="oss"
use alsa && audio_opts="alsa ${audio_opts}"
use esd && audio_opts="esd ${audio_opts}"
use pulseaudio && audio_opts="pa ${audio_opts}"
use sdl && audio_opts="sdl ${audio_opts}"
./configure --prefix=/usr \
--disable-strip \
--disable-werror \
--disable-kvm \
--enable-nptl \
--enable-uuid \
${conf_opts} \
--audio-drv-list="${audio_opts}" \
--target-list="${softmmu_targets} ${user_targets}" \
--cc="$(tc-getCC)" \
--host-cc="$(tc-getBUILD_CC)" \
|| die "configure failed"
# this is for qemu upstream's threaded support which is
# in development and broken
# the kvm project has its own support for threaded IO
# which is always on and works
# --enable-io-thread \
}
src_compile() {
# Restricting parallel build until we get a patch to fix this
emake || die
}
src_install() {
emake DESTDIR="${D}" install || die "make install failed"
if [ ! -z "${softmmu_targets}" ]; then
exeinto /etc/qemu
use qemu-ifup && { doexe \
"${FILESDIR}/qemu-ifup" \
"${FILESDIR}/qemu-ifdown" \
|| die "qemu interface scripts missing" ; }
fi
dodoc Changelog MAINTAINERS TODO pci-ids.txt || die
newdoc pc-bios/README README.pc-bios || die
dohtml qemu-doc.html qemu-tech.html || die
}
pkg_postinst() {
use qemu-ifup || return
elog "You will need the Universal TUN/TAP driver compiled into your"
elog "kernel or loaded as a module to use the virtual network device"
elog "if using -net tap. You will also need support for 802.1d"
elog "Ethernet Bridging and a configured bridge if using the provided"
elog "qemu-ifup script from /etc/qemu."
echo
}