diff -urN simplesim-arm/eval.c simplesim-arm-patched/eval.c --- simplesim-arm/eval.c 2000-11-29 15:53:54.000000000 +0100 +++ simplesim-arm-patched/eval.c 2004-07-29 09:54:22.000000000 +0200 @@ -80,9 +80,7 @@ #include #include #include -#if defined(__CYGWIN32__) #include -#endif #include "host.h" #include "misc.h" diff -urN simplesim-arm/range.c simplesim-arm-patched/range.c --- simplesim-arm/range.c 2000-11-29 15:53:54.000000000 +0100 +++ simplesim-arm-patched/range.c 2004-07-29 09:54:34.000000000 +0200 @@ -78,9 +78,7 @@ #include #include #include -#if defined(__CYGWIN32__) #include -#endif #include "host.h" #include "misc.h" diff -urN simplesim-arm/syscall.c simplesim-arm-patched/syscall.c --- simplesim-arm/syscall.c 2000-11-29 15:53:54.000000000 +0100 +++ simplesim-arm-patched/syscall.c 2004-07-29 16:17:36.252477502 +0200 @@ -179,6 +179,9 @@ #ifndef _MSC_VER #include #endif + /* Ludo */ +#define __USE_LARGEFILE64 1 + /* end Ludo */ #include #ifndef _MSC_VER #include @@ -584,6 +587,8 @@ #define ARM_SYS_setfsuid32 215 #define ARM_SYS_setfsgid32 216 +#define ARM_SYS_fcntl64 221 + /* These are the numbers for the socket function on a socketcall */ /* these were defined at /usr/include/sys/socketcall.h */ @@ -668,6 +673,29 @@ word_t pad6; }; +struct linux_stat64buf +{ + qword_t linux_st_dev; + word_t pad1; + unsigned long int linux_st__ino; /* 32 bit file serial number */ + word_t linux_st_mode; + word_t linux_st_nlink; + word_t linux_st_uid; + word_t linux_st_gid; + qword_t linux_st_rdev; + word_t pad2; + sqword_t linux_st_size; + long int linux_st_blksize; + sqword_t linux_st_blocks; + long int linux_st_atime; + unsigned long int linux_st_atimensec; + long int linux_st_mtime; + unsigned long int linux_st_mtimensec; + long int linux_st_ctime; + unsigned long int linux_st_ctimensec; + qword_t linux_st_ino; /* 64 bit file serial number */ +}; + struct osf_sgttyb { byte_t sg_ispeed; /* input speed */ byte_t sg_ospeed; /* output speed */ @@ -794,6 +822,7 @@ #define LINUX_O_NONBLOCK 04000 #define LINUX_O_SYNC 010000 #define LINUX_O_ASYNC 020000 +#define LINUX_O_LARGEFILE 0400000 /* open(2) flags translation table for SimpleScalar target */ struct { @@ -834,6 +863,7 @@ #ifdef O_ASYNC { LINUX_O_ASYNC, O_ASYNC }, #endif + { LINUX_O_LARGEFILE, 0}, /* Bruno: ignore LARGEFILE flag for now */ #endif /* _MSC_VER */ }; #define LINUX_NFLAGS (sizeof(linux_flag_table)/sizeof(linux_flag_table[0])) @@ -1642,6 +1672,7 @@ break; case ARM_SYS_getuid: + case ARM_SYS_getuid32: #ifdef _MSC_VER warn("syscall getuid() not yet implemented for MSC..."); regs->regs_R[MD_REG_R0] = 0; @@ -1658,6 +1689,7 @@ case ARM_SYS_geteuid: + case ARM_SYS_geteuid32: #ifdef _MSC_VER warn("syscall getuid() not yet implemented for MSC..."); regs->regs_R[MD_REG_R0] = 0; @@ -1795,6 +1827,7 @@ break; case ARM_SYS_getgid: + case ARM_SYS_getgid32: #ifdef _MSC_VER warn("syscall getgid() not yet implemented for MSC..."); regs->regs_R[MD_REG_R0] = 0; @@ -1810,6 +1843,7 @@ break; case ARM_SYS_getegid: + case ARM_SYS_getegid32: #ifdef _MSC_VER warn("syscall getgid() not yet implemented for MSC..."); regs->regs_R[MD_REG_R0] = 0; @@ -2086,6 +2120,39 @@ } break; + case ARM_SYS_fstat64: + { + struct linux_stat64buf linux_sbuf; + struct stat64 sbuf; + /* fstat() the file */ + regs->regs_R[MD_REG_R0] = + fstat64(/*fd*/regs->regs_R[MD_REG_R0], &sbuf); + /* check for an error condition */ + if (regs->regs_R[MD_REG_R0] == (qword_t)-1) + /* got an error, return details */ + regs->regs_R[MD_REG_R0] = -errno; + /* translate the stat structure to host format */ + linux_sbuf.linux_st_dev = MD_SWAPQ(sbuf.st_dev); + linux_sbuf.linux_st__ino = MD_SWAPW(sbuf.__st_ino); + linux_sbuf.linux_st_mode = MD_SWAPW(sbuf.st_mode); + linux_sbuf.linux_st_nlink = MD_SWAPW(sbuf.st_nlink); + linux_sbuf.linux_st_uid = MD_SWAPW(sbuf.st_uid); + linux_sbuf.linux_st_gid = MD_SWAPW(sbuf.st_gid); + linux_sbuf.linux_st_rdev = MD_SWAPQ(sbuf.st_rdev); + linux_sbuf.linux_st_size = MD_SWAPQ(sbuf.st_size); + linux_sbuf.linux_st_blksize = MD_SWAPW(sbuf.st_blksize); + linux_sbuf.linux_st_blocks = MD_SWAPQ(sbuf.st_blocks); + linux_sbuf.linux_st_atime = MD_SWAPW(sbuf.st_atime); + linux_sbuf.linux_st_mtime = MD_SWAPW(sbuf.st_mtime); + linux_sbuf.linux_st_ctime = MD_SWAPW(sbuf.st_ctime); + linux_sbuf.linux_st_ino = MD_SWAPQ(sbuf.st_ino); +/* linux_sbuf.linux_st_ctimensec = MD_SWAPW(sbuf.st_ctimensec); + linux_sbuf.linux_st_mtimensec = MD_SWAPW(sbuf.st_mtimensec); + linux_sbuf.linux_st_atimensec = MD_SWAPW(sbuf.st_atimensec);*/ + + } + break; + #if XXX /*-------------------------------Is there a getpagesize in arm-linux??----------------------*/ case OSF_SYS_getpagesize: @@ -2249,6 +2316,7 @@ break; case ARM_SYS_fcntl: + case ARM_SYS_fcntl64: #ifdef _MSC_VER warn("syscall fcntl() not yet implemented for MSC..."); regs->regs_R[MD_REG_R0] = 0; diff -urN simplesim-arm/target-arm/arm.c simplesim-arm-patched/target-arm/arm.c --- simplesim-arm/target-arm/arm.c 2000-11-29 15:53:54.000000000 +0100 +++ simplesim-arm-patched/target-arm/arm.c 2004-07-29 16:21:20.809292027 +0200 @@ -298,8 +298,8 @@ { "$sp", rt_gpr, 13 }, { "$r14", rt_gpr, 14 }, { "$lr", rt_gpr, 14 }, - { "$r15", rt_gpr, 15 }, { "$pc", rt_gpr, 15 }, + { "$r15", rt_gpr, 15 }, /* floating point register file - double precision */ { "$f0", rt_fpr, 0 }, diff -urN simplesim-arm/target-arm/arm.def simplesim-arm-patched/target-arm/arm.def --- simplesim-arm/target-arm/arm.def 2000-12-20 07:00:08.000000000 +0100 +++ simplesim-arm-patched/target-arm/arm.def 2004-07-29 15:54:12.778885763 +0200 @@ -671,7 +671,7 @@ CONNECT(ALUREG1a_LINK) -DEFLINK(SWPMRS_LINK, 0x00, "swpmrs_link", 4, 0xff) +DEFLINK(SWPMRS_LINK, 0x00, "swpmrs_link", 20, 0x01) #define TSTS_IMPL \ { \ @@ -703,11 +703,11 @@ } \ } DEFINST(TEQS, 0x03, - "teq%cs", "%n,%m", + "teq1%cs", "%n,%m", IntALU, F_ICOMP, DPSR, DPSR, DNA, DPSR, DGPR(RN), DGPR(RM), DSHRS(RS)) -DEFLINK(MRSSWP_LINK, 0x04, "mrsswp_link", 4, 0xff) +DEFLINK(MRSSWP_LINK, 0x04, "mrsswp_link", 20, 0x01) #define CMPS_IMPL \ { \ @@ -880,22 +880,20 @@ #if 0 DEFLINK(MRSTST_LINK, 0xff00, "mrstst_link", 0, 0xf0fff) - CONNECT(MRSTST_LINK) +#endif -#define MRS_CPSR_IMPL \ - { \ - if (COND_VALID(PSR)) \ - { \ - /* FIXME: todo... */ \ - DECLARE_FAULT(md_fault_unimpl); \ - } \ +#define MRS_CPSR_IMPL \ + { \ + if (COND_VALID(PSR)) \ + { \ + SET_GPR(RD, PSR); \ + } \ } -DEFINST(MSR_CPSR, EQ, 0xf0000, - "msr", "%d, cpsr", +DEFINST(MRS_CPSR, 0x00, + "mrs", "%d, cpsr", IntALU, F_ICOMP, DGPR(RD), DNA, DNA, DCOND, DPSR, DNA, DNA) -#endif #define TST_IMPL \ { \ @@ -904,11 +902,12 @@ /* test but don't set flags, nada... */ \ } \ } -DEFINST(TST, 0xff00, +DEFINST(TST, 0x01, "tst%c", "%n,%m", IntALU, F_ICOMP, DNA, DNA, DNA, DCOND, DNA, DNA, DNA) +#if 0 #define SWP_IMPL \ { \ if (COND_VALID(PSR)) \ @@ -921,10 +920,11 @@ "swp%c", "%d,%w,%s,%n", IntMULT, F_ICOMP, DNA, DNA, DNA, DCOND, DNA, DNA, DNA) +#endif CONNECT(MSRTEQ_LINK) - +#if 0 #define TEQ_IMPL \ { \ if (COND_VALID(PSR)) \ @@ -933,44 +933,42 @@ } \ } DEFINST(TEQ, 0x7f00, - "teq%c", "%n,%m", + "teq2%c", "%n,%m", IntALU, F_ICOMP, DNA, DNA, DNA, DCOND, DNA, DNA, DNA) - -#define MSR_CPSR_IMPL \ - { \ - if (COND_VALID(PSR)) \ - { \ - /* FIXME: todo... */ \ - DECLARE_FAULT(md_fault_unimpl); \ - } \ +#endif +#define MSR_CPSR_IMPL \ + { \ + if (COND_VALID(PSR)) \ + { \ + SET_PSR(GPR(RM)); \ + } \ } -DEFINST(MSR_CPSR, 0x0f, - "msr", "cpsr,%d", + +DEFINST(MSR_CPSR, 0x7f00, + "msr", "cpsr,%w", IntALU, F_ICOMP, - DNA, DNA, DNA, DCOND, DNA, DNA, DNA) + DNA, DNA, DNA, DCOND, DGPR(RM), DNA, DNA) CONNECT(MRSSWP_LINK) #if 0 DEFLINK(MRSCMP_LINK, NE, 0x09, "mrscmp_link", 0, 0xf0fff) - CONNECT(MRSCMP_LINK) +#endif -#define MRS_SPSR_IMPL \ - { \ - if (COND_VALID(PSR)) \ - { \ - /* FIXME: todo... */ \ - DECLARE_FAULT(md_fault_unimpl); \ - } \ +#define MRS_SPSR_IMPL \ + { \ + if (COND_VALID(PSR)) \ + { \ + DECLARE_FAULT(md_fault_unimpl); /*SET_GPR(RD, SPSR);*/ \ + } \ } -DEFINST(MSR_SPSR, EQ, 0xf0000, +DEFINST(MRS_SPSR, 0x00, "mrs", "%d, spsr", IntALU, F_ICOMP, - DGPR(RD), DNA, DNA, DCOND, DPSR, DNA, DNA, DNA) -#endif + DGPR(RD), DNA, DNA, DCOND, DPSR, DNA, DNA) #define CMP_IMPL \ { \ @@ -979,11 +977,12 @@ /* compare but don't set flags, nada... */ \ } \ } -DEFINST(CMP, 0xff00, +DEFINST(CMP, 0x01, "cmp%c", "%n,%m", IntALU, F_ICOMP, DNA, DNA, DNA, DCOND, DNA, DNA, DNA) +#if 0 #define SWP1_IMPL \ { \ if (COND_VALID(PSR)) \ @@ -996,6 +995,7 @@ "swp%c", "%d,%w,%s,%n", IntMULT, F_ICOMP, DNA, DNA, DNA, DCOND, DNA, DNA, DNA) +#endif CONNECT(MSRTST_LINK) @@ -1012,18 +1012,17 @@ IntALU, F_ICOMP, DNA, DNA, DNA, DCOND, DNA, DNA, DNA) -#define MSR_SPSR_IMPL \ - { \ - if (COND_VALID(PSR)) \ - { \ - /* FIXME: todo... */ \ - DECLARE_FAULT(md_fault_unimpl); \ - } \ +#define MSR_SPSR_IMPL \ + { \ + if (COND_VALID(PSR)) \ + { \ + DECLARE_FAULT(md_fault_unimpl); /*SET_SPSR(GPR(RM));*/ \ + } \ } -DEFINST(MSR_SPSR, 0x0f, - "msr", "spsr,%d", +DEFINST(MSR_SPSR, 0x1f, + "msr", "spsr,%w", IntALU, F_ICOMP, - DNA, DNA, DNA, DCOND, DNA, DNA, DNA) + DNA, DNA, DNA, DCOND, DGPR(RM), DNA, DNA) CONNECT(ALUIMM0_LINK) @@ -1327,7 +1326,7 @@ } \ } DEFINST(TEQSI, 0x03, - "teq%cs", "%n,#%i", + "teq3%cs", "%n,#%i", IntALU, F_ICOMP, DPSR, DNA, DNA, DCOND, DGPR(RN), DNA, DNA) @@ -1520,7 +1519,7 @@ } \ } DEFINST(TEQI, 0x7f00, - "teq%c", "%n,#%i", + "teq4%c", "%n,#%i", IntALU, F_ICOMP, DNA, DNA, DNA, DCOND, DNA, DNA, DNA) @@ -4215,38 +4214,71 @@ RdPort, F_MEM|F_STORE|F_DISP|F_CISC, DNA, DNA, DNA, DNA, DNA, DNA, DNA) -#if 0 - /* STM_S, 0x04, TODO... */ +#define STM_S_IMPL \ + { \ + if (COND_VALID(PSR)) \ + { \ + /* FIXME: todo... */ \ + DECLARE_FAULT(md_fault_unimpl); \ + fatal("STM_S not implemented\n"); \ + } \ + } DEFINST(STM_S, 0x04, - "stm%c%a", "%n,%R", + "stm%c%a.s", "%n,%R", WrPort, F_MEM|F_STORE|F_DISP/*|F_CISC*/, DNA, DNA, DNA, DNA, DNA, DNA, DNA) /* LDM_SL, 0x05, TODO... */ +#define LDM_SL_IMPL \ + { \ + if (COND_VALID(PSR)) \ + { \ + /* FIXME: todo... */ \ + DECLARE_FAULT(md_fault_unimpl); \ + fatal("LDM_SL not implemented\n"); \ + } \ + } DEFINST(LDM_SL, 0x05, - "stm%c%a", "%n,%R", + "ldm%c%a.s", "%n,%R", WrPort, F_MEM|F_STORE|F_DISP/*|F_CISC*/, DNA, DNA, DNA, DNA, DNA, DNA, DNA) /* STM_SW, 0x06, TODO... */ +#define STM_SW_IMPL \ + { \ + if (COND_VALID(PSR)) \ + { \ + /* FIXME: todo... */ \ + DECLARE_FAULT(md_fault_unimpl); \ + fatal("STM_SW not implemented\n"); \ + } \ + } DEFINST(STM_SW, 0x06, - "stm%c%a", "%n!,%R", + "stm%c%a.s", "%n!,%R", WrPort, F_MEM|F_STORE|F_DISP/*|F_CISC*/, DNA, DNA, DNA, DNA, DNA, DNA, DNA) /* LDM_SWL, 0x07, TODO... */ -DEFINST(LDM_SWL, 0x07, - "stm%c%a", "%n!,%R", +#define LDM_SWL_IMPL \ + { \ + if (COND_VALID(PSR)) \ + { \ + /* FIXME: todo... */ \ + DECLARE_FAULT(md_fault_unimpl); \ + fatal("LDM_SWL not implemented\n"); \ + } \ + } +DEFINST(LDM_SWL, 0x07, + "ldm%c%a.s", "%n!,%R", WrPort, F_MEM|F_STORE|F_DISP/*|F_CISC*/, DNA, DNA, DNA, DNA, DNA, DNA, DNA) -#endif #define STM_U_IMPL \ { \ @@ -4367,37 +4399,112 @@ RdPort, F_MEM|F_STORE|F_DISP|F_CISC, DNA, DNA, DNA, DNA, DNA, DNA, DNA) -#if 0 - /* STM_US, 0x0c, TODO... */ +#define STM_US_IMPL \ + { \ + if (COND_VALID(PSR)) \ + { \ + /* FIXME: todo... */ \ + DECLARE_FAULT(md_fault_unimpl); \ + fatal("STM_US not implemented.\n"); \ + } \ + } DEFINST(STM_US, 0x0c, - "stm%c%a", "%n,%R", + "stm%c%a.s", "%n,%R", WrPort, F_MEM|F_STORE|F_DISP/*|F_CISC*/, DNA, DNA, DNA, DNA, DNA, DNA, DNA) /* LDM_USL, 0x0d, TODO... */ -DEFINST(LDM_USL, 0x0d, - "stm%c%a", "%n,%R", +#define LDM_USL_IMPL \ + { \ + if (COND_VALID(PSR)) \ + { \ + int _i; \ + enum md_fault_type _fault; \ + md_addr_t _addr; \ + word_t _result; \ + \ + _addr = GPR_EX(RN); \ + for (_i=0; _i < 16; _i++) \ + { \ + if (REGLIST & (1 << _i)) \ + { \ + /* store reg(_i) */ \ + _result = READ_WORD(_addr & ~3, _fault); \ + if (_fault != md_fault_none) \ + DECLARE_FAULT(_fault); \ + if (REGLIST & 0x8000) \ + SET_GPR(_i, _result); \ + else \ + DECLARE_FAULT(md_fault_unimpl); /* *(vregR[mode_user][_i]) = _result; */ \ + _addr += 4; \ + } \ + } \ + if (REGLIST & 0x8000) \ + { DECLARE_FAULT(md_fault_unimpl); /*RESTORE_PSR_MODE; */ } \ + } \ + } +DEFINST(LDM_USL, 0x0d, + "ldm%c%a.s", "%n,%R", WrPort, F_MEM|F_STORE|F_DISP/*|F_CISC*/, DNA, DNA, DNA, DNA, DNA, DNA, DNA) /* STM_USW, 0x0e, TODO... */ +#define STM_USW_IMPL \ + { \ + if (COND_VALID(PSR)) \ + { \ + /* FIXME: how does this work??? */ \ + DECLARE_FAULT(md_fault_unimpl); \ + fatal("STM_USW not implemented\n"); \ + } \ + } DEFINST(STM_USW, 0x0e, - "stm%c%a", "%n,%R", + "stm%c%a.s", "%n,%R", WrPort, F_MEM|F_STORE|F_DISP/*|F_CISC*/, DNA, DNA, DNA, DNA, DNA, DNA, DNA) /* LDM_USWL, 0x0f, TODO... */ +#define LDM_USWL_IMPL \ + { \ + if (COND_VALID(PSR)) \ + { \ + int _i; \ + enum md_fault_type _fault; \ + md_addr_t _addr, _wbaddr; \ + word_t _result; \ + \ + _addr = GPR_EX(RN); \ + _wbaddr = GPR_EX(RN) + (ONES(REGLIST) << 2); \ + SET_GPR(RN, _wbaddr); \ + for (_i=0; _i < 16; _i++) \ + { \ + if (REGLIST & (1 << _i)) \ + { \ + /* store reg(_i) */ \ + _result = READ_WORD(_addr & ~3, _fault); \ + if (_fault != md_fault_none) \ + DECLARE_FAULT(_fault); \ + if (REGLIST & 0x8000) \ + SET_GPR(_i, _result); \ + else \ + DECLARE_FAULT(md_fault_unimpl); /* *(vregR[mode_user][_i]) = _result; */ \ + _addr += 4; \ + } \ + } \ + if (REGLIST & 0x8000) \ + { DECLARE_FAULT(md_fault_unimpl); /*RESTORE_PSR_MODE; */ } \ + } \ + } DEFINST(LDM_USWL, 0x0f, - "stm%c%a", "%n,%R", + "ldm%c%a.s", "%n,%R", WrPort, F_MEM|F_STORE|F_DISP/*|F_CISC*/, DNA, DNA, DNA, DNA, DNA, DNA, DNA) -#endif CONNECT(BLKPRE_LINK) @@ -4523,12 +4630,81 @@ /* STM_PS, 0x04, TODO... */ +#define STM_PS_IMPL \ + { \ + if (COND_VALID(PSR)) \ + { \ + int _i; \ + enum md_fault_type _fault; \ + md_addr_t _addr; \ + \ + _addr = GPR_EX(RN) - (ONES(REGLIST) << 2); \ + for (_i=0; _i < 16; _i++) \ + { \ + if (REGLIST & (1 << _i)) \ + { \ + /* store reg(_i) */ \ + if (_i == 15) \ + WRITE_WORD(GPR_MEM(_i), _addr, _fault); \ + else \ + DECLARE_FAULT(md_fault_unimpl); /*WRITE_WORD(*(vregR[mode_user][_i]), _addr, _fault); */\ + if (_fault != md_fault_none) \ + DECLARE_FAULT(_fault); \ + _addr += 4; \ + } \ + } \ + } \ + } +DEFINST(STM_PS, 0x04, + "stm%c%a.s", "%n,%R", + WrPort, F_MEM|F_STORE|F_DISP/*|F_CISC*/, + DNA, DNA, DNA, DNA, DNA, DNA, DNA) + /* LDM_PSL, 0x05, TODO... */ +#define LDM_PSL_IMPL \ + { \ + if (COND_VALID(PSR)) \ + { \ + /* FIXME: todo... */ \ + DECLARE_FAULT(md_fault_unimpl); \ + } \ + } +DEFINST(LDM_PSL, 0x05, + "ldm%c%a.s", "%n,%R", + WrPort, F_MEM|F_STORE|F_DISP/*|F_CISC*/, + DNA, DNA, DNA, DNA, DNA, DNA, DNA) + /* STM_PSW, 0x06, TODO... */ +#define STM_PSW_IMPL \ + { \ + if (COND_VALID(PSR)) \ + { \ + /* FIXME: todo... */ \ + DECLARE_FAULT(md_fault_unimpl); \ + } \ + } +DEFINST(STM_PSW, 0x06, + "stm%c%a.s", "%n,%R", + WrPort, F_MEM|F_STORE|F_DISP/*|F_CISC*/, + DNA, DNA, DNA, DNA, DNA, DNA, DNA) + /* LDM_PSWL, 0x07, TODO... */ +#define LDM_PSWL_IMPL \ + { \ + if (COND_VALID(PSR)) \ + { \ + /* FIXME: todo... */ \ + DECLARE_FAULT(md_fault_unimpl); \ + } \ + } +DEFINST(LDM_PSWL, 0x07, + "ldm%c%a.s", "%n,%R", + WrPort, F_MEM|F_STORE|F_DISP/*|F_CISC*/, + DNA, DNA, DNA, DNA, DNA, DNA, DNA) + #define STM_PU_IMPL \ { \ if (COND_VALID(PSR)) \ @@ -4650,17 +4826,71 @@ /* STM_PUS, 0x0c, TODO... */ +#define STM_PUS_IMPL \ + { \ + if (COND_VALID(PSR)) \ + { \ + /* FIXME: todo... */ \ + DECLARE_FAULT(md_fault_unimpl); \ + } \ + } +DEFINST(STM_PUS, 0x0c, + "stm%c%a.s", "%n,%R", + WrPort, F_MEM|F_STORE|F_DISP/*|F_CISC*/, + DNA, DNA, DNA, DNA, DNA, DNA, DNA) + /* LDM_PUSL, 0x0d, TODO... */ +#define LDM_PUSL_IMPL \ + { \ + if (COND_VALID(PSR)) \ + { \ + /* FIXME: todo... */ \ + DECLARE_FAULT(md_fault_unimpl); \ + } \ + } +DEFINST(LDM_PUSL, 0x0d, + "ldm%c%a.s", "%n,%R", + WrPort, F_MEM|F_STORE|F_DISP/*|F_CISC*/, + DNA, DNA, DNA, DNA, DNA, DNA, DNA) + /* STM_PUSW, 0x0e, TODO... */ +#define STM_PUSW_IMPL \ + { \ + if (COND_VALID(PSR)) \ + { \ + /* FIXME: todo... */ \ + DECLARE_FAULT(md_fault_unimpl); \ + } \ + } +DEFINST(STM_PUSW, 0x0e, + "stm%c%a.s", "%n,%R", + WrPort, F_MEM|F_STORE|F_DISP/*|F_CISC*/, + DNA, DNA, DNA, DNA, DNA, DNA, DNA) + /* LDM_PUSWL, 0x0f, TODO... */ +#define LDM_PUSWL_IMPL \ + { \ + if (COND_VALID(PSR)) \ + { \ + /* FIXME: todo... */ \ + DECLARE_FAULT(md_fault_unimpl); \ + } \ + } +DEFINST(LDM_PUSWL, 0x0f, + "ldm%c%a.s", "%n,%R", + WrPort, F_MEM|F_STORE|F_DISP/*|F_CISC*/, + DNA, DNA, DNA, DNA, DNA, DNA, DNA) + CONNECT(CPROC_LINK) DEFLINK(FPA_LINK, 0x01, "fpa_link", 4, 0x01) +DEFLINK(CP15_LINK, 0x0f, "cp15_link", 4, 0x01) + CONNECT(FPA_LINK) @@ -4712,7 +4942,61 @@ DEFLINK(UNDNRM_LINK, 0x0f, "undnrm_link", 15, 0x01) +/* Memory manipulation instructions (coprocessor 15) */ +/* FIXME: MCR and MRC are more general than just cp15 */ + +CONNECT(CP15_LINK) + +/* todo: Coprocessor Data operations?? (no such thing for cp15) */ +DEFLINK(MMU_LINK, 0x01, "mmu_link", 20, 0x01) + +CONNECT(MMU_LINK) +#if 0 +#define MCR_IMPL \ +{ \ + if(COND_VALID(PSR)) \ + { \ + if(CPNUM != 0x0f) { DECLARE_FAULT(md_fault_unimpl); } \ + else if (RN == 0 || RN == 4 || (RN >= 10 && RN <=12)) \ + { \ + warn("Attempt to write [%u] to Coprocessor 15 register [%u]", GPR(RD), RN); \ + } \ + else \ + { \ + if(RD == 15) { SET_CP15(RN, (GPR(15)+12)); } \ + else { SET_CP15(RN, GPR(RD)); } \ + } \ + } \ +} + +DEFINST(MCR, 0x00, + "mcr%c", "%s,,%d,%n", + IntALU, F_ICOMP, + DGPR(RD), DNA, DNA, DNA, DNA, DNA, DNA) + +#define MRC_IMPL \ +{ \ + if(COND_VALID(PSR)) \ + { \ + if(CPNUM != 0x0f) { DECLARE_FAULT(md_fault_unimpl); } \ + else if (RN == 4 || (RN >= 7 && RN <=12) || RN == 15) \ + { \ + warn("Attempt to read from Coprocessor 15 register [%u]", RN); \ + } \ + else \ + { \ + if(RD == 15) { PSR = ((PSR & (~0x0f << 28)) | (CP15(RN) & (0x0f << 28))); } \ + else { SET_GPR(RD, CP15(RN)); } \ + } \ + } \ +} + +DEFINST(MRC, 0x01, + "mrc%c", "%s,,%d,%n", + IntALU, F_ICOMP, + DPSR, DNA, DNA, DGPR(RD), DPSR, DNA, DNA) +#endif CONNECT(ADFMVF_LINK) DEFLINK(ADFADFI_LINK, 0x00, "adfadfi_link", 3, 0x01) diff -urN simplesim-arm/target-arm/syscall.c simplesim-arm-patched/target-arm/syscall.c --- simplesim-arm/target-arm/syscall.c 2000-11-29 15:53:54.000000000 +0100 +++ simplesim-arm-patched/target-arm/syscall.c 2004-07-29 16:17:36.252477502 +0200 @@ -179,6 +179,9 @@ #ifndef _MSC_VER #include #endif + /* Ludo */ +#define __USE_LARGEFILE64 1 + /* end Ludo */ #include #ifndef _MSC_VER #include @@ -584,6 +587,8 @@ #define ARM_SYS_setfsuid32 215 #define ARM_SYS_setfsgid32 216 +#define ARM_SYS_fcntl64 221 + /* These are the numbers for the socket function on a socketcall */ /* these were defined at /usr/include/sys/socketcall.h */ @@ -668,6 +673,29 @@ word_t pad6; }; +struct linux_stat64buf +{ + qword_t linux_st_dev; + word_t pad1; + unsigned long int linux_st__ino; /* 32 bit file serial number */ + word_t linux_st_mode; + word_t linux_st_nlink; + word_t linux_st_uid; + word_t linux_st_gid; + qword_t linux_st_rdev; + word_t pad2; + sqword_t linux_st_size; + long int linux_st_blksize; + sqword_t linux_st_blocks; + long int linux_st_atime; + unsigned long int linux_st_atimensec; + long int linux_st_mtime; + unsigned long int linux_st_mtimensec; + long int linux_st_ctime; + unsigned long int linux_st_ctimensec; + qword_t linux_st_ino; /* 64 bit file serial number */ +}; + struct osf_sgttyb { byte_t sg_ispeed; /* input speed */ byte_t sg_ospeed; /* output speed */ @@ -794,6 +822,7 @@ #define LINUX_O_NONBLOCK 04000 #define LINUX_O_SYNC 010000 #define LINUX_O_ASYNC 020000 +#define LINUX_O_LARGEFILE 0400000 /* open(2) flags translation table for SimpleScalar target */ struct { @@ -834,6 +863,7 @@ #ifdef O_ASYNC { LINUX_O_ASYNC, O_ASYNC }, #endif + { LINUX_O_LARGEFILE, 0}, /* Bruno: ignore LARGEFILE flag for now */ #endif /* _MSC_VER */ }; #define LINUX_NFLAGS (sizeof(linux_flag_table)/sizeof(linux_flag_table[0])) @@ -1642,6 +1672,7 @@ break; case ARM_SYS_getuid: + case ARM_SYS_getuid32: #ifdef _MSC_VER warn("syscall getuid() not yet implemented for MSC..."); regs->regs_R[MD_REG_R0] = 0; @@ -1658,6 +1689,7 @@ case ARM_SYS_geteuid: + case ARM_SYS_geteuid32: #ifdef _MSC_VER warn("syscall getuid() not yet implemented for MSC..."); regs->regs_R[MD_REG_R0] = 0; @@ -1795,6 +1827,7 @@ break; case ARM_SYS_getgid: + case ARM_SYS_getgid32: #ifdef _MSC_VER warn("syscall getgid() not yet implemented for MSC..."); regs->regs_R[MD_REG_R0] = 0; @@ -1810,6 +1843,7 @@ break; case ARM_SYS_getegid: + case ARM_SYS_getegid32: #ifdef _MSC_VER warn("syscall getgid() not yet implemented for MSC..."); regs->regs_R[MD_REG_R0] = 0; @@ -2086,6 +2120,39 @@ } break; + case ARM_SYS_fstat64: + { + struct linux_stat64buf linux_sbuf; + struct stat64 sbuf; + /* fstat() the file */ + regs->regs_R[MD_REG_R0] = + fstat64(/*fd*/regs->regs_R[MD_REG_R0], &sbuf); + /* check for an error condition */ + if (regs->regs_R[MD_REG_R0] == (qword_t)-1) + /* got an error, return details */ + regs->regs_R[MD_REG_R0] = -errno; + /* translate the stat structure to host format */ + linux_sbuf.linux_st_dev = MD_SWAPQ(sbuf.st_dev); + linux_sbuf.linux_st__ino = MD_SWAPW(sbuf.__st_ino); + linux_sbuf.linux_st_mode = MD_SWAPW(sbuf.st_mode); + linux_sbuf.linux_st_nlink = MD_SWAPW(sbuf.st_nlink); + linux_sbuf.linux_st_uid = MD_SWAPW(sbuf.st_uid); + linux_sbuf.linux_st_gid = MD_SWAPW(sbuf.st_gid); + linux_sbuf.linux_st_rdev = MD_SWAPQ(sbuf.st_rdev); + linux_sbuf.linux_st_size = MD_SWAPQ(sbuf.st_size); + linux_sbuf.linux_st_blksize = MD_SWAPW(sbuf.st_blksize); + linux_sbuf.linux_st_blocks = MD_SWAPQ(sbuf.st_blocks); + linux_sbuf.linux_st_atime = MD_SWAPW(sbuf.st_atime); + linux_sbuf.linux_st_mtime = MD_SWAPW(sbuf.st_mtime); + linux_sbuf.linux_st_ctime = MD_SWAPW(sbuf.st_ctime); + linux_sbuf.linux_st_ino = MD_SWAPQ(sbuf.st_ino); +/* linux_sbuf.linux_st_ctimensec = MD_SWAPW(sbuf.st_ctimensec); + linux_sbuf.linux_st_mtimensec = MD_SWAPW(sbuf.st_mtimensec); + linux_sbuf.linux_st_atimensec = MD_SWAPW(sbuf.st_atimensec);*/ + + } + break; + #if XXX /*-------------------------------Is there a getpagesize in arm-linux??----------------------*/ case OSF_SYS_getpagesize: @@ -2249,6 +2316,7 @@ break; case ARM_SYS_fcntl: + case ARM_SYS_fcntl64: #ifdef _MSC_VER warn("syscall fcntl() not yet implemented for MSC..."); regs->regs_R[MD_REG_R0] = 0;