irix and solaris userland emulation (linux-user targets irix,irixn32,irix64,solaris)
This commit is contained in:
parent
e4ae62b802
commit
235970053f
|
@ -6669,7 +6669,7 @@ target_name=$(echo $target | cut -d '-' -f 1)
|
|||
target_bigendian="no"
|
||||
|
||||
case "$target_name" in
|
||||
armeb|aarch64_be|hppa|lm32|m68k|microblaze|mips|mipsn32|mips64|moxie|or1k|ppc|ppcemb|ppc64|ppc64abi32|s390x|sh4eb|sparc|sparc64|sparc32plus|xtensaeb)
|
||||
armeb|aarch64_be|hppa|lm32|m68k|microblaze|irix|irixn32|irix64|mips|mipsn32|mips64|moxie|or1k|ppc|ppcemb|ppc64|ppc64abi32|s390x|sh4eb|solaris|solaris64|sparc|sparc64|sparc32plus|xtensaeb)
|
||||
target_bigendian=yes
|
||||
;;
|
||||
esac
|
||||
|
@ -6746,6 +6746,28 @@ case "$target_name" in
|
|||
TARGET_ARCH=microblaze
|
||||
bflt="yes"
|
||||
;;
|
||||
irix)
|
||||
TARGET_ARCH=mips
|
||||
TARGET_ABI_DIR=irix
|
||||
TARGET_BASE_ARCH=mips
|
||||
echo "TARGET_ABI_MIPSO32=y" >> $config_target_mak
|
||||
echo "TARGET_ABI_IRIX=y" >> $config_target_mak
|
||||
;;
|
||||
irixn32)
|
||||
TARGET_ARCH=mips64
|
||||
TARGET_ABI_DIR=irix
|
||||
TARGET_BASE_ARCH=mips
|
||||
echo "TARGET_ABI_MIPSN32=y" >> $config_target_mak
|
||||
echo "TARGET_ABI32=y" >> $config_target_mak
|
||||
echo "TARGET_ABI_IRIX=y" >> $config_target_mak
|
||||
;;
|
||||
irix64)
|
||||
TARGET_ARCH=mips64
|
||||
TARGET_ABI_DIR=irix
|
||||
TARGET_BASE_ARCH=mips
|
||||
echo "TARGET_ABI_MIPSN64=y" >> $config_target_mak
|
||||
echo "TARGET_ABI_IRIX=y" >> $config_target_mak
|
||||
;;
|
||||
mips|mipsel)
|
||||
TARGET_ARCH=mips
|
||||
echo "TARGET_ABI_MIPSO32=y" >> $config_target_mak
|
||||
|
@ -6811,6 +6833,17 @@ case "$target_name" in
|
|||
TARGET_ARCH=sh4
|
||||
bflt="yes"
|
||||
;;
|
||||
solaris)
|
||||
TARGET_ARCH=sparc
|
||||
TARGET_ABI_DIR=solaris
|
||||
echo "TARGET_ABI_SOLARIS=y" >> $config_target_mak
|
||||
;;
|
||||
solaris64)
|
||||
TARGET_ARCH=sparc64
|
||||
TARGET_ABI_DIR=solaris
|
||||
TARGET_BASE_ARCH=sparc
|
||||
echo "TARGET_ABI_SOLARIS=y" >> $config_target_mak
|
||||
;;
|
||||
sparc)
|
||||
;;
|
||||
sparc64)
|
||||
|
@ -6961,7 +6994,7 @@ for i in $ARCH $TARGET_BASE_ARCH ; do
|
|||
microblaze*)
|
||||
disas_config "MICROBLAZE"
|
||||
;;
|
||||
mips*)
|
||||
irix*|mips*)
|
||||
disas_config "MIPS"
|
||||
;;
|
||||
moxie*)
|
||||
|
@ -6985,7 +7018,7 @@ for i in $ARCH $TARGET_BASE_ARCH ; do
|
|||
sh4)
|
||||
disas_config "SH4"
|
||||
;;
|
||||
sparc*)
|
||||
solaris*|sparc*)
|
||||
disas_config "SPARC"
|
||||
;;
|
||||
xtensa*)
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
# Default configuration for mips-linux-user
|
|
@ -0,0 +1 @@
|
|||
# Default configuration for mips64-linux-user
|
|
@ -0,0 +1 @@
|
|||
# Default configuration for mipsn32-linux-user
|
|
@ -0,0 +1 @@
|
|||
# Default configuration for sparc-linux-user
|
|
@ -281,6 +281,8 @@ typedef int64_t Elf64_Sxword;
|
|||
#define AT_L2_CACHESHAPE 36 /* bits 4-7: log2 of line size. */
|
||||
#define AT_L3_CACHESHAPE 37 /* val&~255: cache size. */
|
||||
|
||||
#define AT_SUN_LDDATA 2016 /* Solaris specific, rld data segment */
|
||||
|
||||
typedef struct dynamic{
|
||||
Elf32_Sword d_tag;
|
||||
union{
|
||||
|
|
|
@ -690,6 +690,15 @@ static inline void init_thread(struct target_pt_regs *regs,
|
|||
}
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef TARGET_ABI_SOLARIS
|
||||
#define DLINFO_ARCH_ITEMS 1
|
||||
#define ARCH_DLINFO \
|
||||
do { \
|
||||
NEW_AUX_ENT(AT_SUN_LDDATA, (abi_ulong)(interp_info ? interp_info->start_data : 0)); \
|
||||
} while (0)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef TARGET_PPC
|
||||
|
@ -1606,8 +1615,13 @@ static abi_ulong setup_arg_pages(struct linux_binprm *bprm,
|
|||
guard = qemu_real_host_page_size;
|
||||
}
|
||||
|
||||
#ifdef TARGET_ABI_IRIX
|
||||
error = target_mmap(0x7fff8000 - size - guard, size + guard, PROT_READ | PROT_WRITE,
|
||||
MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
|
||||
#else
|
||||
error = target_mmap(0, size + guard, PROT_READ | PROT_WRITE,
|
||||
MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
|
||||
#endif
|
||||
if (error == -1) {
|
||||
perror("mmap stack");
|
||||
exit(-1);
|
||||
|
@ -1799,6 +1813,12 @@ static abi_ulong create_elf_tables(abi_ulong p, int argc, int envc,
|
|||
info->arg_start = u_argv;
|
||||
info->arg_end = u_argv + argc * n;
|
||||
|
||||
#ifdef TARGET_ABI_IRIX
|
||||
#define NEW_AUX_ENT(id, val) do { \
|
||||
put_user_u32(id, u_auxv); u_auxv += n; \
|
||||
put_user_ual(val, u_auxv); u_auxv += n; \
|
||||
} while(0)
|
||||
#else
|
||||
/* This is correct because Linux defines
|
||||
* elf_addr_t as Elf32_Off / Elf64_Off
|
||||
*/
|
||||
|
@ -1806,6 +1826,7 @@ static abi_ulong create_elf_tables(abi_ulong p, int argc, int envc,
|
|||
put_user_ual(id, u_auxv); u_auxv += n; \
|
||||
put_user_ual(val, u_auxv); u_auxv += n; \
|
||||
} while(0)
|
||||
#endif
|
||||
|
||||
#ifdef ARCH_DLINFO
|
||||
/*
|
||||
|
@ -1817,7 +1838,11 @@ static abi_ulong create_elf_tables(abi_ulong p, int argc, int envc,
|
|||
/* There must be exactly DLINFO_ITEMS entries here, or the assert
|
||||
* on info->auxv_len will trigger.
|
||||
*/
|
||||
#ifdef TARGET_ABI_IRIX
|
||||
NEW_AUX_ENT(AT_PHDR, (abi_ulong)(info->load_bias + info->phdr_offset));
|
||||
#else
|
||||
NEW_AUX_ENT(AT_PHDR, (abi_ulong)(info->load_addr + exec->e_phoff));
|
||||
#endif
|
||||
NEW_AUX_ENT(AT_PHENT, (abi_ulong)(sizeof (struct elf_phdr)));
|
||||
NEW_AUX_ENT(AT_PHNUM, (abi_ulong)(exec->e_phnum));
|
||||
NEW_AUX_ENT(AT_PAGESZ, (abi_ulong)(MAX(TARGET_PAGE_SIZE, getpagesize())));
|
||||
|
@ -2016,6 +2041,87 @@ exit_errmsg:
|
|||
}
|
||||
|
||||
|
||||
#ifdef TARGET_ABI_IRIX
|
||||
/* SGI_ELFMAP: Map ELF sections into the address space.
|
||||
IMAGE_FD is the open file descriptor for the image.
|
||||
*/
|
||||
abi_ulong sgi_map_elf_image(int image_fd, struct elf_phdr *phdr, int phnum)
|
||||
{
|
||||
abi_ulong load_addr, load_bias, loaddr, hiaddr, error;
|
||||
int i;
|
||||
const char *errmsg;
|
||||
|
||||
/* Find the maximum size of the image and allocate an appropriate
|
||||
amount of memory to handle that. */
|
||||
loaddr = -1, hiaddr = 0;
|
||||
for (i = 0; i < phnum; ++i) {
|
||||
if (phdr[i].p_type == PT_LOAD) {
|
||||
abi_ulong a = phdr[i].p_vaddr;
|
||||
if (a < loaddr) {
|
||||
loaddr = a;
|
||||
}
|
||||
a += phdr[i].p_memsz;
|
||||
if (a > hiaddr) {
|
||||
hiaddr = a;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* The image indicates that it can be loaded anywhere. Find a
|
||||
location that can hold the memory space required. If the
|
||||
image is pre-linked, LOADDR will be non-zero. Since we do
|
||||
not supply MAP_FIXED here we'll use that address if and
|
||||
only if it remains available. */
|
||||
load_addr = target_mmap(loaddr, hiaddr - loaddr, PROT_NONE,
|
||||
MAP_PRIVATE | MAP_ANON | MAP_NORESERVE,
|
||||
-1, 0);
|
||||
if (load_addr == -1) {
|
||||
goto exit_perror;
|
||||
}
|
||||
/* unmap to avoid failure if objects would be loaded into a hole */
|
||||
target_munmap(load_addr, hiaddr - loaddr);
|
||||
load_bias = load_addr - loaddr;
|
||||
|
||||
for (i = 0; i < phnum; i++) {
|
||||
struct elf_phdr *eppnt = phdr + i;
|
||||
if (eppnt->p_type == PT_LOAD) {
|
||||
abi_ulong vaddr, vaddr_po, vaddr_ps, vaddr_ef, vaddr_em;
|
||||
int elf_prot = 0;
|
||||
|
||||
if (eppnt->p_flags & PF_R) elf_prot = PROT_READ;
|
||||
if (eppnt->p_flags & PF_W) elf_prot |= PROT_WRITE;
|
||||
if (eppnt->p_flags & PF_X) elf_prot |= PROT_EXEC;
|
||||
|
||||
vaddr = load_bias + eppnt->p_vaddr;
|
||||
vaddr_po = TARGET_ELF_PAGEOFFSET(vaddr);
|
||||
vaddr_ps = TARGET_ELF_PAGESTART(vaddr);
|
||||
|
||||
error = target_mmap(vaddr_ps, eppnt->p_filesz + vaddr_po,
|
||||
elf_prot, MAP_PRIVATE | MAP_FIXED,
|
||||
image_fd, eppnt->p_offset - vaddr_po);
|
||||
if (error == -1) {
|
||||
goto exit_perror;
|
||||
}
|
||||
|
||||
vaddr_ef = vaddr + eppnt->p_filesz;
|
||||
vaddr_em = vaddr + eppnt->p_memsz;
|
||||
|
||||
/* If the load segment requests extra zeros (e.g. bss), map it. */
|
||||
if (vaddr_ef < vaddr_em) {
|
||||
zero_bss(vaddr_ef, vaddr_em, elf_prot);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return load_bias + phdr[0].p_vaddr;
|
||||
|
||||
exit_perror:
|
||||
errmsg = strerror(errno);
|
||||
fprintf(stderr, "error in syssgi elfmap: %s\n", errmsg);
|
||||
return -ENOEXEC;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Load an ELF image into the address space.
|
||||
|
||||
IMAGE_NAME is the filename of the image, to use in error messages.
|
||||
|
@ -2099,6 +2205,8 @@ static void load_elf_image(const char *image_name, int image_fd,
|
|||
if (load_addr == -1) {
|
||||
goto exit_perror;
|
||||
}
|
||||
/* unmap to avoid failure if objects would be loaded into a hole */
|
||||
target_munmap(load_addr, hiaddr - loaddr);
|
||||
} 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
|
||||
|
@ -2215,6 +2323,11 @@ static void load_elf_image(const char *image_name, int image_fd,
|
|||
}
|
||||
*pinterp_name = interp_name;
|
||||
}
|
||||
#ifdef TARGET_ABI_IRIX
|
||||
else if (eppnt->p_type == PT_PHDR) {
|
||||
info->phdr_offset = eppnt->p_vaddr;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
if (info->end_data == 0) {
|
||||
|
@ -2230,6 +2343,17 @@ static void load_elf_image(const char *image_name, int image_fd,
|
|||
mmap_unlock();
|
||||
|
||||
close(image_fd);
|
||||
#ifdef TARGET_ABI_IRIX
|
||||
/* PRDA hack */
|
||||
error = target_mmap(0x200000, TARGET_PAGE_SIZE, PROT_READ | PROT_WRITE,
|
||||
MAP_PRIVATE | MAP_FIXED | MAP_ANONYMOUS,
|
||||
-1, 0);
|
||||
if (error == -1) {
|
||||
goto exit_perror;
|
||||
}
|
||||
put_user(getpid(), 0x200e00, target_pid_t);
|
||||
put_user(getpid(), 0x200e40, target_pid_t);
|
||||
#endif
|
||||
return;
|
||||
|
||||
exit_read:
|
||||
|
@ -2463,6 +2587,7 @@ int load_elf_binary(struct linux_binprm *bprm, struct image_info *info)
|
|||
struct elfhdr elf_ex;
|
||||
char *elf_interpreter = NULL;
|
||||
char *scratch;
|
||||
abi_ulong top;
|
||||
|
||||
info->start_mmap = (abi_ulong)ELF_START_MMAP;
|
||||
|
||||
|
@ -2476,7 +2601,7 @@ int load_elf_binary(struct linux_binprm *bprm, struct image_info *info)
|
|||
|
||||
/* Do this so that we can load the interpreter, if need be. We will
|
||||
change some of these later */
|
||||
bprm->p = setup_arg_pages(bprm, info);
|
||||
bprm->p = top = setup_arg_pages(bprm, info);
|
||||
|
||||
scratch = g_new0(char, TARGET_PAGE_SIZE);
|
||||
if (STACK_GROWS_DOWN) {
|
||||
|
@ -2507,6 +2632,26 @@ int load_elf_binary(struct linux_binprm *bprm, struct image_info *info)
|
|||
fprintf(stderr, "%s: %s\n", bprm->filename, strerror(E2BIG));
|
||||
exit(-1);
|
||||
}
|
||||
#ifdef TARGET_ABI_IRIX
|
||||
/* page alignment */
|
||||
if (bprm->p % TARGET_PAGE_SIZE) {
|
||||
int o = bprm->p % TARGET_PAGE_SIZE;
|
||||
int l = top - bprm->p;
|
||||
int p = bprm->p - o;
|
||||
char *ptr = lock_user(VERIFY_WRITE, p, l+o, 0);
|
||||
if (!ptr) {
|
||||
fprintf(stderr, "%s: %s\n", bprm->filename, strerror(EFAULT));
|
||||
exit(-1);
|
||||
}
|
||||
memmove(ptr, ptr+o, l);
|
||||
unlock_user(ptr, p, 1);
|
||||
/* adjust pointers by alignment offset */
|
||||
bprm->p -= o;
|
||||
info->file_string -= o;
|
||||
info->arg_strings -= o;
|
||||
info->env_strings -= o;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (elf_interpreter) {
|
||||
load_elf_interp(elf_interpreter, &interp_info, bprm->buf);
|
||||
|
|
|
@ -4,6 +4,158 @@
|
|||
*
|
||||
* Taken from asm-generic/errno-base.h and asm-generic/errno.h
|
||||
*/
|
||||
#if defined TARGET_ABI_IRIX || defined TARGET_ABI_SOLARIS
|
||||
#define TARGET_EPERM 1 /* Operation not permitted */
|
||||
#define TARGET_ENOENT 2 /* No such file or directory */
|
||||
#define TARGET_ESRCH 3 /* No such process */
|
||||
#define TARGET_EINTR 4 /* Interrupted function call */
|
||||
#define TARGET_EIO 5 /* I/O error */
|
||||
#define TARGET_ENXIO 6 /* No such device or address */
|
||||
#define TARGET_E2BIG 7 /* Arg list too long */
|
||||
#define TARGET_ENOEXEC 8 /* Exec format error */
|
||||
#define TARGET_EBADF 9 /* Bad file number */
|
||||
#define TARGET_ECHILD 10 /* No child processes */
|
||||
#define TARGET_EAGAIN 11 /* Resource temporarily unavailable */
|
||||
#define TARGET_ENOMEM 12 /* Not enough space */
|
||||
#define TARGET_EACCES 13 /* Permission denied */
|
||||
#define TARGET_EFAULT 14 /* Bad address */
|
||||
#define TARGET_ENOTBLK 15 /* Block device required */
|
||||
#define TARGET_EBUSY 16 /* Resource busy */
|
||||
#define TARGET_EEXIST 17 /* File exists */
|
||||
#define TARGET_EXDEV 18 /* Improper link */
|
||||
#define TARGET_ENODEV 19 /* No such device */
|
||||
#define TARGET_ENOTDIR 20 /* Not a directory */
|
||||
#define TARGET_EISDIR 21 /* Is a directory */
|
||||
#define TARGET_EINVAL 22 /* Invalid argument */
|
||||
#define TARGET_ENFILE 23 /* File table overflow */
|
||||
#define TARGET_EMFILE 24 /* Too many open files */
|
||||
#define TARGET_ENOTTY 25 /* Inappropriate I/O control operation */
|
||||
#define TARGET_ETXTBSY 26 /* Text file busy */
|
||||
#define TARGET_EFBIG 27 /* File too large */
|
||||
#define TARGET_ENOSPC 28 /* No space left on device */
|
||||
#define TARGET_ESPIPE 29 /* Illegal seek */
|
||||
#define TARGET_EROFS 30 /* Read only file system */
|
||||
#define TARGET_EMLINK 31 /* Too many links */
|
||||
#define TARGET_EPIPE 32 /* Broken pipe */
|
||||
#define TARGET_EDOM 33 /* Domain error */
|
||||
#define TARGET_ERANGE 34 /* Result too large */
|
||||
#define TARGET_ENOMSG 35 /* No message of desired type */
|
||||
#define TARGET_EIDRM 36 /* Identifier removed */
|
||||
#define TARGET_ECHRNG 37 /* Channel number out of range */
|
||||
#define TARGET_EL2NSYNC 38 /* Level 2 not synchronized */
|
||||
#define TARGET_EL3HLT 39 /* Level 3 halted */
|
||||
#define TARGET_EL3RST 40 /* Level 3 reset */
|
||||
#define TARGET_ELNRNG 41 /* Link number out of range */
|
||||
#define TARGET_EUNATCH 42 /* Protocol driver not attached */
|
||||
#define TARGET_ENOCSI 43 /* No CSI structure available */
|
||||
#define TARGET_EL2HLT 44 /* Level 2 halted */
|
||||
#define TARGET_EDEADLK 45 /* Resource deadlock avoided */
|
||||
#define TARGET_ENOLCK 46 /* No locks available */
|
||||
#define TARGET_ECKPT 47 /* POSIX checkpoint/restart error */
|
||||
|
||||
/* Convergent Error Returns */
|
||||
#define TARGET_EBADE 50 /* invalid exchange */
|
||||
#define TARGET_EBADR 51 /* invalid request descriptor */
|
||||
#define TARGET_EXFULL 52 /* exchange full */
|
||||
#define TARGET_ENOANO 53 /* no anode */
|
||||
#define TARGET_EBADRQC 54 /* invalid request code */
|
||||
#define TARGET_EBADSLT 55 /* invalid slot */
|
||||
#define TARGET_EDEADLOCK 56 /* file locking deadlock error */
|
||||
|
||||
#define TARGET_EBFONT 57 /* bad font file fmt */
|
||||
|
||||
/* stream problems */
|
||||
#define TARGET_ENOSTR 60 /* Device not a stream */
|
||||
#define TARGET_ENODATA 61 /* no data (for no delay io) */
|
||||
#define TARGET_ETIME 62 /* timer expired */
|
||||
#define TARGET_ENOSR 63 /* out of streams resources */
|
||||
|
||||
#define TARGET_ENONET 64 /* Machine is not on the network */
|
||||
#define TARGET_ENOPKG 65 /* Package not installed */
|
||||
#define TARGET_EREMOTE 66 /* The object is remote */
|
||||
#define TARGET_ENOLINK 67 /* the link has been severed */
|
||||
#define TARGET_EADV 68 /* advertise error */
|
||||
#define TARGET_ESRMNT 69 /* srmount error */
|
||||
|
||||
#define TARGET_ECOMM 70 /* Communication error on send */
|
||||
#define TARGET_EPROTO 71 /* Protocol error */
|
||||
#define TARGET_EMULTIHOP 74 /* multihop attempted */
|
||||
#define TARGET_EBADMSG 77 /* Bad message */
|
||||
#define TARGET_ENAMETOOLONG 78 /* Filename too long */
|
||||
#define TARGET_EOVERFLOW 79 /* value too large to be stored in data type */
|
||||
#define TARGET_ENOTUNIQ 80 /* given log. name not unique */
|
||||
#define TARGET_EBADFD 81 /* f.d. invalid for this operation */
|
||||
#define TARGET_EREMCHG 82 /* Remote address changed */
|
||||
|
||||
/* shared library problems */
|
||||
#define TARGET_ELIBACC 83 /* Can't access a needed shared lib. */
|
||||
#define TARGET_ELIBBAD 84 /* Accessing a corrupted shared lib. */
|
||||
#define TARGET_ELIBSCN 85 /* .lib section in a.out corrupted. */
|
||||
#define TARGET_ELIBMAX 86 /* Attempting to link in too many libs. */
|
||||
#define TARGET_ELIBEXEC 87 /* Attempting to exec a shared library. */
|
||||
#define TARGET_EILSEQ 88 /* Illegal byte sequence. */
|
||||
#define TARGET_ENOSYS 89 /* Function not implemented */
|
||||
#define TARGET_ELOOP 90 /* Symbolic link loop */
|
||||
#define TARGET_ERESTART 91 /* Restartable system call */
|
||||
#define TARGET_ESTRPIPE 92 /* if pipe/FIFO, don't sleep in stream head */
|
||||
|
||||
#define TARGET_ENOTEMPTY 93 /* Directory not empty */
|
||||
|
||||
#define TARGET_EUSERS 94 /* Too many users (for UFS) */
|
||||
|
||||
/* BSD Networking Software */
|
||||
/* argument errors */
|
||||
#define TARGET_ENOTSOCK 95 /* Socket operation on non-socket */
|
||||
#define TARGET_EDESTADDRREQ 96 /* Destination address required */
|
||||
#define TARGET_EMSGSIZE 97 /* Inappropriate message buffer length */
|
||||
#define TARGET_EPROTOTYPE 98 /* Protocol wrong type for socket */
|
||||
#define TARGET_ENOPROTOOPT 99 /* Protocol not available */
|
||||
#define TARGET_EPROTONOSUPPORT 120 /* Protocol not supported */
|
||||
#define TARGET_ESOCKTNOSUPPORT 121 /* Socket type not supported */
|
||||
#define TARGET_EOPNOTSUPP 122 /* Operation not supported on socket */
|
||||
#define TARGET_EPFNOSUPPORT 123 /* Protocol family not supported */
|
||||
#define TARGET_EAFNOSUPPORT 124 /* Address family not supported by
|
||||
protocol family */
|
||||
#define TARGET_EADDRINUSE 125 /* Address already in use */
|
||||
#define TARGET_EADDRNOTAVAIL 126 /* Can't assign requested address */
|
||||
|
||||
/* operational errors */
|
||||
#define TARGET_ENETDOWN 127 /* Network is down */
|
||||
#define TARGET_ENETUNREACH 128 /* Network is unreachable */
|
||||
#define TARGET_ENETRESET 129 /* Network dropped connection because
|
||||
of reset */
|
||||
#define TARGET_ECONNABORTED 130 /* Software caused connection abort */
|
||||
#define TARGET_ECONNRESET 131 /* Connection reset by peer */
|
||||
#define TARGET_ENOBUFS 132 /* No buffer space available */
|
||||
#define TARGET_EISCONN 133 /* Socket is already connected */
|
||||
#define TARGET_ENOTCONN 134 /* Socket is not connected */
|
||||
|
||||
/* XENIX has 135 - 142 */
|
||||
#define TARGET_ESHUTDOWN 143 /* Can't send after socket shutdown */
|
||||
#define TARGET_ETOOMANYREFS 144 /* Too many references: can't splice */
|
||||
#define TARGET_ETIMEDOUT 145 /* Connection timed out */
|
||||
#define TARGET_ECONNREFUSED 146 /* Connection refused */
|
||||
#define TARGET_EHOSTDOWN 147 /* Host is down */
|
||||
#define TARGET_EHOSTUNREACH 148 /* No route to host */
|
||||
|
||||
#define TARGET_EWOULDBLOCK TARGET_EAGAIN
|
||||
|
||||
#define TARGET_EALREADY 149 /* operation already in progress */
|
||||
#define TARGET_EINPROGRESS 150 /* operation now in progress */
|
||||
/* SUN Network File System */
|
||||
#define TARGET_ESTALE 151 /* Stale NFS file handle */
|
||||
|
||||
/* XENIX error numbers */
|
||||
#define TARGET_EUCLEAN 135 /* Structure needs cleaning */
|
||||
#define TARGET_ENOTNAM 137 /* Not a XENIX named type file */
|
||||
#define TARGET_ENAVAIL 138 /* No XENIX semaphores available */
|
||||
#define TARGET_EISNAM 139 /* Is a named type file */
|
||||
#define TARGET_EREMOTEIO 140 /* Remote I/O error */
|
||||
#define TARGET_EINIT 141 /* Reserved for future */
|
||||
#define TARGET_EREMDEV 142 /* Error 142 */
|
||||
#define TARGET_ECANCELED 158 /* AIO operation canceled */
|
||||
|
||||
#else
|
||||
#define TARGET_EPERM 1 /* Operation not permitted */
|
||||
#define TARGET_ENOENT 2 /* No such file or directory */
|
||||
#define TARGET_ESRCH 3 /* No such process */
|
||||
|
@ -142,6 +294,7 @@
|
|||
|
||||
#define TARGET_ERFKILL 132 /* Operation not possible due to RF-kill */
|
||||
#define TARGET_EHWPOISON 133 /* Memory page has hardware error */
|
||||
#endif
|
||||
|
||||
/* QEMU internal, not visible to the guest. This is returned when a
|
||||
* system call should be restarted, to tell the main loop that it
|
||||
|
|
|
@ -1,5 +1,12 @@
|
|||
/* emulated ioctl list */
|
||||
|
||||
#ifdef TARGET_ABI_IRIX
|
||||
IOCTL_MAP(TCNGETS, TCGETS, IOC_R, MK_PTR(MK_STRUCT(STRUCT_termios)))
|
||||
IOCTL_MAP(TCNSETS, TCSETS, IOC_R, MK_PTR(MK_STRUCT(STRUCT_termios)))
|
||||
IOCTL_MAP(TCNSETSF, TCSETSF, IOC_R, MK_PTR(MK_STRUCT(STRUCT_termios)))
|
||||
IOCTL_MAP(TCNSETSW, TCSETSW, IOC_R, MK_PTR(MK_STRUCT(STRUCT_termios)))
|
||||
#endif
|
||||
|
||||
IOCTL(TCGETS, IOC_R, MK_PTR(MK_STRUCT(STRUCT_termios)))
|
||||
IOCTL(TCSETS, IOC_W, MK_PTR(MK_STRUCT(STRUCT_termios)))
|
||||
IOCTL(TCSETSF, IOC_W, MK_PTR(MK_STRUCT(STRUCT_termios)))
|
||||
|
@ -55,6 +62,7 @@
|
|||
IOCTL(TIOCMIWAIT, 0, TYPE_INT)
|
||||
IOCTL(TIOCGICOUNT, IOC_R, MK_PTR(MK_STRUCT(STRUCT_serial_icounter_struct)))
|
||||
|
||||
#if !defined(TARGET_ABI_IRIX) && !defined(TARGET_ABI_SOLARIS)
|
||||
IOCTL(KIOCSOUND, 0, TYPE_INT)
|
||||
IOCTL(KDMKTONE, 0, TYPE_INT)
|
||||
IOCTL(KDSETMODE, 0, TYPE_INT)
|
||||
|
@ -126,6 +134,7 @@
|
|||
#ifdef CONFIG_FIEMAP
|
||||
IOCTL_SPECIAL(FS_IOC_FIEMAP, IOC_W | IOC_R, do_ioctl_fs_ioc_fiemap,
|
||||
MK_PTR(MK_STRUCT(STRUCT_fiemap)))
|
||||
#endif
|
||||
#endif
|
||||
|
||||
IOCTL(FS_IOC_GETFLAGS, IOC_R, MK_PTR(TYPE_INT))
|
||||
|
@ -175,7 +184,11 @@
|
|||
IOCTL(SIOCGPGRP, IOC_R, MK_PTR(TYPE_INT)) /* pid_t */
|
||||
IOCTL(SIOCGSTAMP, IOC_R, MK_PTR(MK_STRUCT(STRUCT_timeval)))
|
||||
IOCTL(SIOCGSTAMPNS, IOC_R, MK_PTR(MK_STRUCT(STRUCT_timespec)))
|
||||
#ifdef TARGET_ABI_IRIX
|
||||
IOCTL_MAP(SIOCNREAD, FIONREAD, IOC_R, MK_PTR(TYPE_INT))
|
||||
#endif
|
||||
|
||||
#if !defined TARGET_ABI_IRIX && !defined TARGET_ABI_SOLARIS
|
||||
IOCTL(RNDGETENTCNT, IOC_R, MK_PTR(TYPE_INT))
|
||||
IOCTL(RNDADDTOENTCNT, IOC_W, MK_PTR(TYPE_INT))
|
||||
IOCTL(RNDZAPENTCNT, 0, TYPE_NULL)
|
||||
|
@ -438,6 +451,7 @@
|
|||
MK_PTR(MK_STRUCT(STRUCT_rtentry)))
|
||||
IOCTL_SPECIAL(SIOCDELRT, IOC_W, do_ioctl_rt,
|
||||
MK_PTR(MK_STRUCT(STRUCT_rtentry)))
|
||||
#endif
|
||||
|
||||
#ifdef TARGET_TIOCSTART
|
||||
IOCTL_IGNORE(TIOCSTART)
|
||||
|
|
|
@ -0,0 +1,355 @@
|
|||
/*
|
||||
* IRIX syscalls are in the range from 1000 to 1999.
|
||||
*/
|
||||
#define TARGET_NR_Linux 1000
|
||||
|
||||
/* syscalls as per IRIX /usr/include/sys.s */
|
||||
#define TARGET_NR_syscall (0+TARGET_NR_Linux)
|
||||
#define TARGET_NR_exit (1+TARGET_NR_Linux)
|
||||
#define TARGET_NR_fork (2+TARGET_NR_Linux)
|
||||
#define TARGET_NR_read (3+TARGET_NR_Linux)
|
||||
#define TARGET_NR_write (4+TARGET_NR_Linux)
|
||||
#define TARGET_NR_open (5+TARGET_NR_Linux)
|
||||
#define TARGET_NR_close (6+TARGET_NR_Linux)
|
||||
#define TARGET_NR_creat (8+TARGET_NR_Linux)
|
||||
#define TARGET_NR_link (9+TARGET_NR_Linux)
|
||||
#define TARGET_NR_unlink (10+TARGET_NR_Linux)
|
||||
#define TARGET_NR_execv (11+TARGET_NR_Linux)
|
||||
#define TARGET_NR_chdir (12+TARGET_NR_Linux)
|
||||
#define TARGET_NR_time (13+TARGET_NR_Linux)
|
||||
#define TARGET_NR_chmod (15+TARGET_NR_Linux)
|
||||
#define TARGET_NR_chown (16+TARGET_NR_Linux)
|
||||
#define TARGET_NR_brk (17+TARGET_NR_Linux)
|
||||
#define TARGET_NR_stat (18+TARGET_NR_Linux)
|
||||
#define TARGET_NR_lseek (19+TARGET_NR_Linux)
|
||||
#define TARGET_NR_getpid (20+TARGET_NR_Linux)
|
||||
#define TARGET_NR_mount (21+TARGET_NR_Linux)
|
||||
#define TARGET_NR_umount (22+TARGET_NR_Linux)
|
||||
#define TARGET_NR_setuid (23+TARGET_NR_Linux)
|
||||
#define TARGET_NR_getuid (24+TARGET_NR_Linux)
|
||||
#define TARGET_NR_stime (25+TARGET_NR_Linux)
|
||||
#define TARGET_NR_ptrace (26+TARGET_NR_Linux)
|
||||
#define TARGET_NR_alarm (27+TARGET_NR_Linux)
|
||||
#define TARGET_NR_pause (29+TARGET_NR_Linux)
|
||||
#define TARGET_NR_utime (30+TARGET_NR_Linux)
|
||||
#define TARGET_NR_access (33+TARGET_NR_Linux)
|
||||
#define TARGET_NR_nice (34+TARGET_NR_Linux)
|
||||
#define TARGET_NR_statfs (35+TARGET_NR_Linux)
|
||||
#define TARGET_NR_sync (36+TARGET_NR_Linux)
|
||||
#define TARGET_NR_kill (37+TARGET_NR_Linux)
|
||||
#define TARGET_NR_fstatfs (38+TARGET_NR_Linux)
|
||||
#define TARGET_NR_pgrpsys (39+TARGET_NR_Linux)
|
||||
#define TARGET_NR_syssgi (40+TARGET_NR_Linux)
|
||||
#define TARGET_NR_dup (41+TARGET_NR_Linux)
|
||||
#define TARGET_NR_pipe (42+TARGET_NR_Linux)
|
||||
#define TARGET_NR_times (43+TARGET_NR_Linux)
|
||||
#define TARGET_NR_profil (44+TARGET_NR_Linux)
|
||||
#define TARGET_NR_plock (45+TARGET_NR_Linux)
|
||||
#define TARGET_NR_setgid (46+TARGET_NR_Linux)
|
||||
#define TARGET_NR_getgid (47+TARGET_NR_Linux)
|
||||
#define TARGET_NR_msgsys (49+TARGET_NR_Linux)
|
||||
#define TARGET_NR_sysmips (50+TARGET_NR_Linux)
|
||||
#define TARGET_NR_acct (51+TARGET_NR_Linux)
|
||||
#define TARGET_NR_shmsys (52+TARGET_NR_Linux)
|
||||
#define TARGET_NR_semsys (53+TARGET_NR_Linux)
|
||||
#define TARGET_NR_ioctl (54+TARGET_NR_Linux)
|
||||
#define TARGET_NR_uadmin (55+TARGET_NR_Linux)
|
||||
#define TARGET_NR_sysmp (56+TARGET_NR_Linux)
|
||||
#define TARGET_NR_utssyssgi (57+TARGET_NR_Linux)
|
||||
#define TARGET_NR_execve (59+TARGET_NR_Linux)
|
||||
#define TARGET_NR_umask (60+TARGET_NR_Linux)
|
||||
#define TARGET_NR_chroot (61+TARGET_NR_Linux)
|
||||
#define TARGET_NR_fcntl (62+TARGET_NR_Linux)
|
||||
#define TARGET_NR_ulimit (63+TARGET_NR_Linux)
|
||||
#define TARGET_NR_getrlimit64 (75+TARGET_NR_Linux)
|
||||
#define TARGET_NR_setrlimit64 (76+TARGET_NR_Linux)
|
||||
#define TARGET_NR_nanosleep (77+TARGET_NR_Linux)
|
||||
#define TARGET_NR_lseek64 (78+TARGET_NR_Linux)
|
||||
#define TARGET_NR_rmdir (79+TARGET_NR_Linux)
|
||||
#define TARGET_NR_mkdir (80+TARGET_NR_Linux)
|
||||
#define TARGET_NR_getdents (81+TARGET_NR_Linux)
|
||||
#define TARGET_NR_sginap (82+TARGET_NR_Linux)
|
||||
#define TARGET_NR_sgikopt (83+TARGET_NR_Linux)
|
||||
#define TARGET_NR_sysfs (84+TARGET_NR_Linux)
|
||||
#define TARGET_NR_getmsg (85+TARGET_NR_Linux)
|
||||
#define TARGET_NR_putmsg (86+TARGET_NR_Linux)
|
||||
#define TARGET_NR_poll (87+TARGET_NR_Linux)
|
||||
#define TARGET_NR_sigreturn (88+TARGET_NR_Linux)
|
||||
#define TARGET_NR_accept (89+TARGET_NR_Linux)
|
||||
#define TARGET_NR_bind (90+TARGET_NR_Linux)
|
||||
#define TARGET_NR_connect (91+TARGET_NR_Linux)
|
||||
#define TARGET_NR_gethostid (92+TARGET_NR_Linux)
|
||||
#define TARGET_NR_getpeername (93+TARGET_NR_Linux)
|
||||
#define TARGET_NR_getsockname (94+TARGET_NR_Linux)
|
||||
#define TARGET_NR_getsockopt (95+TARGET_NR_Linux)
|
||||
#define TARGET_NR_listen (96+TARGET_NR_Linux)
|
||||
#define TARGET_NR_recv (97+TARGET_NR_Linux)
|
||||
#define TARGET_NR_recvfrom (98+TARGET_NR_Linux)
|
||||
#define TARGET_NR_recvmsg (99+TARGET_NR_Linux)
|
||||
#define TARGET_NR_select (100+TARGET_NR_Linux)
|
||||
#define TARGET_NR_send (101+TARGET_NR_Linux)
|
||||
#define TARGET_NR_sendmsg (102+TARGET_NR_Linux)
|
||||
#define TARGET_NR_sendto (103+TARGET_NR_Linux)
|
||||
#define TARGET_NR_sethostid (104+TARGET_NR_Linux)
|
||||
#define TARGET_NR_setsockopt (105+TARGET_NR_Linux)
|
||||
#define TARGET_NR_shutdown (106+TARGET_NR_Linux)
|
||||
#define TARGET_NR_socket (107+TARGET_NR_Linux)
|
||||
#define TARGET_NR_gethostname (108+TARGET_NR_Linux)
|
||||
#define TARGET_NR_sethostname (109+TARGET_NR_Linux)
|
||||
#define TARGET_NR_getdomainname (110+TARGET_NR_Linux)
|
||||
#define TARGET_NR_setdomainname (111+TARGET_NR_Linux)
|
||||
#define TARGET_NR_truncate (112+TARGET_NR_Linux)
|
||||
#define TARGET_NR_ftruncate (113+TARGET_NR_Linux)
|
||||
#define TARGET_NR_rename (114+TARGET_NR_Linux)
|
||||
#define TARGET_NR_symlink (115+TARGET_NR_Linux)
|
||||
#define TARGET_NR_readlink (116+TARGET_NR_Linux)
|
||||
#define TARGET_NR_nfssvc (119+TARGET_NR_Linux)
|
||||
#define TARGET_NR_getfh (120+TARGET_NR_Linux)
|
||||
#define TARGET_NR_async_daemons (121+TARGET_NR_Linux)
|
||||
#define TARGET_NR_exportfs (122+TARGET_NR_Linux)
|
||||
#define TARGET_NR_setregid (123+TARGET_NR_Linux)
|
||||
#define TARGET_NR_setreuid (124+TARGET_NR_Linux)
|
||||
#define TARGET_NR_getitimer (125+TARGET_NR_Linux)
|
||||
#define TARGET_NR_setitimer (126+TARGET_NR_Linux)
|
||||
#define TARGET_NR_adjtime (127+TARGET_NR_Linux)
|
||||
#define TARGET_NR_gettimeofday (128+TARGET_NR_Linux)
|
||||
#define TARGET_NR_sproc (129+TARGET_NR_Linux)
|
||||
#define TARGET_NR_sgiprctl (130+TARGET_NR_Linux)
|
||||
#define TARGET_NR_procblk (131+TARGET_NR_Linux)
|
||||
#define TARGET_NR_sprocsp (132+TARGET_NR_Linux)
|
||||
#define TARGET_NR_mmap (134+TARGET_NR_Linux)
|
||||
#define TARGET_NR_munmap (135+TARGET_NR_Linux)
|
||||
#define TARGET_NR_mprotect (136+TARGET_NR_Linux)
|
||||
#define TARGET_NR_msync (137+TARGET_NR_Linux)
|
||||
#define TARGET_NR_madvise (138+TARGET_NR_Linux)
|
||||
#define TARGET_NR_pagelock (139+TARGET_NR_Linux)
|
||||
#define TARGET_NR_getpagesize (140+TARGET_NR_Linux)
|
||||
#define TARGET_NR_quotactl (141+TARGET_NR_Linux)
|
||||
#define TARGET_NR_getpgid (143+TARGET_NR_Linux)
|
||||
#define TARGET_NR_setpgid (144+TARGET_NR_Linux)
|
||||
#define TARGET_NR_vhangup (145+TARGET_NR_Linux)
|
||||
#define TARGET_NR_fsync (146+TARGET_NR_Linux)
|
||||
#define TARGET_NR_fchdir (147+TARGET_NR_Linux)
|
||||
#define TARGET_NR_getrlimit (148+TARGET_NR_Linux)
|
||||
#define TARGET_NR_setrlimit (149+TARGET_NR_Linux)
|
||||
#define TARGET_NR_cacheflush (150+TARGET_NR_Linux)
|
||||
#define TARGET_NR_cachectl (151+TARGET_NR_Linux)
|
||||
#define TARGET_NR_fchown (152+TARGET_NR_Linux)
|
||||
#define TARGET_NR_fchmod (153+TARGET_NR_Linux)
|
||||
#define TARGET_NR_socketpair (155+TARGET_NR_Linux)
|
||||
#define TARGET_NR_sysinfosgi (156+TARGET_NR_Linux)
|
||||
#define TARGET_NR_uname (157+TARGET_NR_Linux)
|
||||
#define TARGET_NR_xstat (158+TARGET_NR_Linux)
|
||||
#define TARGET_NR_lxstat (159+TARGET_NR_Linux)
|
||||
#define TARGET_NR_fxstat (160+TARGET_NR_Linux)
|
||||
#define TARGET_NR_xmknod (161+TARGET_NR_Linux)
|
||||
#define TARGET_NR_sigaction (162+TARGET_NR_Linux)
|
||||
#define TARGET_NR_sigpending (163+TARGET_NR_Linux)
|
||||
#define TARGET_NR_sigprocmask (164+TARGET_NR_Linux)
|
||||
#define TARGET_NR_sigsuspend (165+TARGET_NR_Linux)
|
||||
#define TARGET_NR_sigpoll (166+TARGET_NR_Linux)
|
||||
#define TARGET_NR_swapctl (167+TARGET_NR_Linux)
|
||||
#define TARGET_NR_getcontext (168+TARGET_NR_Linux)
|
||||
#define TARGET_NR_setcontext (169+TARGET_NR_Linux)
|
||||
#define TARGET_NR_waitid (170+TARGET_NR_Linux)
|
||||
#define TARGET_NR_sigstack (171+TARGET_NR_Linux)
|
||||
#define TARGET_NR_sigaltstack (172+TARGET_NR_Linux)
|
||||
#define TARGET_NR_sigsendset (173+TARGET_NR_Linux)
|
||||
#define TARGET_NR_statvfs (174+TARGET_NR_Linux)
|
||||
#define TARGET_NR_fstatvfs (175+TARGET_NR_Linux)
|
||||
#define TARGET_NR_getpmsg (176+TARGET_NR_Linux)
|
||||
#define TARGET_NR_putpmsg (177+TARGET_NR_Linux)
|
||||
#define TARGET_NR_lchown (178+TARGET_NR_Linux)
|
||||
#define TARGET_NR_priocntl (179+TARGET_NR_Linux)
|
||||
#define TARGET_NR_ksigqueue (180+TARGET_NR_Linux)
|
||||
#define TARGET_NR_readv (181+TARGET_NR_Linux)
|
||||
#define TARGET_NR_writev (182+TARGET_NR_Linux)
|
||||
#define TARGET_NR_truncate64 (183+TARGET_NR_Linux)
|
||||
#define TARGET_NR_ftruncate64 (184+TARGET_NR_Linux)
|
||||
#define TARGET_NR_mmap64 (185+TARGET_NR_Linux)
|
||||
#define TARGET_NR_dmi (186+TARGET_NR_Linux)
|
||||
#define TARGET_NR_pread64 (187+TARGET_NR_Linux)
|
||||
#define TARGET_NR_pwrite64 (188+TARGET_NR_Linux)
|
||||
#define TARGET_NR_fdatasync (189+TARGET_NR_Linux)
|
||||
#define TARGET_NR_sgifastpath (190+TARGET_NR_Linux)
|
||||
#define TARGET_NR_attr_get (191+TARGET_NR_Linux)
|
||||
#define TARGET_NR_attr_getf (192+TARGET_NR_Linux)
|
||||
#define TARGET_NR_attr_set (193+TARGET_NR_Linux)
|
||||
#define TARGET_NR_attr_setf (194+TARGET_NR_Linux)
|
||||
#define TARGET_NR_attr_remove (195+TARGET_NR_Linux)
|
||||
#define TARGET_NR_attr_removef (196+TARGET_NR_Linux)
|
||||
#define TARGET_NR_attr_list (197+TARGET_NR_Linux)
|
||||
#define TARGET_NR_attr_listf (198+TARGET_NR_Linux)
|
||||
#define TARGET_NR_attr_multi (199+TARGET_NR_Linux)
|
||||
#define TARGET_NR_attr_multif (200+TARGET_NR_Linux)
|
||||
#define TARGET_NR_statvfs64 (201+TARGET_NR_Linux)
|
||||
#define TARGET_NR_fstatvfs64 (202+TARGET_NR_Linux)
|
||||
#define TARGET_NR_getmountid (203+TARGET_NR_Linux)
|
||||
#define TARGET_NR_nsproc (204+TARGET_NR_Linux)
|
||||
#define TARGET_NR_getdents64 (205+TARGET_NR_Linux)
|
||||
#define TARGET_NR_afs_syscall (206+TARGET_NR_Linux)
|
||||
#define TARGET_NR_ngetdents (207+TARGET_NR_Linux)
|
||||
#define TARGET_NR_ngetdents64 (208+TARGET_NR_Linux)
|
||||
#define TARGET_NR_sgi_sesmgr (209+TARGET_NR_Linux)
|
||||
#define TARGET_NR_pidsprocsp (210+TARGET_NR_Linux)
|
||||
#define TARGET_NR_rexec (211+TARGET_NR_Linux)
|
||||
#define TARGET_NR_timer_create (212+TARGET_NR_Linux)
|
||||
#define TARGET_NR_timer_delete (213+TARGET_NR_Linux)
|
||||
#define TARGET_NR_timer_settime (214+TARGET_NR_Linux)
|
||||
#define TARGET_NR_timer_gettime (215+TARGET_NR_Linux)
|
||||
#define TARGET_NR_timer_getoverrun (216+TARGET_NR_Linux)
|
||||
#define TARGET_NR_sched_rr_get_interval (217+TARGET_NR_Linux)
|
||||
#define TARGET_NR_sched_yield (218+TARGET_NR_Linux)
|
||||
#define TARGET_NR_sched_getscheduler (219+TARGET_NR_Linux)
|
||||
#define TARGET_NR_sched_setscheduler (220+TARGET_NR_Linux)
|
||||
#define TARGET_NR_sched_getparam (221+TARGET_NR_Linux)
|
||||
#define TARGET_NR_sched_setparam (222+TARGET_NR_Linux)
|
||||
#define TARGET_NR_usync_cntl (223+TARGET_NR_Linux)
|
||||
#define TARGET_NR_psema_cntl (224+TARGET_NR_Linux)
|
||||
#define TARGET_NR_restartreturn (225+TARGET_NR_Linux)
|
||||
#define TARGET_NR_sysget (226+TARGET_NR_Linux)
|
||||
#define TARGET_NR_xpg4_recvmsg (227+TARGET_NR_Linux)
|
||||
#define TARGET_NR_umfscall (228+TARGET_NR_Linux)
|
||||
#define TARGET_NR_nsproctid (229+TARGET_NR_Linux)
|
||||
#define TARGET_NR_rexec_complete (230+TARGET_NR_Linux)
|
||||
#define TARGET_NR_xpg4_sigaltstack (231+TARGET_NR_Linux)
|
||||
#define TARGET_NR_xpg4_select (232+TARGET_NR_Linux)
|
||||
#define TARGET_NR_xpg4_setregid (233+TARGET_NR_Linux)
|
||||
#define TARGET_NR_linkfollow (234+TARGET_NR_Linux)
|
||||
|
||||
|
||||
/* msgsys(cmd, ...), same as solaris... */
|
||||
#define TARGET_NR_msgsys_msgget 0
|
||||
#define TARGET_NR_msgsys_msgctl 1
|
||||
#define TARGET_NR_msgsys_msgrcv 2
|
||||
#define TARGET_NR_msgsys_msgsnd 3
|
||||
|
||||
|
||||
/* shmsys(cmd, ...), same as solaris... */
|
||||
#define TARGET_NR_shmsys_shmat 0
|
||||
#define TARGET_NR_shmsys_shmctl 1
|
||||
#define TARGET_NR_shmsys_shmdt 2
|
||||
#define TARGET_NR_shmsys_shmget 3
|
||||
|
||||
|
||||
/* semsys(cmd, ...), same as solaris... */
|
||||
#define TARGET_NR_semsys_semctl 0
|
||||
#define TARGET_NR_semsys_semget 1
|
||||
#define TARGET_NR_semsys_semop 2
|
||||
|
||||
|
||||
/* pgrpsys(cmd), same as solaris... */
|
||||
#define TARGET_NR_pgrpsys_getpgrp 0
|
||||
#define TARGET_NR_pgrpsys_setpgrp 1
|
||||
|
||||
|
||||
/* syssgi(cmd, ...) */
|
||||
#define TARGET_NR_syssgi_setsid (20)
|
||||
#define TARGET_NR_syssgi_setpgid (21)
|
||||
#define TARGET_NR_syssgi_sysconf (22)
|
||||
#define TARGET_NR_syssgi_pathconf (23)
|
||||
#define TARGET_NR_syssgi_setgroups (40)
|
||||
#define TARGET_NR_syssgi_getgroups (41)
|
||||
#define TARGET_NR_syssgi_settimeofday (52)
|
||||
#define TARGET_NR_syssgi_rusage (56)
|
||||
#define TARGET_NR_syssgi_sigaltstack (60)
|
||||
#define TARGET_NR_syssgi_getpgid (64)
|
||||
#define TARGET_NR_syssgi_getsid (65)
|
||||
/* SGI specific syssgi calls */
|
||||
#define TARGET_NR_syssgi_sysid (1)
|
||||
#define TARGET_NR_syssgi_elfmap (68)
|
||||
#define TARGET_NR_syssgi_rldenv (92)
|
||||
#define TARGET_NR_syssgi_tosstsave (108)
|
||||
#define TARGET_NR_syssgi_fdhi (109)
|
||||
#define TARGET_NR_syssgi_fpbcopy (129)
|
||||
#define TARGET_NR_syssgi_getust (130)
|
||||
|
||||
|
||||
/* syssgi(sysconf, cmd, ...) */
|
||||
#define TARGET_NR_sysconf_childmax (2)
|
||||
#define TARGET_NR_sysconf_clktick (3)
|
||||
#define TARGET_NR_sysconf_openmax (5)
|
||||
#define TARGET_NR_sysconf_pagesize (11)
|
||||
#define TARGET_NR_sysconf_nprocs (14)
|
||||
#define TARGET_NR_sysconf_acl (25)
|
||||
#define TARGET_NR_sysconf_mac (28)
|
||||
#define TARGET_NR_sysconf_cap (29)
|
||||
|
||||
|
||||
/* sysmp(cmd, ...) */
|
||||
#define TARGET_NR_sysmp_nprocs (1)
|
||||
#define TARGET_NR_sysmp_naprocs (2)
|
||||
#define TARGET_NR_sysmp_pgsize (14)
|
||||
|
||||
|
||||
/* prctl(cmd, ...) */
|
||||
#define TARGET_NR_prctl_isblocked (2)
|
||||
#define TARGET_NR_prctl_maxpprocs (5)
|
||||
#define TARGET_NR_prctl_unblkonexec (6)
|
||||
#define TARGET_NR_prctl_setexitsig (8)
|
||||
#define TARGET_NR_prctl_termchild (12)
|
||||
#define TARGET_NR_prctl_getnshare (14)
|
||||
#define TARGET_NR_prctl_initthreads (20)
|
||||
#define TARGET_NR_prctl_threadctl (21)
|
||||
#define TARGET_NR_prctl_lastshexit (22)
|
||||
|
||||
|
||||
/* prctl(TARGET_NR_prctl_threadctl, cmd, ...) */
|
||||
#define TARGET_NR_prctl_thread_exit (1)
|
||||
#define TARGET_NR_prctl_thread_block (2)
|
||||
#define TARGET_NR_prctl_thread_unblock (3)
|
||||
#define TARGET_NR_prctl_thread_kill (4)
|
||||
#define TARGET_NR_prctl_thread_sched (5)
|
||||
|
||||
|
||||
/* procblk(cmd, ...) */
|
||||
#define TARGET_NR_procblk_block (0)
|
||||
#define TARGET_NR_procblk_unblock (1)
|
||||
#define TARGET_NR_procblk_count (2)
|
||||
|
||||
|
||||
/* usync_cntl(cmd, ...), list from netbsd 5.2 */
|
||||
#define TARGET_NR_usync_block (1)
|
||||
#define TARGET_NR_usync_intr_block (2)
|
||||
#define TARGET_NR_usync_unblock_all (3)
|
||||
#define TARGET_NR_usync_unblock (4)
|
||||
#define TARGET_NR_usync_notify_register (5)
|
||||
#define TARGET_NR_usync_notify (6)
|
||||
#define TARGET_NR_usync_notify_delete (7)
|
||||
#define TARGET_NR_usync_notify_clear (8)
|
||||
#define TARGET_NR_usync_get_state (11)
|
||||
#define TARGET_NR_usync_handoff (12)
|
||||
|
||||
|
||||
/* psema_cntl(cmd, ...), list from /usr/sbin/par */
|
||||
#define TARGET_NR_psema_open (1)
|
||||
#define TARGET_NR_psema_close (2)
|
||||
#define TARGET_NR_psema_unlink (3)
|
||||
#define TARGET_NR_psema_post (4)
|
||||
#define TARGET_NR_psema_wait (5)
|
||||
#define TARGET_NR_psema_trywait (6)
|
||||
#define TARGET_NR_psema_getvalue (7)
|
||||
#define TARGET_NR_psema_wait2 (9)
|
||||
|
||||
|
||||
/* swapctl(cmd, arg) */
|
||||
#define TARGET_NR_swapctl_getfree (103)
|
||||
|
||||
|
||||
/* sysinfosgi(cmd, buf, size) */
|
||||
#define TARGET_NR_sysinfo_gethostname 2
|
||||
#define TARGET_NR_sysinfo_sethostname 258
|
||||
#define TARGET_NR_sysinfo_getsrpcdomain 9
|
||||
#define TARGET_NR_sysinfo_setsrpcdomain 265
|
||||
#define TARGET_NR_sysinfo_sysname 1
|
||||
#define TARGET_NR_sysinfo_release 3
|
||||
#define TARGET_NR_sysinfo_version 4
|
||||
#define TARGET_NR_sysinfo_machine 5
|
||||
#define TARGET_NR_sysinfo_cpuarch 6
|
||||
#define TARGET_NR_sysinfo_hwserial 7
|
||||
#define TARGET_NR_sysinfo_hwproducer 8
|
||||
#define TARGET_NR_sysinfo_processors 109
|
||||
|
||||
|
||||
/* utssyssgi(obuf, ibuf, cmd) */
|
||||
#define TARGET_NR_utssys_uname (0)
|
|
@ -0,0 +1,36 @@
|
|||
/*
|
||||
* MIPS specific CPU ABI and functions for linux-user
|
||||
*
|
||||
* Copyright (c) 2004-2005 Jocelyn Mayer
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef IRIX_TARGET_CPU_H
|
||||
#define IRIX_TARGET_CPU_H
|
||||
|
||||
static inline void cpu_clone_regs(CPUMIPSState *env, target_ulong newsp)
|
||||
{
|
||||
if (newsp) {
|
||||
env->active_tc.gpr[29] = newsp;
|
||||
}
|
||||
env->active_tc.gpr[7] = 0;
|
||||
env->active_tc.gpr[2] = 0;
|
||||
}
|
||||
|
||||
static inline void cpu_set_tls(CPUMIPSState *env, target_ulong newtls)
|
||||
{
|
||||
env->active_tc.CP0_UserLocal = newtls;
|
||||
}
|
||||
|
||||
#endif
|
|
@ -0,0 +1,20 @@
|
|||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation, or (at your option) any
|
||||
* later version. See the COPYING file in the top-level directory.
|
||||
*/
|
||||
|
||||
#ifndef MIPS_TARGET_ELF_H
|
||||
#define MIPS_TARGET_ELF_H
|
||||
static inline const char *cpu_get_model(uint32_t eflags)
|
||||
{
|
||||
/* O32 is MIPS I and MIPS II ISA, N32/N64 is MIPS III and MIPS IV ISA */
|
||||
if ((eflags & EF_MIPS_ARCH) == EF_MIPS_ARCH_1 ||
|
||||
(eflags & EF_MIPS_ARCH) == EF_MIPS_ARCH_2) {
|
||||
return "24Kf"; // MIPS32
|
||||
// return "R4000";
|
||||
}
|
||||
return "5Kf"; // MIPS64
|
||||
}
|
||||
#endif
|
|
@ -0,0 +1,66 @@
|
|||
#ifndef IRIX_TARGET_SIGNAL_H
|
||||
#define IRIX_TARGET_SIGNAL_H
|
||||
|
||||
#include "cpu.h"
|
||||
|
||||
/* this struct defines a stack used during syscall handling */
|
||||
|
||||
typedef struct target_sigaltstack {
|
||||
#ifdef TARGET_ABI32
|
||||
abi_uint ss_sp;
|
||||
#else
|
||||
abi_ulong ss_sp;
|
||||
#endif
|
||||
uint32_t ss_size;
|
||||
abi_int ss_flags;
|
||||
} target_stack_t;
|
||||
|
||||
|
||||
/*
|
||||
* sigaltstack controls
|
||||
*/
|
||||
#define TARGET_SS_ONSTACK 1
|
||||
#define TARGET_SS_DISABLE 2
|
||||
|
||||
#define TARGET_MINSIGSTKSZ 2048
|
||||
#define TARGET_SIGSTKSZ 8192
|
||||
|
||||
static inline target_ulong get_sp_from_cpustate(CPUMIPSState *state)
|
||||
{
|
||||
return state->active_tc.gpr[29];
|
||||
}
|
||||
|
||||
struct target_mcontext32 {
|
||||
uint32_t gregs[36];
|
||||
double fregs[16];
|
||||
uint32_t fpcsr;
|
||||
};
|
||||
|
||||
struct target_mcontext64 {
|
||||
uint64_t gregs[37];
|
||||
double fregs[32];
|
||||
uint32_t fpcsr;
|
||||
};
|
||||
|
||||
struct target_mcontext {
|
||||
union {
|
||||
struct target_mcontext32 _32;
|
||||
struct target_mcontext64 _64;
|
||||
} mc;
|
||||
};
|
||||
|
||||
struct target_ucontext {
|
||||
abi_ulong tuc_flags;
|
||||
#ifdef TARGET_ABI32
|
||||
abi_uint tuc_link;
|
||||
#else
|
||||
abi_ulong tuc_link;
|
||||
#endif
|
||||
target_sigset_t tuc_sigmask;
|
||||
struct target_sigaltstack tuc_stack;
|
||||
struct target_mcontext tuc_mcontext;
|
||||
};
|
||||
|
||||
int save_context(CPUMIPSState *regs, struct target_mcontext *sc, int setret);
|
||||
int restore_context(CPUMIPSState *regs, struct target_mcontext *sc);
|
||||
#endif /* TARGET_SIGNAL_H */
|
|
@ -0,0 +1,55 @@
|
|||
/*
|
||||
* MIPS specific structures for linux-user
|
||||
*
|
||||
* Copyright (c) 2013 Fabrice Bellard
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef IRIX_TARGET_STRUCTS_H
|
||||
#define IRIX_TARGET_STRUCTS_H
|
||||
|
||||
struct target_ipc_perm {
|
||||
abi_uint uid; /* Owner's user ID. */
|
||||
abi_uint gid; /* Owner's group ID. */
|
||||
abi_uint cuid; /* Creator's user ID. */
|
||||
abi_uint cgid; /* Creator's group ID. */
|
||||
abi_uint mode; /* Read/write permission. */
|
||||
abi_ulong __seq; /* Sequence number. */
|
||||
abi_int __key; /* Key. */
|
||||
abi_ulong __pad1[4];
|
||||
};
|
||||
|
||||
struct target_shmid_ds {
|
||||
struct target_ipc_perm shm_perm; /* operation permission struct */
|
||||
#ifdef TARGET_ABI32
|
||||
abi_int shm_segsz; /* size of segment in bytes */
|
||||
abi_ulong shm_amp;
|
||||
short shm_lkcnt;
|
||||
short __pad0;
|
||||
#else
|
||||
abi_int shm_osegsz;
|
||||
abi_long shm_segsz; /* size of segment in bytes */
|
||||
abi_int __pad0;
|
||||
#endif
|
||||
abi_int shm_lpid; /* pid of last shmop */
|
||||
abi_int shm_cpid; /* pid of creator */
|
||||
abi_ulong shm_nattch; /* number of current attaches */
|
||||
abi_ulong shm_cnattch; /* number of current attaches */
|
||||
abi_ulong shm_atime; /* time of last shmat() */
|
||||
abi_ulong shm_dtime; /* time of last shmdt() */
|
||||
abi_ulong shm_ctime; /* time of last change by shmctl() */
|
||||
abi_ulong __pad1[4];
|
||||
};
|
||||
|
||||
#endif
|
|
@ -0,0 +1,30 @@
|
|||
#ifndef IRIX_TARGET_SYSCALL_H
|
||||
#define IRIX_TARGET_SYSCALL_H
|
||||
|
||||
/* this struct defines the way the registers are stored on the
|
||||
stack during a system call. */
|
||||
|
||||
struct target_pt_regs {
|
||||
/* Saved main processor registers. */
|
||||
target_ulong regs[32];
|
||||
|
||||
/* Saved special registers. */
|
||||
target_ulong cp0_status;
|
||||
target_ulong lo;
|
||||
target_ulong hi;
|
||||
target_ulong cp0_badvaddr;
|
||||
target_ulong cp0_cause;
|
||||
target_ulong cp0_epc;
|
||||
};
|
||||
|
||||
#define UNAME_MACHINE "irix"
|
||||
#define UNAME_MINIMUM_RELEASE "2.6.32"
|
||||
|
||||
#define TARGET_FORCE_SHMLBA
|
||||
|
||||
static inline abi_ulong target_shmlba(CPUMIPSState *env)
|
||||
{
|
||||
return 0x40000;
|
||||
}
|
||||
|
||||
#endif
|
|
@ -0,0 +1,260 @@
|
|||
/* from asm/termbits.h */
|
||||
|
||||
#define TARGET_NCCS 23
|
||||
|
||||
struct target_termios {
|
||||
unsigned int c_iflag; /* input mode flags */
|
||||
unsigned int c_oflag; /* output mode flags */
|
||||
unsigned int c_cflag; /* control mode flags */
|
||||
unsigned int c_lflag; /* local mode flags */
|
||||
#ifdef IRIX_NEW_TERMIO
|
||||
unsigned int c_ospeed;
|
||||
unsigned int c_ispeed;
|
||||
#endif
|
||||
unsigned char c_cc[TARGET_NCCS]; /* control characters */
|
||||
};
|
||||
|
||||
/* c_iflag bits */
|
||||
#define TARGET_IGNBRK 0000001
|
||||
#define TARGET_BRKINT 0000002
|
||||
#define TARGET_IGNPAR 0000004
|
||||
#define TARGET_PARMRK 0000010
|
||||
#define TARGET_INPCK 0000020
|
||||
#define TARGET_ISTRIP 0000040
|
||||
#define TARGET_INLCR 0000100
|
||||
#define TARGET_IGNCR 0000200
|
||||
#define TARGET_ICRNL 0000400
|
||||
#define TARGET_IUCLC 0001000
|
||||
#define TARGET_IXON 0002000
|
||||
#define TARGET_IXANY 0004000
|
||||
#define TARGET_IXOFF 0010000
|
||||
#define TARGET_IMAXBEL 0020000
|
||||
#define TARGET_IUTF8 0040000
|
||||
|
||||
/* c_oflag bits */
|
||||
#define TARGET_OPOST 0000001
|
||||
#define TARGET_OLCUC 0000002
|
||||
#define TARGET_ONLCR 0000004
|
||||
#define TARGET_OCRNL 0000010
|
||||
#define TARGET_ONOCR 0000020
|
||||
#define TARGET_ONLRET 0000040
|
||||
#define TARGET_OFILL 0000100
|
||||
#define TARGET_OFDEL 0000200
|
||||
#define TARGET_NLDLY 0000400
|
||||
#define TARGET_NL0 0000000
|
||||
#define TARGET_NL1 0000400
|
||||
#define TARGET_CRDLY 0003000
|
||||
#define TARGET_CR0 0000000
|
||||
#define TARGET_CR1 0001000
|
||||
#define TARGET_CR2 0002000
|
||||
#define TARGET_CR3 0003000
|
||||
#define TARGET_TABDLY 0014000
|
||||
#define TARGET_TAB0 0000000
|
||||
#define TARGET_TAB1 0004000
|
||||
#define TARGET_TAB2 0010000
|
||||
#define TARGET_TAB3 0014000
|
||||
#define TARGET_XTABS 0014000
|
||||
#define TARGET_BSDLY 0020000
|
||||
#define TARGET_BS0 0000000
|
||||
#define TARGET_BS1 0020000
|
||||
#define TARGET_VTDLY 0040000
|
||||
#define TARGET_VT0 0000000
|
||||
#define TARGET_VT1 0040000
|
||||
#define TARGET_FFDLY 0100000
|
||||
#define TARGET_FF0 0000000
|
||||
#define TARGET_FF1 0100000
|
||||
|
||||
/* c_cflag bit meaning */
|
||||
#define TARGET_CBAUD 0010017
|
||||
#define TARGET_B0 0000000 /* hang up */
|
||||
#define TARGET_B50 0000001
|
||||
#define TARGET_B75 0000002
|
||||
#define TARGET_B110 0000003
|
||||
#define TARGET_B134 0000004
|
||||
#define TARGET_B150 0000005
|
||||
#define TARGET_B200 0000006
|
||||
#define TARGET_B300 0000007
|
||||
#define TARGET_B600 0000010
|
||||
#define TARGET_B1200 0000011
|
||||
#define TARGET_B1800 0000012
|
||||
#define TARGET_B2400 0000013
|
||||
#define TARGET_B4800 0000014
|
||||
#define TARGET_B9600 0000015
|
||||
#define TARGET_B19200 0000016
|
||||
#define TARGET_B38400 0000017
|
||||
#define TARGET_EXTA B19200
|
||||
#define TARGET_EXTB B38400
|
||||
#define TARGET_CSIZE 0000060
|
||||
#define TARGET_CS5 0000000
|
||||
#define TARGET_CS6 0000020
|
||||
#define TARGET_CS7 0000040
|
||||
#define TARGET_CS8 0000060
|
||||
#define TARGET_CSTOPB 0000100
|
||||
#define TARGET_CREAD 0000200
|
||||
#define TARGET_PARENB 0000400
|
||||
#define TARGET_PARODD 0001000
|
||||
#define TARGET_HUPCL 0002000
|
||||
#define TARGET_CLOCAL 0004000
|
||||
#define TARGET_CBAUDEX 0010000
|
||||
#define TARGET_BOTHER 0010000
|
||||
#define TARGET_B57600 0010001
|
||||
#define TARGET_B115200 0010002
|
||||
#define TARGET_B230400 0010003
|
||||
#define TARGET_B460800 0010004
|
||||
#define TARGET_B500000 0010005
|
||||
#define TARGET_B576000 0010006
|
||||
#define TARGET_B921600 0010007
|
||||
#define TARGET_B1000000 0010010
|
||||
#define TARGET_B1152000 0010011
|
||||
#define TARGET_B1500000 0010012
|
||||
#define TARGET_B2000000 0010013
|
||||
#define TARGET_B2500000 0010014
|
||||
#define TARGET_B3000000 0010015
|
||||
#define TARGET_B3500000 0010016
|
||||
#define TARGET_B4000000 0010017
|
||||
#define TARGET_CIBAUD 002003600000 /* input baud rate (not used) */
|
||||
#define TARGET_CMSPAR 010000000000 /* mark or space (stick) parity */
|
||||
#define TARGET_CRTSCTS 020000000000 /* flow control */
|
||||
|
||||
/* c_lflag bits */
|
||||
#define TARGET_ISIG 0000001
|
||||
#define TARGET_ICANON 0000002
|
||||
#define TARGET_XCASE 0000004
|
||||
#define TARGET_ECHO 0000010
|
||||
#define TARGET_ECHOE 0000020
|
||||
#define TARGET_ECHOK 0000040
|
||||
#define TARGET_ECHONL 0000100
|
||||
#define TARGET_NOFLSH 0000200
|
||||
#define TARGET_IEXTEN 0000400
|
||||
#define TARGET_ECHOCTL 0001000
|
||||
#define TARGET_ECHOPRT 0002000
|
||||
#define TARGET_ECHOKE 0004000
|
||||
#define TARGET_FLUSHO 0010000
|
||||
#define TARGET_PENDIN 0040000
|
||||
#define TARGET_TOSTOP 0100000
|
||||
#define TARGET_ITOSTOP TARGET_TOSTOP
|
||||
|
||||
/* c_cc character offsets */
|
||||
#define TARGET_VINTR 0
|
||||
#define TARGET_VQUIT 1
|
||||
#define TARGET_VERASE 2
|
||||
#define TARGET_VKILL 3
|
||||
#define TARGET_VMIN 4
|
||||
#define TARGET_VTIME 5
|
||||
#define TARGET_VEOL2 6
|
||||
#define TARGET_VSWTC 7
|
||||
#define TARGET_VSTART 8
|
||||
#define TARGET_VSTOP 9
|
||||
#define TARGET_VSUSP 10
|
||||
/* VDSUSP not supported */
|
||||
#define TARGET_VREPRINT 12
|
||||
#define TARGET_VDISCARD 13
|
||||
#define TARGET_VWERASE 14
|
||||
#define TARGET_VLNEXT 15
|
||||
#define TARGET_VEOF 16
|
||||
#define TARGET_VEOL 17
|
||||
|
||||
/* ioctls */
|
||||
|
||||
#ifdef IRIX_NEW_TERMIO
|
||||
#define TARGET_TCGETA 0x54c9
|
||||
#define TARGET_TCSETA 0x54ca
|
||||
#define TARGET_TCSETAW 0x54cb
|
||||
#define TARGET_TCSETAF 0x54cc
|
||||
#else
|
||||
#define TARGET_TCGETA 0x5401
|
||||
#define TARGET_TCSETA 0x5402
|
||||
#define TARGET_TCSETAW 0x5403
|
||||
#define TARGET_TCSETAF 0x5404
|
||||
#endif
|
||||
|
||||
#define TARGET_TCSBRK 0x5405
|
||||
#define TARGET_TCXONC 0x5406
|
||||
#define TARGET_TCFLSH 0x5407
|
||||
|
||||
#define TARGET_TCGETS 0x540d
|
||||
#define TARGET_TCSETS 0x540e
|
||||
#define TARGET_TCSETSW 0x540f
|
||||
#define TARGET_TCSETSF 0x5410
|
||||
|
||||
#define TARGET_TCNGETS 0x54d5
|
||||
#define TARGET_TCNSETS 0x54d6
|
||||
#define TARGET_TCNSETSW 0x54d7
|
||||
#define TARGET_TCNSETSF 0x54d8
|
||||
|
||||
#define TARGET_TIOCEXCL 0x740d /* set exclusive use of tty */
|
||||
#define TARGET_TIOCNXCL 0x740e /* reset exclusive use of tty */
|
||||
#define TARGET_TIOCOUTQ 0x7472 /* output queue size */
|
||||
#define TARGET_TIOCSTI 0x5472 /* simulate terminal input */
|
||||
#define TARGET_TIOCMGET 0x741d /* get all modem bits */
|
||||
#define TARGET_TIOCMBIS 0x741b /* bis modem bits */
|
||||
#define TARGET_TIOCMBIC 0x741c /* bic modem bits */
|
||||
#define TARGET_TIOCMSET 0x741a /* set all modem bits */
|
||||
#define TARGET_TIOCPKT 0x5470 /* pty: set/clear packet mode */
|
||||
#define TARGET_TIOCPKT_DATA 0x00 /* data packet */
|
||||
#define TARGET_TIOCPKT_FLUSHREAD 0x01 /* flush packet */
|
||||
#define TARGET_TIOCPKT_FLUSHWRITE 0x02 /* flush packet */
|
||||
#define TARGET_TIOCPKT_STOP 0x04 /* stop output */
|
||||
#define TARGET_TIOCPKT_START 0x08 /* start output */
|
||||
#define TARGET_TIOCPKT_NOSTOP 0x10 /* no more ^S, ^Q */
|
||||
#define TARGET_TIOCPKT_DOSTOP 0x20 /* now do ^S ^Q */
|
||||
/* #define TIOCPKT_IOCTL 0x40 state change of pty driver */
|
||||
#define TARGET_TIOCSWINSZ TARGET_IOW('t', 103, struct winsize) /* set window size */
|
||||
#define TARGET_TIOCGWINSZ TARGET_IOR('t', 104, struct winsize) /* get window size */
|
||||
#define TARGET_TIOCNOTTY 0x5471 /* void tty association */
|
||||
#define TARGET_TIOCSETD 0x7401
|
||||
#define TARGET_TIOCGETD 0x7400
|
||||
|
||||
#define TARGET_FIOCLEX 0x6601
|
||||
#define TARGET_FIONCLEX 0x6602
|
||||
#define TARGET_FIOASYNC 0x667d
|
||||
#define TARGET_FIONBIO 0x667e
|
||||
#define TARGET_FIOQSIZE 0x667f
|
||||
|
||||
#define TARGET_TIOCGLTC 0x7474 /* get special local chars */
|
||||
#define TARGET_TIOCSLTC 0x7475 /* set special local chars */
|
||||
#define TARGET_TIOCSPGRP TARGET_IOW('t', 118, int) /* set pgrp of tty */
|
||||
#define TARGET_TIOCGPGRP TARGET_IOR('t', 119, int) /* get pgrp of tty */
|
||||
#define TARGET_TIOCCONS TARGET_IOW('t', 120, int) /* become virtual console */
|
||||
|
||||
#define TARGET_FIONREAD 0x467f
|
||||
#define TARGET_TIOCINQ TARGET_FIONREAD
|
||||
|
||||
#define TARGET_TIOCGETP 0x7408
|
||||
#define TARGET_TIOCSETP 0x7409
|
||||
#define TARGET_TIOCSETN 0x740a /* TIOCSETP wo flush */
|
||||
|
||||
/* #define TARGET_TIOCSETA TARGET_IOW('t', 20, struct termios) set termios struct */
|
||||
/* #define TARGET_TIOCSETAW TARGET_IOW('t', 21, struct termios) drain output, set */
|
||||
/* #define TARGET_TIOCSETAF TARGET_IOW('t', 22, struct termios) drn out, fls in, set */
|
||||
/* #define TARGET_TIOCGETD TARGET_IOR('t', 26, int) get line discipline */
|
||||
/* #define TARGET_TIOCSETD TARGET_IOW('t', 27, int) set line discipline */
|
||||
/* 127-124 compat */
|
||||
|
||||
#define TARGET_TIOCSBRK 0x5427 /* BSD compatibility */
|
||||
#define TARGET_TIOCCBRK 0x5428 /* BSD compatibility */
|
||||
#define TARGET_TIOCGSID 0x7416 /* Return the session ID of FD */
|
||||
#define TARGET_TIOCGPTN TARGET_IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
|
||||
#define TARGET_TIOCSPTLCK TARGET_IOW('T',0x31, int) /* Lock/unlock Pty */
|
||||
|
||||
/* I hope the range from 0x5480 on is free ... */
|
||||
#define TARGET_TIOCSCTTY 0x5480 /* become controlling tty */
|
||||
#define TARGET_TIOCGSOFTCAR 0x5481
|
||||
#define TARGET_TIOCSSOFTCAR 0x5482
|
||||
#define TARGET_TIOCLINUX 0x5483
|
||||
#define TARGET_TIOCGSERIAL 0x5484
|
||||
#define TARGET_TIOCSSERIAL 0x5485
|
||||
#define TARGET_TCSBRKP 0x5486 /* Needed for POSIX tcsendbreak() */
|
||||
#define TARGET_TIOCSERCONFIG 0x5488
|
||||
#define TARGET_TIOCSERGWILD 0x5489
|
||||
#define TARGET_TIOCSERSWILD 0x548a
|
||||
#define TARGET_TIOCGLCKTRMIOS 0x548b
|
||||
#define TARGET_TIOCSLCKTRMIOS 0x548c
|
||||
#define TARGET_TIOCSERGSTRUCT 0x548d /* For debugging only */
|
||||
#define TARGET_TIOCSERGETLSR 0x548e /* Get line status register */
|
||||
#define TARGET_TIOCSERGETMULTI 0x548f /* Get multiport config */
|
||||
#define TARGET_TIOCSERSETMULTI 0x5490 /* Set multiport config */
|
||||
#define TARGET_TIOCMIWAIT 0x5491 /* wait for a change on serial input line(s) */
|
||||
#define TARGET_TIOCGICOUNT 0x5492 /* read serial port inline interrupt counts */
|
||||
#define TARGET_TIOCGHAYESESP 0x5493 /* Get Hayes ESP configuration */
|
||||
#define TARGET_TIOCSHAYESESP 0x5494 /* Set Hayes ESP configuration */
|
|
@ -126,7 +126,7 @@ int cpu_get_pic_interrupt(CPUX86State *env)
|
|||
/* Helper routines for implementing atomic operations. */
|
||||
|
||||
/* Make sure everything is in a consistent state for calling fork(). */
|
||||
void fork_start(void)
|
||||
void fork_start(CPUArchState *env)
|
||||
{
|
||||
start_exclusive();
|
||||
mmap_fork_start();
|
||||
|
@ -134,21 +134,21 @@ void fork_start(void)
|
|||
cpu_list_lock();
|
||||
}
|
||||
|
||||
void fork_end(int child)
|
||||
void fork_end(CPUArchState *env, int child)
|
||||
{
|
||||
mmap_fork_end(child);
|
||||
if (child) {
|
||||
CPUState *cpu, *next_cpu;
|
||||
CPUState *cpu, *next_cpu, *cur_cpu = ENV_GET_CPU(env);
|
||||
/* Child processes created by fork() only have a single thread.
|
||||
Discard information about the parent threads. */
|
||||
CPU_FOREACH_SAFE(cpu, next_cpu) {
|
||||
if (cpu != thread_cpu) {
|
||||
if (cpu != cur_cpu) {
|
||||
QTAILQ_REMOVE(&cpus, cpu, node);
|
||||
}
|
||||
}
|
||||
qemu_mutex_init(&tb_ctx.tb_lock);
|
||||
qemu_init_cpu_list();
|
||||
gdbserver_fork(thread_cpu);
|
||||
gdbserver_fork(cur_cpu);
|
||||
/* qemu_init_cpu_list() takes care of reinitializing the
|
||||
* exclusive state, so we don't need to end_exclusive() here.
|
||||
*/
|
||||
|
@ -1066,7 +1066,7 @@ static void restore_window(CPUSPARCState *env)
|
|||
#endif
|
||||
}
|
||||
|
||||
static void flush_windows(CPUSPARCState *env)
|
||||
void flush_windows(CPUSPARCState *env)
|
||||
{
|
||||
int offset, cwp1;
|
||||
|
||||
|
@ -1158,6 +1158,38 @@ void cpu_loop (CPUSPARCState *env)
|
|||
env->pc = env->npc;
|
||||
env->npc = env->npc + 4;
|
||||
break;
|
||||
#ifdef TARGET_ABI_SOLARIS
|
||||
case 0xa4: /* gethrtime() */
|
||||
{
|
||||
struct timespec ts;
|
||||
unsigned long long tm;
|
||||
clock_gettime(CLOCK_MONOTONIC_RAW, &ts);
|
||||
|
||||
tm = ts.tv_sec * 1000000000LL + ts.tv_nsec;
|
||||
env->regwptr[0] = (uint32_t)(tm >> 32);
|
||||
env->regwptr[1] = (uint32_t)(tm);
|
||||
if (do_strace)
|
||||
gemu_log("%d gethrtime() = %llu\n", getpid(), tm);
|
||||
}
|
||||
/* next instruction */
|
||||
env->pc = env->npc;
|
||||
env->npc = env->npc + 4;
|
||||
break;
|
||||
case 0xa7: /* gethrestime() */
|
||||
{
|
||||
struct timespec ts;
|
||||
clock_gettime(CLOCK_REALTIME, &ts);
|
||||
|
||||
env->regwptr[0] = ts.tv_sec;
|
||||
env->regwptr[1] = ts.tv_nsec;
|
||||
if (do_strace)
|
||||
gemu_log("%d gethrestime() = %lu\n", getpid(), ts.tv_sec);
|
||||
}
|
||||
/* next instruction */
|
||||
env->pc = env->npc;
|
||||
env->npc = env->npc + 4;
|
||||
break;
|
||||
#endif
|
||||
#ifndef TARGET_SPARC64
|
||||
case TT_WIN_OVF: /* window overflow */
|
||||
save_window(env);
|
||||
|
@ -1791,8 +1823,273 @@ void cpu_loop(CPUPPCState *env)
|
|||
|
||||
#ifdef TARGET_MIPS
|
||||
|
||||
# ifdef TARGET_ABI_MIPSO32
|
||||
# define MIPS_SYS(name, args) args,
|
||||
# if defined(TARGET_ABI_IRIX)
|
||||
/* emulating the PRDA is expensive, since for every memory access the address
|
||||
* has to be examined. Do this only if the user requires it.
|
||||
*/
|
||||
int irix_emulate_prda;
|
||||
|
||||
/*
|
||||
* The N32 ABI takes 64 bit args and return values in a 64 bit register, while
|
||||
* the O32 ABI splits these in two 32 bit registers.
|
||||
* Map 64 bit args to 32 bits here to avoid dealing with it in the syscall code.
|
||||
* Also, a 64 bit return code in 2 32 bit registers must be recombined for N32.
|
||||
*
|
||||
* N32 uses the 64 bit syscall version if one is available (e.g. getdents64)
|
||||
* Map 32 bit system calls to the 64 bit version here as well.
|
||||
*
|
||||
* Structure/union argument passing is left aligned. In N32, an object of 32 bit
|
||||
* is in that case shifted to the upper half of the 64 bit register.
|
||||
* Thus, in the special case of semsys(SEMCTL...), the 5th argument must be
|
||||
* dealt with like a 64 bit argument in N32 for the correct value to be passed.
|
||||
*/
|
||||
# define SYSCALL_ARGS(n,a64,r64,s) ((n)|(a64)<<4|((r64)<<8)|((s)<<16))
|
||||
# define SYSCALL_NARGS(v) ((v)&0xf) /* #registers, incl. padding */
|
||||
# define SYSCALL_ARG64(v) (((v)>>4)&0xf) /* position of 64bit arg */
|
||||
# define SYSCALL_RET64(v) (((v)>>8)&0x1) /* returns a 64bit value */
|
||||
# define SYSCALL_MAP(v) ((v)>>16) /* N32 32bit syscall to 64bit */
|
||||
# define _ 0 /* for a better overview */
|
||||
# define X 8 /* place holder for "don't know" for proprietary syscalls */
|
||||
static const uint32_t mips_syscall_args[] = { /* see IRIX:/usr/include/sys.s */
|
||||
SYSCALL_ARGS(8, _, _, _), /* 0: syscall */
|
||||
SYSCALL_ARGS(1, _, _, _), /* 1: exit */
|
||||
SYSCALL_ARGS(0, _, _, _), /* 2: fork */
|
||||
SYSCALL_ARGS(3, _, _, _), /* 3: read */
|
||||
SYSCALL_ARGS(3, _, _, _), /* 4: write */
|
||||
SYSCALL_ARGS(3, _, _, _), /* 5: open */
|
||||
SYSCALL_ARGS(1, _, _, _), /* 6: close */
|
||||
SYSCALL_ARGS(_, _, _, _),
|
||||
SYSCALL_ARGS(2, _, _, _), /* 8: creat */
|
||||
SYSCALL_ARGS(2, _, _, _), /* 9: link */
|
||||
SYSCALL_ARGS(1, _, _, _), /* 10: unlink */
|
||||
SYSCALL_ARGS(2, _, _, _), /* 11: execv */
|
||||
SYSCALL_ARGS(1, _, _, _), /* 12: chdir */
|
||||
SYSCALL_ARGS(0, _, _, _), /* 13: time */
|
||||
SYSCALL_ARGS(_, _, _, _),
|
||||
SYSCALL_ARGS(2, _, _, _), /* 15: chmod */
|
||||
SYSCALL_ARGS(3, _, _, _), /* 16: chown */
|
||||
SYSCALL_ARGS(1, _, _, _), /* 17: brk */
|
||||
SYSCALL_ARGS(2, _, _, _), /* 18: stat */
|
||||
SYSCALL_ARGS(3, _, _, TARGET_NR_lseek64), /* 19: lseek */
|
||||
SYSCALL_ARGS(0, _, _, _), /* 20: getpid */
|
||||
SYSCALL_ARGS(6, _, _, _), /* 21: mount */
|
||||
SYSCALL_ARGS(1, _, _, _), /* 22: umount */
|
||||
SYSCALL_ARGS(1, _, _, _), /* 23: setuid */
|
||||
SYSCALL_ARGS(0, _, _, _), /* 24: getuid */
|
||||
SYSCALL_ARGS(1, _, _, _), /* 25: stime */
|
||||
SYSCALL_ARGS(4, _, _, _), /* 26: ptrace */
|
||||
SYSCALL_ARGS(1, _, _, _), /* 27: alarm */
|
||||
SYSCALL_ARGS(_, _, _, _),
|
||||
SYSCALL_ARGS(0, _, _, _), /* 29: pause */
|
||||
SYSCALL_ARGS(2, _, _, _), /* 30: utime */
|
||||
SYSCALL_ARGS(_, _, _, _),
|
||||
SYSCALL_ARGS(_, _, _, _),
|
||||
SYSCALL_ARGS(2, _, _, _), /* 33: access */
|
||||
SYSCALL_ARGS(1, _, _, _), /* 34: nice */
|
||||
SYSCALL_ARGS(4, _, _, _), /* 35: statfs */
|
||||
SYSCALL_ARGS(0, _, _, _), /* 36: sync */
|
||||
SYSCALL_ARGS(2, _, _, _), /* 37: kill */
|
||||
SYSCALL_ARGS(4, _, _, _), /* 38: fstatfs */
|
||||
SYSCALL_ARGS(1, _, _, _), /* 39: pgrpsys */
|
||||
SYSCALL_ARGS(X, _, _, _), /* 40: syssgi */
|
||||
SYSCALL_ARGS(1, _, _, _), /* 41: dup */
|
||||
SYSCALL_ARGS(0, _, _, _), /* 42: pipe */
|
||||
SYSCALL_ARGS(1, _, _, _), /* 43: times */
|
||||
SYSCALL_ARGS(4, _, _, _), /* 44: profil */
|
||||
SYSCALL_ARGS(1, _, _, _), /* 45: plock */
|
||||
SYSCALL_ARGS(1, _, _, _), /* 46: setgid */
|
||||
SYSCALL_ARGS(0, _, _, _), /* 47: getgid */
|
||||
SYSCALL_ARGS(_, _, _, _),
|
||||
SYSCALL_ARGS(6, _, _, _), /* 49: msgsys */
|
||||
SYSCALL_ARGS(4, _, _, _), /* 50: sysmips */
|
||||
SYSCALL_ARGS(1, _, _, _), /* 51: acct */
|
||||
SYSCALL_ARGS(5, _, _, _), /* 52: shmsys */
|
||||
SYSCALL_ARGS(5, 5, _, _), /* 53: semsys */
|
||||
SYSCALL_ARGS(3, _, _, _), /* 54: ioctl */
|
||||
SYSCALL_ARGS(3, _, _, _), /* 55: uadmin */
|
||||
SYSCALL_ARGS(X, _, _, _), /* 56: sysmp */
|
||||
SYSCALL_ARGS(3, _, _, _), /* 57: utssys */
|
||||
SYSCALL_ARGS(_, _, _, _),
|
||||
SYSCALL_ARGS(3, _, _, _), /* 59: execve */
|
||||
SYSCALL_ARGS(1, _, _, _), /* 60: umask */
|
||||
SYSCALL_ARGS(1, _, _, _), /* 61: chroot */
|
||||
SYSCALL_ARGS(3, _, _, _), /* 62: fcntl */
|
||||
SYSCALL_ARGS(2, _, _, _), /* 63: ulimit */
|
||||
SYSCALL_ARGS(_, _, _, _),
|
||||
SYSCALL_ARGS(_, _, _, _),
|
||||
SYSCALL_ARGS(_, _, _, _),
|
||||
SYSCALL_ARGS(_, _, _, _),
|
||||
SYSCALL_ARGS(_, _, _, _),
|
||||
SYSCALL_ARGS(_, _, _, _),
|
||||
SYSCALL_ARGS(_, _, _, _),
|
||||
SYSCALL_ARGS(_, _, _, _),
|
||||
SYSCALL_ARGS(_, _, _, _),
|
||||
SYSCALL_ARGS(_, _, _, _),
|
||||
SYSCALL_ARGS(_, _, _, _),
|
||||
SYSCALL_ARGS(2, _, _, _), /* 75: getrlimit64 */
|
||||
SYSCALL_ARGS(2, _, _, _), /* 76: setrlimit64 */
|
||||
SYSCALL_ARGS(2, _, _, _), /* 77: nanosleep */
|
||||
SYSCALL_ARGS(5, 2, 1, _), /* 78: lseek64 */
|
||||
SYSCALL_ARGS(1, _, _, _), /* 79: rmdir */
|
||||
SYSCALL_ARGS(2, _, _, _), /* 80: mkdir */
|
||||
SYSCALL_ARGS(3, _, _, TARGET_NR_getdents64),/* 81: getdents */
|
||||
SYSCALL_ARGS(1, _, _, _), /* 82: sginap */
|
||||
SYSCALL_ARGS(3, _, _, _), /* 83: sgikopt */
|
||||
SYSCALL_ARGS(3, _, _, _), /* 84: sysfs */
|
||||
SYSCALL_ARGS(4, _, _, _), /* 85: getmsg */
|
||||
SYSCALL_ARGS(4, _, _, _), /* 86: putmsg */
|
||||
SYSCALL_ARGS(3, _, _, _), /* 87: poll */
|
||||
SYSCALL_ARGS(3, _, _, _), /* 88: sigreturn */
|
||||
SYSCALL_ARGS(3, _, _, _), /* 89: accept */
|
||||
SYSCALL_ARGS(3, _, _, _), /* 90: bind */
|
||||
SYSCALL_ARGS(3, _, _, _), /* 91: connect */
|
||||
SYSCALL_ARGS(0, _, _, _), /* 92: gethostid */
|
||||
SYSCALL_ARGS(3, _, _, _), /* 93: getpeername */
|
||||
SYSCALL_ARGS(3, _, _, _), /* 94: getsockname */
|
||||
SYSCALL_ARGS(5, _, _, _), /* 95: getsockopt */
|
||||
SYSCALL_ARGS(2, _, _, _), /* 96: listen */
|
||||
SYSCALL_ARGS(4, _, _, _), /* 97: recv */
|
||||
SYSCALL_ARGS(6, _, _, _), /* 98: recvfrom */
|
||||
SYSCALL_ARGS(3, _, _, _), /* 99: recvmsg */
|
||||
SYSCALL_ARGS(5, _, _, _), /* 100: select */
|
||||
SYSCALL_ARGS(4, _, _, _), /* 101: send */
|
||||
SYSCALL_ARGS(3, _, _, _), /* 102: sendmsg */
|
||||
SYSCALL_ARGS(6, _, _, _), /* 103: sendto */
|
||||
SYSCALL_ARGS(1, _, _, _), /* 104: sethostid */
|
||||
SYSCALL_ARGS(5, _, _, _), /* 105: setsockopt */
|
||||
SYSCALL_ARGS(2, _, _, _), /* 106: shutdown */
|
||||
SYSCALL_ARGS(3, _, _, _), /* 107: socket */
|
||||
SYSCALL_ARGS(2, _, _, _), /* 108: gethostname */
|
||||
SYSCALL_ARGS(2, _, _, _), /* 109: sethostname */
|
||||
SYSCALL_ARGS(2, _, _, _), /* 110: getdomainname */
|
||||
SYSCALL_ARGS(2, _, _, _), /* 111: setdomainname */
|
||||
SYSCALL_ARGS(2, _, _, TARGET_NR_truncate64),/* 112: truncate */
|
||||
SYSCALL_ARGS(2, _, _, TARGET_NR_ftruncate64),/* 113: ftruncate */
|
||||
SYSCALL_ARGS(2, _, _, _), /* 114: rename */
|
||||
SYSCALL_ARGS(2, _, _, _), /* 115: symlink */
|
||||
SYSCALL_ARGS(3, _, _, _), /* 116: readlink */
|
||||
SYSCALL_ARGS(_, _, _, _),
|
||||
SYSCALL_ARGS(_, _, _, _),
|
||||
SYSCALL_ARGS(X, _, _, _), /* 119: nfssvc */
|
||||
SYSCALL_ARGS(X, _, _, _), /* 120: getfh */
|
||||
SYSCALL_ARGS(X, _, _, _), /* 121: async_daemon */
|
||||
SYSCALL_ARGS(X, _, _, _), /* 122: exportfs */
|
||||
SYSCALL_ARGS(2, _, _, _), /* 123: setregid */
|
||||
SYSCALL_ARGS(2, _, _, _), /* 123: setreuid */
|
||||
SYSCALL_ARGS(2, _, _, _), /* 125: getitimer */
|
||||
SYSCALL_ARGS(3, _, _, _), /* 126: setitimer */
|
||||
SYSCALL_ARGS(2, _, _, _), /* 127: adjtime */
|
||||
SYSCALL_ARGS(1, _, _, _), /* 128: gettimeofday */
|
||||
SYSCALL_ARGS(3, _, _, _), /* 129: sproc */
|
||||
SYSCALL_ARGS(3, _, _, _), /* 130: prctl */
|
||||
SYSCALL_ARGS(3, _, _, _), /* 131: procblk */
|
||||
SYSCALL_ARGS(5, _, _, _), /* 132: sprocsp */
|
||||
SYSCALL_ARGS(_, _, _, _),
|
||||
SYSCALL_ARGS(6, _, _, TARGET_NR_mmap64), /* 134: mmap */
|
||||
SYSCALL_ARGS(2, _, _, _), /* 135: munmap */
|
||||
SYSCALL_ARGS(3, _, _, _), /* 136: mprotect */
|
||||
SYSCALL_ARGS(3, _, _, _), /* 137: msync */
|
||||
SYSCALL_ARGS(3, _, _, _), /* 138: madvise */
|
||||
SYSCALL_ARGS(3, _, _, _), /* 139: pagelock */
|
||||
SYSCALL_ARGS(0, _, _, _), /* 140: getpagesize */
|
||||
SYSCALL_ARGS(4, _, _, _), /* 141: quotactl */
|
||||
SYSCALL_ARGS(_, _, _, _),
|
||||
SYSCALL_ARGS(1, _, _, _), /* 143: getpgid */
|
||||
SYSCALL_ARGS(2, _, _, _), /* 144: setpgid */
|
||||
SYSCALL_ARGS(0, _, _, _), /* 145: vhangup */
|
||||
SYSCALL_ARGS(1, _, _, _), /* 146: fsync */
|
||||
SYSCALL_ARGS(1, _, _, _), /* 147: fchdir */
|
||||
SYSCALL_ARGS(2, _, _, TARGET_NR_getrlimit64),/* 148: getrlimit */
|
||||
SYSCALL_ARGS(2, _, _, TARGET_NR_setrlimit64),/* 149: setrlimit */
|
||||
SYSCALL_ARGS(3, _, _, _), /* 150: cacheflush */
|
||||
SYSCALL_ARGS(3, _, _, _), /* 151: cachectl */
|
||||
SYSCALL_ARGS(3, _, _, _), /* 152: fchown */
|
||||
SYSCALL_ARGS(2, _, _, _), /* 153: fchmod */
|
||||
SYSCALL_ARGS(_, _, _, _),
|
||||
SYSCALL_ARGS(4, _, _, _), /* 155: socketpair */
|
||||
SYSCALL_ARGS(3, _, _, _), /* 156: sysinfo */
|
||||
SYSCALL_ARGS(1, _, _, _), /* 157: uname */
|
||||
SYSCALL_ARGS(3, _, _, _), /* 158: xstat */
|
||||
SYSCALL_ARGS(3, _, _, _), /* 159: lxstat */
|
||||
SYSCALL_ARGS(3, _, _, _), /* 160: fxstat */
|
||||
SYSCALL_ARGS(4, _, _, _), /* 161: xmknod */
|
||||
SYSCALL_ARGS(4, _, _, _), /* 162: sigaction */
|
||||
SYSCALL_ARGS(1, _, _, _), /* 163: sigpending */
|
||||
SYSCALL_ARGS(3, _, _, _), /* 164: sigprocmask */
|
||||
SYSCALL_ARGS(1, _, _, _), /* 165: sigsuspend */
|
||||
SYSCALL_ARGS(3, _, _, _), /* 166: sigpoll */
|
||||
SYSCALL_ARGS(2, _, _, _), /* 167: swapctl */
|
||||
SYSCALL_ARGS(1, _, _, _), /* 168: getcontext */
|
||||
SYSCALL_ARGS(1, _, _, _), /* 169: setcontext */
|
||||
SYSCALL_ARGS(5, _, _, _), /* 170: waitsys */
|
||||
SYSCALL_ARGS(2, _, _, _), /* 171: sigstack */
|
||||
SYSCALL_ARGS(2, _, _, _), /* 172: sigaltstack */
|
||||
SYSCALL_ARGS(2, _, _, _), /* 173: sigsendset */
|
||||
SYSCALL_ARGS(2, _, _, TARGET_NR_statvfs64), /* 174: statvfs */
|
||||
SYSCALL_ARGS(2, _, _, TARGET_NR_fstatvfs64),/* 175: fstatvfs */
|
||||
SYSCALL_ARGS(5, _, _, _), /* 176: getpmsg */
|
||||
SYSCALL_ARGS(5, _, _, _), /* 177: putpmsg */
|
||||
SYSCALL_ARGS(3, _, _, _), /* 178: lchown */
|
||||
SYSCALL_ARGS(0, _, _, _), /* 179: priocntl */
|
||||
SYSCALL_ARGS(X, _, _, _), /* 180: ksigqueue */
|
||||
SYSCALL_ARGS(3, _, _, _), /* 181: readv */
|
||||
SYSCALL_ARGS(3, _, _, _), /* 182: writev */
|
||||
SYSCALL_ARGS(4, 2, _, _), /* 183: truncate64 */
|
||||
SYSCALL_ARGS(4, 2, _, _), /* 184: ftruncate64 */
|
||||
SYSCALL_ARGS(8, 6, _, _), /* 185: mmap64 */
|
||||
SYSCALL_ARGS(X, _, _, _), /* 186: dmi */
|
||||
SYSCALL_ARGS(6, 4, _, _), /* 187: pread64 */
|
||||
SYSCALL_ARGS(6, 4, _, _), /* 188: pwrite64 */
|
||||
SYSCALL_ARGS(1, _, _, _), /* 189: fdatasync */
|
||||
SYSCALL_ARGS(X, _, _, _), /* 190: sgifastpath */
|
||||
SYSCALL_ARGS(5, _, _, _), /* 191: attr_get */
|
||||
SYSCALL_ARGS(5, _, _, _), /* 192: attr_getf */
|
||||
SYSCALL_ARGS(5, _, _, _), /* 193: attr_set */
|
||||
SYSCALL_ARGS(5, _, _, _), /* 194: attr_setf */
|
||||
SYSCALL_ARGS(3, _, _, _), /* 195: attr_remove */
|
||||
SYSCALL_ARGS(3, _, _, _), /* 196: attr_removef */
|
||||
SYSCALL_ARGS(5, _, _, _), /* 197: attr_list */
|
||||
SYSCALL_ARGS(5, _, _, _), /* 198: attr_listf */
|
||||
SYSCALL_ARGS(4, _, _, _), /* 199: attr_multi */
|
||||
SYSCALL_ARGS(4, _, _, _), /* 200: attr_multif */
|
||||
SYSCALL_ARGS(2, _, _, _), /* 201: statvfs64 */
|
||||
SYSCALL_ARGS(2, _, _, _), /* 202: fstatvfs64 */
|
||||
SYSCALL_ARGS(2, _, _, _), /* 203: getmountid */
|
||||
SYSCALL_ARGS(5, _, _, _), /* 204: nsproc */
|
||||
SYSCALL_ARGS(3, _, _, _), /* 205: getdents64 */
|
||||
SYSCALL_ARGS(X, _, _, _), /* 206: afs_syscall */
|
||||
SYSCALL_ARGS(4, _, _, TARGET_NR_ngetdents64),/* 207: ngetdents */
|
||||
SYSCALL_ARGS(4, _, _, _), /* 208: ngetdents64 */
|
||||
SYSCALL_ARGS(X, _, _, _), /* 209: sgi_sesmgr */
|
||||
SYSCALL_ARGS(X, _, _, _), /* 210: pidsprocsp */
|
||||
SYSCALL_ARGS(X, _, _, _), /* 211: rexec */
|
||||
SYSCALL_ARGS(3, _, _, _), /* 212: timer_create */
|
||||
SYSCALL_ARGS(1, _, _, _), /* 213: timer_delete */
|
||||
SYSCALL_ARGS(4, _, _, _), /* 214: timer_settime */
|
||||
SYSCALL_ARGS(2, _, _, _), /* 215: timer_gettime */
|
||||
SYSCALL_ARGS(1, _, _, _), /* 216: timer_getoverrun */
|
||||
SYSCALL_ARGS(2, _, _, _), /* 217: sched_rr_get_interval */
|
||||
SYSCALL_ARGS(0, _, _, _), /* 218: sched_yield */
|
||||
SYSCALL_ARGS(1, _, _, _), /* 219: sched_getscheduler */
|
||||
SYSCALL_ARGS(3, _, _, _), /* 220: sched_setscheduler */
|
||||
SYSCALL_ARGS(2, _, _, _), /* 221: sched_getparam */
|
||||
SYSCALL_ARGS(2, _, _, _), /* 222: sched_setparam */
|
||||
SYSCALL_ARGS(2, _, _, _), /* 223: usync_cntl */
|
||||
SYSCALL_ARGS(5, _, _, _), /* 224: psema_cntl */
|
||||
SYSCALL_ARGS(X, _, _, _), /* 225: restartreturn */
|
||||
SYSCALL_ARGS(5, _, _, _), /* 226: sysget */
|
||||
SYSCALL_ARGS(3, _, _, _), /* 227: xpg4_recvmsg */
|
||||
SYSCALL_ARGS(X, _, _, _), /* 228: umfscall */
|
||||
SYSCALL_ARGS(X, _, _, _), /* 229: nsproctid */
|
||||
SYSCALL_ARGS(X, _, _, _), /* 230: rexec_complete */
|
||||
SYSCALL_ARGS(2, _, _, _), /* 231: xpg4_sigaltstack */
|
||||
SYSCALL_ARGS(5, _, _, _), /* 232: xpg4_select */
|
||||
SYSCALL_ARGS(2, _, _, _), /* 233: xpg4_setregid */
|
||||
SYSCALL_ARGS(2, _, _, _), /* 234: linkfollow */
|
||||
};
|
||||
# else
|
||||
# define MIPS_SYS(name, args) args,
|
||||
# define SYSCALL_NARGS(v) (v)
|
||||
static const uint8_t mips_syscall_args[] = {
|
||||
MIPS_SYS(sys_syscall , 8) /* 4000 */
|
||||
MIPS_SYS(sys_exit , 1)
|
||||
|
@ -2160,6 +2457,7 @@ static const uint8_t mips_syscall_args[] = {
|
|||
};
|
||||
# undef MIPS_SYS
|
||||
# endif /* O32 */
|
||||
#define NUM_SYSCALLS (sizeof(mips_syscall_args) / sizeof(*mips_syscall_args))
|
||||
|
||||
static int do_store_exclusive(CPUMIPSState *env)
|
||||
{
|
||||
|
@ -2241,14 +2539,45 @@ static int do_break(CPUMIPSState *env, target_siginfo_t *info,
|
|||
return ret;
|
||||
}
|
||||
|
||||
#if defined(TARGET_ABI_IRIX) && defined(TARGET_ABI_MIPSN32)
|
||||
/* split the arg64'th arg, which is a 64 bit arg in a 64 bit register, into an
|
||||
* even/odd 32 bit register pair, moving the other args up as necessary. This is
|
||||
* needed because the syscall ABI for TARGET_ABI32 only knows about 32 bit args.
|
||||
*/
|
||||
static void get_args_n32(target_ulong *regs, int arg64, int num, abi_ulong args[8])
|
||||
{
|
||||
int i, j;
|
||||
|
||||
/* what a nuisance, and all this just for a few of the syscalls :-( */
|
||||
if (arg64) {
|
||||
for (i = 0; i < arg64-1; i++)
|
||||
args[i] = regs[i];
|
||||
args[i] = 0; i += (i & 1); /* align to even register */
|
||||
args[i++] = regs[arg64-1] >> 32;
|
||||
args[i++] = regs[arg64-1];
|
||||
/* at most <num> registers are needed for the expanded args */
|
||||
for (j = arg64; i < num; j++)
|
||||
args[i++] = regs[j];
|
||||
} else {
|
||||
for (i = 0; i < num; i++)
|
||||
args[i] = regs[i];
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void cpu_loop(CPUMIPSState *env)
|
||||
{
|
||||
CPUState *cs = CPU(mips_env_get_cpu(env));
|
||||
target_siginfo_t info;
|
||||
int trapnr;
|
||||
abi_long ret;
|
||||
# ifdef TARGET_ABI_MIPSO32
|
||||
unsigned int syscall_num;
|
||||
int offset = 0;
|
||||
# ifdef TARGET_ABI_IRIX
|
||||
TaskState *ts = cs->opaque;
|
||||
|
||||
__put_user(ts->ts_tid, (abi_int *)&ts->prda[0xe00]);
|
||||
__put_user(ts->ts_tid, (abi_int *)&ts->prda[0xe40]);
|
||||
# endif
|
||||
|
||||
for(;;) {
|
||||
|
@ -2260,17 +2589,23 @@ void cpu_loop(CPUMIPSState *env)
|
|||
switch(trapnr) {
|
||||
case EXCP_SYSCALL:
|
||||
env->active_tc.PC += 4;
|
||||
# ifdef TARGET_ABI_MIPSO32
|
||||
syscall_num = env->active_tc.gpr[2] - 4000;
|
||||
syscall_num = env->active_tc.gpr[2] - TARGET_NR_Linux;
|
||||
# ifdef TARGET_ABI_IRIX
|
||||
/* handle indirect syscalls here, else N32 64 bit args are passed incorrectly */
|
||||
offset = (syscall_num == TARGET_NR_syscall - TARGET_NR_Linux);
|
||||
if (offset)
|
||||
syscall_num = env->active_tc.gpr[4] - TARGET_NR_Linux;
|
||||
# endif
|
||||
if (syscall_num >= sizeof(mips_syscall_args)) {
|
||||
ret = -TARGET_ENOSYS;
|
||||
} else {
|
||||
# ifdef TARGET_ABI_MIPSO32
|
||||
int nb_args;
|
||||
abi_ulong sp_reg;
|
||||
abi_ulong arg5 = 0, arg6 = 0, arg7 = 0, arg8 = 0;
|
||||
abi_ulong arg4 = 0, arg5 = 0, arg6 = 0, arg7 = 0, arg8 = 0;
|
||||
|
||||
nb_args = mips_syscall_args[syscall_num];
|
||||
sp_reg = env->active_tc.gpr[29];
|
||||
nb_args = SYSCALL_NARGS(mips_syscall_args[syscall_num]);
|
||||
sp_reg = env->active_tc.gpr[29] + 4*offset;
|
||||
switch (nb_args) {
|
||||
/* these arguments are taken from the stack */
|
||||
case 8:
|
||||
|
@ -2289,24 +2624,41 @@ void cpu_loop(CPUMIPSState *env)
|
|||
if ((ret = get_user_ual(arg5, sp_reg + 16)) != 0) {
|
||||
goto done_syscall;
|
||||
}
|
||||
case 4:
|
||||
if (offset && (ret = get_user_ual(arg4, sp_reg + 12)) != 0) {
|
||||
goto done_syscall;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
ret = do_syscall(env, env->active_tc.gpr[2],
|
||||
env->active_tc.gpr[4],
|
||||
env->active_tc.gpr[5],
|
||||
env->active_tc.gpr[6],
|
||||
env->active_tc.gpr[7],
|
||||
ret = do_syscall(env, syscall_num + TARGET_NR_Linux,
|
||||
env->active_tc.gpr[4+offset],
|
||||
env->active_tc.gpr[5+offset],
|
||||
env->active_tc.gpr[6+offset],
|
||||
offset ? arg4 : env->active_tc.gpr[7],
|
||||
arg5, arg6, arg7, arg8);
|
||||
}
|
||||
done_syscall:
|
||||
done_syscall: ;
|
||||
# else
|
||||
ret = do_syscall(env, env->active_tc.gpr[2],
|
||||
env->active_tc.gpr[4], env->active_tc.gpr[5],
|
||||
env->active_tc.gpr[6], env->active_tc.gpr[7],
|
||||
env->active_tc.gpr[8], env->active_tc.gpr[9],
|
||||
env->active_tc.gpr[10], env->active_tc.gpr[11]);
|
||||
# if defined TARGET_ABI_IRIX && defined TARGET_ABI_MIPSN32
|
||||
/* split 64 bit args into 2 32 bit args for N32 */
|
||||
int nb_args;
|
||||
int arg64;
|
||||
abi_ulong args[8];
|
||||
|
||||
/* map certain syscalls to their 64 bit version */
|
||||
if (SYSCALL_MAP(mips_syscall_args[syscall_num]))
|
||||
syscall_num = SYSCALL_MAP(mips_syscall_args[syscall_num]) - TARGET_NR_Linux;
|
||||
nb_args = SYSCALL_NARGS(mips_syscall_args[syscall_num]);
|
||||
arg64 = SYSCALL_ARG64(mips_syscall_args[syscall_num]);
|
||||
get_args_n32(&env->active_tc.gpr[4+offset], arg64, nb_args, args);
|
||||
# else
|
||||
target_ulong *args = &env->active_tc.gpr[4+offset];
|
||||
# endif
|
||||
ret = do_syscall(env, syscall_num + TARGET_NR_Linux,
|
||||
args[0], args[1], args[2], args[3],
|
||||
args[4], args[5], args[6], args[7]);
|
||||
# endif /* O32 */
|
||||
}
|
||||
if (ret == -TARGET_ERESTARTSYS) {
|
||||
env->active_tc.PC -= 4;
|
||||
break;
|
||||
|
@ -2316,13 +2668,29 @@ done_syscall:
|
|||
Avoid clobbering register state. */
|
||||
break;
|
||||
}
|
||||
/* on return: gpr7 = error flag, gpr2/3 = value(s) or error code */
|
||||
# if defined TARGET_ABI_IRIX
|
||||
# if defined TARGET_ABI_MIPSN32
|
||||
/* restore a 64 bit retval for N32 */
|
||||
if (SYSCALL_RET64(mips_syscall_args[syscall_num])) {
|
||||
target_ulong tret = ((target_ulong)ret << 32) | env->active_tc.gpr[3];
|
||||
env->active_tc.gpr[7] = (tret >= (target_ulong)-1700);
|
||||
env->active_tc.gpr[2] = (env->active_tc.gpr[7] ? -tret : tret);
|
||||
} else
|
||||
# endif
|
||||
{
|
||||
env->active_tc.gpr[7] = (ret >= (abi_ulong)-1700);
|
||||
env->active_tc.gpr[2] = (env->active_tc.gpr[7] ? -ret : ret);
|
||||
}
|
||||
# else
|
||||
if ((abi_ulong)ret >= (abi_ulong)-1133) {
|
||||
env->active_tc.gpr[7] = 1; /* error flag */
|
||||
ret = -ret;
|
||||
env->active_tc.gpr[2] = -ret;
|
||||
} else {
|
||||
env->active_tc.gpr[7] = 0; /* error flag */
|
||||
env->active_tc.gpr[2] = ret;
|
||||
}
|
||||
env->active_tc.gpr[2] = ret;
|
||||
# endif
|
||||
break;
|
||||
case EXCP_TLBL:
|
||||
case EXCP_TLBS:
|
||||
|
@ -2342,6 +2710,14 @@ done_syscall:
|
|||
info.si_code = 0;
|
||||
queue_signal(env, info.si_signo, QEMU_SI_FAULT, &info);
|
||||
break;
|
||||
#ifdef TARGET_ABI_IRIX
|
||||
case EXCP_FPE:
|
||||
info.si_signo = TARGET_SIGFPE;
|
||||
info.si_errno = 0;
|
||||
info.si_code = 0;
|
||||
queue_signal(env, info.si_signo, QEMU_SI_FAULT, &info);
|
||||
break;
|
||||
#endif
|
||||
case EXCP_INTERRUPT:
|
||||
/* just indicate that signals should be handled asap */
|
||||
break;
|
||||
|
@ -3944,9 +4320,7 @@ void qemu_cpu_kick(CPUState *cpu)
|
|||
|
||||
void task_settid(TaskState *ts)
|
||||
{
|
||||
if (ts->ts_tid == 0) {
|
||||
ts->ts_tid = (pid_t)syscall(SYS_gettid);
|
||||
}
|
||||
ts->ts_tid = (pid_t)syscall(SYS_gettid);
|
||||
}
|
||||
|
||||
void stop_all_tasks(void)
|
||||
|
@ -3962,6 +4336,39 @@ void stop_all_tasks(void)
|
|||
void init_task_state(TaskState *ts)
|
||||
{
|
||||
ts->used = 1;
|
||||
|
||||
#ifdef TARGET_ABI_IRIX
|
||||
pthread_mutex_init(&ts->procblk_mutex, NULL);
|
||||
pthread_cond_init(&ts->procblk_cond, NULL);
|
||||
#endif
|
||||
}
|
||||
|
||||
TaskState *find_task_state(pid_t tid)
|
||||
{
|
||||
CPUState *cpu;
|
||||
TaskState *ts = NULL;
|
||||
|
||||
for (cpu = first_cpu; cpu; cpu = CPU_NEXT(cpu)) {
|
||||
ts = cpu->opaque;
|
||||
if (ts->ts_tid == tid)
|
||||
break;
|
||||
}
|
||||
|
||||
return ts;
|
||||
}
|
||||
|
||||
CPUState *find_cpu_state(pid_t tid)
|
||||
{
|
||||
CPUState *cpu;
|
||||
TaskState *ts;
|
||||
|
||||
for (cpu = first_cpu; cpu; cpu = CPU_NEXT(cpu)) {
|
||||
ts = cpu->opaque;
|
||||
if (ts->ts_tid == tid)
|
||||
break;
|
||||
}
|
||||
|
||||
return cpu;
|
||||
}
|
||||
|
||||
CPUArchState *cpu_copy(CPUArchState *env)
|
||||
|
@ -4574,7 +4981,7 @@ int main(int argc, char **argv, char **envp)
|
|||
|
||||
target_set_brk(info->brk);
|
||||
syscall_init();
|
||||
signal_init();
|
||||
signal_init(env);
|
||||
|
||||
/* Now that we've loaded the binary, GUEST_BASE is fixed. Delay
|
||||
generating the prologue until now so that the prologue can take
|
||||
|
@ -4856,6 +5263,17 @@ int main(int argc, char **argv, char **envp)
|
|||
}
|
||||
restore_snan_bit_mode(env);
|
||||
}
|
||||
# if defined TARGET_ABI_IRIX && !defined TARGET_ABI_MIPSO32
|
||||
/* TODO: is this OK? */
|
||||
if ((info->elf_flags & EF_MIPS_ARCH) == EF_MIPS_ARCH_4) {
|
||||
/* enable MIPS IV COP1X instructions for N32 and N64 */
|
||||
env->CP0_Status |= (1 << CP0St_CU3);
|
||||
env->hflags |= MIPS_HFLAG_COP1X;
|
||||
}
|
||||
/* check if PRDA emulation is requested */
|
||||
if (getenv("QEMU_IRIXPRDA"))
|
||||
irix_emulate_prda = 1;
|
||||
# endif
|
||||
}
|
||||
#elif defined(TARGET_NIOS2)
|
||||
{
|
||||
|
|
|
@ -58,6 +58,9 @@ struct image_info {
|
|||
abi_ulong pt_dynamic_addr;
|
||||
struct image_info *other_info;
|
||||
#endif
|
||||
#ifdef TARGET_ABI_IRIX
|
||||
abi_ulong phdr_offset;
|
||||
#endif
|
||||
};
|
||||
|
||||
#ifdef TARGET_I386
|
||||
|
@ -119,6 +122,22 @@ typedef struct TaskState {
|
|||
/* Extra fields for semihosted binaries. */
|
||||
abi_ulong heap_base;
|
||||
abi_ulong heap_limit;
|
||||
#endif
|
||||
#if defined(TARGET_ABI_IRIX)
|
||||
struct TaskState *parent_task;
|
||||
abi_ulong ctx_link;
|
||||
abi_ulong sigtramp;
|
||||
unsigned char prda[TARGET_PAGE_SIZE];
|
||||
int procblk_count;
|
||||
pthread_mutex_t procblk_mutex;
|
||||
pthread_cond_t procblk_cond;
|
||||
int is_pthread;
|
||||
int is_blocked;
|
||||
int termchild_sig;
|
||||
int exit_sig;
|
||||
#endif
|
||||
#if defined(TARGET_ABI_SOLARIS)
|
||||
abi_ulong ctx_link;
|
||||
#endif
|
||||
abi_ulong stack_base;
|
||||
int used; /* non zero if used */
|
||||
|
@ -152,6 +171,8 @@ typedef struct TaskState {
|
|||
|
||||
extern char *exec_path;
|
||||
void init_task_state(TaskState *ts);
|
||||
TaskState *find_task_state(pid_t tid);
|
||||
CPUState *find_cpu_state(pid_t tid);
|
||||
void task_settid(TaskState *);
|
||||
void stop_all_tasks(void);
|
||||
extern const char *qemu_uname_release;
|
||||
|
@ -189,6 +210,15 @@ int loader_exec(int fdexec, const char *filename, char **argv, char **envp,
|
|||
uint32_t get_elf_eflags(int fd);
|
||||
int load_elf_binary(struct linux_binprm *bprm, struct image_info *info);
|
||||
int load_flt_binary(struct linux_binprm *bprm, struct image_info *info);
|
||||
#ifdef TARGET_ABI_IRIX
|
||||
#ifdef TARGET_ABI_MIPSN64
|
||||
struct elf64_phdr;
|
||||
abi_ulong sgi_map_elf_image(int image_fd, struct elf64_phdr *phdr, int phnum);
|
||||
#else
|
||||
struct elf32_phdr;
|
||||
abi_ulong sgi_map_elf_image(int image_fd, struct elf32_phdr *phdr, int phnum);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
abi_long memcpy_to_target(abi_ulong dest, const void *src,
|
||||
unsigned long len);
|
||||
|
@ -205,8 +235,8 @@ void cpu_loop(CPUArchState *env);
|
|||
const char *target_strerror(int err);
|
||||
int get_osversion(void);
|
||||
void init_qemu_uname_release(void);
|
||||
void fork_start(void);
|
||||
void fork_end(int child);
|
||||
void fork_start(CPUArchState *env);
|
||||
void fork_end(CPUArchState *env, int child);
|
||||
|
||||
/* Creates the initial guest address space in the host memory space using
|
||||
* the given host start address hint and size. The guest_start parameter
|
||||
|
@ -378,7 +408,7 @@ extern int do_strace;
|
|||
|
||||
/* signal.c */
|
||||
void process_pending_signals(CPUArchState *cpu_env);
|
||||
void signal_init(void);
|
||||
void signal_init(CPUArchState *env);
|
||||
int queue_signal(CPUArchState *env, int sig, int si_type,
|
||||
target_siginfo_t *info);
|
||||
void host_to_target_siginfo(target_siginfo_t *tinfo, const siginfo_t *info);
|
||||
|
@ -387,8 +417,8 @@ int target_to_host_signal(int sig);
|
|||
int host_to_target_signal(int sig);
|
||||
long do_sigreturn(CPUArchState *env);
|
||||
long do_rt_sigreturn(CPUArchState *env);
|
||||
abi_long do_sigaltstack(abi_ulong uss_addr, abi_ulong uoss_addr, abi_ulong sp);
|
||||
int do_sigprocmask(int how, const sigset_t *set, sigset_t *oldset);
|
||||
abi_long do_sigaltstack(CPUArchState *env, abi_ulong uss_addr, abi_ulong uoss_addr, abi_ulong sp);
|
||||
int do_sigprocmask(CPUArchState *env, int how, const sigset_t *set, sigset_t *oldset);
|
||||
/**
|
||||
* block_signals: block all signals while handling this guest syscall
|
||||
*
|
||||
|
@ -407,7 +437,7 @@ int do_sigprocmask(int how, const sigset_t *set, sigset_t *oldset);
|
|||
*
|
||||
* Return value: non-zero if there was a pending signal, zero if not.
|
||||
*/
|
||||
int block_signals(void); /* Returns non zero if signal pending */
|
||||
int block_signals(CPUArchState *env); /* Returns non zero if signal pending */
|
||||
|
||||
#ifdef TARGET_I386
|
||||
/* vm86.c */
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,5 +1,91 @@
|
|||
|
||||
#if defined(TARGET_MIPS)
|
||||
#if defined(TARGET_ABI_IRIX) || defined(TARGET_ABI_SOLARIS)
|
||||
|
||||
/* For setsockopt(2) */
|
||||
#define TARGET_SOL_SOCKET 0xffff
|
||||
|
||||
#define TARGET_SO_DEBUG 0x0001
|
||||
#define TARGET_SO_REUSEADDR 0x0004
|
||||
#define TARGET_SO_KEEPALIVE 0x0008
|
||||
#define TARGET_SO_DONTROUTE 0x0010
|
||||
#define TARGET_SO_BROADCAST 0x0020
|
||||
#define TARGET_SO_LINGER 0x0080
|
||||
#define TARGET_SO_OOBINLINE 0x0100
|
||||
#define TARGET_SO_ACCEPTCONN 0x0002
|
||||
/* To add :#define TARGET_SO_REUSEPORT 0x0200 */
|
||||
|
||||
#define TARGET_SO_TYPE 0x1008
|
||||
#define TARGET_SO_ERROR 0x1007
|
||||
#define TARGET_SO_SNDBUF 0x1001
|
||||
#define TARGET_SO_RCVBUF 0x1002
|
||||
#define TARGET_SO_SNDBUFFORCE 0x10ff
|
||||
#define TARGET_SO_RCVBUFFORCE 0x10fe
|
||||
#define TARGET_SO_RCVLOWAT 0x1003
|
||||
#define TARGET_SO_SNDLOWAT 0x1004
|
||||
#define TARGET_SO_RCVTIMEO 0x1006
|
||||
#define TARGET_SO_SNDTIMEO 0x1005
|
||||
#define TARGET_SO_PROTOCOL 0x1009
|
||||
#define TARGET_SO_DOMAIN 0x100c
|
||||
#define TARGET_SO_TIMESTAMP 0x1013
|
||||
#define TARGET_SCM_TIMESTAMP TARGET_SO_TIMESTAMP
|
||||
|
||||
/* linux-specific, might as well be the same as on i386 */
|
||||
#define TARGET_SO_NO_CHECK 11
|
||||
#define TARGET_SO_PRIORITY 12
|
||||
#define TARGET_SO_BSDCOMPAT 14
|
||||
|
||||
#define TARGET_SO_PASSCRED 17
|
||||
#define TARGET_SO_PEERCRED 18
|
||||
#define TARGET_SO_BINDTODEVICE 25
|
||||
|
||||
/* Socket filtering */
|
||||
#define TARGET_SO_ATTACH_FILTER 26
|
||||
#define TARGET_SO_DETACH_FILTER 27
|
||||
|
||||
#define TARGET_SO_PEERNAME 28
|
||||
|
||||
#define TARGET_SO_PEERSEC 30
|
||||
#define TARGET_SO_PASSSEC 34
|
||||
#define TARGET_SO_TIMESTAMPNS 35
|
||||
#define TARGET_SCM_TIMESTAMPNS TARGET_SO_TIMESTAMPNS
|
||||
|
||||
/* Security levels - as per NRL IPv6 - don't actually do anything */
|
||||
#define TARGET_SO_SECURITY_AUTHENTICATION 19
|
||||
#define TARGET_SO_SECURITY_ENCRYPTION_TRANSPORT 20
|
||||
#define TARGET_SO_SECURITY_ENCRYPTION_NETWORK 21
|
||||
|
||||
#define TARGET_SO_MARK 36
|
||||
|
||||
#define TARGET_SO_TIMESTAMPING 37
|
||||
#define TARGET_SCM_TIMESTAMPING TARGET_SO_TIMESTAMPING
|
||||
|
||||
#define TARGET_SO_RXQ_OVFL 40
|
||||
|
||||
#define TARGET_SO_WIFI_STATUS 41
|
||||
#define TARGET_SCM_WIFI_STATUS TARGET_SO_WIFI_STATUS
|
||||
#define TARGET_SO_PEEK_OFF 42
|
||||
|
||||
/* Instruct lower device to use last 4-bytes of skb data as FCS */
|
||||
#define TARGET_SO_NOFCS 43
|
||||
|
||||
/** sock_type - Socket types */
|
||||
|
||||
#define ARCH_HAS_SOCKET_TYPES 1
|
||||
|
||||
enum sock_type {
|
||||
TARGET_SOCK_STREAM = 2,
|
||||
TARGET_SOCK_DGRAM = 1,
|
||||
TARGET_SOCK_RAW = 4,
|
||||
TARGET_SOCK_RDM = 5,
|
||||
TARGET_SOCK_SEQPACKET = 6,
|
||||
TARGET_SOCK_CLOEXEC = 0x080000,
|
||||
TARGET_SOCK_NONBLOCK = 0x100000,
|
||||
};
|
||||
|
||||
#define TARGET_SOCK_MAX (TARGET_SOCK_SEQPACKET + 1)
|
||||
#define TARGET_SOCK_TYPE_MASK 0xf /* Covers up to TARGET_SOCK_MAX-1. */
|
||||
|
||||
#elif defined(TARGET_MIPS)
|
||||
/* MIPS special values for constants */
|
||||
|
||||
/*
|
||||
|
|
|
@ -0,0 +1,360 @@
|
|||
/*
|
||||
* Solaris syscalls. This is derived from Netbsd svr4_32_sysent.c and Solaris 7
|
||||
* syscall.h, with extensions from Illumos for stuff undefined in Solaris 7.
|
||||
*/
|
||||
|
||||
#define TARGET_NR_syscall 0
|
||||
#define TARGET_NR_exit 1
|
||||
#define TARGET_NR_fork 2
|
||||
#define TARGET_NR_read 3
|
||||
#define TARGET_NR_write 4
|
||||
#define TARGET_NR_open 5
|
||||
#define TARGET_NR_close 6
|
||||
#define TARGET_NR_linkat 7 /* wait in Solaris 7 */
|
||||
#define TARGET_NR_creat 8
|
||||
#define TARGET_NR_link 9
|
||||
#define TARGET_NR_unlink 10
|
||||
#define TARGET_NR_symlinkat 11 /* exec in Solaris 7 */
|
||||
#define TARGET_NR_chdir 12
|
||||
#define TARGET_NR_time 13
|
||||
#define TARGET_NR_mknod 14
|
||||
#define TARGET_NR_chmod 15
|
||||
#define TARGET_NR_chown 16
|
||||
#define TARGET_NR_brk 17
|
||||
#define TARGET_NR_stat 18
|
||||
#define TARGET_NR_lseek 19
|
||||
#define TARGET_NR_getpid 20
|
||||
#define TARGET_NR_mount 21
|
||||
#define TARGET_NR_readlinkat 22 /* umount in Solaris 7 */
|
||||
#define TARGET_NR_setuid 23
|
||||
#define TARGET_NR_getuid 24
|
||||
#define TARGET_NR_stime 25
|
||||
#define TARGET_NR_pcsample 26
|
||||
#define TARGET_NR_alarm 27
|
||||
#define TARGET_NR_fstat 28
|
||||
#define TARGET_NR_pause 29
|
||||
#define TARGET_NR_utime 30
|
||||
#define TARGET_NR_stty 31
|
||||
#define TARGET_NR_gtty 32
|
||||
#define TARGET_NR_access 33
|
||||
#define TARGET_NR_nice 34
|
||||
#define TARGET_NR_statfs 35
|
||||
#define TARGET_NR_sync 36
|
||||
#define TARGET_NR_kill 37
|
||||
#define TARGET_NR_fstatfs 38
|
||||
#define TARGET_NR_pgrpsys 39
|
||||
#define TARGET_NR_xenix 40 /* uucopystr for Solaris 10 */
|
||||
#define TARGET_NR_dup 41
|
||||
#define TARGET_NR_pipe 42
|
||||
#define TARGET_NR_times 43
|
||||
#define TARGET_NR_profil 44
|
||||
#define TARGET_NR_faccessat 45 /* plock in Solaris 7 */
|
||||
#define TARGET_NR_setgid 46
|
||||
#define TARGET_NR_getgid 47
|
||||
#define TARGET_NR_mknodat 48 /* signal in Solaris 7 */
|
||||
#define TARGET_NR_msgsys 49
|
||||
#define TARGET_NR_sysarch 50
|
||||
#define TARGET_NR_acct 51
|
||||
#define TARGET_NR_shmsys 52
|
||||
#define TARGET_NR_semsys 53
|
||||
#define TARGET_NR_ioctl 54
|
||||
#define TARGET_NR_uadmin 55
|
||||
#define TARGET_NR_fchownat 56 /* undefined for Solaris 7 */
|
||||
#define TARGET_NR_utssyssunos 57
|
||||
#define TARGET_NR_fdsync 58
|
||||
#define TARGET_NR_execve 59
|
||||
#define TARGET_NR_umask 60
|
||||
#define TARGET_NR_chroot 61
|
||||
#define TARGET_NR_fcntl 62
|
||||
#define TARGET_NR_ulimit 63
|
||||
#define TARGET_NR_renameat 64 /* undefined in Solaris 7 */
|
||||
#define TARGET_NR_unlinkat 65 /* undefined in Solaris 7 */
|
||||
#define TARGET_NR_fstatat 66 /* undefined in Solaris 7 */
|
||||
#define TARGET_NR_fstatat64 67 /* undefined in Solaris 7 */
|
||||
#define TARGET_NR_openat 68 /* undefined in Solaris 7 */
|
||||
#define TARGET_NR_openat64 69 /* undefined in Solaris 7 */
|
||||
#define TARGET_NR_tasksys 70 /* undefined in Solaris 7 */
|
||||
#define TARGET_NR_acctctl 71 /* undefined in Solaris 7 */
|
||||
#define TARGET_NR_exacctsys 72 /* undefined in Solaris 7 */
|
||||
#define TARGET_NR_getpagesizes 73 /* undefined in Solaris 7 */
|
||||
#define TARGET_NR_rctlsys 74 /* undefined in Solaris 7 */
|
||||
#define TARGET_NR_sidsys 75 /* undefined in Solaris 7 */
|
||||
#define TARGET_NR_fsat 76 /* undefined in Solaris 7 */
|
||||
#define TARGET_NR_lwp_park 77 /* undefined in Solaris 7 */
|
||||
#define TARGET_NR_sendfilev 78 /* undefined in Solaris 7 */
|
||||
#define TARGET_NR_rmdir 79
|
||||
#define TARGET_NR_mkdir 80
|
||||
#define TARGET_NR_getdents 81
|
||||
#define TARGET_NR_privsys 82 /* undefined in Solaris 7 */
|
||||
#define TARGET_NR_ucredsys 83 /* undefined in Solaris 7 */
|
||||
#define TARGET_NR_sysfs 84
|
||||
#define TARGET_NR_getmsg 85
|
||||
#define TARGET_NR_putmsg 86
|
||||
#define TARGET_NR_poll 87
|
||||
#define TARGET_NR_lstat 88
|
||||
#define TARGET_NR_symlink 89
|
||||
#define TARGET_NR_readlink 90
|
||||
#define TARGET_NR_setgroups 91
|
||||
#define TARGET_NR_getgroups 92
|
||||
#define TARGET_NR_fchmod 93
|
||||
#define TARGET_NR_fchown 94
|
||||
#define TARGET_NR_sigprocmask 95
|
||||
#define TARGET_NR_sigsuspend 96
|
||||
#define TARGET_NR_sigaltstack 97
|
||||
#define TARGET_NR_sigaction 98
|
||||
#define TARGET_NR_sigpendingsys 99
|
||||
#define TARGET_NR_context 100
|
||||
#define TARGET_NR_fchmodat 101 /* evsys in Solaris 7 */
|
||||
#define TARGET_NR_mkdirat 102 /* evtrapret in Solaris 7 */
|
||||
#define TARGET_NR_statvfs 103
|
||||
#define TARGET_NR_fstatvfs 104
|
||||
#define TARGET_NR_getloadavg 105
|
||||
#define TARGET_NR_nfssys 106
|
||||
#define TARGET_NR_waitid 107
|
||||
#define TARGET_NR_sigsendsys 108
|
||||
#define TARGET_NR_hrtsys 109
|
||||
#define TARGET_NR_acancel 110 /* utimesys in Solaris 10 */
|
||||
#define TARGET_NR_async 111 /* sigresend in Solaris 10 */
|
||||
#define TARGET_NR_priocntlsys 112
|
||||
#define TARGET_NR_pathconf 113
|
||||
#define TARGET_NR_mincore 114
|
||||
#define TARGET_NR_mmap 115
|
||||
#define TARGET_NR_mprotect 116
|
||||
#define TARGET_NR_munmap 117
|
||||
#define TARGET_NR_fpathconf 118
|
||||
#define TARGET_NR_vfork 119
|
||||
#define TARGET_NR_fchdir 120
|
||||
#define TARGET_NR_readv 121
|
||||
#define TARGET_NR_writev 122
|
||||
#define TARGET_NR_xstat 123 /* preadv in Solaris 10 */
|
||||
#define TARGET_NR_lxstat 124 /* pwritev in Solaris 10 */
|
||||
#define TARGET_NR_fxstat 125 /* undefined in Solaris 10 */
|
||||
#define TARGET_NR_xmknod 126 /* undefined in Solaris 10 */
|
||||
#define TARGET_NR_clocal 127 /* mmapobj in Solaris 10 */
|
||||
#define TARGET_NR_setrlimit 128
|
||||
#define TARGET_NR_getrlimit 129
|
||||
#define TARGET_NR_lchown 130
|
||||
#define TARGET_NR_memcntl 131
|
||||
#define TARGET_NR_getpmsg 132
|
||||
#define TARGET_NR_putpmsg 133
|
||||
#define TARGET_NR_rename 134
|
||||
#define TARGET_NR_unamesunos 135
|
||||
#define TARGET_NR_setegid 136
|
||||
#define TARGET_NR_sysconfig 137
|
||||
#define TARGET_NR_adjtime 138
|
||||
#define TARGET_NR_sysinfosunos 139
|
||||
#define TARGET_NR_sharefs 140 /* undefined for Solaris 7 */
|
||||
#define TARGET_NR_seteuid 141
|
||||
#define TARGET_NR_forksys 142 /* vtrace for Solaris 7 */
|
||||
#define TARGET_NR_fork1 143 /* undefined for Solaris 10 */
|
||||
#define TARGET_NR_sigtimedwait 144
|
||||
#define TARGET_NR_lwp_info 145
|
||||
#define TARGET_NR_yield 146
|
||||
#define TARGET_NR_lwp_sema_wait 147 /* undefined in Solaris 10 */
|
||||
#define TARGET_NR_lwp_sema_post 148
|
||||
#define TARGET_NR_lwp_sema_trywait 149
|
||||
#define TARGET_NR_lwp_detach 150 /* undefined for Solaris 7 */
|
||||
#define TARGET_NR_corectl 151
|
||||
#define TARGET_NR_modctl 152
|
||||
#define TARGET_NR_fchroot 153
|
||||
#define TARGET_NR_utimes 154
|
||||
#define TARGET_NR_vhangup 155
|
||||
#define TARGET_NR_gettimeofday 156
|
||||
#define TARGET_NR_getitimer 157
|
||||
#define TARGET_NR_setitimer 158
|
||||
#define TARGET_NR_lwp_create 159
|
||||
#define TARGET_NR_lwp_exit 160
|
||||
#define TARGET_NR_lwp_suspend 161
|
||||
#define TARGET_NR_lwp_continue 162
|
||||
#define TARGET_NR_lwp_kill 163
|
||||
#define TARGET_NR_lwp_self 164
|
||||
#define TARGET_NR_lwp_setprivate 165 /* lwp_sigmask for Solaris 10 */
|
||||
#define TARGET_NR_lwp_getprivate 166 /* lwp_private for Solaris 10 */
|
||||
#define TARGET_NR_lwp_wait 167
|
||||
#define TARGET_NR_lwp_mutex_wakeup 168
|
||||
#define TARGET_NR_lwp_mutex_lock 169 /* undefined in Solaris 10 */
|
||||
#define TARGET_NR_lwp_cond_wait 170
|
||||
#define TARGET_NR_lwp_cond_signal 171
|
||||
#define TARGET_NR_lwp_cond_broadcast 172
|
||||
#define TARGET_NR_pread 173
|
||||
#define TARGET_NR_pwrite 174
|
||||
#define TARGET_NR__llseek 175
|
||||
#define TARGET_NR_inst_sync 176
|
||||
#define TARGET_NR_brand 177
|
||||
#define TARGET_NR_kaio 178
|
||||
#define TARGET_NR_cpc 179 /* undefined in Solaris 7 */
|
||||
#define TARGET_NR_meminfosys 180 /* undefined in Solaris 7 */
|
||||
#define TARGET_NR_rusagesys 181 /* undefined in Solaris 7 */
|
||||
#define TARGET_NR_port 182 /* undefined in Solaris 7 */
|
||||
#define TARGET_NR_pollsys 183 /* undefined in Solaris 7 */
|
||||
#define TARGET_NR_tsolsys 184 /* labelsys in Solaris 10 */
|
||||
#define TARGET_NR_acl 185
|
||||
#define TARGET_NR_auditsys 186
|
||||
#define TARGET_NR_processor_bind 187
|
||||
#define TARGET_NR_processor_info 188
|
||||
#define TARGET_NR_p_online 189
|
||||
#define TARGET_NR_sigqueue 190
|
||||
#define TARGET_NR_clock_gettime 191
|
||||
#define TARGET_NR_clock_settime 192
|
||||
#define TARGET_NR_clock_getres 193
|
||||
#define TARGET_NR_timer_create 194
|
||||
#define TARGET_NR_timer_delete 195
|
||||
#define TARGET_NR_timer_settime 196
|
||||
#define TARGET_NR_timer_gettime 197
|
||||
#define TARGET_NR_timer_getoverrun 198
|
||||
#define TARGET_NR_nanosleep 199
|
||||
#define TARGET_NR_facl 200
|
||||
#define TARGET_NR_door 201
|
||||
#define TARGET_NR_setreuid 202
|
||||
#define TARGET_NR_setregid 203
|
||||
#define TARGET_NR_install_utrap 204
|
||||
#define TARGET_NR_signotify 205
|
||||
#define TARGET_NR_schedctl 206
|
||||
#define TARGET_NR_pset 207
|
||||
#define TARGET_NR_sparc_utrap_install 208
|
||||
#define TARGET_NR_resolvepath 209
|
||||
#define TARGET_NR_signotifywait 210 /* lwp_mutex_timedlock for Solaris 10 */
|
||||
#define TARGET_NR_lwp_sigredirect 211 /* lwp_sema_timedwait for Solaris 10 */
|
||||
#define TARGET_NR_lwp_alarm 212 /* lwp_rwlock_sys for Solaris 10 */
|
||||
/* system calls for large files ( > 2 gigabyte) */
|
||||
#define TARGET_NR_getdents64 213
|
||||
#define TARGET_NR_mmap64 214
|
||||
#define TARGET_NR_stat64 215
|
||||
#define TARGET_NR_lstat64 216
|
||||
#define TARGET_NR_fstat64 217
|
||||
#define TARGET_NR_statvfs64 218
|
||||
#define TARGET_NR_fstatvfs64 219
|
||||
#define TARGET_NR_setrlimit64 220
|
||||
#define TARGET_NR_getrlimit64 221
|
||||
#define TARGET_NR_pread64 222
|
||||
#define TARGET_NR_pwrite64 223
|
||||
#define TARGET_NR_creat64 224
|
||||
#define TARGET_NR_open64 225
|
||||
#define TARGET_NR_rpcsys 226
|
||||
#define TARGET_NR_zone 227 /* undefined in Solaris 7 */
|
||||
#define TARGET_NR_autofssys 228 /* undefined in Solaris 7 */
|
||||
#define TARGET_NR_getcwd 229
|
||||
#define TARGET_NR_so_socket 230
|
||||
#define TARGET_NR_so_socketpair 231
|
||||
#define TARGET_NR_bind 232
|
||||
#define TARGET_NR_listen 233
|
||||
#define TARGET_NR_accept 234
|
||||
#define TARGET_NR_connect 235
|
||||
#define TARGET_NR_shutdown 236
|
||||
#define TARGET_NR_recv 237
|
||||
#define TARGET_NR_recvfrom 238
|
||||
#define TARGET_NR_recvmsg 239
|
||||
#define TARGET_NR_send 240
|
||||
#define TARGET_NR_sendmsg 241
|
||||
#define TARGET_NR_sendto 242
|
||||
#define TARGET_NR_getpeername 243
|
||||
#define TARGET_NR_getsockname 244
|
||||
#define TARGET_NR_getsockopt 245
|
||||
#define TARGET_NR_setsockopt 246
|
||||
#define TARGET_NR_sockconfig 247
|
||||
/* NTP system calls */
|
||||
#define TARGET_NR_ntp_gettime 248
|
||||
#define TARGET_NR_ntp_adjtime 249
|
||||
#define TARGET_NR_lwp_mutex_unlock 250
|
||||
#define TARGET_NR_lwp_mutex_trylock 251
|
||||
#define TARGET_NR_lwp_mutex_register 252
|
||||
#define TARGET_NR_cladm 253
|
||||
#define TARGET_NR_uucopy 254 /* undefined in Solaris 7 */
|
||||
#define TARGET_NR_umount2 255 /* undefined in Solaris 7 */
|
||||
|
||||
|
||||
/* forksys(cmd) */
|
||||
#define TARGET_NR_forksys_forkx 0
|
||||
#define TARGET_NR_forksys_forkallx 1
|
||||
#define TARGET_NR_forksys_vforkx 2
|
||||
|
||||
/* pgrpsys(cmd, ...) */
|
||||
#define TARGET_NR_pgrpsys_getpgrp 0
|
||||
#define TARGET_NR_pgrpsys_setpgrp 1
|
||||
#define TARGET_NR_pgrpsys_getsid 2
|
||||
#define TARGET_NR_pgrpsys_setsid 3
|
||||
#define TARGET_NR_pgrpsys_getpgid 4
|
||||
#define TARGET_NR_pgrpsys_setpgid 5
|
||||
|
||||
/* sigpendingsys(cmd, ...) */
|
||||
#define TARGET_NR_sigpsys_sigpending 1
|
||||
#define TARGET_NR_sigpsys_sigfillset 2
|
||||
|
||||
/* memcntl(..., ..., cmd, ...) */
|
||||
#define TARGET_NR_memcntl_msync 1
|
||||
#define TARGET_NR_memcntl_mlock 2
|
||||
#define TARGET_NR_memcntl_munlock 3
|
||||
#define TARGET_NR_memcntl_madvise 4
|
||||
#define TARGET_NR_memcntl_mlockall 5
|
||||
#define TARGET_NR_memcntl_munlockall 6
|
||||
#define TARGET_NR_memcntl_hatadvise 7
|
||||
|
||||
/* context(cmd, ...) */
|
||||
#define TARGET_NR_context_getcontext 0
|
||||
#define TARGET_NR_context_setcontext 1
|
||||
|
||||
/* fsat(cmd, ...) */
|
||||
#define TARGET_NR_fsat_openat 0
|
||||
#define TARGET_NR_fsat_openat64 1
|
||||
#define TARGET_NR_fsat_fstatat64 2
|
||||
#define TARGET_NR_fsat_fstatat 3
|
||||
#define TARGET_NR_fsat_renameat 4
|
||||
#define TARGET_NR_fsat_fchownat 5
|
||||
#define TARGET_NR_fsat_unlinkat 6
|
||||
#define TARGET_NR_fsat_futimesat 7
|
||||
|
||||
/* msgsys(cmd, ...) */
|
||||
#define TARGET_NR_msgsys_msgget 0
|
||||
#define TARGET_NR_msgsys_msgctl 1
|
||||
#define TARGET_NR_msgsys_msgrcv 2
|
||||
#define TARGET_NR_msgsys_msgsnd 3
|
||||
#define TARGET_NR_msgsys_msgids 4
|
||||
#define TARGET_NR_msgsys_msgsnap 5
|
||||
|
||||
/* shmsys(cmd, ...) */
|
||||
#define TARGET_NR_shmsys_shmat 0
|
||||
#define TARGET_NR_shmsys_shmctl 1
|
||||
#define TARGET_NR_shmsys_shmdt 2
|
||||
#define TARGET_NR_shmsys_shmget 3
|
||||
#define TARGET_NR_shmsys_shmids 4
|
||||
|
||||
/* semsys(cmd, ...) */
|
||||
#define TARGET_NR_semsys_semctl 0
|
||||
#define TARGET_NR_semsys_semget 1
|
||||
#define TARGET_NR_semsys_semop 2
|
||||
#define TARGET_NR_semsys_semids 3
|
||||
#define TARGET_NR_semsys_semtimedop 4
|
||||
|
||||
/* rusagesys(cmd, ...) */
|
||||
#define TARGET_NR_rusagesys_rusage 0
|
||||
#define TARGET_NR_rusagesys_rusagecld 1
|
||||
#define TARGET_NR_rusagesys_rusagelwp 2
|
||||
#define TARGET_NR_rusagesys_vmusage 3
|
||||
|
||||
/* sysconfig(cmd) */
|
||||
#define TARGET_NR_sysconf_childmax 3
|
||||
#define TARGET_NR_sysconf_openmax 4
|
||||
#define TARGET_NR_sysconf_pagesize 6
|
||||
#define TARGET_NR_sysconf_clktick 7
|
||||
#define TARGET_NR_sysconf_nprocs 12
|
||||
#define TARGET_NR_sysconf_physmem 26
|
||||
#define TARGET_NR_sysconf_stckprot 43
|
||||
|
||||
/* systnfosunos(cmd, ...) */
|
||||
#define TARGET_NR_sysinfo_gethostname 2
|
||||
#define TARGET_NR_sysinfo_sethostname 258
|
||||
#define TARGET_NR_sysinfo_getsrpcdomain 9
|
||||
#define TARGET_NR_sysinfo_setsrpcdomain 265
|
||||
#define TARGET_NR_sysinfo_sysname 1
|
||||
#define TARGET_NR_sysinfo_release 3
|
||||
#define TARGET_NR_sysinfo_version 4
|
||||
#define TARGET_NR_sysinfo_machine 5
|
||||
#define TARGET_NR_sysinfo_cpuarch 6
|
||||
#define TARGET_NR_sysinfo_hwserial 7
|
||||
#define TARGET_NR_sysinfo_hwproducer 8
|
||||
#define TARGET_NR_sysinfo_platform 513
|
||||
#define TARGET_NR_sysinfo_isalist 514
|
||||
#define TARGET_NR_sysinfo_arch32 516
|
||||
#define TARGET_NR_sysinfo_arch64 517
|
||||
#define TARGET_NR_sysinfo_archkern 518
|
||||
#define TARGET_NR_sysinfo_archnative 519
|
|
@ -0,0 +1,44 @@
|
|||
/*
|
||||
* SPARC specific CPU ABI and functions for linux-user
|
||||
*
|
||||
* Copyright (C) 2003 Thomas M. Ogrisegg <tom@fnord.at>
|
||||
* Copyright (C) 2003-2005 Fabrice Bellard
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef SOLARIS_TARGET_CPU_H
|
||||
#define SOLARIS_TARGET_CPU_H
|
||||
|
||||
static inline void cpu_clone_regs(CPUSPARCState *env, target_ulong newsp)
|
||||
{
|
||||
if (newsp) {
|
||||
env->regwptr[22] = newsp;
|
||||
}
|
||||
/* syscall return for clone child: 0, and clear CF since
|
||||
* this counts as a success return value.
|
||||
*/
|
||||
env->regwptr[0] = 0;
|
||||
#if defined(TARGET_SPARC64) && !defined(TARGET_ABI32)
|
||||
env->xcc &= ~PSR_CARRY;
|
||||
#else
|
||||
env->psr &= ~PSR_CARRY;
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline void cpu_set_tls(CPUSPARCState *env, target_ulong newtls)
|
||||
{
|
||||
env->gregs[7] = newtls;
|
||||
}
|
||||
|
||||
#endif
|
|
@ -0,0 +1,18 @@
|
|||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation, or (at your option) any
|
||||
* later version. See the COPYING file in the top-level directory.
|
||||
*/
|
||||
|
||||
#ifndef SPARC_TARGET_ELF_H
|
||||
#define SPARC_TARGET_ELF_H
|
||||
static inline const char *cpu_get_model(uint32_t eflags)
|
||||
{
|
||||
#ifdef TARGET_SPARC64
|
||||
return "TI UltraSparc II";
|
||||
#else
|
||||
return "Fujitsu MB86904";
|
||||
#endif
|
||||
}
|
||||
#endif
|
|
@ -0,0 +1,91 @@
|
|||
#ifndef SOLARIS_TARGET_SIGNAL_H
|
||||
#define SOLARIS_TARGET_SIGNAL_H
|
||||
|
||||
#include "cpu.h"
|
||||
|
||||
/* this struct defines a stack used during syscall handling */
|
||||
|
||||
typedef struct target_sigaltstack {
|
||||
abi_ulong ss_sp;
|
||||
abi_ulong ss_size;
|
||||
abi_long ss_flags;
|
||||
} target_stack_t;
|
||||
|
||||
|
||||
/*
|
||||
* sigaltstack controls
|
||||
*/
|
||||
#define TARGET_SS_ONSTACK 1
|
||||
#define TARGET_SS_DISABLE 2
|
||||
|
||||
#define TARGET_MINSIGSTKSZ 4096
|
||||
#define TARGET_SIGSTKSZ 16384
|
||||
|
||||
#ifndef UREG_O6
|
||||
#define UREG_O6 6
|
||||
#endif
|
||||
#ifndef UREG_SP
|
||||
#define UREG_SP UREG_O6
|
||||
#endif
|
||||
|
||||
static inline abi_ulong get_sp_from_cpustate(CPUSPARCState *state)
|
||||
{
|
||||
return state->regwptr[UREG_SP];
|
||||
}
|
||||
|
||||
struct target_mcontext32 {
|
||||
uint32_t gregs[19];
|
||||
uint32_t gwins;
|
||||
union {
|
||||
double dregs[16];
|
||||
float fregs[32];
|
||||
};
|
||||
uint32_t fqu; /* ptr to array of FQ entries */
|
||||
uint32_t fpfsr; /* FPU status register */
|
||||
uint8_t fpqcnt; /* # of entries in saved FQ */
|
||||
uint8_t fpqesz; /* # of bytes per FQ entry */
|
||||
uint8_t fpen; /* flag signifying fpu in use */
|
||||
uint32_t pad1;
|
||||
uint32_t xrsid;
|
||||
uint32_t xrsptr;
|
||||
uint32_t pad[19];
|
||||
};
|
||||
|
||||
struct target_mcontext64 {
|
||||
uint64_t gregs[21];
|
||||
uint32_t gwins;
|
||||
union {
|
||||
double dregs[16];
|
||||
float fregs[32];
|
||||
};
|
||||
uint32_t fqu; /* ptr to array of FQ entries */
|
||||
uint32_t fpfsr; /* FPU status register */
|
||||
uint8_t fpqcnt; /* # of entries in saved FQ */
|
||||
uint8_t fpqesz; /* # of bytes per FQ entry */
|
||||
uint8_t fpen; /* flag signifying fpu in use */
|
||||
uint32_t pad1;
|
||||
uint32_t xrsid;
|
||||
uint32_t xrsptr;
|
||||
uint32_t pad[19];
|
||||
};
|
||||
|
||||
struct target_mcontext {
|
||||
union {
|
||||
struct target_mcontext32 _32;
|
||||
struct target_mcontext64 _64;
|
||||
};
|
||||
};
|
||||
|
||||
struct target_ucontext {
|
||||
abi_ulong tuc_flags;
|
||||
abi_ulong tuc_link;
|
||||
target_sigset_t tuc_sigmask;
|
||||
struct target_sigaltstack tuc_stack;
|
||||
int pad;
|
||||
struct target_mcontext tuc_mcontext;
|
||||
};
|
||||
|
||||
int save_context(CPUSPARCState *regs, struct target_mcontext *sc, int setret);
|
||||
int restore_context(CPUSPARCState *regs, struct target_mcontext *sc);
|
||||
|
||||
#endif /* TARGET_SIGNAL_H */
|
|
@ -0,0 +1,63 @@
|
|||
/*
|
||||
* SPARC specific structures for linux-user
|
||||
*
|
||||
* Copyright (c) 2013 Fabrice Bellard
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef SOLARIS_TARGET_STRUCTS_H
|
||||
#define SOLARIS_TARGET_STRUCTS_H
|
||||
|
||||
struct target_ipc_perm {
|
||||
abi_int __key; /* Key. */
|
||||
abi_uint uid; /* Owner's user ID. */
|
||||
abi_uint gid; /* Owner's group ID. */
|
||||
abi_uint cuid; /* Creator's user ID. */
|
||||
abi_uint cgid; /* Creator's group ID. */
|
||||
#if TARGET_ABI_BITS == 32
|
||||
abi_ushort __pad1;
|
||||
abi_ushort mode; /* Read/write permission. */
|
||||
abi_ushort __pad2;
|
||||
#else
|
||||
abi_ushort mode;
|
||||
abi_ushort __pad1;
|
||||
#endif
|
||||
abi_ushort __seq; /* Sequence number. */
|
||||
uint64_t __unused1;
|
||||
uint64_t __unused2;
|
||||
};
|
||||
|
||||
struct target_shmid_ds {
|
||||
struct target_ipc_perm shm_perm; /* operation permission struct */
|
||||
#if TARGET_ABI_BITS == 32
|
||||
abi_uint __pad1;
|
||||
#endif
|
||||
abi_ulong shm_atime; /* time of last shmat() */
|
||||
#if TARGET_ABI_BITS == 32
|
||||
abi_uint __pad2;
|
||||
#endif
|
||||
abi_ulong shm_dtime; /* time of last shmdt() */
|
||||
#if TARGET_ABI_BITS == 32
|
||||
abi_uint __pad3;
|
||||
#endif
|
||||
abi_ulong shm_ctime; /* time of last change by shmctl() */
|
||||
abi_long shm_segsz; /* size of segment in bytes */
|
||||
abi_ulong shm_cpid; /* pid of creator */
|
||||
abi_ulong shm_lpid; /* pid of last shmop */
|
||||
abi_long shm_nattch; /* number of current attaches */
|
||||
abi_ulong __unused1;
|
||||
abi_ulong __unused2;
|
||||
};
|
||||
|
||||
#endif
|
|
@ -0,0 +1,24 @@
|
|||
#ifndef SOLARIS_TARGET_SYSCALL_H
|
||||
#define SOLARIS_TARGET_SYSCALL_H
|
||||
|
||||
struct target_pt_regs {
|
||||
abi_ulong psr;
|
||||
abi_ulong pc;
|
||||
abi_ulong npc;
|
||||
abi_ulong y;
|
||||
abi_ulong u_regs[16];
|
||||
};
|
||||
|
||||
#define UNAME_MACHINE "sun4"
|
||||
#define UNAME_MINIMUM_RELEASE "2.6.32"
|
||||
|
||||
/* SPARC kernels don't define this in their Kconfig, but they have the
|
||||
* same ABI as if they did, implemented by sparc-specific code which fishes
|
||||
* directly in the u_regs() struct for half the parameters in sparc_do_fork()
|
||||
* and copy_thread().
|
||||
*/
|
||||
#define TARGET_MINSIGSTKSZ 4096
|
||||
#define TARGET_MLOCKALL_MCL_CURRENT 0x1
|
||||
#define TARGET_MLOCKALL_MCL_FUTURE 0x2
|
||||
|
||||
#endif
|
|
@ -0,0 +1,280 @@
|
|||
/* from asm/termbits.h */
|
||||
|
||||
#define TARGET_NCCS 19
|
||||
|
||||
struct target_termios {
|
||||
unsigned int c_iflag; /* input mode flags */
|
||||
unsigned int c_oflag; /* output mode flags */
|
||||
unsigned int c_cflag; /* control mode flags */
|
||||
unsigned int c_lflag; /* local mode flags */
|
||||
unsigned char c_cc[TARGET_NCCS]; /* control characters */
|
||||
};
|
||||
|
||||
/* c_cc characters */
|
||||
#define TARGET_VINTR 0
|
||||
#define TARGET_VQUIT 1
|
||||
#define TARGET_VERASE 2
|
||||
#define TARGET_VKILL 3
|
||||
#define TARGET_VEOF 4
|
||||
#define TARGET_VEOL 5
|
||||
#define TARGET_VEOL2 6
|
||||
#define TARGET_VSWTC 7
|
||||
#define TARGET_VSTART 8
|
||||
#define TARGET_VSTOP 9
|
||||
|
||||
#define TARGET_VSUSP 10
|
||||
#define TARGET_VDSUSP 11 /* SunOS POSIX nicety I do believe... */
|
||||
#define TARGET_VREPRINT 12
|
||||
#define TARGET_VDISCARD 13
|
||||
#define TARGET_VWERASE 14
|
||||
#define TARGET_VLNEXT 15
|
||||
|
||||
/* Kernel keeps vmin/vtime separated, user apps assume vmin/vtime is
|
||||
* shared with eof/eol
|
||||
*/
|
||||
#define TARGET_VMIN TARGET_VEOF
|
||||
#define TARGET_VTIME TARGET_VEOL
|
||||
|
||||
/* c_iflag bits */
|
||||
#define TARGET_IGNBRK 0x00000001
|
||||
#define TARGET_BRKINT 0x00000002
|
||||
#define TARGET_IGNPAR 0x00000004
|
||||
#define TARGET_PARMRK 0x00000008
|
||||
#define TARGET_INPCK 0x00000010
|
||||
#define TARGET_ISTRIP 0x00000020
|
||||
#define TARGET_INLCR 0x00000040
|
||||
#define TARGET_IGNCR 0x00000080
|
||||
#define TARGET_ICRNL 0x00000100
|
||||
#define TARGET_IUCLC 0x00000200
|
||||
#define TARGET_IXON 0x00000400
|
||||
#define TARGET_IXANY 0x00000800
|
||||
#define TARGET_IXOFF 0x00001000
|
||||
#define TARGET_IMAXBEL 0x00002000
|
||||
#define TARGET_IUTF8 0x00004000
|
||||
|
||||
/* c_oflag bits */
|
||||
#define TARGET_OPOST 0x00000001
|
||||
#define TARGET_OLCUC 0x00000002
|
||||
#define TARGET_ONLCR 0x00000004
|
||||
#define TARGET_OCRNL 0x00000008
|
||||
#define TARGET_ONOCR 0x00000010
|
||||
#define TARGET_ONLRET 0x00000020
|
||||
#define TARGET_OFILL 0x00000040
|
||||
#define TARGET_OFDEL 0x00000080
|
||||
#define TARGET_NLDLY 0x00000100
|
||||
#define TARGET_NL0 0x00000000
|
||||
#define TARGET_NL1 0x00000100
|
||||
#define TARGET_CRDLY 0x00000600
|
||||
#define TARGET_CR0 0x00000000
|
||||
#define TARGET_CR1 0x00000200
|
||||
#define TARGET_CR2 0x00000400
|
||||
#define TARGET_CR3 0x00000600
|
||||
#define TARGET_TABDLY 0x00001800
|
||||
#define TARGET_TAB0 0x00000000
|
||||
#define TARGET_TAB1 0x00000800
|
||||
#define TARGET_TAB2 0x00001000
|
||||
#define TARGET_TAB3 0x00001800
|
||||
#define TARGET_XTABS 0x00001800
|
||||
#define TARGET_BSDLY 0x00002000
|
||||
#define TARGET_BS0 0x00000000
|
||||
#define TARGET_BS1 0x00002000
|
||||
#define TARGET_VTDLY 0x00004000
|
||||
#define TARGET_VT0 0x00000000
|
||||
#define TARGET_VT1 0x00004000
|
||||
#define TARGET_FFDLY 0x00008000
|
||||
#define TARGET_FF0 0x00000000
|
||||
#define TARGET_FF1 0x00008000
|
||||
#define TARGET_PAGEOUT 0x00010000 /* SUNOS specific */
|
||||
#define TARGET_WRAP 0x00020000 /* SUNOS specific */
|
||||
|
||||
/* c_cflag bit meaning */
|
||||
#define TARGET_CBAUD 0x0020000f
|
||||
#define TARGET_B0 0x00000000 /* hang up */
|
||||
#define TARGET_B50 0x00000001
|
||||
#define TARGET_B75 0x00000002
|
||||
#define TARGET_B110 0x00000003
|
||||
#define TARGET_B134 0x00000004
|
||||
#define TARGET_B150 0x00000005
|
||||
#define TARGET_B200 0x00000006
|
||||
#define TARGET_B300 0x00000007
|
||||
#define TARGET_B600 0x00000008
|
||||
#define TARGET_B1200 0x00000009
|
||||
#define TARGET_B1800 0x0000000a
|
||||
#define TARGET_B2400 0x0000000b
|
||||
#define TARGET_B4800 0x0000000c
|
||||
#define TARGET_B9600 0x0000000d
|
||||
#define TARGET_B19200 0x0000000e
|
||||
#define TARGET_B38400 0x0000000f
|
||||
#define TARGET_EXTA B19200
|
||||
#define TARGET_EXTB B38400
|
||||
#define TARGET_CSIZE 0x00000030
|
||||
#define TARGET_CS5 0x00000000
|
||||
#define TARGET_CS6 0x00000010
|
||||
#define TARGET_CS7 0x00000020
|
||||
#define TARGET_CS8 0x00000030
|
||||
#define TARGET_CSTOPB 0x00000040
|
||||
#define TARGET_CREAD 0x00000080
|
||||
#define TARGET_PARENB 0x00000100
|
||||
#define TARGET_PARODD 0x00000200
|
||||
#define TARGET_HUPCL 0x00000400
|
||||
#define TARGET_CLOCAL 0x00000800
|
||||
#define TARGET_CBAUDEX 0x00200000
|
||||
/* We'll never see these speeds with the Zilogs, but for completeness... */
|
||||
#define TARGET_B57600 (TARGET_CBAUDEX+1)
|
||||
#define TARGET_B115200 (TARGET_CBAUDEX+2)
|
||||
#define TARGET_B230400 (TARGET_CBAUDEX+3)
|
||||
#define TARGET_B460800 (TARGET_CBAUDEX+4)
|
||||
/* This is what we can do with the Zilogs. */
|
||||
#define TARGET_B76800 (TARGET_CBAUDEX+5)
|
||||
/* This is what we can do with the SAB82532. */
|
||||
#define TARGET_B153600 (TARGET_CBAUDEX+6)
|
||||
#define TARGET_B307200 (TARGET_CBAUDEX+7)
|
||||
#define TARGET_B614400 (TARGET_CBAUDEX+8)
|
||||
#define TARGET_B921600 (TARGET_CBAUDEX+9)
|
||||
/* And these are the rest... */
|
||||
#define TARGET_B500000 (TARGET_CBAUDEX+10)
|
||||
#define TARGET_B576000 (TARGET_CBAUDEX+11)
|
||||
#define TARGET_B1000000 (TARGET_CBAUDEX+12)
|
||||
#define TARGET_B1152000 (TARGET_CBAUDEX+13)
|
||||
#define TARGET_B1500000 (TARGET_CBAUDEX+14)
|
||||
#define TARGET_B2000000 (TARGET_CBAUDEX+15)
|
||||
/* These have totally bogus values and nobody uses them
|
||||
so far. Later on we'd have to use say 0x10000x and
|
||||
adjust CBAUD constant and drivers accordingly.
|
||||
#define B2500000 0x00001010
|
||||
#define B3000000 0x00001011
|
||||
#define B3500000 0x00001012
|
||||
#define B4000000 0x00001013 */
|
||||
#define TARGET_CIBAUD 0x004f0000 /* input baud rate (not used) */
|
||||
#define TARGET_CMSPAR 0x40000000 /* mark or space (stick) parity */
|
||||
#define TARGET_CRTSCTS 0x80000000 /* flow control */
|
||||
|
||||
/* c_lflag bits */
|
||||
#define TARGET_ISIG 0x00000001
|
||||
#define TARGET_ICANON 0x00000002
|
||||
#define TARGET_XCASE 0x00000004
|
||||
#define TARGET_ECHO 0x00000008
|
||||
#define TARGET_ECHOE 0x00000010
|
||||
#define TARGET_ECHOK 0x00000020
|
||||
#define TARGET_ECHONL 0x00000040
|
||||
#define TARGET_NOFLSH 0x00000080
|
||||
#define TARGET_TOSTOP 0x00000100
|
||||
#define TARGET_ECHOCTL 0x00000200
|
||||
#define TARGET_ECHOPRT 0x00000400
|
||||
#define TARGET_ECHOKE 0x00000800
|
||||
#define TARGET_DEFECHO 0x00001000 /* SUNOS thing, what is it? */
|
||||
#define TARGET_FLUSHO 0x00002000
|
||||
#define TARGET_PENDIN 0x00004000
|
||||
#define TARGET_IEXTEN 0x00008000
|
||||
|
||||
/* ioctls */
|
||||
#define TARGET_IO_(t,n) (((t)<<8)|(n))
|
||||
|
||||
/* Big T */
|
||||
#define TARGET_TCGETA TARGET_IO_('T', 1)
|
||||
#define TARGET_TCSETA TARGET_IO_('T', 2)
|
||||
#define TARGET_TCSETAW TARGET_IO_('T', 3)
|
||||
#define TARGET_TCSETAF TARGET_IO_('T', 4)
|
||||
#define TARGET_TCSBRK TARGET_IO_('T', 5)
|
||||
#define TARGET_TCXONC TARGET_IO_('T', 6)
|
||||
#define TARGET_TCFLSH TARGET_IO_('T', 7)
|
||||
#define TARGET_TCGETS TARGET_IO_('T', 13)
|
||||
#define TARGET_TCSETS TARGET_IO_('T', 14)
|
||||
#define TARGET_TCSETSW TARGET_IO_('T', 15)
|
||||
#define TARGET_TCSETSF TARGET_IO_('T', 16)
|
||||
|
||||
#define TARGET_TIOCGSOFTCAR TARGET_IO_('T', 105)
|
||||
#define TARGET_TIOCSSOFTCAR TARGET_IO_('T', 106)
|
||||
//#define __TIOCUCNTL _IOCTL('T', 102) /* SunOS Specific */
|
||||
#define TARGET_TIOCSWINSZ TARGET_IO_('T', 103)
|
||||
#define TARGET_TIOCGWINSZ TARGET_IO_('T', 104)
|
||||
|
||||
//#define __TIOCREMOTE _IOCTL('t', 30) /* SunOS Specific */
|
||||
/* Note that all the ioctls that are not available in Linux have a
|
||||
* double underscore on the front to: a) avoid some programs to
|
||||
* thing we support some ioctls under Linux (autoconfiguration stuff)
|
||||
*/
|
||||
/* Little t */
|
||||
#define TARGET_TIOCGETD TARGET_IO_('t', 0)
|
||||
#define TARGET_TIOCSETD TARGET_IO_('t', 1)
|
||||
//#define __TIOCHPCL _IOCTL('t') /* SunOS Specific */
|
||||
//#define __TIOCMODG _IOCTL('t', 3) /* SunOS Specific */
|
||||
//#define __TIOCMODS _IOCTL('t', 4) /* SunOS Specific */
|
||||
//#define __TIOCGETP _IOCTL('t', 8) /* SunOS Specific */
|
||||
//#define __TIOCSETP _IOCTL('t', 9) /* SunOS Specific */
|
||||
//#define __TIOCSETN _IOCTL('t', 10) /* SunOS Specific */
|
||||
#define TARGET_TIOCEXCL TARGET_IO_('t', 13)
|
||||
#define TARGET_TIOCNXCL TARGET_IO_('t', 14)
|
||||
//#define __TIOCFLUSH _IOCTL('t', 16) /* SunOS Specific */
|
||||
//#define __TIOCSETC _IOCTL('t', 17) /* SunOS Specific */
|
||||
//#define __TIOCGETC _IOCTL('t', 18) /* SunOS Specific */
|
||||
//#define __TIOCTCNTL _IOCTL('t', 32) /* SunOS Specific */
|
||||
//#define __TIOCSIGNAL _IOCTL('t', 31) /* SunOS Specific */
|
||||
//#define __TIOCSETX _IOCTL('t', 34) /* SunOS Specific */
|
||||
//#define __TIOCGETX _IOCTL('t', 35) /* SunOS Specific */
|
||||
#define TARGET_TIOCCONS TARGET_IO_('t', 36)
|
||||
//#define __TIOCSSIZE _IOCTL('t', 37) /* SunOS Specific */
|
||||
//#define __TIOCGSIZE _IOCTL('t', 38) /* SunOS Specific */
|
||||
#define TARGET_TIOCMGET TARGET_IO_('t', 29)
|
||||
#define TARGET_TIOCMBIC TARGET_IO_('t', 28)
|
||||
#define TARGET_TIOCMBIS TARGET_IO_('t', 27)
|
||||
#define TARGET_TIOCMSET TARGET_IO_('t', 26)
|
||||
#define TARGET_TIOCSTART TARGET_IO_('t', 110)
|
||||
#define TARGET_TIOCSTOP TARGET_IO_('t', 111)
|
||||
#define TARGET_TIOCPKT TARGET_IO_('t', 112)
|
||||
#define TARGET_TIOCNOTTY TARGET_IO_('t', 113)
|
||||
#define TARGET_TIOCSTI TARGET_IO_('t', 23)
|
||||
#define TARGET_TIOCOUTQ TARGET_IO_('t', 115)
|
||||
//#define __TIOCGLTC _IOCTL('t', 116) /* SunOS Specific */
|
||||
//#define __TIOCSLTC _IOCTL('t', 117) /* SunOS Specific */
|
||||
/* 118 is the non-posix setpgrp tty ioctl */
|
||||
/* 119 is the non-posix getpgrp tty ioctl */
|
||||
//#define __TIOCCDTR TARGET_IO_('t', 120) /* SunOS Specific */
|
||||
//#define __TIOCSDTR TARGET_IO_('t', 121) /* SunOS Specific */
|
||||
#define TARGET_TIOCCBRK TARGET_IO_('t', 122)
|
||||
#define TARGET_TIOCSBRK TARGET_IO_('t', 123)
|
||||
//#define __TIOCLGET TARGET_IO_('t', 124) /* SunOS Specific */
|
||||
//#define __TIOCLSET TARGET_IO_('t', 125) /* SunOS Specific */
|
||||
//#define __TIOCLBIC TARGET_IO_('t', 126) /* SunOS Specific */
|
||||
//#define __TIOCLBIS TARGET_IO_('t', 127) /* SunOS Specific */
|
||||
//#define __TIOCISPACE TARGET_IO_('t', 128) /* SunOS Specific */
|
||||
//#define __TIOCISIZE TARGET_IO_('t', 129) /* SunOS Specific */
|
||||
#define TARGET_TIOCSPGRP TARGET_IO_('t', 21)
|
||||
#define TARGET_TIOCGPGRP TARGET_IO_('t', 20)
|
||||
#define TARGET_TIOCSCTTY TARGET_IO_('t', 132)
|
||||
#define TARGET_TIOCGSID TARGET_IO_('t', 22)
|
||||
/* Get minor device of a pty master's FD -- Solaris equiv is ISPTM */
|
||||
#define TARGET_TIOCGPTN TARGET_IO_('t', 134) /* Get Pty Number */
|
||||
#define TARGET_TIOCSPTLCK TARGET_IO_('t', 135) /* Lock/unlock PTY */
|
||||
|
||||
/* Little f */
|
||||
#define TARGET_FIOCLEX TARGET_IO('f', 1)
|
||||
#define TARGET_FIONCLEX TARGET_IO('f', 2)
|
||||
#define TARGET_FIOASYNC TARGET_IOW('f', 125, int)
|
||||
#define TARGET_FIONBIO TARGET_IOW('f', 126, int)
|
||||
#define TARGET_FIONREAD TARGET_IOR('f', 127, int)
|
||||
#define TARGET_TIOCINQ TARGET_FIONREAD
|
||||
|
||||
/* SCARY Rutgers local SunOS kernel hackery, perhaps I will support it
|
||||
* someday. This is completely bogus, I know...
|
||||
*/
|
||||
//#define __TCGETSTAT TARGET_IO('T', 200) /* Rutgers specific */
|
||||
//#define __TCSETSTAT TARGET_IO('T', 201) /* Rutgers specific */
|
||||
|
||||
/* Linux specific, no SunOS equivalent. */
|
||||
#define TARGET_TIOCLINUX 0x541C
|
||||
#define TARGET_TIOCGSERIAL 0x541E
|
||||
#define TARGET_TIOCSSERIAL 0x541F
|
||||
#define TARGET_TCSBRKP 0x5425
|
||||
#define TARGET_TIOCTTYGSTRUCT 0x5426
|
||||
#define TARGET_TIOCSERCONFIG 0x5453
|
||||
#define TARGET_TIOCSERGWILD 0x5454
|
||||
#define TARGET_TIOCSERSWILD 0x5455
|
||||
#define TARGET_TIOCGLCKTRMIOS 0x5456
|
||||
#define TARGET_TIOCSLCKTRMIOS 0x5457
|
||||
#define TARGET_TIOCSERGSTRUCT 0x5458 /* For debugging only */
|
||||
#define TARGET_TIOCSERGETLSR 0x5459 /* Get line status register */
|
||||
#define TARGET_TIOCSERGETMULTI 0x545A /* Get multiport config */
|
||||
#define TARGET_TIOCSERSETMULTI 0x545B /* Set multiport config */
|
||||
#define TARGET_TIOCMIWAIT 0x545C /* Wait input */
|
||||
#define TARGET_TIOCGICOUNT 0x545D /* Read serial port inline interrupt counts */
|
|
@ -21,16 +21,16 @@ typedef struct target_sigaltstack {
|
|||
#define TARGET_MINSIGSTKSZ 4096
|
||||
#define TARGET_SIGSTKSZ 16384
|
||||
|
||||
#ifndef UREG_I6
|
||||
#define UREG_I6 6
|
||||
#ifndef UREG_O6
|
||||
#define UREG_O6 6
|
||||
#endif
|
||||
#ifndef UREG_FP
|
||||
#define UREG_FP UREG_I6
|
||||
#ifndef UREG_SP
|
||||
#define UREG_SP UREG_O6
|
||||
#endif
|
||||
|
||||
static inline abi_ulong get_sp_from_cpustate(CPUSPARCState *state)
|
||||
{
|
||||
return state->regwptr[UREG_FP];
|
||||
return state->regwptr[UREG_SP];
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -21,16 +21,16 @@ typedef struct target_sigaltstack {
|
|||
#define TARGET_MINSIGSTKSZ 4096
|
||||
#define TARGET_SIGSTKSZ 16384
|
||||
|
||||
#ifndef UREG_I6
|
||||
#define UREG_I6 6
|
||||
#ifndef UREG_O6
|
||||
#define UREG_O6 6
|
||||
#endif
|
||||
#ifndef UREG_FP
|
||||
#define UREG_FP UREG_I6
|
||||
#ifndef UREG_SP
|
||||
#define UREG_SP UREG_O6
|
||||
#endif
|
||||
|
||||
static inline abi_ulong get_sp_from_cpustate(CPUSPARCState *state)
|
||||
{
|
||||
return state->regwptr[UREG_FP];
|
||||
return state->regwptr[UREG_SP];
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -5,6 +5,9 @@
|
|||
#include <sys/shm.h>
|
||||
#include <sys/select.h>
|
||||
#include <sys/mount.h>
|
||||
#include <sys/mman.h>
|
||||
#include <sys/syscall.h>
|
||||
#include <unistd.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <netinet/tcp.h>
|
||||
#include <linux/if_packet.h>
|
||||
|
@ -73,6 +76,7 @@ UNUSED static void print_socket_protocol(int domain, int type, int protocol);
|
|||
/*
|
||||
* Utility functions
|
||||
*/
|
||||
#if defined(TARGET_NR_semctl) || defined(TARGET_NR_ipc)
|
||||
static void
|
||||
print_ipc_cmd(int cmd)
|
||||
{
|
||||
|
@ -120,6 +124,7 @@ if( cmd == val ) { \
|
|||
/* Some value we don't recognize */
|
||||
gemu_log("%d",cmd);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
print_signal(abi_ulong arg, int last)
|
||||
|
@ -188,6 +193,7 @@ static void print_si_code(int arg)
|
|||
gemu_log("%s", codename);
|
||||
}
|
||||
|
||||
#if defined(TARGET_NR_rt_sigqueueinfo) || defined(TARGET_NR_rt_tgsigqueueinfo)
|
||||
static void get_target_siginfo(target_siginfo_t *tinfo,
|
||||
const target_siginfo_t *info)
|
||||
{
|
||||
|
@ -241,8 +247,10 @@ static void get_target_siginfo(target_siginfo_t *tinfo,
|
|||
case TARGET_SIGCHLD:
|
||||
__get_user(tinfo->_sifields._sigchld._pid,
|
||||
&info->_sifields._sigchld._pid);
|
||||
#if !defined(TARGET_ABI_IRIX) && !defined(TARGET_ABI_SOLARIS)
|
||||
__get_user(tinfo->_sifields._sigchld._uid,
|
||||
&info->_sifields._sigchld._uid);
|
||||
#endif
|
||||
__get_user(tinfo->_sifields._sigchld._status,
|
||||
&info->_sifields._sigchld._status);
|
||||
__get_user(tinfo->_sifields._sigchld._utime,
|
||||
|
@ -274,6 +282,7 @@ static void get_target_siginfo(target_siginfo_t *tinfo,
|
|||
|
||||
tinfo->si_code = deposit32(si_code, 16, 16, si_type);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void print_siginfo(const target_siginfo_t *tinfo)
|
||||
{
|
||||
|
@ -303,8 +312,8 @@ static void print_siginfo(const target_siginfo_t *tinfo)
|
|||
tinfo->_sifields._timer._timer2);
|
||||
break;
|
||||
case QEMU_SI_POLL:
|
||||
gemu_log(", si_band=%d, si_fd=%d",
|
||||
tinfo->_sifields._sigpoll._band,
|
||||
gemu_log(", si_band = "TARGET_ABI_FMT_ld", si_fd = %d",
|
||||
(abi_long)tinfo->_sifields._sigpoll._band,
|
||||
tinfo->_sifields._sigpoll._fd);
|
||||
break;
|
||||
case QEMU_SI_FAULT:
|
||||
|
@ -312,14 +321,20 @@ static void print_siginfo(const target_siginfo_t *tinfo)
|
|||
print_pointer(tinfo->_sifields._sigfault._addr, 1);
|
||||
break;
|
||||
case QEMU_SI_CHLD:
|
||||
gemu_log(", si_pid=%u, si_uid=%u, si_status=%d"
|
||||
gemu_log(", si_pid = %u"
|
||||
#if !defined(TARGET_ABI_IRIX) && !defined(TARGET_ABI_SOLARIS)
|
||||
", si_uid = %u"
|
||||
#endif
|
||||
", si_status = %d"
|
||||
", si_utime=" TARGET_ABI_FMT_ld
|
||||
", si_stime=" TARGET_ABI_FMT_ld,
|
||||
(unsigned int)(tinfo->_sifields._sigchld._pid),
|
||||
#if !defined(TARGET_ABI_IRIX) && !defined(TARGET_ABI_SOLARIS)
|
||||
(unsigned int)(tinfo->_sifields._sigchld._uid),
|
||||
#endif
|
||||
tinfo->_sifields._sigchld._status,
|
||||
tinfo->_sifields._sigchld._utime,
|
||||
tinfo->_sifields._sigchld._stime);
|
||||
(abi_long)tinfo->_sifields._sigchld._utime,
|
||||
(abi_long)tinfo->_sifields._sigchld._stime);
|
||||
break;
|
||||
case QEMU_SI_RT:
|
||||
gemu_log(", si_pid=%u, si_uid=%u, si_sigval=" TARGET_ABI_FMT_ld,
|
||||
|
@ -451,17 +466,22 @@ print_socket_type(int type)
|
|||
case TARGET_SOCK_SEQPACKET:
|
||||
gemu_log("SOCK_SEQPACKET");
|
||||
break;
|
||||
#ifdef TARGET_SOCK_PACKET
|
||||
case TARGET_SOCK_PACKET:
|
||||
gemu_log("SOCK_PACKET");
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
print_socket_protocol(int domain, int type, int protocol)
|
||||
{
|
||||
if (domain == AF_PACKET ||
|
||||
(domain == AF_INET && type == TARGET_SOCK_PACKET)) {
|
||||
if (domain == AF_PACKET
|
||||
#ifdef TARGET_SOCK_PACKET
|
||||
|| (domain == AF_INET && type == TARGET_SOCK_PACKET)
|
||||
#endif
|
||||
) {
|
||||
switch (protocol) {
|
||||
case 0x0003:
|
||||
gemu_log("ETH_P_ALL");
|
||||
|
@ -725,6 +745,7 @@ print_syscall_ret_newselect(const struct syscallname *name, abi_long ret)
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifdef TARGET_NR_adjtimex
|
||||
/* special meanings of adjtimex()' non-negative return values */
|
||||
#define TARGET_TIME_OK 0 /* clock synchronized, no leap second */
|
||||
#define TARGET_TIME_INS 1 /* insert leap second */
|
||||
|
@ -770,6 +791,7 @@ print_syscall_ret_adjtimex(const struct syscallname *name, abi_long ret)
|
|||
|
||||
gemu_log("\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
UNUSED static struct flags access_flags[] = {
|
||||
FLAG_GENERIC(F_OK),
|
||||
|
@ -1410,6 +1432,7 @@ print_fcntl(const struct syscallname *name,
|
|||
gemu_log("F_SETOWN,");
|
||||
print_raw_param(TARGET_ABI_FMT_ld, arg2, 0);
|
||||
break;
|
||||
#ifdef TARGET_F_SETSIG
|
||||
case TARGET_F_GETSIG:
|
||||
gemu_log("F_GETSIG");
|
||||
break;
|
||||
|
@ -1417,6 +1440,7 @@ print_fcntl(const struct syscallname *name,
|
|||
gemu_log("F_SETSIG,");
|
||||
print_raw_param(TARGET_ABI_FMT_ld, arg2, 0);
|
||||
break;
|
||||
#endif
|
||||
#if TARGET_ABI_BITS == 32
|
||||
case TARGET_F_GETLK64:
|
||||
gemu_log("F_GETLK64,");
|
||||
|
@ -1543,8 +1567,11 @@ print_socket(const struct syscallname *name,
|
|||
gemu_log(",");
|
||||
print_socket_type(type);
|
||||
gemu_log(",");
|
||||
if (domain == AF_PACKET ||
|
||||
(domain == AF_INET && type == TARGET_SOCK_PACKET)) {
|
||||
if (domain == AF_PACKET
|
||||
#ifdef TARGET_SOCK_PACKET
|
||||
|| (domain == AF_INET && type == TARGET_SOCK_PACKET)
|
||||
#endif
|
||||
) {
|
||||
protocol = tswap16(protocol);
|
||||
}
|
||||
print_socket_protocol(domain, type, protocol);
|
||||
|
@ -1888,16 +1915,25 @@ print_socketcall(const struct syscallname *name,
|
|||
}
|
||||
#endif
|
||||
|
||||
#if defined(TARGET_NR_stat) || defined(TARGET_NR_stat64) || \
|
||||
defined(TARGET_NR_lstat) || defined(TARGET_NR_lstat64)
|
||||
#if defined(TARGET_NR_stat) || defined(TARGET_NR_stat64) || defined(TARGET_NR_xstat) || \
|
||||
defined(TARGET_NR_lstat) || defined(TARGET_NR_lstat64) || defined(TARGET_NR_lxstat)
|
||||
static void
|
||||
print_stat(const struct syscallname *name,
|
||||
abi_long arg0, abi_long arg1, abi_long arg2,
|
||||
abi_long arg3, abi_long arg4, abi_long arg5)
|
||||
{
|
||||
print_syscall_prologue(name);
|
||||
#if defined(TARGET_NR_xstat) || defined(TARGET_NR_lxstat)
|
||||
if (name->nr == TARGET_NR_xstat || name->nr == TARGET_NR_lxstat) {
|
||||
print_raw_param("%d", arg0, 0);
|
||||
print_string(arg1, 0);
|
||||
print_pointer(arg2, 1);
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
print_string(arg0, 0);
|
||||
print_pointer(arg1, 1);
|
||||
}
|
||||
print_syscall_epilogue(name);
|
||||
}
|
||||
#define print_lstat print_stat
|
||||
|
@ -1905,15 +1941,24 @@ print_stat(const struct syscallname *name,
|
|||
#define print_lstat64 print_stat
|
||||
#endif
|
||||
|
||||
#if defined(TARGET_NR_fstat) || defined(TARGET_NR_fstat64)
|
||||
#if defined(TARGET_NR_fstat) || defined(TARGET_NR_fstat64) || defined(TARGET_NR_fxstat)
|
||||
static void
|
||||
print_fstat(const struct syscallname *name,
|
||||
abi_long arg0, abi_long arg1, abi_long arg2,
|
||||
abi_long arg3, abi_long arg4, abi_long arg5)
|
||||
{
|
||||
print_syscall_prologue(name);
|
||||
#ifdef TARGET_NR_fxstat
|
||||
if (name->nr == TARGET_NR_fxstat) {
|
||||
print_raw_param("%d", arg0, 0);
|
||||
print_raw_param("%d", arg1, 0);
|
||||
print_pointer(arg2, 1);
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
print_raw_param("%d", arg0, 0);
|
||||
print_pointer(arg1, 1);
|
||||
}
|
||||
print_syscall_epilogue(name);
|
||||
}
|
||||
#define print_fstat64 print_fstat
|
||||
|
@ -2605,7 +2650,7 @@ print_syscall(int num,
|
|||
int i;
|
||||
const char *format="%s(" TARGET_ABI_FMT_ld "," TARGET_ABI_FMT_ld "," TARGET_ABI_FMT_ld "," TARGET_ABI_FMT_ld "," TARGET_ABI_FMT_ld "," TARGET_ABI_FMT_ld ")";
|
||||
|
||||
gemu_log("%d ", getpid() );
|
||||
gemu_log("%ld ", syscall(SYS_gettid) );
|
||||
|
||||
for(i=0;i<nsyscalls;i++)
|
||||
if( scnames[i].nr == num ) {
|
||||
|
@ -2620,7 +2665,8 @@ print_syscall(int num,
|
|||
}
|
||||
return;
|
||||
}
|
||||
gemu_log("Unknown syscall %d\n", num);
|
||||
gemu_log("Unknown syscall %d", num);
|
||||
gemu_log(format,"", arg1,arg2,arg3,arg4,arg5,arg6);
|
||||
}
|
||||
|
||||
|
||||
|
@ -2634,19 +2680,19 @@ print_syscall_ret(int num, abi_long ret)
|
|||
if( scnames[i].nr == num ) {
|
||||
if( scnames[i].result != NULL ) {
|
||||
scnames[i].result(&scnames[i],ret);
|
||||
} else {
|
||||
if (ret < 0) {
|
||||
errstr = target_strerror(-ret);
|
||||
}
|
||||
if (errstr) {
|
||||
gemu_log(" = -1 errno=" TARGET_ABI_FMT_ld " (%s)\n",
|
||||
-ret, errstr);
|
||||
} else {
|
||||
gemu_log(" = " TARGET_ABI_FMT_ld "\n", ret);
|
||||
}
|
||||
return;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (ret < 0) {
|
||||
errstr = target_strerror(-ret);
|
||||
}
|
||||
if (errstr) {
|
||||
gemu_log(" = -1 errno=" TARGET_ABI_FMT_ld " (%s)\n",
|
||||
-ret, errstr);
|
||||
} else {
|
||||
gemu_log(" = " TARGET_ABI_FMT_ld "\n", ret);
|
||||
}
|
||||
}
|
||||
|
||||
void print_taken_signal(int target_signum, const target_siginfo_t *tinfo)
|
||||
|
|
|
@ -361,6 +361,9 @@
|
|||
#ifdef TARGET_NR_getrlimit
|
||||
{ TARGET_NR_getrlimit, "getrlimit" , NULL, NULL, NULL },
|
||||
#endif
|
||||
#ifdef TARGET_NR_getrlimit64
|
||||
{ TARGET_NR_getrlimit64, "getrlimit64" , NULL, NULL, NULL },
|
||||
#endif
|
||||
#ifdef TARGET_NR_get_robust_list
|
||||
{ TARGET_NR_get_robust_list, "get_robust_list" , NULL, NULL, NULL },
|
||||
#endif
|
||||
|
@ -485,9 +488,6 @@
|
|||
#ifdef TARGET_NR_linkat
|
||||
{ TARGET_NR_linkat, "linkat" , NULL, print_linkat, NULL },
|
||||
#endif
|
||||
#ifdef TARGET_NR_Linux
|
||||
{ TARGET_NR_Linux, "Linux" , NULL, NULL, NULL },
|
||||
#endif
|
||||
#ifdef TARGET_NR_listen
|
||||
{ TARGET_NR_listen, "listen" , NULL, NULL, NULL },
|
||||
#endif
|
||||
|
@ -575,6 +575,9 @@
|
|||
#ifdef TARGET_NR_mmap2
|
||||
{ TARGET_NR_mmap2, "mmap2" , NULL, print_mmap2, print_syscall_ret_addr },
|
||||
#endif
|
||||
#ifdef TARGET_NR_mmap64
|
||||
{ TARGET_NR_mmap64, "mmap64" , NULL, NULL, print_syscall_ret_addr },
|
||||
#endif
|
||||
#ifdef TARGET_NR_modify_ldt
|
||||
{ TARGET_NR_modify_ldt, "modify_ldt" , NULL, NULL, NULL },
|
||||
#endif
|
||||
|
@ -644,6 +647,12 @@
|
|||
#ifdef TARGET_NR_nanosleep
|
||||
{ TARGET_NR_nanosleep, "nanosleep" , NULL, NULL, NULL },
|
||||
#endif
|
||||
#ifdef TARGET_NR_ngetdents
|
||||
{ TARGET_NR_ngetdents, "ngetdents" , NULL, NULL, NULL },
|
||||
#endif
|
||||
#ifdef TARGET_NR_ngetdents64
|
||||
{ TARGET_NR_ngetdents64, "ngetdents64" , NULL, NULL, NULL },
|
||||
#endif
|
||||
#ifdef TARGET_NR_fstatat64
|
||||
{ TARGET_NR_fstatat64, "fstatat64" , NULL, print_fstatat64, NULL },
|
||||
#endif
|
||||
|
@ -680,9 +689,15 @@
|
|||
#ifdef TARGET_NR_open
|
||||
{ TARGET_NR_open, "open" , NULL, print_open, NULL },
|
||||
#endif
|
||||
#ifdef TARGET_NR_open64
|
||||
{ TARGET_NR_open64, "open64" , NULL, print_open, NULL },
|
||||
#endif
|
||||
#ifdef TARGET_NR_openat
|
||||
{ TARGET_NR_openat, "openat" , NULL, print_openat, NULL },
|
||||
#endif
|
||||
#ifdef TARGET_NR_openat64
|
||||
{ TARGET_NR_openat64, "openat64" , NULL, print_openat, NULL },
|
||||
#endif
|
||||
#ifdef TARGET_NR_osf_adjtime
|
||||
{ TARGET_NR_osf_adjtime, "osf_adjtime" , NULL, NULL, NULL },
|
||||
#endif
|
||||
|
@ -1328,6 +1343,9 @@
|
|||
#ifdef TARGET_NR_setrlimit
|
||||
{ TARGET_NR_setrlimit, "setrlimit" , NULL, NULL, NULL },
|
||||
#endif
|
||||
#ifdef TARGET_NR_setrlimit64
|
||||
{ TARGET_NR_setrlimit64, "setrlimit64" , NULL, NULL, NULL },
|
||||
#endif
|
||||
#ifdef TARGET_NR_set_robust_list
|
||||
{ TARGET_NR_set_robust_list, "set_robust_list" , NULL, NULL, NULL },
|
||||
#endif
|
||||
|
@ -1359,6 +1377,12 @@
|
|||
#ifdef TARGET_NR_sgetmask
|
||||
{ TARGET_NR_sgetmask, "sgetmask" , NULL, NULL, NULL },
|
||||
#endif
|
||||
#ifdef TARGET_NR_sgiprctl
|
||||
{ TARGET_NR_sgiprctl, "sgiprctl" , NULL, NULL, NULL },
|
||||
#endif
|
||||
#ifdef TARGET_NR_sgisysinfo
|
||||
{ TARGET_NR_sgisysinfo, "sgisysinfo" , NULL, NULL, NULL },
|
||||
#endif
|
||||
#ifdef TARGET_NR_shmat
|
||||
{ TARGET_NR_shmat, "shmat" , NULL, NULL, print_syscall_ret_addr },
|
||||
#endif
|
||||
|
@ -1491,6 +1515,12 @@
|
|||
#ifdef TARGET_NR_sysmips
|
||||
{ TARGET_NR_sysmips, "sysmips" , NULL, NULL, NULL },
|
||||
#endif
|
||||
#ifdef TARGET_NR_sysmp
|
||||
{ TARGET_NR_sysmp, "sysmp" , NULL, NULL, NULL },
|
||||
#endif
|
||||
#ifdef TARGET_NR_syssgi
|
||||
{ TARGET_NR_syssgi, "syssgi" , NULL, NULL, NULL },
|
||||
#endif
|
||||
#ifdef TARGET_NR_sys_setaltroot
|
||||
{ TARGET_NR_sys_setaltroot, "sys_setaltroot" , NULL, NULL, NULL },
|
||||
#endif
|
||||
|
@ -1641,6 +1671,18 @@
|
|||
#ifdef TARGET_NR_writev
|
||||
{ TARGET_NR_writev, "writev" , "%s(%d,%p,%#x)", NULL, NULL },
|
||||
#endif
|
||||
#ifdef TARGET_NR_fxstat
|
||||
{ TARGET_NR_fxstat, "fxstat" , NULL, print_fstat, NULL },
|
||||
#endif
|
||||
#ifdef TARGET_NR_lxstat
|
||||
{ TARGET_NR_lxstat, "lxstat" , NULL, print_lstat, NULL },
|
||||
#endif
|
||||
#ifdef TARGET_NR_xstat
|
||||
{ TARGET_NR_xstat, "xstat" , NULL, print_stat, NULL },
|
||||
#endif
|
||||
#ifdef TARGET_NR_lseek64
|
||||
{ TARGET_NR_lseek64, "lseek64" , NULL, NULL, NULL },
|
||||
#endif
|
||||
#ifdef TARGET_NR_utimensat
|
||||
{ TARGET_NR_utimensat, "utimensat", NULL, print_utimensat, NULL },
|
||||
#endif
|
||||
|
@ -1659,3 +1701,36 @@
|
|||
#ifdef TARGET_NR_atomic_barrier
|
||||
{ TARGET_NR_atomic_barrier, "atomic_barrier", NULL, NULL, NULL },
|
||||
#endif
|
||||
#ifdef TARGET_NR_getcontext
|
||||
{ TARGET_NR_getcontext, "getcontext", NULL, NULL, NULL },
|
||||
#endif
|
||||
#ifdef TARGET_NR_setcontext
|
||||
{ TARGET_NR_setcontext, "setcontext", NULL, NULL, NULL },
|
||||
#endif
|
||||
#ifdef TARGET_NR_statvfs
|
||||
{ TARGET_NR_statvfs, "statvfs", NULL, NULL, NULL },
|
||||
#endif
|
||||
#ifdef TARGET_NR_statvfs64
|
||||
{ TARGET_NR_statvfs64, "statvfs64", NULL, NULL, NULL },
|
||||
#endif
|
||||
#ifdef TARGET_NR_fstatvfs
|
||||
{ TARGET_NR_fstatvfs, "fstatvfs", NULL, NULL, NULL },
|
||||
#endif
|
||||
#ifdef TARGET_NR_fstatvfs64
|
||||
{ TARGET_NR_fstatvfs64, "fstatvfs64", NULL, NULL, NULL },
|
||||
#endif
|
||||
#ifdef TARGET_NR_sproc
|
||||
{ TARGET_NR_sproc, "sproc", NULL, NULL, NULL },
|
||||
#endif
|
||||
#ifdef TARGET_NR_nsproc
|
||||
{ TARGET_NR_nsproc, "nsproc", NULL, NULL, NULL },
|
||||
#endif
|
||||
#ifdef TARGET_NR_procblk
|
||||
{ TARGET_NR_procblk, "procblk", NULL, NULL, NULL },
|
||||
#endif
|
||||
#ifdef TARGET_NR_psema_cntl
|
||||
{ TARGET_NR_psema_cntl, "psema_cntl", NULL, NULL, NULL },
|
||||
#endif
|
||||
#ifdef TARGET_NR_usync_cntl
|
||||
{ TARGET_NR_usync_cntl, "usync_cntl", NULL, NULL, NULL },
|
||||
#endif
|
||||
|
|
3051
linux-user/syscall.c
3051
linux-user/syscall.c
File diff suppressed because it is too large
Load Diff
|
@ -203,12 +203,21 @@ struct target_ip_mreq_source {
|
|||
};
|
||||
|
||||
struct target_timeval {
|
||||
#if defined(TARGET_ABI_IRIX) && defined(TARGET_ABI_MIPSN64)
|
||||
int tv_pad1;
|
||||
abi_int tv_sec;
|
||||
#else
|
||||
abi_long tv_sec;
|
||||
#endif
|
||||
abi_long tv_usec;
|
||||
};
|
||||
|
||||
struct target_timespec {
|
||||
#if defined(TARGET_ABI_IRIX) && defined(TARGET_ABI_MIPSN64)
|
||||
abi_int tv_sec;
|
||||
#else
|
||||
abi_long tv_sec;
|
||||
#endif
|
||||
abi_long tv_nsec;
|
||||
};
|
||||
|
||||
|
@ -255,7 +264,11 @@ struct target_timex {
|
|||
abi_int:32; abi_int:32; abi_int:32;
|
||||
};
|
||||
|
||||
#ifdef TARGET_ABI_IRIX
|
||||
typedef abi_int target_clock_t;
|
||||
#else
|
||||
typedef abi_long target_clock_t;
|
||||
#endif
|
||||
|
||||
#define TARGET_HZ 100
|
||||
|
||||
|
@ -267,8 +280,13 @@ struct target_tms {
|
|||
};
|
||||
|
||||
struct target_utimbuf {
|
||||
#ifdef TARGET_ABI_IRIX
|
||||
abi_int actime;
|
||||
abi_int modtime;
|
||||
#else
|
||||
abi_long actime;
|
||||
abi_long modtime;
|
||||
#endif
|
||||
};
|
||||
|
||||
struct target_sel_arg_struct {
|
||||
|
@ -286,9 +304,15 @@ struct target_msghdr {
|
|||
abi_long msg_name; /* Socket name */
|
||||
int msg_namelen; /* Length of name */
|
||||
abi_long msg_iov; /* Data blocks */
|
||||
#ifdef TARGET_ABI_IRIX
|
||||
abi_int msg_iovlen; /* Number of blocks */
|
||||
abi_long msg_control; /* Per protocol magic (eg BSD file descriptor passing) */
|
||||
abi_int msg_controllen; /* Length of cmsg list */
|
||||
#else
|
||||
abi_long msg_iovlen; /* Number of blocks */
|
||||
abi_long msg_control; /* Per protocol magic (eg BSD file descriptor passing) */
|
||||
abi_long msg_controllen; /* Length of cmsg list */
|
||||
#endif
|
||||
unsigned int msg_flags;
|
||||
};
|
||||
|
||||
|
@ -376,7 +400,9 @@ struct target_dirent64 {
|
|||
uint64_t d_ino;
|
||||
int64_t d_off;
|
||||
unsigned short d_reclen;
|
||||
#if !defined TARGET_ABI_IRIX && !defined TARGET_ABI_SOLARIS
|
||||
unsigned char d_type;
|
||||
#endif
|
||||
char d_name[256];
|
||||
};
|
||||
|
||||
|
@ -386,24 +412,38 @@ struct target_dirent64 {
|
|||
#define TARGET_SIG_IGN ((abi_long)1) /* ignore signal */
|
||||
#define TARGET_SIG_ERR ((abi_long)-1) /* error return from signal */
|
||||
|
||||
#ifdef TARGET_MIPS
|
||||
#if defined TARGET_MIPS || defined TARGET_ABI_SOLARIS
|
||||
#define TARGET_NSIG 128
|
||||
#else
|
||||
#define TARGET_NSIG 64
|
||||
#endif
|
||||
|
||||
#if defined TARGET_ABI_IRIX || defined TARGET_ABI_SOLARIS
|
||||
#define TARGET_NSIG_BPW (8*sizeof(uint32_t))
|
||||
#define TARGET_NSIG_WORDS (TARGET_NSIG / TARGET_NSIG_BPW)
|
||||
|
||||
typedef struct {
|
||||
uint32_t sig[TARGET_NSIG_WORDS];
|
||||
} target_sigset_t;
|
||||
#else
|
||||
#define TARGET_NSIG_BPW TARGET_ABI_BITS
|
||||
#define TARGET_NSIG_WORDS (TARGET_NSIG / TARGET_NSIG_BPW)
|
||||
|
||||
typedef struct {
|
||||
abi_ulong sig[TARGET_NSIG_WORDS];
|
||||
} target_sigset_t;
|
||||
#endif
|
||||
|
||||
#ifdef BSWAP_NEEDED
|
||||
static inline void tswap_sigset(target_sigset_t *d, const target_sigset_t *s)
|
||||
{
|
||||
int i;
|
||||
for(i = 0;i < TARGET_NSIG_WORDS; i++)
|
||||
#if defined TARGET_ABI_IRIX || defined TARGET_ABI_SOLARIS
|
||||
d->sig[i] = tswap32(s->sig[i]);
|
||||
#else
|
||||
d->sig[i] = tswapal(s->sig[i]);
|
||||
#endif
|
||||
}
|
||||
#else
|
||||
static inline void tswap_sigset(target_sigset_t *d, const target_sigset_t *s)
|
||||
|
@ -427,7 +467,7 @@ void host_to_target_old_sigset(abi_ulong *old_sigset,
|
|||
void target_to_host_old_sigset(sigset_t *sigset,
|
||||
const abi_ulong *old_sigset);
|
||||
struct target_sigaction;
|
||||
int do_sigaction(int sig, const struct target_sigaction *act,
|
||||
int do_sigaction(CPUArchState *env, int sig, const struct target_sigaction *act,
|
||||
struct target_sigaction *oact);
|
||||
|
||||
#if defined(TARGET_I386) || defined(TARGET_ARM) || defined(TARGET_SPARC) \
|
||||
|
@ -438,7 +478,15 @@ int do_sigaction(int sig, const struct target_sigaction *act,
|
|||
|| defined(TARGET_TILEGX) || defined(TARGET_HPPA) || defined(TARGET_NIOS2) \
|
||||
|| defined(TARGET_RISCV)
|
||||
|
||||
#if defined(TARGET_SPARC)
|
||||
#if defined(TARGET_ABI_IRIX) || defined(TARGET_ABI_SOLARIS)
|
||||
#define TARGET_SA_NOCLDSTOP 0x00020000
|
||||
#define TARGET_SA_NOCLDWAIT 0x00010000
|
||||
#define TARGET_SA_SIGINFO 0x00000008
|
||||
#define TARGET_SA_ONSTACK 0x00000001
|
||||
#define TARGET_SA_RESTART 0x00000004
|
||||
#define TARGET_SA_NODEFER 0x00000010
|
||||
#define TARGET_SA_RESETHAND 0x00000002
|
||||
#elif defined(TARGET_SPARC)
|
||||
#define TARGET_SA_NOCLDSTOP 8u
|
||||
#define TARGET_SA_NOCLDWAIT 0x100u
|
||||
#define TARGET_SA_SIGINFO 0x200u
|
||||
|
@ -536,47 +584,7 @@ int do_sigaction(int sig, const struct target_sigaction *act,
|
|||
#define TARGET_SIG_UNBLOCK 2
|
||||
#define TARGET_SIG_SETMASK 3
|
||||
|
||||
#elif defined(TARGET_SPARC)
|
||||
|
||||
#define TARGET_SIGHUP 1
|
||||
#define TARGET_SIGINT 2
|
||||
#define TARGET_SIGQUIT 3
|
||||
#define TARGET_SIGILL 4
|
||||
#define TARGET_SIGTRAP 5
|
||||
#define TARGET_SIGABRT 6
|
||||
#define TARGET_SIGIOT 6
|
||||
#define TARGET_SIGSTKFLT 7 /* actually EMT */
|
||||
#define TARGET_SIGFPE 8
|
||||
#define TARGET_SIGKILL 9
|
||||
#define TARGET_SIGBUS 10
|
||||
#define TARGET_SIGSEGV 11
|
||||
#define TARGET_SIGSYS 12
|
||||
#define TARGET_SIGPIPE 13
|
||||
#define TARGET_SIGALRM 14
|
||||
#define TARGET_SIGTERM 15
|
||||
#define TARGET_SIGURG 16
|
||||
#define TARGET_SIGSTOP 17
|
||||
#define TARGET_SIGTSTP 18
|
||||
#define TARGET_SIGCONT 19
|
||||
#define TARGET_SIGCHLD 20
|
||||
#define TARGET_SIGTTIN 21
|
||||
#define TARGET_SIGTTOU 22
|
||||
#define TARGET_SIGIO 23
|
||||
#define TARGET_SIGXCPU 24
|
||||
#define TARGET_SIGXFSZ 25
|
||||
#define TARGET_SIGVTALRM 26
|
||||
#define TARGET_SIGPROF 27
|
||||
#define TARGET_SIGWINCH 28
|
||||
#define TARGET_SIGPWR 29
|
||||
#define TARGET_SIGUSR1 30
|
||||
#define TARGET_SIGUSR2 31
|
||||
#define TARGET_SIGRTMIN 32
|
||||
|
||||
#define TARGET_SIG_BLOCK 0x01 /* for blocking signals */
|
||||
#define TARGET_SIG_UNBLOCK 0x02 /* for unblocking signals */
|
||||
#define TARGET_SIG_SETMASK 0x04 /* for setting the signal mask */
|
||||
|
||||
#elif defined(TARGET_MIPS)
|
||||
#elif defined(TARGET_MIPS) || defined(TARGET_ABI_SOLARIS)
|
||||
|
||||
#define TARGET_SIGHUP 1 /* Hangup (POSIX). */
|
||||
#define TARGET_SIGINT 2 /* Interrupt (ANSI). */
|
||||
|
@ -613,7 +621,11 @@ int do_sigaction(int sig, const struct target_sigaction *act,
|
|||
#define TARGET_SIGPROF 29 /* Profiling alarm clock (4.2 BSD). */
|
||||
#define TARGET_SIGXCPU 30 /* CPU limit exceeded (4.2 BSD). */
|
||||
#define TARGET_SIGXFSZ 31 /* File size limit exceeded (4.2 BSD). */
|
||||
#ifdef TARGET_ABI_SOLARIS
|
||||
#define TARGET_SIGRTMIN 42
|
||||
#else
|
||||
#define TARGET_SIGRTMIN 32
|
||||
#endif
|
||||
|
||||
#define TARGET_SIG_BLOCK 1 /* for blocking signals */
|
||||
#define TARGET_SIG_UNBLOCK 2 /* for unblocking signals */
|
||||
|
@ -659,6 +671,46 @@ int do_sigaction(int sig, const struct target_sigaction *act,
|
|||
#define TARGET_SIG_UNBLOCK 1
|
||||
#define TARGET_SIG_SETMASK 2
|
||||
|
||||
#elif defined(TARGET_SPARC)
|
||||
|
||||
#define TARGET_SIGHUP 1
|
||||
#define TARGET_SIGINT 2
|
||||
#define TARGET_SIGQUIT 3
|
||||
#define TARGET_SIGILL 4
|
||||
#define TARGET_SIGTRAP 5
|
||||
#define TARGET_SIGABRT 6
|
||||
#define TARGET_SIGIOT 6
|
||||
#define TARGET_SIGSTKFLT 7 /* actually EMT */
|
||||
#define TARGET_SIGFPE 8
|
||||
#define TARGET_SIGKILL 9
|
||||
#define TARGET_SIGBUS 10
|
||||
#define TARGET_SIGSEGV 11
|
||||
#define TARGET_SIGSYS 12
|
||||
#define TARGET_SIGPIPE 13
|
||||
#define TARGET_SIGALRM 14
|
||||
#define TARGET_SIGTERM 15
|
||||
#define TARGET_SIGURG 16
|
||||
#define TARGET_SIGSTOP 17
|
||||
#define TARGET_SIGTSTP 18
|
||||
#define TARGET_SIGCONT 19
|
||||
#define TARGET_SIGCHLD 20
|
||||
#define TARGET_SIGTTIN 21
|
||||
#define TARGET_SIGTTOU 22
|
||||
#define TARGET_SIGIO 23
|
||||
#define TARGET_SIGXCPU 24
|
||||
#define TARGET_SIGXFSZ 25
|
||||
#define TARGET_SIGVTALRM 26
|
||||
#define TARGET_SIGPROF 27
|
||||
#define TARGET_SIGWINCH 28
|
||||
#define TARGET_SIGPWR 29
|
||||
#define TARGET_SIGUSR1 30
|
||||
#define TARGET_SIGUSR2 31
|
||||
#define TARGET_SIGRTMIN 32
|
||||
|
||||
#define TARGET_SIG_BLOCK 0x01 /* for blocking signals */
|
||||
#define TARGET_SIG_UNBLOCK 0x02 /* for unblocking signals */
|
||||
#define TARGET_SIG_SETMASK 0x04 /* for setting the signal mask */
|
||||
|
||||
#else
|
||||
|
||||
/* OpenRISC Using the general signals */
|
||||
|
@ -723,7 +775,7 @@ struct target_sigaction {
|
|||
target_sigset_t sa_mask;
|
||||
abi_ulong sa_restorer;
|
||||
};
|
||||
#elif defined(TARGET_MIPS)
|
||||
#elif defined(TARGET_MIPS) || defined(TARGET_ABI_SOLARIS)
|
||||
struct target_sigaction {
|
||||
uint32_t sa_flags;
|
||||
#if defined(TARGET_ABI_MIPSN32)
|
||||
|
@ -812,7 +864,7 @@ typedef struct {
|
|||
#define QEMU_SI_RT 5
|
||||
|
||||
typedef struct target_siginfo {
|
||||
#ifdef TARGET_MIPS
|
||||
#if defined(TARGET_MIPS) || defined(TARGET_ABI_SOLARIS)
|
||||
int si_signo;
|
||||
int si_code;
|
||||
int si_errno;
|
||||
|
@ -847,10 +899,17 @@ typedef struct target_siginfo {
|
|||
/* SIGCHLD */
|
||||
struct {
|
||||
pid_t _pid; /* which child */
|
||||
#if defined(TARGET_ABI_IRIX) || defined(TARGET_ABI_SOLARIS)
|
||||
target_clock_t _utime;
|
||||
int _status; /* exit code */
|
||||
target_clock_t _stime;
|
||||
int _swap;
|
||||
#else
|
||||
uid_t _uid; /* sender's uid */
|
||||
int _status; /* exit code */
|
||||
target_clock_t _utime;
|
||||
target_clock_t _stime;
|
||||
#endif
|
||||
} _sigchld;
|
||||
|
||||
/* SIGILL, SIGFPE, SIGSEGV, SIGBUS */
|
||||
|
@ -860,8 +919,13 @@ typedef struct target_siginfo {
|
|||
|
||||
/* SIGPOLL */
|
||||
struct {
|
||||
#if defined(TARGET_ABI_IRIX) || defined(TARGET_ABI_SOLARIS)
|
||||
int _fd;
|
||||
abi_long _band; /* POLL_IN, POLL_OUT, POLL_MSG */
|
||||
#else
|
||||
int _band; /* POLL_IN, POLL_OUT, POLL_MSG */
|
||||
int _fd;
|
||||
#endif
|
||||
} _sigpoll;
|
||||
} _sifields;
|
||||
} target_siginfo_t;
|
||||
|
@ -944,11 +1008,13 @@ struct target_rlimit {
|
|||
#define TARGET_RLIM_INFINITY 0x7fffffffffffffffull
|
||||
#elif defined(TARGET_MIPS) || (defined(TARGET_SPARC) && TARGET_ABI_BITS == 32)
|
||||
#define TARGET_RLIM_INFINITY 0x7fffffffUL
|
||||
#define TARGET_RLIM64_INFINITY 0x7fffffffffffffffull
|
||||
#else
|
||||
#define TARGET_RLIM_INFINITY ((abi_ulong)-1)
|
||||
#define TARGET_RLIM64_INFINITY ((uint64_t)-1)
|
||||
#endif
|
||||
|
||||
#if defined(TARGET_MIPS)
|
||||
#if defined(TARGET_MIPS) || defined(TARGET_ABI_SOLARIS)
|
||||
#define TARGET_RLIMIT_CPU 0
|
||||
#define TARGET_RLIMIT_FSIZE 1
|
||||
#define TARGET_RLIMIT_DATA 2
|
||||
|
@ -1008,6 +1074,10 @@ struct target_pollfd {
|
|||
#define TARGET_KDSETLED 0x4B32 /* set led state [lights, not flags] */
|
||||
#define TARGET_KDSIGACCEPT 0x4B4E
|
||||
|
||||
#ifdef TARGET_ABI_IRIX
|
||||
#define TARGET_SIOCNREAD 0x4004730a
|
||||
#endif
|
||||
|
||||
#if defined(TARGET_ALPHA) || defined(TARGET_MIPS) || defined(TARGET_SH4)
|
||||
#define TARGET_SIOCATMARK TARGET_IOR('s', 7, int)
|
||||
#define TARGET_SIOCGPGRP TARGET_IOR('s', 9, pid_t)
|
||||
|
@ -1311,10 +1381,21 @@ struct target_pollfd {
|
|||
|
||||
#define TARGET_NCC 8
|
||||
struct target_termio {
|
||||
#ifdef TARGET_ABI_IRIX
|
||||
uint32_t c_iflag; /* input mode flags */
|
||||
uint32_t c_oflag; /* output mode flags */
|
||||
uint32_t c_cflag; /* control mode flags */
|
||||
uint32_t c_lflag; /* local mode flags */
|
||||
#ifdef IRIX_NEW_TERMIO
|
||||
uint32_t c_ospeed;
|
||||
uint32_t c_ispeed;
|
||||
#endif
|
||||
#else
|
||||
unsigned short c_iflag; /* input mode flags */
|
||||
unsigned short c_oflag; /* output mode flags */
|
||||
unsigned short c_cflag; /* control mode flags */
|
||||
unsigned short c_lflag; /* local mode flags */
|
||||
#endif
|
||||
unsigned char c_line; /* line discipline */
|
||||
unsigned char c_cc[TARGET_NCC]; /* control characters */
|
||||
};
|
||||
|
@ -1356,6 +1437,9 @@ struct target_winsize {
|
|||
#define TARGET_MAP_NONBLOCK 0x20000 /* do not block on IO */
|
||||
#define TARGET_MAP_STACK 0x40000 /* ignored */
|
||||
#define TARGET_MAP_HUGETLB 0x80000 /* create a huge page mapping */
|
||||
#ifdef TARGET_ABI_IRIX
|
||||
#define TARGET_MAP_AUTOGROW 0x40
|
||||
#endif
|
||||
#elif defined(TARGET_PPC)
|
||||
#define TARGET_MAP_FIXED 0x10 /* Interpret addr exactly */
|
||||
#define TARGET_MAP_ANONYMOUS 0x20 /* don't use a file */
|
||||
|
@ -1392,6 +1476,19 @@ struct target_winsize {
|
|||
#define TARGET_MAP_NONBLOCK 0x20000 /* do not block on IO */
|
||||
#define TARGET_MAP_STACK 0x40000 /* ignored */
|
||||
#define TARGET_MAP_HUGETLB 0x80000 /* create a huge page mapping */
|
||||
#elif defined TARGET_ABI_SOLARIS
|
||||
#define TARGET_MAP_FIXED 0x10 /* Interpret addr exactly */
|
||||
#define TARGET_MAP_ANONYMOUS 0x0100 /* don't use a file */
|
||||
#define TARGET_MAP_GROWSDOWN 0 /* stack-like segment */
|
||||
#define TARGET_MAP_DENYWRITE 0 /* ETXTBSY */
|
||||
#define TARGET_MAP_EXECUTABLE 0x0400 /* mark it as an executable */
|
||||
#define TARGET_MAP_LOCKED 0 /* pages are locked */
|
||||
#define TARGET_MAP_NORESERVE 0x0040 /* don't check for reservations */
|
||||
#define TARGET_MAP_POPULATE 0 /* populate (prefault) pagetables */
|
||||
#define TARGET_MAP_NONBLOCK 0 /* do not block on IO */
|
||||
#define TARGET_MAP_UNINITIALIZED 0 /* for anonymous mmap, memory could be uninitialized */
|
||||
#define TARGET_MAP_STACK 0 /* ignored */
|
||||
#define TARGET_MAP_HUGETLB 0 /* create a huge page mapping */
|
||||
#else
|
||||
#define TARGET_MAP_FIXED 0x10 /* Interpret addr exactly */
|
||||
#define TARGET_MAP_ANONYMOUS 0x20 /* don't use a file */
|
||||
|
@ -1504,6 +1601,56 @@ struct target_eabi_stat64 {
|
|||
} QEMU_PACKED;
|
||||
#endif
|
||||
|
||||
#elif defined(TARGET_ABI_SOLARIS)
|
||||
|
||||
struct target_stat {
|
||||
abi_ulong st_dev;
|
||||
abi_long st_pad1[3];
|
||||
abi_ulong st_ino;
|
||||
abi_uint st_mode;
|
||||
abi_uint st_nlink;
|
||||
abi_int st_uid;
|
||||
abi_int st_gid;
|
||||
abi_ulong st_rdev;
|
||||
abi_long st_pad2[2];
|
||||
abi_long st_size;
|
||||
abi_long st_pad3;
|
||||
abi_long target_st_atime;
|
||||
abi_ulong __unused1;
|
||||
abi_long target_st_mtime;
|
||||
abi_ulong __unused2;
|
||||
abi_long target_st_ctime;
|
||||
abi_ulong __unused3;
|
||||
abi_int st_blksize;
|
||||
int64_t st_blocks;
|
||||
char st_fstype[16];
|
||||
abi_long __unused4[8];
|
||||
};
|
||||
|
||||
#define TARGET_HAS_STRUCT_STAT64
|
||||
struct target_stat64 {
|
||||
abi_ulong st_dev;
|
||||
abi_long st_pad1[3];
|
||||
uint64_t st_ino;
|
||||
abi_uint st_mode;
|
||||
abi_uint st_nlink;
|
||||
abi_int st_uid;
|
||||
abi_int st_gid;
|
||||
abi_ulong st_rdev;
|
||||
abi_long st_pad2[2];
|
||||
int64_t st_size;
|
||||
abi_long target_st_atime;
|
||||
abi_ulong __unused1;
|
||||
abi_long target_st_mtime;
|
||||
abi_ulong __unused2;
|
||||
abi_long target_st_ctime;
|
||||
abi_ulong __unused3;
|
||||
abi_int st_blksize;
|
||||
int64_t st_blocks;
|
||||
char st_fstype[16];
|
||||
abi_long __unused4[8];
|
||||
};
|
||||
|
||||
#elif defined(TARGET_SPARC64) && !defined(TARGET_ABI32)
|
||||
struct target_stat {
|
||||
unsigned int st_dev;
|
||||
|
@ -1583,7 +1730,7 @@ struct target_stat64 {
|
|||
unsigned char __pad0[6];
|
||||
unsigned short st_dev;
|
||||
|
||||
uint64_t st_ino;
|
||||
uint64_t st_ino;
|
||||
|
||||
unsigned int st_mode;
|
||||
unsigned int st_nlink;
|
||||
|
@ -1597,6 +1744,7 @@ struct target_stat64 {
|
|||
unsigned char __pad3[8];
|
||||
|
||||
int64_t st_size;
|
||||
|
||||
unsigned int st_blksize;
|
||||
|
||||
unsigned char __pad4[8];
|
||||
|
@ -1787,13 +1935,87 @@ struct target_stat64 {
|
|||
unsigned long long st_ino;
|
||||
} QEMU_PACKED;
|
||||
|
||||
#elif defined (TARGET_ABI_IRIX)
|
||||
|
||||
struct target_stat {
|
||||
uint32_t st_dev;
|
||||
abi_long st_pad0[3]; /* Reserved for st_dev expansion */
|
||||
abi_ulong st_ino;
|
||||
|
||||
uint32_t st_mode;
|
||||
uint32_t st_nlink;
|
||||
|
||||
int32_t st_uid;
|
||||
int32_t st_gid;
|
||||
|
||||
uint32_t st_rdev;
|
||||
abi_long st_pad1[2]; /* Reserved for st_rdev expansion */
|
||||
abi_long st_size;
|
||||
abi_long st_pad2;
|
||||
|
||||
/*
|
||||
* Actually this should be timestruc_t st_atime, st_mtime and st_ctime
|
||||
* but we don't have it under Linux.
|
||||
*/
|
||||
int32_t target_st_atime;
|
||||
abi_long target_st_atime_nsec;
|
||||
|
||||
int32_t target_st_mtime;
|
||||
abi_long target_st_mtime_nsec;
|
||||
|
||||
int32_t target_st_ctime;
|
||||
abi_long target_st_ctime_nsec;
|
||||
|
||||
abi_long st_blksize;
|
||||
abi_long st_blocks;
|
||||
char st_fstype[16];
|
||||
abi_long st_projid;
|
||||
abi_long st_pad[7];
|
||||
};
|
||||
|
||||
#define TARGET_HAS_STRUCT_STAT64
|
||||
struct target_stat64 {
|
||||
uint32_t st_dev;
|
||||
abi_long st_pad0[3]; /* Reserved for st_dev expansion */
|
||||
uint64_t st_ino;
|
||||
|
||||
uint32_t st_mode;
|
||||
uint32_t st_nlink;
|
||||
|
||||
int32_t st_uid;
|
||||
int32_t st_gid;
|
||||
|
||||
uint32_t st_rdev;
|
||||
abi_long st_pad1[2]; /* Reserved for st_rdev expansion */
|
||||
int64_t st_size;
|
||||
abi_long st_pad2;
|
||||
|
||||
/*
|
||||
* Actually this should be timestruc_t st_atime, st_mtime and st_ctime
|
||||
* but we don't have it under Linux.
|
||||
*/
|
||||
int32_t target_st_atime;
|
||||
abi_long target_st_atime_nsec;
|
||||
|
||||
int32_t target_st_mtime;
|
||||
abi_long target_st_mtime_nsec;
|
||||
|
||||
int32_t target_st_ctime;
|
||||
abi_long target_st_ctime_nsec;
|
||||
|
||||
abi_long st_blksize;
|
||||
int64_t st_blocks;
|
||||
char st_fstype[16];
|
||||
abi_long st_projid;
|
||||
abi_long st_pad[7];
|
||||
};
|
||||
|
||||
#elif defined(TARGET_ABI_MIPSN64)
|
||||
|
||||
/* The memory layout is the same as of struct stat64 of the 32-bit kernel. */
|
||||
struct target_stat {
|
||||
unsigned int st_dev;
|
||||
unsigned int st_pad0[3]; /* Reserved for st_dev expansion */
|
||||
|
||||
abi_ulong st_ino;
|
||||
|
||||
unsigned int st_mode;
|
||||
|
@ -1804,7 +2026,6 @@ struct target_stat {
|
|||
|
||||
unsigned int st_rdev;
|
||||
unsigned int st_pad1[3]; /* Reserved for st_rdev expansion */
|
||||
|
||||
abi_ulong st_size;
|
||||
|
||||
/*
|
||||
|
@ -1822,32 +2043,80 @@ struct target_stat {
|
|||
|
||||
unsigned int st_blksize;
|
||||
unsigned int st_pad2;
|
||||
|
||||
abi_ulong st_blocks;
|
||||
};
|
||||
|
||||
#elif defined(TARGET_ABI_MIPSN32)
|
||||
|
||||
struct target_stat {
|
||||
abi_ulong st_dev;
|
||||
abi_ulong st_pad0[3]; /* Reserved for st_dev expansion */
|
||||
uint64_t st_ino;
|
||||
unsigned int st_mode;
|
||||
unsigned int st_nlink;
|
||||
int st_uid;
|
||||
int st_gid;
|
||||
abi_ulong st_rdev;
|
||||
abi_ulong st_pad1[3]; /* Reserved for st_rdev expansion */
|
||||
int64_t st_size;
|
||||
abi_long target_st_atime;
|
||||
abi_ulong target_st_atime_nsec; /* Reserved for st_atime expansion */
|
||||
abi_long target_st_mtime;
|
||||
abi_ulong target_st_mtime_nsec; /* Reserved for st_mtime expansion */
|
||||
abi_long target_st_ctime;
|
||||
abi_ulong target_st_ctime_nsec; /* Reserved for st_ctime expansion */
|
||||
abi_ulong st_blksize;
|
||||
abi_ulong st_pad2;
|
||||
int64_t st_blocks;
|
||||
unsigned st_dev;
|
||||
int st_pad0[3]; /* Reserved for network id */
|
||||
unsigned int st_ino;
|
||||
unsigned int st_mode;
|
||||
unsigned int st_nlink;
|
||||
int st_uid;
|
||||
int st_gid;
|
||||
unsigned st_rdev;
|
||||
unsigned int st_pad1[2];
|
||||
unsigned int st_size;
|
||||
unsigned int st_pad2;
|
||||
/*
|
||||
* Actually this should be timestruc_t st_atime, st_mtime and st_ctime
|
||||
* but we don't have it under Linux.
|
||||
*/
|
||||
unsigned int target_st_atime;
|
||||
unsigned int target_st_atime_nsec;
|
||||
unsigned int target_st_mtime;
|
||||
unsigned int target_st_mtime_nsec;
|
||||
unsigned int target_st_ctime;
|
||||
unsigned int target_st_ctime_nsec;
|
||||
unsigned int st_blksize;
|
||||
unsigned int st_blocks;
|
||||
unsigned int st_pad3[14];
|
||||
};
|
||||
|
||||
/*
|
||||
* This matches struct stat64 in glibc2.1, hence the absolutely insane
|
||||
* amounts of padding around dev_t's. The memory layout is the same as of
|
||||
* struct stat of the 64-bit kernel.
|
||||
*/
|
||||
|
||||
#define TARGET_HAS_STRUCT_STAT64
|
||||
struct target_stat64 {
|
||||
unsigned int st_dev;
|
||||
unsigned int st_pad0[3]; /* Reserved for st_dev expansion */
|
||||
|
||||
uint64_t st_ino;
|
||||
|
||||
unsigned int st_mode;
|
||||
unsigned int st_nlink;
|
||||
|
||||
int st_uid;
|
||||
int st_gid;
|
||||
|
||||
unsigned int st_rdev;
|
||||
|
||||
unsigned int st_pad1[3]; /* Reserved for st_rdev expansion */
|
||||
|
||||
int st_size;
|
||||
|
||||
/*
|
||||
* Actually this should be timestruc_t st_atime, st_mtime and st_ctime
|
||||
* but we don't have it under Linux.
|
||||
*/
|
||||
int target_st_atime;
|
||||
unsigned int target_st_atime_nsec; /* Reserved for st_atime expansion */
|
||||
|
||||
int target_st_mtime;
|
||||
unsigned int target_st_mtime_nsec; /* Reserved for st_mtime expansion */
|
||||
|
||||
int target_st_ctime;
|
||||
unsigned int target_st_ctime_nsec; /* Reserved for st_ctime expansion */
|
||||
|
||||
unsigned int st_blksize;
|
||||
|
||||
int st_blocks;
|
||||
unsigned int st_pad2;
|
||||
};
|
||||
|
||||
#elif defined(TARGET_ABI_MIPSO32)
|
||||
|
@ -2214,7 +2483,11 @@ typedef struct {
|
|||
#ifdef TARGET_MIPS
|
||||
#ifdef TARGET_ABI_MIPSN32
|
||||
struct target_statfs {
|
||||
#ifdef TARGET_ABI_IRIX
|
||||
short f_type;
|
||||
#else
|
||||
int32_t f_type;
|
||||
#endif
|
||||
int32_t f_bsize;
|
||||
int32_t f_frsize; /* Fragment size - unsupported */
|
||||
int32_t f_blocks;
|
||||
|
@ -2230,7 +2503,11 @@ struct target_statfs {
|
|||
};
|
||||
#else
|
||||
struct target_statfs {
|
||||
#ifdef TARGET_ABI_IRIX
|
||||
short f_type;
|
||||
#else
|
||||
abi_long f_type;
|
||||
#endif
|
||||
abi_long f_bsize;
|
||||
abi_long f_frsize; /* Fragment size - unsupported */
|
||||
abi_long f_blocks;
|
||||
|
@ -2247,10 +2524,18 @@ struct target_statfs {
|
|||
#endif
|
||||
|
||||
struct target_statfs64 {
|
||||
#ifdef TARGET_ABI_IRIX
|
||||
short f_type;
|
||||
short __pad1;
|
||||
uint32_t f_bsize;
|
||||
uint32_t f_frsize; /* Fragment size - unsupported */
|
||||
uint32_t __pad2;
|
||||
#else
|
||||
uint32_t f_type;
|
||||
uint32_t f_bsize;
|
||||
uint32_t f_frsize; /* Fragment size - unsupported */
|
||||
uint32_t __pad;
|
||||
#endif
|
||||
uint64_t f_blocks;
|
||||
uint64_t f_bfree;
|
||||
uint64_t f_files;
|
||||
|
@ -2361,12 +2646,45 @@ struct target_statfs64 {
|
|||
#define TARGET_F_SETLKW 9
|
||||
#define TARGET_F_SETOWN 5 /* for sockets. */
|
||||
#define TARGET_F_GETOWN 6 /* for sockets. */
|
||||
#define TARGET_F_SETOWN_EX 15
|
||||
#define TARGET_F_GETOWN_EX 16
|
||||
#define TARGET_F_SETSIG 10 /* for sockets. */
|
||||
#define TARGET_F_GETSIG 11 /* for sockets. */
|
||||
|
||||
#define TARGET_F_RDLCK 1
|
||||
#define TARGET_F_WRLCK 2
|
||||
#define TARGET_F_UNLCK 8
|
||||
#define TARGET_F_EXLCK 16
|
||||
#define TARGET_F_SHLCK 32
|
||||
#elif defined(TARGET_ABI_IRIX)
|
||||
#define TARGET_F_GETLK 14
|
||||
#define TARGET_F_SETLK 6
|
||||
#define TARGET_F_SETLKW 7
|
||||
#define TARGET_F_SETOWN 23 /* for sockets. */
|
||||
#define TARGET_F_GETOWN 24 /* for sockets. */
|
||||
#define TARGET_F_ALLOCSP 10
|
||||
#define TARGET_F_FREESP 11
|
||||
#define TARGET_F_ALLOCSP64 36
|
||||
#define TARGET_F_FREESP64 37
|
||||
|
||||
#define TARGET_F_RDLCK 1
|
||||
#define TARGET_F_WRLCK 2
|
||||
#define TARGET_F_UNLCK 3
|
||||
#elif defined(TARGET_ABI_SOLARIS)
|
||||
#define TARGET_F_GETLK 14
|
||||
#define TARGET_F_SETLK 6
|
||||
#define TARGET_F_SETLKW 7
|
||||
#define TARGET_F_SETOWN 23 /* for sockets. */
|
||||
#define TARGET_F_GETOWN 24 /* for sockets. */
|
||||
#define TARGET_F_ALLOCSP 10
|
||||
#define TARGET_F_FREESP 11
|
||||
#define TARGET_F_ALLOCSP64 28
|
||||
#define TARGET_F_FREESP64 27
|
||||
#define TARGET_F_DUP2FD 9
|
||||
|
||||
#define TARGET_F_RDLCK 1
|
||||
#define TARGET_F_WRLCK 2
|
||||
#define TARGET_F_UNLCK 3
|
||||
#elif defined(TARGET_MIPS)
|
||||
#define TARGET_F_GETLK 14
|
||||
#define TARGET_F_SETLK 6
|
||||
|
@ -2388,9 +2706,12 @@ struct target_statfs64 {
|
|||
#define TARGET_F_SETLKW 7
|
||||
#define TARGET_F_SETOWN 8 /* for sockets. */
|
||||
#define TARGET_F_GETOWN 9 /* for sockets. */
|
||||
#endif
|
||||
#define TARGET_F_SETOWN_EX 15
|
||||
#define TARGET_F_GETOWN_EX 16
|
||||
#define TARGET_F_SETSIG 10 /* for sockets. */
|
||||
#define TARGET_F_GETSIG 11 /* for sockets. */
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef TARGET_F_RDLCK
|
||||
#define TARGET_F_RDLCK 0
|
||||
|
@ -2412,7 +2733,7 @@ struct target_statfs64 {
|
|||
#define TARGET_F_GETSIG 11 /* for sockets. */
|
||||
#endif
|
||||
|
||||
#if defined(TARGET_MIPS)
|
||||
#if defined(TARGET_MIPS) || defined(TARGET_ABI_SOLARIS)
|
||||
#define TARGET_F_GETLK64 33 /* using 'struct flock64' */
|
||||
#define TARGET_F_SETLK64 34
|
||||
#define TARGET_F_SETLKW64 35
|
||||
|
@ -2486,6 +2807,23 @@ struct target_statfs64 {
|
|||
#define TARGET_O_NOFOLLOW 0100000 /* don't follow links */
|
||||
#define TARGET_O_LARGEFILE 0200000
|
||||
#define TARGET_O_DIRECT 0400000 /* direct disk access hint */
|
||||
#elif defined (TARGET_ABI_SOLARIS)
|
||||
#define TARGET_O_APPEND 0x0008
|
||||
#define TARGET_O_CREAT 0x0100 /* not fcntl */
|
||||
#define TARGET_O_NDELAY 0x0004
|
||||
#define TARGET_O_NONBLOCK 0x0080
|
||||
#define TARGET_O_LARGEFILE 0x2000
|
||||
#define TARGET_O_DSYNC 0x0040
|
||||
#define TARGET_O_TRUNC 0x0200 /* not fcntl */
|
||||
#define TARGET_O_EXCL 0x0400 /* not fcntl */
|
||||
#define TARGET_O_NOCTTY 0x0800 /* not fcntl */
|
||||
#define TARGET_O_CLOEXEC 0x800000
|
||||
#define TARGET___O_SYNC 0x0010
|
||||
#define TARGET_O_NOFOLLOW 0x20000
|
||||
#define TARGET_FASYNC 0
|
||||
#define TARGET_O_DIRECT 0
|
||||
#define TARGET_O_NOATIME 0
|
||||
#define TARGET_O_PATH 0
|
||||
#elif defined (TARGET_SPARC)
|
||||
#define TARGET_O_APPEND 0x0008
|
||||
#define TARGET_FASYNC 0x0040 /* fcntl, for BSD compatibility */
|
||||
|
@ -2579,11 +2917,13 @@ struct target_flock {
|
|||
short l_whence;
|
||||
abi_long l_start;
|
||||
abi_long l_len;
|
||||
#if defined(TARGET_MIPS)
|
||||
#if defined(TARGET_MIPS) || defined(TARGET_ABI_IRIX)
|
||||
abi_long l_sysid;
|
||||
#elif defined(TARGET_ABI_SOLARIS)
|
||||
abi_int l_sysid;
|
||||
#endif
|
||||
int l_pid;
|
||||
#if defined(TARGET_MIPS)
|
||||
#if defined TARGET_MIPS || defined TARGET_ABI_IRIX || defined TARGET_ABI_SOLARIS
|
||||
abi_long pad[4];
|
||||
#endif
|
||||
};
|
||||
|
@ -2598,6 +2938,11 @@ struct target_flock64 {
|
|||
#endif
|
||||
abi_llong l_start;
|
||||
abi_llong l_len;
|
||||
#if defined(TARGET_MIPS) || defined(TARGET_ABI_IRIX)
|
||||
abi_long l_sysid;
|
||||
#elif defined(TARGET_ABI_SOLARIS)
|
||||
abi_int l_sysid;
|
||||
#endif
|
||||
int l_pid;
|
||||
} QEMU_PACKED;
|
||||
|
||||
|
@ -2898,9 +3243,18 @@ typedef int32_t target_timer_t;
|
|||
/ sizeof(int32_t))
|
||||
|
||||
struct target_sigevent {
|
||||
#ifdef TARGET_ABI_IRIX
|
||||
int sigev_notify;
|
||||
struct {
|
||||
int sigev_signo;
|
||||
abi_ulong sigev_nifunc;
|
||||
};
|
||||
target_sigval_t sigev_value;
|
||||
#else
|
||||
target_sigval_t sigev_value;
|
||||
abi_int sigev_signo;
|
||||
abi_int sigev_notify;
|
||||
#endif
|
||||
union {
|
||||
abi_int _pad[TARGET_SIGEV_PAD_SIZE];
|
||||
abi_int _tid;
|
||||
|
@ -2952,4 +3306,168 @@ struct target_user_cap_data {
|
|||
/* Return size of the log buffer */
|
||||
#define TARGET_SYSLOG_ACTION_SIZE_BUFFER 10
|
||||
|
||||
#if defined TARGET_ABI_IRIX || defined TARGET_ABI_SOLARIS
|
||||
struct target_statvfs {
|
||||
abi_ulong f_bsize; /* fundamental file system block size */
|
||||
abi_ulong f_frsize; /* fragment size */
|
||||
abi_ulong f_blocks; /* total # of blocks of f_frsize on fs */
|
||||
abi_ulong f_bfree; /* total # of free blocks of f_frsize */
|
||||
abi_ulong f_bavail; /* # of free blocks avail to non-superuser */
|
||||
abi_ulong f_files; /* total # of file nodes (inodes) */
|
||||
abi_ulong f_ffree; /* total # of free file nodes */
|
||||
abi_ulong f_favail; /* # of free nodes avail to non-superuser */
|
||||
abi_ulong f_fsid; /* file system id (dev for now) */
|
||||
uint32_t f_pad0[4];
|
||||
abi_ulong f_flag; /* bit-mask of flags */
|
||||
abi_ulong f_namemax; /* maximum file name length */
|
||||
uint32_t f_pad1[24]; /* reserved for future expansion */
|
||||
};
|
||||
|
||||
struct target_statvfs64 {
|
||||
abi_ulong f_bsize; /* fundamental file system block size */
|
||||
abi_ulong f_frsize; /* fragment size */
|
||||
uint64_t f_blocks; /* total # of blocks of f_frsize on fs */
|
||||
uint64_t f_bfree; /* total # of free blocks of f_frsize */
|
||||
uint64_t f_bavail; /* # of free blocks avail to non-superuser */
|
||||
uint64_t f_files; /* total # of file nodes (inodes) */
|
||||
uint64_t f_ffree; /* total # of free file nodes */
|
||||
uint64_t f_favail; /* # of free nodes avail to non-superuser */
|
||||
abi_ulong f_fsid; /* file system id (dev for now) */
|
||||
uint32_t f_pad0[4];
|
||||
abi_ulong f_flag; /* bit-mask of flags */
|
||||
abi_ulong f_namemax; /* maximum file name length */
|
||||
uint32_t f_pad1[24]; /* reserved for future expansion */
|
||||
};
|
||||
|
||||
struct target_utsname {
|
||||
char sysname[257];
|
||||
char nodename[257];
|
||||
char release[257];
|
||||
char version[257];
|
||||
char machine[257];
|
||||
#ifdef TARGET_ABI_IRIX
|
||||
char reserved[257][8];
|
||||
#endif
|
||||
};
|
||||
|
||||
#define TARGET_P_PID 0
|
||||
#define TARGET_P_PGID 2
|
||||
#define TARGET_P_ALL 7
|
||||
|
||||
/* wait flags */
|
||||
#define TARGET_WEXITED 0001
|
||||
#define TARGET_WSTOPPED 0004
|
||||
#define TARGET_WCONTINUED 0010
|
||||
#define TARGET_WNOHANG 0100
|
||||
#define TARGET_WNOWAIT 0200
|
||||
|
||||
#define TARGET_STAT64_VER 3
|
||||
|
||||
/* common sem/shm/msg definitions */
|
||||
#define TARGET_IPC_RMID 10
|
||||
#define TARGET_IPC_SET 11
|
||||
#define TARGET_IPC_STAT 12
|
||||
|
||||
#define TARGET_IPC_CREAT 0001000
|
||||
#define TARGET_IPC_EXCL 0002000
|
||||
#define TARGET_IPC_NOWAIT 0004000
|
||||
|
||||
/* sem function definitions */
|
||||
#define TARGET_SEM_GETNCNT 3
|
||||
#define TARGET_SEM_GETPID 4
|
||||
#define TARGET_SEM_GETVAL 5
|
||||
#define TARGET_SEM_GETALL 6
|
||||
#define TARGET_SEM_GETZCNT 7
|
||||
#define TARGET_SEM_SETVAL 8
|
||||
#define TARGET_SEM_SETALL 9
|
||||
|
||||
/* shm function definitions */
|
||||
#define TARGET_SHM_LOCK 3
|
||||
#define TARGET_SHM_UNLOCK 4
|
||||
|
||||
#define TARGET_SHM_RDONLY 010000
|
||||
#define TARGET_SHM_RND 020000
|
||||
|
||||
/* msg function definitions */
|
||||
#define TARGET_MSG_NOERROR 010000
|
||||
#endif
|
||||
|
||||
#ifdef TARGET_ABI_IRIX
|
||||
/* usync interface - undocumented by SGI, so there's some guesswork :-( */
|
||||
struct target_usync {
|
||||
abi_int u_magic; /* 1002 in all cases? */
|
||||
uint64_t u_sync; /* pointer to sync object */
|
||||
uint16_t u_type; /* type of sync object? Either 1 or 2 */
|
||||
uint16_t u_flags; /* e.g. timeout flag for timed wait */
|
||||
abi_int u_unknown1[4]; /* some signal stuff? */
|
||||
uint64_t u_lock; /* pointer to mutex for cond_wait */
|
||||
uint64_t u_sec; /* timeout for cond_wait, tv_sec */
|
||||
uint64_t u_nsec; /* timeout for cond_wait, tv_nsec */
|
||||
abi_int u_unknown2[6];
|
||||
};
|
||||
|
||||
#define TARGET_US_TIMEOUT 0x00000004
|
||||
|
||||
/* nsproc interface - structure from sys/prctl.h */
|
||||
struct target_prthread {
|
||||
#ifdef TARGET_ABI_MIPSN32
|
||||
abi_uint prt_entry;
|
||||
abi_uint prt_arg;
|
||||
abi_uint prt_flags;
|
||||
abi_uint prt_stkptr;
|
||||
#else
|
||||
abi_ulong prt_entry;
|
||||
abi_ulong prt_arg;
|
||||
abi_uint prt_flags;
|
||||
abi_ulong prt_stkptr;
|
||||
#endif
|
||||
abi_int prt_stklen;
|
||||
};
|
||||
|
||||
/* sproc flags */
|
||||
#define TARGET_PR_SPROC 0x00000001
|
||||
#define TARGET_PR_SFDS 0x00000002
|
||||
#define TARGET_PR_SDIR 0x00000004
|
||||
#define TARGET_PR_SADDR 0x00000040
|
||||
#define TARGET_PR_SALL 0x0000007f
|
||||
#define TARGET_PR_BLOCK 0x01000000
|
||||
#endif
|
||||
|
||||
#ifdef TARGET_ABI_SOLARIS
|
||||
#define TARGET_E_OK 8
|
||||
|
||||
#define TARGET_PC_LINK_MAX 1
|
||||
#define TARGET_PC_MAX_CANON 2
|
||||
#define TARGET_PC_MAX_INPUT 3
|
||||
#define TARGET_PC_NAME_MAX 4
|
||||
#define TARGET_PC_PATH_MAX 5
|
||||
#define TARGET_PC_PIPE_BUF 6
|
||||
#define TARGET_PC_NO_TRUNC 7
|
||||
#define TARGET_PC_VDISABLE 8
|
||||
#define TARGET_PC_CHOWN_RESTRICTED 9
|
||||
#define TARGET_PC_ASYNC_IO 10
|
||||
#define TARGET_PC_PRIO_IO 11
|
||||
#define TARGET_PC_SYNC_IO 12
|
||||
#define TARGET_PC_ALLOC_SIZE_MIN 13
|
||||
#define TARGET_PC_REC_INCR_XFER_SIZE 14
|
||||
#define TARGET_PC_REC_MAX_XFER_SIZE 15
|
||||
#define TARGET_PC_REC_MIN_XFER_SIZE 16
|
||||
#define TARGET_PC_REC_XFER_ALIGN 17
|
||||
#define TARGET_PC_SYMLINK_MAX 18
|
||||
#define TARGET_PC_2_SYMLINKS 19
|
||||
#else
|
||||
#define TARGET_PC_LINK_MAX 1
|
||||
#define TARGET_PC_MAX_CANON 2
|
||||
#define TARGET_PC_MAX_INPUT 3
|
||||
#define TARGET_PC_NAME_MAX 4
|
||||
#define TARGET_PC_PATH_MAX 5
|
||||
#define TARGET_PC_PIPE_BUF 6
|
||||
#define TARGET_PC_NO_TRUNC 8
|
||||
#define TARGET_PC_VDISABLE 9
|
||||
#define TARGET_PC_CHOWN_RESTRICTED 7
|
||||
#define TARGET_PC_ASYNC_IO 64
|
||||
#define TARGET_PC_PRIO_IO 11
|
||||
#define TARGET_PC_SYNC_IO 10
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
obj-y += translate.o dsp_helper.o op_helper.o lmi_helper.o helper.o cpu.o
|
||||
obj-y += gdbstub.o msa_helper.o mips-semi.o
|
||||
obj-y += gdbstub.o msa_helper.o mips-semi.o irix_helper.o
|
||||
obj-$(CONFIG_SOFTMMU) += machine.o cp0_timer.o
|
||||
obj-$(CONFIG_KVM) += kvm.o
|
||||
|
|
|
@ -956,3 +956,26 @@ MSALDST_PROTO(d)
|
|||
#undef MSALDST_PROTO
|
||||
|
||||
DEF_HELPER_3(cache, void, env, tl, i32)
|
||||
|
||||
#ifdef TARGET_ABI_IRIX
|
||||
DEF_HELPER_2(irix_prda_ld_8, i64, tl, env)
|
||||
DEF_HELPER_2(irix_prda_ld_16, i64, tl, env)
|
||||
DEF_HELPER_2(irix_prda_ld_32, i64, tl, env)
|
||||
DEF_HELPER_2(irix_prda_ld_64, i64, tl, env)
|
||||
DEF_HELPER_2(irix_prda_ld_8s, i64, tl, env)
|
||||
DEF_HELPER_2(irix_prda_ld_16s, i64, tl, env)
|
||||
DEF_HELPER_2(irix_prda_ld_32s, i64, tl, env)
|
||||
DEF_HELPER_2(irix_prda_ld_16b, i64, tl, env)
|
||||
DEF_HELPER_2(irix_prda_ld_32b, i64, tl, env)
|
||||
DEF_HELPER_2(irix_prda_ld_64b, i64, tl, env)
|
||||
DEF_HELPER_2(irix_prda_ld_16sb, i64, tl, env)
|
||||
DEF_HELPER_2(irix_prda_ld_32sb, i64, tl, env)
|
||||
|
||||
DEF_HELPER_3(irix_prda_st_8, void, i64, tl, env)
|
||||
DEF_HELPER_3(irix_prda_st_16, void, i64, tl, env)
|
||||
DEF_HELPER_3(irix_prda_st_32, void, i64, tl, env)
|
||||
DEF_HELPER_3(irix_prda_st_64, void, i64, tl, env)
|
||||
DEF_HELPER_3(irix_prda_st_16b, void, i64, tl, env)
|
||||
DEF_HELPER_3(irix_prda_st_32b, void, i64, tl, env)
|
||||
DEF_HELPER_3(irix_prda_st_64b, void, i64, tl, env)
|
||||
#endif
|
||||
|
|
|
@ -0,0 +1,164 @@
|
|||
/*
|
||||
* IRIX PRDA access helper functions for QEMU
|
||||
*
|
||||
* Copyright (c) 2015 Kai-Uwe Bloem <derkub@gmail.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "qemu/osdep.h"
|
||||
#include "cpu.h"
|
||||
#include "exec/cpu_ldst.h"
|
||||
#include "exec/helper-proto.h"
|
||||
|
||||
|
||||
#ifdef TARGET_ABI_IRIX
|
||||
/* argh, ugly! need TaskState here to access PRDA storage */
|
||||
#include <linux-user/qemu.h>
|
||||
|
||||
#define DEBUG(x) //x
|
||||
|
||||
static inline void *prda_ptr(CPUMIPSState *env, target_ulong addr)
|
||||
{
|
||||
TaskState *ts = ENV_GET_CPU(env)->opaque;
|
||||
return &ts->prda[addr-0x200000];
|
||||
}
|
||||
|
||||
uint64_t helper_irix_prda_ld_8(target_ulong addr, CPUMIPSState *env)
|
||||
{
|
||||
uint64_t ret;
|
||||
ret = ldub_p(prda_ptr(env, addr));
|
||||
DEBUG(printf("ld8(%p) addr=%lx val=%lx\n",env,(long)addr,(long)ret));
|
||||
return ret;
|
||||
}
|
||||
|
||||
uint64_t helper_irix_prda_ld_16(target_ulong addr, CPUMIPSState *env)
|
||||
{
|
||||
uint64_t ret;
|
||||
ret = lduw_p(prda_ptr(env, addr));
|
||||
DEBUG(printf("ld16(%p) addr=%lx val=%lx\n",env,(long)addr,(long)ret));
|
||||
return ret;
|
||||
}
|
||||
uint64_t helper_irix_prda_ld_32(target_ulong addr, CPUMIPSState *env)
|
||||
{
|
||||
uint64_t ret;
|
||||
ret = (uint32_t)ldl_p(prda_ptr(env, addr));
|
||||
DEBUG(printf("ld32(%p) addr=%lx val=%lx\n",env,(long)addr,(long)ret));
|
||||
return ret;
|
||||
}
|
||||
uint64_t helper_irix_prda_ld_64(target_ulong addr, CPUMIPSState *env)
|
||||
{
|
||||
uint64_t ret;
|
||||
ret = ldq_p(prda_ptr(env, addr));
|
||||
DEBUG(printf("ld64(%p) addr=%lx val=%lx\n",env,(long)addr,(long)ret));
|
||||
return ret;
|
||||
}
|
||||
|
||||
uint64_t helper_irix_prda_ld_8s(target_ulong addr, CPUMIPSState *env)
|
||||
{
|
||||
uint64_t ret;
|
||||
ret = ldsb_p(prda_ptr(env, addr));
|
||||
DEBUG(printf("ld8s(%p) addr=%lx val=%lx\n",env,(long)addr,(long)ret));
|
||||
return ret;
|
||||
}
|
||||
|
||||
uint64_t helper_irix_prda_ld_16s(target_ulong addr, CPUMIPSState *env)
|
||||
{
|
||||
uint64_t ret;
|
||||
ret = ldsw_p(prda_ptr(env, addr));
|
||||
DEBUG(printf("ld16s(%p) addr=%lx val=%lx\n",env,(long)addr,(long)ret));
|
||||
return ret;
|
||||
}
|
||||
uint64_t helper_irix_prda_ld_32s(target_ulong addr, CPUMIPSState *env)
|
||||
{
|
||||
uint64_t ret;
|
||||
ret = (int32_t)ldl_p(prda_ptr(env, addr));
|
||||
DEBUG(printf("ld32s(%p) addr=%lx val=%lx\n",env,(long)addr,(long)ret));
|
||||
return ret;
|
||||
}
|
||||
|
||||
uint64_t helper_irix_prda_ld_16b(target_ulong addr, CPUMIPSState *env)
|
||||
{
|
||||
uint64_t ret;
|
||||
ret = lduw_be_p(prda_ptr(env, addr));
|
||||
DEBUG(printf("ld16b(%p) addr=%lx val=%lx\n",env,(long)addr,(long)ret));
|
||||
return ret;
|
||||
}
|
||||
uint64_t helper_irix_prda_ld_32b(target_ulong addr, CPUMIPSState *env)
|
||||
{
|
||||
uint64_t ret;
|
||||
ret = (uint32_t)ldl_be_p(prda_ptr(env, addr));
|
||||
DEBUG(printf("ld32b(%p) addr=%lx val=%lx\n",env,(long)addr,(long)ret));
|
||||
return ret;
|
||||
}
|
||||
uint64_t helper_irix_prda_ld_64b(target_ulong addr, CPUMIPSState *env)
|
||||
{
|
||||
uint64_t ret;
|
||||
ret = ldq_be_p(prda_ptr(env, addr));
|
||||
DEBUG(printf("ld64b(%p) addr=%lx val=%lx\n",env,(long)addr,(long)ret));
|
||||
return ret;
|
||||
}
|
||||
uint64_t helper_irix_prda_ld_16sb(target_ulong addr, CPUMIPSState *env)
|
||||
{
|
||||
uint64_t ret;
|
||||
ret = ldsw_be_p(prda_ptr(env, addr));
|
||||
DEBUG(printf("ld16sb(%p) addr=%lx val=%lx\n",env,(long)addr,(long)ret));
|
||||
return ret;
|
||||
}
|
||||
uint64_t helper_irix_prda_ld_32sb(target_ulong addr, CPUMIPSState *env)
|
||||
{
|
||||
uint64_t ret;
|
||||
ret = (int32_t)ldl_be_p(prda_ptr(env, addr));
|
||||
DEBUG(printf("ld32sb(%p) addr=%lx val=%lx\n",env,(long)addr,(long)ret));
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
void helper_irix_prda_st_8(uint64_t val, target_ulong addr, CPUMIPSState *env)
|
||||
{
|
||||
DEBUG(printf("st8(%p) addr=%lx val=%lx\n",env,(long)addr,(long)val));
|
||||
stb_p(prda_ptr(env, addr), val);
|
||||
}
|
||||
void helper_irix_prda_st_16(uint64_t val, target_ulong addr, CPUMIPSState *env)
|
||||
{
|
||||
DEBUG(printf("st16(%p) addr=%lx val=%lx\n",env,(long)addr,(long)val));
|
||||
stw_p(prda_ptr(env, addr), val);
|
||||
}
|
||||
void helper_irix_prda_st_32(uint64_t val, target_ulong addr, CPUMIPSState *env)
|
||||
{
|
||||
DEBUG(printf("st32(%p) addr=%lx val=%lx\n",env,(long)addr,(long)val));
|
||||
stl_p(prda_ptr(env, addr), val);
|
||||
}
|
||||
void helper_irix_prda_st_64(uint64_t val, target_ulong addr, CPUMIPSState *env)
|
||||
{
|
||||
DEBUG(printf("st64(%p) addr=%lx val=%lx\n",env,(long)addr,(long)val));
|
||||
stq_p(prda_ptr(env, addr), val);
|
||||
}
|
||||
void helper_irix_prda_st_16b(uint64_t val, target_ulong addr, CPUMIPSState *env)
|
||||
{
|
||||
DEBUG(printf("st16b(%p) addr=%lx val=%lx\n",env,(long)addr,(long)val));
|
||||
stw_be_p(prda_ptr(env, addr), val);
|
||||
}
|
||||
void helper_irix_prda_st_32b(uint64_t val, target_ulong addr, CPUMIPSState *env)
|
||||
{
|
||||
DEBUG(printf("st32b(%p) addr=%lx val=%lx\n",env,(long)addr,(long)val));
|
||||
stl_be_p(prda_ptr(env, addr), val);
|
||||
}
|
||||
void helper_irix_prda_st_64b(uint64_t val, target_ulong addr, CPUMIPSState *env)
|
||||
{
|
||||
DEBUG(printf("st64b(%p) addr=%lx val=%lx\n",env,(long)addr,(long)val));
|
||||
stq_be_p(prda_ptr(env, addr), val);
|
||||
}
|
||||
|
||||
#endif
|
|
@ -2142,6 +2142,187 @@ static target_ulong pc_relative_pc (DisasContext *ctx)
|
|||
return pc;
|
||||
}
|
||||
|
||||
#ifdef TARGET_ABI_IRIX
|
||||
static void (*irix_prda_helpers_ld[MO_SSIZE|MO_BSWAP])(TCGv_i64 ret, TCGv addr, TCGv_ptr env) = {
|
||||
[MO_UB] = gen_helper_irix_prda_ld_8,
|
||||
[MO_UW] = gen_helper_irix_prda_ld_16,
|
||||
[MO_UL] = gen_helper_irix_prda_ld_32,
|
||||
[MO_Q] = gen_helper_irix_prda_ld_64,
|
||||
[MO_SB] = gen_helper_irix_prda_ld_8s,
|
||||
[MO_SW] = gen_helper_irix_prda_ld_16s,
|
||||
[MO_SL] = gen_helper_irix_prda_ld_32s,
|
||||
[MO_UW|MO_BSWAP] = gen_helper_irix_prda_ld_16b,
|
||||
[MO_UL|MO_BSWAP] = gen_helper_irix_prda_ld_32b,
|
||||
[MO_Q|MO_BSWAP] = gen_helper_irix_prda_ld_64b,
|
||||
[MO_SW|MO_BSWAP] = gen_helper_irix_prda_ld_16sb,
|
||||
[MO_SL|MO_BSWAP] = gen_helper_irix_prda_ld_32sb,
|
||||
};
|
||||
|
||||
static void (*irix_prda_helpers_st[MO_SSIZE|MO_BSWAP])(TCGv_i64 val, TCGv addr, TCGv_ptr env) = {
|
||||
[MO_UB] = gen_helper_irix_prda_st_8,
|
||||
[MO_UW] = gen_helper_irix_prda_st_16,
|
||||
[MO_UL] = gen_helper_irix_prda_st_32,
|
||||
[MO_Q] = gen_helper_irix_prda_st_64,
|
||||
[MO_UW|MO_BSWAP] = gen_helper_irix_prda_st_16b,
|
||||
[MO_UL|MO_BSWAP] = gen_helper_irix_prda_st_32b,
|
||||
[MO_Q|MO_BSWAP] = gen_helper_irix_prda_st_64b,
|
||||
};
|
||||
|
||||
extern int irix_emulate_prda;
|
||||
|
||||
static void tcg_gen_irix_ld_i32(TCGv_i32 val, TCGv addr, TCGArg idx, TCGMemOp memop)
|
||||
{
|
||||
if (irix_emulate_prda) {
|
||||
TCGv t0, t1;
|
||||
TCGv_i32 t2 = tcg_temp_local_new_i32();
|
||||
TCGv_i64 t3;
|
||||
TCGLabel *l1 = gen_new_label();
|
||||
TCGLabel *l2 = gen_new_label();
|
||||
|
||||
t1 = tcg_temp_local_new();
|
||||
tcg_gen_mov_tl(t1, addr);
|
||||
|
||||
t0 = tcg_temp_new();
|
||||
tcg_gen_shri_tl(t0, t1, TARGET_PAGE_BITS);
|
||||
tcg_gen_brcondi_tl(TCG_COND_NE, t0, 0x200000 >> TARGET_PAGE_BITS, l1);
|
||||
tcg_temp_free(t0);
|
||||
|
||||
assert(irix_prda_helpers_ld[memop] != NULL);
|
||||
t3 = tcg_temp_new_i64();
|
||||
(irix_prda_helpers_ld[memop])(t3, t1, cpu_env);
|
||||
tcg_gen_extrl_i64_i32(t2, t3);
|
||||
tcg_temp_free_i64(t3);
|
||||
tcg_gen_br(l2);
|
||||
|
||||
gen_set_label(l1);
|
||||
tcg_gen_qemu_ld_i32(t2, t1, idx, memop);
|
||||
|
||||
gen_set_label(l2);
|
||||
tcg_gen_mov_tl(addr, t1);
|
||||
tcg_gen_mov_i32(val, t2);
|
||||
tcg_temp_free(t1);
|
||||
tcg_temp_free_i32(t2);
|
||||
} else
|
||||
tcg_gen_qemu_ld_i32(val, addr, idx, memop);
|
||||
}
|
||||
static void tcg_gen_irix_ld_i64(TCGv_i64 val, TCGv addr, TCGArg idx, TCGMemOp memop)
|
||||
{
|
||||
if (irix_emulate_prda) {
|
||||
TCGv t0, t1;
|
||||
TCGv_i64 t2 = tcg_temp_local_new_i64();
|
||||
TCGLabel *l1 = gen_new_label();
|
||||
TCGLabel *l2 = gen_new_label();
|
||||
|
||||
t1 = tcg_temp_local_new();
|
||||
tcg_gen_mov_tl(t1, addr);
|
||||
|
||||
t0 = tcg_temp_new();
|
||||
tcg_gen_shri_tl(t0, t1, TARGET_PAGE_BITS);
|
||||
tcg_gen_brcondi_tl(TCG_COND_NE, t0, 0x200000 >> TARGET_PAGE_BITS, l1);
|
||||
tcg_temp_free(t0);
|
||||
|
||||
assert(irix_prda_helpers_ld[memop] != NULL);
|
||||
(irix_prda_helpers_ld[memop])(t2, t1, cpu_env);
|
||||
tcg_gen_br(l2);
|
||||
|
||||
gen_set_label(l1);
|
||||
tcg_gen_qemu_ld_i64(t2, t1, idx, memop);
|
||||
|
||||
gen_set_label(l2);
|
||||
tcg_gen_mov_tl(addr, t1);
|
||||
tcg_gen_mov_i64(val, t2);
|
||||
tcg_temp_free(t1);
|
||||
tcg_temp_free_i64(t2);
|
||||
} else
|
||||
tcg_gen_qemu_ld_i64(val, addr, idx, memop);
|
||||
}
|
||||
#define tcg_gen_qemu_ld_i32(v,a,i,m) tcg_gen_irix_ld_i32(v,a,i,m)
|
||||
#define tcg_gen_qemu_ld_i64(v,a,i,m) tcg_gen_irix_ld_i64(v,a,i,m)
|
||||
|
||||
#undef tcg_gen_qemu_ld_tl
|
||||
#if TARGET_LONG_BITS == 32
|
||||
#define tcg_gen_qemu_ld_tl(v,a,i,m) tcg_gen_irix_ld_i32(v,a,i,m)
|
||||
#else
|
||||
#define tcg_gen_qemu_ld_tl(v,a,i,m) tcg_gen_irix_ld_i64(v,a,i,m)
|
||||
#endif
|
||||
|
||||
static void tcg_gen_irix_st_i32(TCGv_i32 val, TCGv addr, TCGArg idx, TCGMemOp memop)
|
||||
{
|
||||
if (irix_emulate_prda) {
|
||||
TCGv t0, t1;
|
||||
TCGv_i32 t2;
|
||||
TCGv_i64 t3;
|
||||
TCGLabel *l1 = gen_new_label();
|
||||
TCGLabel *l2 = gen_new_label();
|
||||
|
||||
t1 = tcg_temp_local_new();
|
||||
tcg_gen_mov_tl(t1, addr);
|
||||
t2 = tcg_temp_local_new_i32();
|
||||
tcg_gen_mov_i32(t2, val);
|
||||
|
||||
t0 = tcg_temp_new();
|
||||
tcg_gen_shri_tl(t0, t1, TARGET_PAGE_BITS);
|
||||
tcg_gen_brcondi_tl(TCG_COND_NE, t0, 0x200000 >> TARGET_PAGE_BITS, l1);
|
||||
tcg_temp_free(t0);
|
||||
|
||||
assert(irix_prda_helpers_st[memop] != NULL);
|
||||
t3 = tcg_temp_new_i64();
|
||||
tcg_gen_extu_i32_i64(t3, t2);
|
||||
(irix_prda_helpers_st[memop])(t3, t1, cpu_env);
|
||||
tcg_temp_free_i64(t3);
|
||||
tcg_gen_br(l2);
|
||||
|
||||
gen_set_label(l1);
|
||||
tcg_gen_qemu_st_i32(t2, t1, idx, memop);
|
||||
|
||||
gen_set_label(l2);
|
||||
tcg_temp_free(t1);
|
||||
tcg_temp_free_i32(t2);
|
||||
} else
|
||||
tcg_gen_qemu_st_i32(val, addr, idx, memop);
|
||||
}
|
||||
static void tcg_gen_irix_st_i64(TCGv_i64 val, TCGv addr, TCGArg idx, TCGMemOp memop)
|
||||
{
|
||||
if (irix_emulate_prda) {
|
||||
TCGv t0, t1;
|
||||
TCGv_i64 t2;
|
||||
TCGLabel *l1 = gen_new_label();
|
||||
TCGLabel *l2 = gen_new_label();
|
||||
|
||||
t1 = tcg_temp_local_new();
|
||||
tcg_gen_mov_tl(t1, addr);
|
||||
t2 = tcg_temp_local_new_i64();
|
||||
tcg_gen_mov_i64(t2, val);
|
||||
|
||||
t0 = tcg_temp_new();
|
||||
tcg_gen_shri_tl(t0, t1, TARGET_PAGE_BITS);
|
||||
tcg_gen_brcondi_tl(TCG_COND_NE, t0, 0x200000 >> TARGET_PAGE_BITS, l1);
|
||||
tcg_temp_free(t0);
|
||||
|
||||
assert(irix_prda_helpers_st[memop] != NULL);
|
||||
(irix_prda_helpers_st[memop])(t2, t1, cpu_env);
|
||||
tcg_gen_br(l2);
|
||||
|
||||
gen_set_label(l1);
|
||||
tcg_gen_qemu_st_i64(t2, t1, idx, memop);
|
||||
|
||||
gen_set_label(l2);
|
||||
tcg_temp_free(t1);
|
||||
tcg_temp_free_i64(t2);
|
||||
} else
|
||||
tcg_gen_qemu_st_i64(val, addr, idx, memop);
|
||||
}
|
||||
#define tcg_gen_qemu_st_i32(v,a,i,m) tcg_gen_irix_st_i32(v,a,i,m)
|
||||
#define tcg_gen_qemu_st_i64(v,a,i,m) tcg_gen_irix_st_i64(v,a,i,m)
|
||||
|
||||
#undef tcg_gen_qemu_st_tl
|
||||
#if TARGET_LONG_BITS == 32
|
||||
#define tcg_gen_qemu_st_tl(v,a,i,m) tcg_gen_irix_st_i32(v,a,i,m)
|
||||
#else
|
||||
#define tcg_gen_qemu_st_tl(v,a,i,m) tcg_gen_irix_st_i64(v,a,i,m)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Load */
|
||||
static void gen_ld(DisasContext *ctx, uint32_t opc,
|
||||
int rt, int base, int16_t offset)
|
||||
|
@ -2177,7 +2358,7 @@ static void gen_ld(DisasContext *ctx, uint32_t opc,
|
|||
gen_store_gpr(t0, rt);
|
||||
break;
|
||||
case OPC_LDL:
|
||||
t1 = tcg_temp_new();
|
||||
t1 = tcg_temp_local_new(); /*X*/
|
||||
/* Do a byte access to possibly trigger a page
|
||||
fault with the unaligned address. */
|
||||
tcg_gen_qemu_ld_tl(t1, t0, mem_idx, MO_UB);
|
||||
|
@ -2199,7 +2380,7 @@ static void gen_ld(DisasContext *ctx, uint32_t opc,
|
|||
gen_store_gpr(t0, rt);
|
||||
break;
|
||||
case OPC_LDR:
|
||||
t1 = tcg_temp_new();
|
||||
t1 = tcg_temp_local_new(); /*X*/
|
||||
/* Do a byte access to possibly trigger a page
|
||||
fault with the unaligned address. */
|
||||
tcg_gen_qemu_ld_tl(t1, t0, mem_idx, MO_UB);
|
||||
|
@ -2278,7 +2459,7 @@ static void gen_ld(DisasContext *ctx, uint32_t opc,
|
|||
mem_idx = MIPS_HFLAG_UM;
|
||||
/* fall through */
|
||||
case OPC_LWL:
|
||||
t1 = tcg_temp_new();
|
||||
t1 = tcg_temp_local_new(); /*X*/
|
||||
/* Do a byte access to possibly trigger a page
|
||||
fault with the unaligned address. */
|
||||
tcg_gen_qemu_ld_tl(t1, t0, mem_idx, MO_UB);
|
||||
|
@ -2304,7 +2485,7 @@ static void gen_ld(DisasContext *ctx, uint32_t opc,
|
|||
mem_idx = MIPS_HFLAG_UM;
|
||||
/* fall through */
|
||||
case OPC_LWR:
|
||||
t1 = tcg_temp_new();
|
||||
t1 = tcg_temp_local_new(); /*X*/
|
||||
/* Do a byte access to possibly trigger a page
|
||||
fault with the unaligned address. */
|
||||
tcg_gen_qemu_ld_tl(t1, t0, mem_idx, MO_UB);
|
||||
|
|
|
@ -636,6 +636,8 @@ const mips_def_t mips_defs[] =
|
|||
.CP1_fcr0 = (1 << FCR0_F64) | (1 << FCR0_L) | (1 << FCR0_W) |
|
||||
(1 << FCR0_D) | (1 << FCR0_S) |
|
||||
(0x89 << FCR0_PRID) | (0x0 << FCR0_REV),
|
||||
.CP1_fcr31 = 0,
|
||||
.CP1_fcr31_rw_bitmask = 0xFF83FFFF,
|
||||
.SEGBITS = 42,
|
||||
.PABITS = 36,
|
||||
.insn_flags = CPU_MIPS64R2,
|
||||
|
|
|
@ -41,9 +41,9 @@ static void sparc_cpu_reset(CPUState *s)
|
|||
#ifndef TARGET_SPARC64
|
||||
env->wim = 1;
|
||||
#endif
|
||||
env->regwptr = env->regbase + (env->cwp * 16);
|
||||
CC_OP = CC_OP_FLAGS;
|
||||
#if defined(CONFIG_USER_ONLY)
|
||||
env->cwp = env->nwindows - 1;
|
||||
#ifdef TARGET_SPARC64
|
||||
env->cleanwin = env->nwindows - 2;
|
||||
env->cansave = env->nwindows - 2;
|
||||
|
@ -74,6 +74,7 @@ static void sparc_cpu_reset(CPUState *s)
|
|||
env->npc = env->pc + 4;
|
||||
#endif
|
||||
env->cache_control = 0;
|
||||
env->regwptr = env->regbase + (env->cwp * 16);
|
||||
}
|
||||
|
||||
static bool sparc_cpu_exec_interrupt(CPUState *cs, int interrupt_request)
|
||||
|
|
|
@ -820,4 +820,9 @@ static inline bool tb_am_enabled(int tb_flags)
|
|||
#endif
|
||||
}
|
||||
|
||||
/* main.c */
|
||||
void flush_windows(CPUSPARCState *env);
|
||||
|
||||
#include "exec/exec-all.h"
|
||||
|
||||
#endif
|
||||
|
|
118
util/path.c
118
util/path.c
|
@ -15,13 +15,17 @@ struct pathelem
|
|||
char *name;
|
||||
/* Full path name, eg. /usr/gnemul/x86-linux/lib. */
|
||||
char *pathname;
|
||||
/* Entry type */
|
||||
unsigned char type;
|
||||
/* Parent */
|
||||
struct pathelem *parent;
|
||||
/* Children */
|
||||
unsigned int num_entries;
|
||||
struct pathelem *entries[0];
|
||||
int num_entries;
|
||||
struct pathelem **entries;
|
||||
};
|
||||
|
||||
static struct pathelem *base;
|
||||
static struct pathelem **base;
|
||||
int base_count;
|
||||
|
||||
/* First N chars of S1 match S2, and S2 is N chars long. */
|
||||
static int strneq(const char *s1, unsigned int n, const char *s2)
|
||||
|
@ -37,14 +41,15 @@ static int strneq(const char *s1, unsigned int n, const char *s2)
|
|||
static struct pathelem *add_entry(struct pathelem *root, const char *name,
|
||||
unsigned type);
|
||||
|
||||
static struct pathelem *new_entry(const char *root,
|
||||
struct pathelem *parent,
|
||||
const char *name)
|
||||
static struct pathelem *new_entry(const char *root, struct pathelem *parent,
|
||||
const char *name, unsigned char type)
|
||||
{
|
||||
struct pathelem *new = g_malloc(sizeof(*new));
|
||||
new->name = g_strdup(name);
|
||||
new->pathname = g_strdup_printf("%s/%s", root, name);
|
||||
new->num_entries = 0;
|
||||
new->type = type;
|
||||
new->entries = NULL;
|
||||
new->num_entries = -1;
|
||||
return new;
|
||||
}
|
||||
|
||||
|
@ -64,6 +69,7 @@ static struct pathelem *add_dir_maybe(struct pathelem *path)
|
|||
{
|
||||
DIR *dir;
|
||||
|
||||
path->num_entries = 0;
|
||||
if ((dir = opendir(path->pathname)) != NULL) {
|
||||
struct dirent *dirent;
|
||||
|
||||
|
@ -84,22 +90,18 @@ static struct pathelem *add_entry(struct pathelem *root, const char *name,
|
|||
|
||||
root->num_entries++;
|
||||
|
||||
root = g_realloc(root, sizeof(*root)
|
||||
+ sizeof(root->entries[0])*root->num_entries);
|
||||
root->entries = g_realloc(root->entries,
|
||||
sizeof(root->entries[0])*root->num_entries);
|
||||
e = &root->entries[root->num_entries-1];
|
||||
|
||||
*e = new_entry(root->pathname, root, name);
|
||||
if (is_dir_maybe(type)) {
|
||||
*e = add_dir_maybe(*e);
|
||||
}
|
||||
|
||||
*e = new_entry(root->pathname, root, name, type);
|
||||
return root;
|
||||
}
|
||||
|
||||
/* This needs to be done after tree is stabilized (ie. no more reallocs!). */
|
||||
static void set_parents(struct pathelem *child, struct pathelem *parent)
|
||||
{
|
||||
unsigned int i;
|
||||
int i;
|
||||
|
||||
child->parent = parent;
|
||||
for (i = 0; i < child->num_entries; i++)
|
||||
|
@ -108,9 +110,9 @@ static void set_parents(struct pathelem *child, struct pathelem *parent)
|
|||
|
||||
/* FIXME: Doesn't handle DIR/.. where DIR is not in emulated dir. */
|
||||
static const char *
|
||||
follow_path(const struct pathelem *cursor, const char *name)
|
||||
follow_path(struct pathelem *cursor, const char *name)
|
||||
{
|
||||
unsigned int i, namelen;
|
||||
int i, namelen;
|
||||
|
||||
name += strspn(name, "/");
|
||||
namelen = strcspn(name, "/");
|
||||
|
@ -124,6 +126,20 @@ follow_path(const struct pathelem *cursor, const char *name)
|
|||
if (strneq(name, namelen, "."))
|
||||
return follow_path(cursor, name + namelen);
|
||||
|
||||
if (cursor->num_entries < 0) {
|
||||
static char path[255];
|
||||
if (is_dir_maybe(cursor->type))
|
||||
add_dir_maybe(cursor);
|
||||
else if (cursor->type == DT_LNK &&
|
||||
readlink(cursor->pathname, path, sizeof(path)) >= 0) {
|
||||
if (*path != '/')
|
||||
add_dir_maybe(cursor);
|
||||
} else
|
||||
cursor->num_entries = 0;
|
||||
if (cursor->num_entries > 0)
|
||||
set_parents(cursor, cursor->parent);
|
||||
}
|
||||
|
||||
for (i = 0; i < cursor->num_entries; i++)
|
||||
if (strneq(name, namelen, cursor->entries[i]->name))
|
||||
return follow_path(cursor->entries[i], name + namelen);
|
||||
|
@ -132,46 +148,64 @@ follow_path(const struct pathelem *cursor, const char *name)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
void init_paths(const char *prefix)
|
||||
void init_paths(const char *prefix_list)
|
||||
{
|
||||
char pref_buf[PATH_MAX];
|
||||
int count = base_count;
|
||||
char *list, *prefix, *p;
|
||||
|
||||
if (prefix[0] == '\0' ||
|
||||
!strcmp(prefix, "/"))
|
||||
return;
|
||||
list = g_strdup(prefix_list);
|
||||
|
||||
if (prefix[0] != '/') {
|
||||
char *cwd = getcwd(NULL, 0);
|
||||
size_t pref_buf_len = sizeof(pref_buf);
|
||||
for (p = list; *p; p++) count += (*p == ':');
|
||||
base = g_realloc(base, sizeof(*base) * (count + 1));
|
||||
|
||||
if (!cwd)
|
||||
abort();
|
||||
pstrcpy(pref_buf, sizeof(pref_buf), cwd);
|
||||
pstrcat(pref_buf, pref_buf_len, "/");
|
||||
pstrcat(pref_buf, pref_buf_len, prefix);
|
||||
free(cwd);
|
||||
} else
|
||||
pstrcpy(pref_buf, sizeof(pref_buf), prefix + 1);
|
||||
for (prefix = strtok(list, ":"); prefix; prefix = strtok(NULL, ":")) {
|
||||
if (prefix[0] == '\0' || !strcmp(prefix, "/"))
|
||||
continue;
|
||||
|
||||
base = new_entry("", NULL, pref_buf);
|
||||
base = add_dir_maybe(base);
|
||||
if (base->num_entries == 0) {
|
||||
g_free(base->pathname);
|
||||
g_free(base->name);
|
||||
g_free(base);
|
||||
base = NULL;
|
||||
} else {
|
||||
set_parents(base, base);
|
||||
if (prefix[0] != '/') {
|
||||
char *cwd = getcwd(NULL, 0);
|
||||
size_t pref_buf_len = sizeof(pref_buf);
|
||||
|
||||
if (!cwd)
|
||||
abort();
|
||||
pstrcpy(pref_buf, sizeof(pref_buf), cwd);
|
||||
pstrcat(pref_buf, pref_buf_len, "/");
|
||||
pstrcat(pref_buf, pref_buf_len, prefix);
|
||||
free(cwd);
|
||||
} else
|
||||
pstrcpy(pref_buf, sizeof(pref_buf), prefix + 1);
|
||||
|
||||
base[base_count] = new_entry("", NULL, pref_buf, DT_DIR);
|
||||
base[base_count] = add_dir_maybe(base[base_count]);
|
||||
|
||||
if (base[base_count]->num_entries <= 0) {
|
||||
g_free(base[base_count]->pathname);
|
||||
g_free(base[base_count]->name);
|
||||
g_free(base[base_count]);
|
||||
} else {
|
||||
set_parents(base[base_count], base[base_count]);
|
||||
base_count ++;
|
||||
}
|
||||
}
|
||||
g_free(list);
|
||||
}
|
||||
|
||||
/* Look for path in emulation dir, otherwise return name. */
|
||||
const char *path(const char *name)
|
||||
{
|
||||
const char *p;
|
||||
int i;
|
||||
|
||||
/* Only do absolute paths: quick and dirty, but should mostly be OK.
|
||||
Could do relative by tracking cwd. */
|
||||
if (!base || !name || name[0] != '/')
|
||||
return name;
|
||||
|
||||
return follow_path(base, name) ?: name;
|
||||
for (i = 0; i < base_count; i++) {
|
||||
if ((p = follow_path(base[i], name)))
|
||||
return p;
|
||||
}
|
||||
|
||||
return name;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue