5f73c6ccf0
gcc: * config.gcc (extra_parts): Remove. (*-*-freebsd*): Remove extra_parts. (*-*-linux*, frv-*-*linux*, *-*-kfreebsd*-gnu, *-*-knetbsd*-gnu, *-*-gnu*, *-*-kopensolaris*-gnu): Likewise. (*-*-netbsd*): Remove t-libc-ok, t-netbsd from tmake_file. Remove extra_parts for *-*-netbsd*1.[7-9]*, *-*-netbsd[2-9]*, *-*-netbsdelf[2-9]*. (*-*-openbsd*): Remove t-libc-ok from tmake_file. (alpha*-*-linux*): Remove extra_parts. (alpha*-*-freebsd*): Likewise. (bfin*-linux-uclibc*): Likewise. (fr30-*-elf): Likewise. (moxie-*-elf): Likewise. (moxie-*-uclinux*): Likewise. (h8300-*-rtems*): Remove h8300/t-elf from tmake_file. (h8300-*-elf*): Likewise. (hppa*64*-*-hpux11*): Remove extra_parts. (i[34567]86-*-elf*): Remove i386/t-i386elf, i386/t-crtstuff from tmake_file. (x86_64-*-elf*): Likewise. (i[34567]86-*-freebsd*): Remove tmake_file. (x86_64-*-freebsd*): Likewise. (x86_64-*-netbsd*): Likewise. (i[34567]86-*-openbsd2.*, i[34567]86-*openbsd3.[0123]): Remove t-libc-ok from tmake_file. (i[34567]86-*-linux*, i[34567]86-*-kfreebsd*-gnu, i[34567]86-*-knetbsd*-gnu, i[34567]86-*-gnu*, i[34567]86-*-kopensolaris*-gnu): Remove i386/t-crtstuff from tmake_file. Remove extra_parts. (x86_64-*-linux*, x86_64-*-kfreebsd*-gnu, x86_64-*-knetbsd*-gnu): Remove i386/t-crtstuff from tmake_file. (i[34567]86-*-lynxos*): Likewise. Remove extra_parts. (ia64*-*-elf*): Remove extra_parts. (ia64*-*-freebsd*): Likewise. (ia64*-*-linux*): Likewise. (ia64-hp-*vms*): Remove ia64/t-vms from tmake_file. (m32r-*-elf*): Remove extra_parts. (m32rle-*-elf*): Likewise. (m32r-*-rtems*): Likewise. (m68k-*-elf*, fido-*-elf*): Likewise. (m68k*-*-openbsd*): Remove t-libc-ok from tmake_file. (m68k-*-rtems*): Remove extra_parts. (mep-*-*): Likewise. (microblaze*-linux*): Likewise. (mips64*-*-linux*, mipsisa64*-*-linux*): Likewise. (mips*-*-linux*): Likewise. (powerpc-*-lynxos*): Likewise. (s390x-ibm-tpf*): Likewise. (score-*-elf): Likewise. Remove tmake_file. (sh-*-elf*, sh[12346l]*-*-elf*, sh-*-linux*, sh[2346lbe]*-*-linux*, sh-*-netbsdelf*, shl*-*-netbsdelf*, sh5-*-netbsd*, sh5l*-*-netbsd*, sh64-*-netbsd*, sh64l*-*-netbsd*): Remove sh/t-elf from tmake_file. Remove sh/t-superh from tmake_file for sh*-superh-elf. Remove sh/t-linux64 from tmake_file for sh64*-*-linux*. (sh-*-rtems*): Remove sh/t-elf from tmake_file. (sh-wrs-vxworks): Likewise. (sparc-*-linux*): Remove extra_parts. (sparc64-*-linux*): Likewise. (sparc64-*-freebsd*, ultrasparc-*-freebsd*): Likewise. (xstormy16-*-elf): Likewise. (xtensa*-*-linux*): Remove xtensa/t-linux from tmake_file. (am33_2.0-*-linux*): Remove extra_parts. * configure.ac (extra_parts): Don't substitute. * configure: Regenerate. * crtstuff.c: Move to ../libgcc. * Makefile.in (CRTSTUFF_CFLAGS): Remove. (EXTRA_PARTS): Remove. (CRTSTUFF_T_CFLAGS): Remove. (MOSTLYCLEANFILES): Remove $(EXTRA_PARTS). (GCC_EXTRA_PARTS): Remove. (libgcc.mvars): Remove GCC_EXTRA_PARTS, CRTSTUFF_CFLAGS, CRTSTUFF_T_CFLAGS, CRTSTUFF_T_CFLAGS_S. Emit GCC_CFLAGS, INHIBIT_LIBC_CFLAGS. ($(T)crtbegin.o, $(T)crtend.o, $(T)crtbeginS.o, $(T)crtendS.o) ($(T)crtbeginT.o): Remove. * config/alpha/t-vms (EXTRA_PARTS): Remove. ($(T)vms-dwarf2.o, $(T)vms-dwarf2eh.o): Remove. * config/alpha/vms-dwarf2.asm: Move to ../libgcc/config/alpha/vms-dwarf2.S. * config/alpha/vms-dwarf2eh.asm: Move to ../libgcc/config/alpha/vms-dwarf2eh.S. * config/arm/crti.asm: Move to ../libgcc/config/arm/crti.S. * config/arm/crtn.asm: Move to ../libgcc/config/arm/crtn.S. * config/arm/t-arm-elf (EXTRA_MULTILIB_PARTS): Remove. ($(T)crti.o, $(T)crtn.o): Remove. * config/arm/t-linux: Remove comment. * config/arm/t-linux-eabi (EXTRA_MULTILIB_PARTS): Remove. * config/arm/t-strongarm-elf (EXTRA_MULTILIB_PARTS): Remove. ($(T)crti.o, $(T)crtn.o): Remove. * config/arm/t-symbian (EXTRA_MULTILIB_PARTS): Remove. * config/bfin/crti.s: Move to ../libgcc/config/bfin/crti.S. * config/bfin/crtn.s: Move to ../libgcc/config/bfin/crtn.S. * config/bfin/crtlibid.s: Move to ../libgcc/config/bfin/crtlibid.S. * config/bfin/t-bfin (EXTRA_PARTS): Remove. ($(T)crti.o, $(T)crtn.o): Remove. * config/bfin/t-bfin-elf (CRTSTUFF_T_CFLAGS): Remove. ($(T)crti.o, $(T)crtn.o, $(T)crtlibid.o): Remove (EXTRA_MULTILIB_PARTS): Remove. * config/bfin/t-bfin-linux (CRTSTUFF_T_CFLAGS, EXTRA_MULTILIB_PARTS): Remove. * config/bfin/t-bfin-uclinux (CRTSTUFF_T_CFLAGS): Remove. ($(T)crtlibid.o): Remove. (EXTRA_MULTILIB_PARTS): Remove. * config/c6x/crti.s: Move to ../libgcc/config/c6x/crti.S. * config/c6x/crtn.s: Move to ../libgcc/config/c6x/crtn.S. * config/c6x/t-c6x-elf ($(T)crti.o, $(T)crtn.o): Remove. (EXTRA_MULTILIB_PARTS): Remove. (CRTSTUFF_T_CFLAGS, CRTSTUFF_T_CFLAGS_S): Remove. * config/c6x/t-c6x-uclinux (CRTSTUFF_T_CFLAGS, CRTSTUFF_T_CFLAGS_S): Remove. * config/cris/t-elfmulti (CRTSTUFF_T_CFLAGS): Remove. * config/cris/t-linux (CRTSTUFF_T_CFLAGS_S): Remove. * config/fr30/crti.asm: Move to ../libgcc/config/fr30/crti.S. * config/fr30/crtn.asm: Move to ../libgcc/config/fr30/crtn.S. * config/fr30/t-fr30 ($(T)crti.o, $(T)crtn.o): Remove. * config/frv/frvbegin.c, config/frv/frvend.c: Move to ../libgcc/config/frv. * config/frv/t-frv (EXTRA_MULTILIB_PARTS): Remove. (FRVSTUFF_CFLAGS, $(T)frvbegin$(objext), $(T)frvend$(objext)): Remove. * config/frv/t-linux (EXTRA_MULTILIB_PARTS): Remove. (CRTSTUFF_T_CFLAGS): Remove. * config/h8300/crti.asm: Move to ../libgcc/config/h8300/crti.S. * config/h8300/crtn.asm: Move to ../libgcc/config/h8300/crtn.S. * config/h8300/t-elf: Remove. * config/i386/cygming-crtbegin.c, config/i386/cygming-crtend.c: Move to ../libgcc/config/i386. * config/i386/t-crtstuff: Remove. * config/i386/t-i386elf: Remove. * config/i386/t-linux64 (EXTRA_MULTILIB_PARTS): Remove. * config/i386/t-nto (CRTSTUFF_T_CFLAGS, EXTRA_PARTS): Remove. * config/ia64/crtbegin.asm: Move to ../libgcc/config/ia64/crtbegin.S. * config/ia64/crtend.asm: Move to ../libgcc/config/ia64/crtend.S. * config/ia64/crti.asm: Move to ../libgcc/config/ia64/crti.S. * config/ia64/crtn.asm: Move to ../libgcc/config/ia64/crtn.S. * config/ia64/t-vms: Remove. * config/ia64/vms-crtinit.asm: Move to ../libgcc/config/ia64/vms-crtinit.S. * config/m32c/t-m32c (EXTRA_MULTILIB_PARTS): Remove. * config/m32r/initfini.c: Move to ../libgcc/config/m32r. * config/m32r/t-linux (CRTSTUFF_T_CFLAGS_S): Remove. * config/m32r/t-m32r (CRTSTUFF_T_CFLAGS): Remove. ($(T)crtinit.o, $(T)crtfini.o): Remove. (m32rx, m32r2): Remove. (EXTRA_MULTILIB_PARTS): Remove. * config/m68k/crti.s: Move to ../libgcc/config/m68k/crti.S. * config/m68k/crtn.s: Move to ../libgcc/config/m68k/crtn.S. * config/m68k/t-crtstuff: Remove. * config/m68k/t-linux (EXTRA_MULTILIB_PARTS): Remove. * config/m68k/t-m68kelf: Remove. * config/m68k/t-uclinux (EXTRA_MULTILIB_PARTS): Remove. * config/mcore/crti.asm: Move to ../libgcc/config/mcore/crti.S. * config/mcore/crtn.asm: Move to ../libgcc/config/mcore/crtn.S. * config/mcore/t-mcore ($(T)crti.o, $(T)crtn.o): Remove. (EXTRA_PARTS, EXTRA_MULTILIB_PARTS): Remove. * config/mep/t-mep (CRTSTUFF_CFLAGS): Remove. (EXTRA_MULTILIB_PARTS): Remove. * config/microblaze/crti.s: Move to ../libgcc/config/microblaze/crti.S. * config/microblaze/crtn.s: Move to ../libgcc/config/microblaze/crtn.S. * config/microblaze/t-microblaze (EXTRA_MULTILIB_PARTS, EXTRA_PARTS): Remove. ($(T)crti$(objext), $(T)crtn$(objext)): Remove. * config/mips/crti.asm: Move to ../libgcc/config/mips/crti.S. * config/mips/crtn.asm: Move to ../libgcc/config/mips/crtn.S. * config/mips/t-elf (CRTSTUFF_T_CFLAGS): Remove. ($(T)crti.o, $(T)crtn.o): Remove. (EXTRA_MULTILIB_PARTS): Remove. * config/mips/t-isa3264: Likewise. * config/mips/t-linux64 (EXTRA_MULTILIB_PARTS): Remove. * config/mips/t-r3900 (EXTRA_MULTILIB_PARTS): Remove. (CRTSTUFF_T_CFLAGS): Remove. * config/mips/t-sde (CRTSTUFF_T_CFLAGS): Remove. ($(T)crti.o, $(T)crtn.o): Remove. (EXTRA_MULTILIB_PARTS): Remove. * config/mips/t-sr71k (EXTRA_MULTILIB_PARTS, CRTSTUFF_T_CFLAGS): Remove. ($(T)crti.o, $(T)crtn.o): Remove. * config/mips/t-st (EXTRA_MULTILIB_PARTS): Remove. * config/mips/t-vr (CRTSTUFF_T_CFLAGS): Remove. (EXTRA_MULTILIB_PARTS): Remove. ($(T)crti.o, $(T)crtn.o): Remove. * config/mmix/crti.asm: Move to ../libgcc/config/crti.S. * config/mmix/crtn.asm: Move to ../libgcc/config/crtn.S. * config/mmix/t-mmix (CRTSTUFF_T_CFLAGS): Remove. * config/moxie/crti.asm, config/moxie/crtn.asm: Remove. * config/pa/stublib.c: Move to libgcc/config/pa. * config/pa/t-linux (CRTSTUFF_T_CFLAGS_S): Remove. * config/pa/t-linux64 (CRTSTUFF_T_CFLAGS_S): Remove. * config/pa/t-pa-hpux11 (LIBGCCSTUB_OBJS, stublib.c): Remove. (pthread_default_stacksize_np-stub.o, pthread_mutex_lock-stub.o) (pthread_mutex_unlock-stub.o, pthread_once-stub.o) ($(T)libgcc_stub.a): Remove. * config/pa/t-pa64 (LIBGCCSTUB_OBJS, stublib.c): Remove. (rfi-stub.o, dfi-stub.o, cxaf-stub.o, jvrc-stub.o) (pthread_default_stacksize_np-stub.o, pthread_mutex_lock-stub.o) (pthread_mutex_unlock-stub.o, pthread_once-stub.o) ($(T)libgcc_stub.a): Remove. * config/rs6000/eabi-cn.asm: Move to ../../../libgcc/config/rs6000/eabi-cn.S. * config/rs6000/eabi-ci.asm: Move to ../../../libgcc/config/rs6000/eabi-ci.S. * config/rs6000/sol-ci.asm: Move to ../../../libgcc/config/rs6000/sol-ci.S. * config/rs6000/sol-cn.asm: Move to ../../../libgcc/config/rs6000/sol-cn.S. * config/rs6000/t-lynx (EXTRA_MULTILIB_PARTS): Remove. (CRTSTUFF_T_CFLAGS, CRTSTUFF_T_CFLAGS_S): Remove. * config/rs6000/t-netbsd (CRTSTUFF_T_CFLAGS, CRTSTUFF_T_CFLAGS_S): Remove. (EXTRA_MULTILIB_PARTS): Remove. * config/rs6000/t-ppccomm (EXTRA_MULTILIB_PARTS): Remove. (ecrti.S, ecrtn.S, ncrti.S, ncrtn.S): Remove. ($(T)ecrti$(objext), $(T)ecrtn$(objext), $(T)ncrti$(objext), $(T)ncrtn$(objext)): Remove. (CRTSTUFF_T_CFLAGS, CRTSTUFF_T_CFLAGS_S): Remove. * config/rs6000/t-vxworks (EXTRA_MULTILIB_PARTS): Remove. * config/rx/t-rx (EXTRA_MULTILIB_PARTS): Remove. * config/score/crti.asm: Move to ../libgcc/config/score/crti.S. * config/score/crtn.asm: Move to ../libgcc/config/score/crtn.S. * config/score/t-score-elf: Remove. * config/sh/crt1.asm: Move to ../libgcc/config/sh/crt1.S. * config/sh/crti.asm: Move to ../libgcc/config/sh/crti.S. * config/sh/crtn.asm: Move to ../libgcc/config/sh/crtn.S. * config/sh/lib1funcs-4-300.asm: Move to ../../../libgcc/config/sh/lib1funcs-4-300.S. * config/sh/lib1funcs-Os-4-200.asm: Move to ../libgcc/config/sh/lib1funcs-Os-4-200.S. * config/sh/t-elf: Remove. * config/sh/t-linux (EXTRA_MULTILIB_PARTS): Remove. * config/sh/t-linux64: Remove. * config/sh/t-netbsd (EXTRA_MULTILIB_PARTS): Remove. * config/sh/t-sh ($(T)crt1.o, $(T)crti.o, $(T)crtn.o): Remove. (IC_EXTRA_PARTS, OPT_EXTRA_PARTS, EXTRA_MULTILIB_PARTS): Remove. ($(T)ic_invalidate_array_4-100.o) ($(T)libic_invalidate_array_4-100.a) ($(T)ic_invalidate_array_4-200.o) ($(T)libic_invalidate_array_4-200.a, $(T)ic_invalidate_array_4a.o) ($(T)libic_invalidate_array_4a.a, $(T)sdivsi3_i4i-Os-4-200.o) ($(T)udivsi3_i4i-Os-4-200.o, $(T)unwind-dw2-Os-4-200.o) ($(T)libgcc-Os-4-200.a, $(T)div_table-4-300.o) ($(T)libgcc-4-300.a): Remove. * config/sh/t-superh: Remove. * config/sh/t-vxworks (EXTRA_MULTILIB_PARTS): Remove. * config/sparc/t-linux64 (CRTSTUFF_T_CFLAGS): Remove. * config/spu/cache.S: Move to ../libgcc/config/spu. * config/spu/cachemgr.c: Move to ../libgcc/config/spu. * config/spu/t-spu-elf (CRTSTUFF_T_CFLAGS): Remove. (EXTRA_MULTILIB_PARTS): Remove. ($(T)cachemgr.o, $(T)cachemgr_nonatomic.o, $(T)libgcc_%.a): Remove. ($(T)cache8k.o, $(T)cache16k.o, $(T)cache32k.o, $(T)cache32k.o) ($(T)cache64k.o, $(T)cache128k.o): Remove. * config/t-freebsd (CRTSTUFF_T_CFLAGS_S): Remove. * config/t-libc-ok: Remove. * config/t-linux (CRTSTUFF_T_CFLAGS_S): Remove. * config/t-lynx (CRTSTUFF_T_CFLAGS_S): Remove. * config/t-netbsd: Remove. * config/t-svr4 (CRTSTUFF_T_CFLAGS_S): Remove. * config/t-vxworks (EXTRA_MULTILIB_PARTS): Remove. * config/vms/t-vms (VMS_EXTRA_PARTS): Remove. ($(T)vcrt0.o, $(T)pcrt0.o): Remove. * config/vms/vms-ucrt0.c: Move to ../libgcc/config/vms. * config/xtensa/crti.asm: Move to ../libgcc/config/xtensa/crti.S. * config/xtensa/crtn.asm: Move to ../libgcc/config/xtensa/crtn.S. * config/xtensa/t-elf (CRTSTUFF_T_CFLAGS, CRTSTUFF_T_CFLAGS_S): Remove. (EXTRA_MULTILIB_PARTS): Remove. * config/xtensa/t-linux: Remove. * config/xtensa/t-xtensa ($(T)crti.o, $(T)crtn.o): Remove. gcc/po: * EXCLUDES (crtstuff.c): Remove. libgcc: * crtstuff.c: New file. * Makefile.in (CRTSTUFF_CFLAGS): Define. (CRTSTUFF_T_CFLAGS): Define. (extra-parts, INSTALL_PARTS): Remove conditional assignments. (crtbegin$(objext), crtend$(objext), crtbeginS$(objext)) (crtendS$(objext), crtbeginT.o): Use $(srcdir) to refer to crtstuff.c. Use $<. (crtbeginT.o): Use $(objext). [!CUSTOM_CRTIN] (crti$(objext), crtn$(objext)): New rules. (libgcc-extra-parts): Don't compare EXTRA_PARTS, GCC_EXTRA_PARTS. (gcc-extra-parts): Remove. * config.host (*-*-freebsd*): Add t-crtstuff-pic to tmake_file. Set extra_parts. (*-*-linux*, frv-*-*linux*, *-*-kfreebsd*-gnu, *-*-knetbsd*-gnu, *-*-gnu*): Also handle *-*-kopensolaris*-gnu. Add t-crtstuff-pic to tmake_file. (*-*-lynxos*): New case. Set tmake_file, extra_parts. (*-*-netbsd*): Add t-crtstuff-pic to tmake_file. Set extra_parts for *-*-netbsd*1.[7-9]*, *-*-netbsd[2-9]*, *-*-netbsdelf[2-9]*. (*-*-openbsd*): Add t-crtstuff-pic to tmake_file. (*-*-rtems*): Set extra_parts. (*-*-solaris2*): Remove t-crtin from tmake_file for Solaris < 10. (*-*-uclinux*): New case. Set extra_parts. (*-*-vms*): New case. Set tmake_file, extra_parts. (*-*-elf): Set extra_parts. (alpha*-*-freebsd*): Add crtbeginT.o to extra_parts. (alpha64-dec-*vms*): Append to tmake_file, remove vms/t-vms, vms/t-vms64. Set extra_parts. (alpha*-dec-*vms*): Append to tmake_file, remove vms/t-vms. Set extra_parts. (arm*-*-freebsd*): Add t-crtin to tmake_file. Add crtbegin.o, crtend.o, crti.o, crtn.o to extra_parts. (arm-wrs-vxworks): Append to tmake_file. Set extra_parts. (arm*-*-uclinux*): Set extra_parts. (arm*-*-ecos-elf): Likewise. (arm*-*-eabi*, arm*-*-symbianelf*): Set extra_parts for arm*-*-eabi*. (arm*-*-rtems*): Set extra_parts. (arm*-*-elf): Likewise. (avr-*-rtems*): Clear extra_parts. (bfin*-elf*): Add bfin/t-crtlibid, bfin/t-crtstuff to extra_parts. Set extra_parts. (bfin*-uclinux*): Likewise. (bfin*-linux-uclibc*): Add bfin/t-crtstuff to tmake_file. (bfin*-rtems*): Append to tmake_file. Set extra_parts. (bfin*-*): Likewise. (crisv32-*-elf, crisv32-*-none, cris-*-elf, cris-*-none): Split into ... (crisv32-*-elf): ... this. (crisv32-*-none): ... this. (cris-*-elf, cris-*-none): New cases. Add cris/t-elfmulti to tmake_file. (fr30-*-elf): Append to tmake_file. Set extra_parts. (frv-*-elf): Append to tmake_file, add frv/t-frv. Set extra_parts. (h8300-*-rtems*): Append to tmake_file. Set extra_parts. (h8300-*-elf*): Likewise. (hppa*64*-*-hpux11*): Add pa/t-stublib, pa/t-stublib64 to tmake_file. Set extra_parts. (hppa[12]*-*-hpux11*): Add pa/t-stublib to tmake_file. Set extra_parts. (i[34567]86-*-elf*): Add i386/t-crtstuff, t-crtstuff-pic to tmake_file. (x86_64-*-elf*): Likewise. (i[34567]86-*-freebsd*): Add i386/t-crtstuff to tmake_file. (x86_64-*-freebsd*): Likewise. (x86_64-*-netbsd*): Likewise. (i[34567]86-*-linux*): Likewise. (i[34567]86-*-kfreebsd*-gnu, i[34567]86-*-knetbsd*-gnu) (i[34567]86-*-gnu*, i[34567]86-*-kopensolaris*-gnu): Likewise. (x86_64-*-linux*): Likewise. (x86_64-*-kfreebsd*-gnu, x86_64-*-knetbsd*-gnu): Likewise. (i[34567]86-*-lynxos*): Add t-crtstuff-pic, i386/t-crtstuff to tmake_file. Set extra_parts. (i[34567]86-*-nto-qnx*): Set tmake_file, extra_parts. (i[34567]86-*-rtems*): Append to tmake_file, remove t-crtin. Append to extra_parts, remove crtbegin.o, crtend.o. (ia64*-*-elf*): Append to extra_parts, remove crtbegin.o, crtend.o. (ia64*-*-freebsd*): Append to extra_parts, remove crtbegin.o, crtend.o, crtbeginS.o, crtendS.o. (ia64*-*-linux*): Comment extra_parts. (ia64-hp-*vms*): Append to tmake_file, remove vms/t-vms, vms/t-vms64. Set extra_parts. (iq2000*-*-elf*): Clear extra_parts. (lm32-*-elf*, lm32-*-rtems*): Add t-crtin to tmake_file. (lm32-*-uclinux*): Add to extra_parts, remove crtbegin.o, crtend.o (m32r-*-elf*, m32r-*-rtems*): Split off ... (m32r-*-rtems*): ... this. Add m32r/t-m32r to tmake_file. (m68k-*-elf*): Add t-crtin to tmake_file. (m68k-*-rtems*): Add crti.o, crtn.o to extra_parts. (mcore-*-elf): Likewise. (microblaze*-*-*): Set extra_parts. (mips*-sde-elf*): New case. Set tmake_file, extra_parts. (mipsisa32-*-elf*, mipsisa32el-*-elf*, mipsisa32r2-*-elf*) (mipsisa32r2el-*-elf*, mipsisa64-*-elf*, mipsisa64el-*-elf*) (mipsisa64r2-*-elf*, mipsisa64r2el-*-elf*): Add mips/t-crtstuff to tmake_file. Set extra_parts. (mipsisa64sr71k-*-elf*): Likewise. (mipsisa64sb1-*-elf*, mipsisa64sb1el-*-elf*): Likewise. (mips-*-elf*, mipsel-*-elf*): Likewise. (mips64-*-elf*, mips64el-*-elf*): Likewise. (mips64vr-*-elf*, mips64vrel-*-elf*): Likewise. (mips64orion-*-elf*, mips64orionel-*-elf*): Likewise. (mips*-*-rtems*): Likewise. (mipstx39-*-elf*, mipstx39el-*-elf*): Likewise. (moxie-*-*): Split into ... (moxie-*-elf, moxie-*-uclinux*): ... this. Add to extra_parts, remove crtbegin.o, crtend.o. (moxie-*-rtems*): New case. Set tmake_file. Clear extra_parts. (powerpc-*-freebsd*): Add rs6000/t-crtstuff to tmake_file. Set extra_parts. (powerpc-*-netbsd*): Add rs6000/t-netbsd to tmake_file. (powerpc-*-eabispe*): Add rs6000/t-crtstuff, t-crtstuff-pic to tmake_file. Set extra_parts. (powerpc-*-eabisimaltivec*): Add to tmake_file, add rs6000/t-ppccomm, rs6000/t-crtstuff, t-crtstuff-pic to tmake_file. Set extra_parts. (powerpc-*-eabisim*): Likewise. (powerpc-*-elf*): Likewise. (powerpc-*-eabialtivec*): Likewise. (powerpc-xilinx-eabi*): Likewise. (powerpc-*-eabi*): Likewise. (powerpc-*-rtems*): Likewise. (powerpc-*-linux*, powerpc64-*-linux*): Add rs6000/t-crtstuff to tmake_file. Set extra_parts. (powerpc-*-lynxos*): Add to tmake_file. (powerpcle-*-elf*): Add to tmake_file, add rs6000/t-ppccomm, rs6000/t-crtstuff, t-crtstuff-pic. Set extra_parts. (powerpcle-*-eabisim*): Likewise. (powerpcle-*-eabi*): Likewise. (rx-*-elf): Remove extra_parts. (s390x-ibm-tpf*): Set extra_parts. (score-*-elf): Set extra_parts. (sh-*-elf*, sh[12346l]*-*-elf*, sh-*-linux*) (sh[2346lbe]*-*-linux*, sh-*-netbsdelf*, shl*-*-netbsdelf*) (sh5-*-netbsd*, sh5l*-*-netbsd*, sh64-*-netbsd*) (sh64l*-*-netbsd*): Split into ... (sh-*-elf*, sh[12346l]*-*-elf*): ... this. Add t-crtstuff-pic to tmake_file. Set extra_parts. (sh-*-rtems*): Add to tmake_file, add t-crtstuff-pic. Set extra_parts. (sh-wrs-vxworks): Add to tmake_file, add t-crtstuff-pic. (sparc-*-elf*): Remove t-crtin from tmake_file. Add to extra_parts, remove crtbegin.o, crtend.o. (sparc-*-linux*): Add sparc/t-linux64 to tmake_file. (sparc64-*-linux*): Likewise. (sparc-*-rtems*): Remove sparc/t-elf from tmake_file. Add to extra_parts, remove crtbegin.o, crtend.o. (sparc64-*-elf*): Remove t-crtin from tmake_file. Add to extra_parts, remove crtbegin.o, crtend.o. (sparc64-*-rtems*): Remove t-crtin from tmake_file. Add to extra_parts, remove crtbegin.o, crtend.o. (sparc64-*-freebsd*, ultrasparc-*-freebsd*): Add to extra_parts. (sparc64-*-linux*): Add sparc/t-linux64 to tmake_file. (spu-*-elf*): Add to tmake_file, add spu/t-elf. Set extra_parts. (tic6x-*-uclinux): Add c6x/t-uxlinux, t-crtstuff-pic to tmake_file. Set extra_parts. (tic6x-*-*): Change to ... (tic6x-*-elf): ... this. Set extra_parts. (xtensa*-*-elf*): Add to tmake_file, add xtensa/t-elf. Set extra_parts. (am33_2.0-*-linux*): Add comment. (mep*-*-*): Add mep/t-mep to tmake_file. Set extra_parts. * config/alpha/t-vms: New file. * config/alpha/vms-dwarf2.S, config/alpha/vms-dwarf2eh.S: New files. * config/arm/crti.S, config/arm/crtn.S: New files. * config/bfin/crti.S, config/bfin/crtn.S: New files. * config/bfin/crtlibid.S: New file. * config/bfin/t-crtlibid, config/bfin/t-crtstuff: New files. * config/c6x/crti.S, config/c6x/crtn.S: New files. * config/c6x/t-elf (CUSTOM_CRTIN): Set. (crti.o, crtin.o): New rules. (CRTSTUFF_T_CFLAGS, CRTSTUFF_T_CFLAGS_S): Set. * config/c6x/t-uclinux: New file. * config/cris/t-elfmulti: New file. * config/cris/t-linux (CRTSTUFF_T_CFLAGS_S): Set. * config/fr30/crti.S, config/fr30/crtn.S: New files. * config/frv/frvbegin.c, config/frv/frvend.c: New files. * config/frv/t-frv: New file. * config/frv/t-linux (CRTSTUFF_T_CFLAGS): Set. * config/h8300/crti.S, config/h8300/crtn.S: New files. * config/i386/cygming-crtbegin.c, config/i386/cygming-crtend.c: New files. * config/i386/t-cygming (crtbegin.o, crtend.o): Use $(srcdir) to refer to cygming-crtbegin.c, cygming-crtend.c. Use $<. * config/i386/t-nto: New file. * config/ia64/crtbegin.S, config/ia64/crtend.S: New files. * config/ia64/crti.S, config/ia64/crtn.S: New files. * config/ia64/t-ia64 (crtbegin.o, crtend.o, crtbeginS.o, crtendS.o): Use $(srcdir) to refer to crtbegin.S, crtend.S. Use .S extension. Use $<. * config/ia64/t-vms (CRTSTUFF_T_CFLAGS, CRTSTUFF_T_CFLAGS_S): Set. (crtinitS.o): New rule. * config/ia64/vms-crtinit.S: New file. * config/lm32/t-elf ($(T)crti.o, $(T)crtn.o): Remove. * config/m32r/initfini.c: New file. * config/m32r/t-linux, config/m32r/t-m32r: New files. * config/m68k/crti.S, config/m68k/crtn.S: New files. * config/mcore/crti.S, config/mcore/crtn.S: New files. * config/mep/t-mep: New file. * config/microblaze/crti.S, config/microblaze/crtn.S: New files. * config/microblaze/t-microblaze (MULTILIB_OPTIONS): Remove. * config/mips/crti.S, config/mips/crtn.S: New files. * config/mips/t-crtstuff: New file. * config/mmix/crti.S, config/mmix/crtn.S: New files. * config/mmix/t-mmix (CRTSTUFF_T_CFLAGS): Set. (CUSTOM_CRTIN): Set. ($(T)crti.o, $(T)crtn.o): Remove $(T), dependencies. Use $(srcdir) to refer to crti.S, crtn.S. Use .S extension, $<. * config/moxie/crti.asm: Rename to ... * config/moxie/crti.S: ... this. * config/moxie/crtn.asm: Rename to ... * config/moxie/crtn.S: ... this. * config/moxie/t-moxie: Remove. * config/pa/stublib.c: New file. * config/pa/t-stublib, config/pa/t-stublib64: New files. * config/rs6000/eabi-ci.S, config/rs6000/eabi-cn.S: New files. * config/rs6000/sol-ci.S, config/rs6000/sol-cn.S: New files. * config/rs6000/t-crtstuff: New file. * config/rs6000/t-ppccomm (EXTRA_PARTS): Remove. (ecrti.S, ecrtn.S, ncrti.S, ncrtn.S): Remove. (ecrti$(objext)): Depend on $(srcdir)/config/rs6000/eabi-ci.S. Make output file explicit. (ecrtn$(objext)): Depend on $(srcdir)/config/rs6000/eabi-cn.S. Make output file explicit. (ncrti$(objext): Depend on $(srcdir)/config/rs6000/sol-ci.S. Make output file explicit. (ncrtn$(objext)): Depend on $(srcdir)/config/rs6000/sol-cn.S. Make output file explicit. * config/score/crti.S, config/score/crtn.S: New files. * config/sh/crt1.S, config/sh/crti.S, config/sh/crtn.S: New files. * config/sh/lib1funcs-4-300.S, config/sh/lib1funcs-Os-4-200.S: New files. * config/sh/t-sh, config/sh/t-superh: New files. * config/sparc/t-linux64: New file. * config/spu/cache.S, config/spu/cachemgr.c: New files. * config/spu/t-elf (CRTSTUFF_T_CFLAGS): Set. (cachemgr.o, cachemgr_nonatomic.o, libgcc_%.a, cache8k.o) (cache16k.o, cache32k.o, cache64k.o, cache128k.o): New rules. * config/t-crtin: Remove. * config/t-crtstuff-pic: New file. * config/t-sol2 (CUSTOM_CRTIN): Set. (crti.o, crtn.o): New rules. * config/vms/t-vms: New file. * config/vms/vms-ucrt0.c: New file. * config/xtensa/t-elf: New file. From-SVN: r180771
439 lines
12 KiB
C
439 lines
12 KiB
C
/* Copyright (C) 2008, 2009 Free Software Foundation, Inc.
|
|
|
|
This file is part of GCC.
|
|
|
|
GCC is free software; you can redistribute it and/or modify it under
|
|
the terms of the GNU General Public License as published by the Free
|
|
Software Foundation; either version 3, or (at your option) any later
|
|
version.
|
|
|
|
GCC 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 General Public License
|
|
for more details.
|
|
|
|
Under Section 7 of GPL version 3, you are granted additional
|
|
permissions described in the GCC Runtime Library Exception, version
|
|
3.1, as published by the Free Software Foundation.
|
|
|
|
You should have received a copy of the GNU General Public License and
|
|
a copy of the GCC Runtime Library Exception along with this program;
|
|
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
|
<http://www.gnu.org/licenses/>. */
|
|
|
|
#include <spu_mfcio.h>
|
|
#include <spu_internals.h>
|
|
#include <spu_intrinsics.h>
|
|
#include <spu_cache.h>
|
|
|
|
extern unsigned long long __ea_local_store;
|
|
extern char __cache_tag_array_size;
|
|
|
|
#define LINE_SIZE 128
|
|
#define TAG_MASK (LINE_SIZE - 1)
|
|
|
|
#define WAYS 4
|
|
#define SET_MASK ((int) &__cache_tag_array_size - LINE_SIZE)
|
|
|
|
#define CACHE_LINES ((int) &__cache_tag_array_size / \
|
|
sizeof (struct __cache_tag_array) * WAYS)
|
|
|
|
struct __cache_tag_array
|
|
{
|
|
unsigned int tag_lo[WAYS];
|
|
unsigned int tag_hi[WAYS];
|
|
void *base[WAYS];
|
|
int reserved[WAYS];
|
|
vector unsigned short dirty_bits[WAYS];
|
|
};
|
|
|
|
extern struct __cache_tag_array __cache_tag_array[];
|
|
extern char __cache[];
|
|
|
|
/* In order to make the code seem a little cleaner, and to avoid having
|
|
64/32 bit ifdefs all over the place, we use macros. */
|
|
|
|
#ifdef __EA64__
|
|
typedef unsigned long long addr;
|
|
|
|
#define CHECK_TAG(_entry, _way, _tag) \
|
|
((_entry)->tag_lo[(_way)] == ((_tag) & 0xFFFFFFFF) \
|
|
&& (_entry)->tag_hi[(_way)] == ((_tag) >> 32))
|
|
|
|
#define GET_TAG(_entry, _way) \
|
|
((unsigned long long)(_entry)->tag_hi[(_way)] << 32 \
|
|
| (unsigned long long)(_entry)->tag_lo[(_way)])
|
|
|
|
#define SET_TAG(_entry, _way, _tag) \
|
|
(_entry)->tag_lo[(_way)] = (_tag) & 0xFFFFFFFF; \
|
|
(_entry)->tag_hi[(_way)] = (_tag) >> 32
|
|
|
|
#else /*__EA32__*/
|
|
typedef unsigned long addr;
|
|
|
|
#define CHECK_TAG(_entry, _way, _tag) \
|
|
((_entry)->tag_lo[(_way)] == (_tag))
|
|
|
|
#define GET_TAG(_entry, _way) \
|
|
((_entry)->tag_lo[(_way)])
|
|
|
|
#define SET_TAG(_entry, _way, _tag) \
|
|
(_entry)->tag_lo[(_way)] = (_tag)
|
|
|
|
#endif
|
|
|
|
/* In GET_ENTRY, we cast away the high 32 bits,
|
|
as the tag is only in the low 32. */
|
|
|
|
#define GET_ENTRY(_addr) \
|
|
((struct __cache_tag_array *) \
|
|
si_to_uint (si_a (si_and (si_from_uint ((unsigned int) (addr) (_addr)), \
|
|
si_from_uint (SET_MASK)), \
|
|
si_from_uint ((unsigned int) __cache_tag_array))))
|
|
|
|
#define GET_CACHE_LINE(_addr, _way) \
|
|
((void *) (__cache + ((_addr) & SET_MASK) * WAYS) + ((_way) * LINE_SIZE));
|
|
|
|
#define CHECK_DIRTY(_vec) (si_to_uint (si_orx ((qword) (_vec))))
|
|
#define SET_EMPTY(_entry, _way) ((_entry)->tag_lo[(_way)] = 1)
|
|
#define CHECK_EMPTY(_entry, _way) ((_entry)->tag_lo[(_way)] == 1)
|
|
|
|
#define LS_FLAG 0x80000000
|
|
#define SET_IS_LS(_entry, _way) ((_entry)->reserved[(_way)] |= LS_FLAG)
|
|
#define CHECK_IS_LS(_entry, _way) ((_entry)->reserved[(_way)] & LS_FLAG)
|
|
#define GET_LRU(_entry, _way) ((_entry)->reserved[(_way)] & ~LS_FLAG)
|
|
|
|
static int dma_tag = 32;
|
|
|
|
static void
|
|
__cache_evict_entry (struct __cache_tag_array *entry, int way)
|
|
{
|
|
addr tag = GET_TAG (entry, way);
|
|
|
|
if (CHECK_DIRTY (entry->dirty_bits[way]) && !CHECK_IS_LS (entry, way))
|
|
{
|
|
#ifdef NONATOMIC
|
|
/* Non-atomic writes. */
|
|
unsigned int oldmask, mach_stat;
|
|
char *line = ((void *) 0);
|
|
|
|
/* Enter critical section. */
|
|
mach_stat = spu_readch (SPU_RdMachStat);
|
|
spu_idisable ();
|
|
|
|
/* Issue DMA request. */
|
|
line = GET_CACHE_LINE (entry->tag_lo[way], way);
|
|
mfc_put (line, tag, LINE_SIZE, dma_tag, 0, 0);
|
|
|
|
/* Wait for DMA completion. */
|
|
oldmask = mfc_read_tag_mask ();
|
|
mfc_write_tag_mask (1 << dma_tag);
|
|
mfc_read_tag_status_all ();
|
|
mfc_write_tag_mask (oldmask);
|
|
|
|
/* Leave critical section. */
|
|
if (__builtin_expect (mach_stat & 1, 0))
|
|
spu_ienable ();
|
|
#else
|
|
/* Allocate a buffer large enough that we know it has 128 bytes
|
|
that are 128 byte aligned (for DMA). */
|
|
|
|
char buffer[LINE_SIZE + 127];
|
|
qword *buf_ptr = (qword *) (((unsigned int) (buffer) + 127) & ~127);
|
|
qword *line = GET_CACHE_LINE (entry->tag_lo[way], way);
|
|
qword bits;
|
|
unsigned int mach_stat;
|
|
|
|
/* Enter critical section. */
|
|
mach_stat = spu_readch (SPU_RdMachStat);
|
|
spu_idisable ();
|
|
|
|
do
|
|
{
|
|
/* We atomically read the current memory into a buffer
|
|
modify the dirty bytes in the buffer, and write it
|
|
back. If writeback fails, loop and try again. */
|
|
|
|
mfc_getllar (buf_ptr, tag, 0, 0);
|
|
mfc_read_atomic_status ();
|
|
|
|
/* The method we're using to write 16 dirty bytes into
|
|
the buffer at a time uses fsmb which in turn uses
|
|
the least significant 16 bits of word 0, so we
|
|
load the bits and rotate so that the first bit of
|
|
the bitmap is in the first bit that fsmb will use. */
|
|
|
|
bits = (qword) entry->dirty_bits[way];
|
|
bits = si_rotqbyi (bits, -2);
|
|
|
|
/* Si_fsmb creates the mask of dirty bytes.
|
|
Use selb to nab the appropriate bits. */
|
|
buf_ptr[0] = si_selb (buf_ptr[0], line[0], si_fsmb (bits));
|
|
|
|
/* Rotate to next 16 byte section of cache. */
|
|
bits = si_rotqbyi (bits, 2);
|
|
|
|
buf_ptr[1] = si_selb (buf_ptr[1], line[1], si_fsmb (bits));
|
|
bits = si_rotqbyi (bits, 2);
|
|
buf_ptr[2] = si_selb (buf_ptr[2], line[2], si_fsmb (bits));
|
|
bits = si_rotqbyi (bits, 2);
|
|
buf_ptr[3] = si_selb (buf_ptr[3], line[3], si_fsmb (bits));
|
|
bits = si_rotqbyi (bits, 2);
|
|
buf_ptr[4] = si_selb (buf_ptr[4], line[4], si_fsmb (bits));
|
|
bits = si_rotqbyi (bits, 2);
|
|
buf_ptr[5] = si_selb (buf_ptr[5], line[5], si_fsmb (bits));
|
|
bits = si_rotqbyi (bits, 2);
|
|
buf_ptr[6] = si_selb (buf_ptr[6], line[6], si_fsmb (bits));
|
|
bits = si_rotqbyi (bits, 2);
|
|
buf_ptr[7] = si_selb (buf_ptr[7], line[7], si_fsmb (bits));
|
|
bits = si_rotqbyi (bits, 2);
|
|
|
|
mfc_putllc (buf_ptr, tag, 0, 0);
|
|
}
|
|
while (mfc_read_atomic_status ());
|
|
|
|
/* Leave critical section. */
|
|
if (__builtin_expect (mach_stat & 1, 0))
|
|
spu_ienable ();
|
|
#endif
|
|
}
|
|
|
|
/* In any case, marking the lo tag with 1 which denotes empty. */
|
|
SET_EMPTY (entry, way);
|
|
entry->dirty_bits[way] = (vector unsigned short) si_from_uint (0);
|
|
}
|
|
|
|
void
|
|
__cache_evict (__ea void *ea)
|
|
{
|
|
addr tag = (addr) ea & ~TAG_MASK;
|
|
struct __cache_tag_array *entry = GET_ENTRY (ea);
|
|
int i = 0;
|
|
|
|
/* Cycles through all the possible ways an address could be at
|
|
and evicts the way if found. */
|
|
|
|
for (i = 0; i < WAYS; i++)
|
|
if (CHECK_TAG (entry, i, tag))
|
|
__cache_evict_entry (entry, i);
|
|
}
|
|
|
|
static void *
|
|
__cache_fill (int way, addr tag)
|
|
{
|
|
unsigned int oldmask, mach_stat;
|
|
char *line = ((void *) 0);
|
|
|
|
/* Reserve our DMA tag. */
|
|
if (dma_tag == 32)
|
|
dma_tag = mfc_tag_reserve ();
|
|
|
|
/* Enter critical section. */
|
|
mach_stat = spu_readch (SPU_RdMachStat);
|
|
spu_idisable ();
|
|
|
|
/* Issue DMA request. */
|
|
line = GET_CACHE_LINE (tag, way);
|
|
mfc_get (line, tag, LINE_SIZE, dma_tag, 0, 0);
|
|
|
|
/* Wait for DMA completion. */
|
|
oldmask = mfc_read_tag_mask ();
|
|
mfc_write_tag_mask (1 << dma_tag);
|
|
mfc_read_tag_status_all ();
|
|
mfc_write_tag_mask (oldmask);
|
|
|
|
/* Leave critical section. */
|
|
if (__builtin_expect (mach_stat & 1, 0))
|
|
spu_ienable ();
|
|
|
|
return (void *) line;
|
|
}
|
|
|
|
static void
|
|
__cache_miss (__ea void *ea, struct __cache_tag_array *entry, int way)
|
|
{
|
|
|
|
addr tag = (addr) ea & ~TAG_MASK;
|
|
unsigned int lru = 0;
|
|
int i = 0;
|
|
int idx = 0;
|
|
|
|
/* If way > 4, then there are no empty slots, so we must evict
|
|
the least recently used entry. */
|
|
if (way >= 4)
|
|
{
|
|
for (i = 0; i < WAYS; i++)
|
|
{
|
|
if (GET_LRU (entry, i) > lru)
|
|
{
|
|
lru = GET_LRU (entry, i);
|
|
idx = i;
|
|
}
|
|
}
|
|
__cache_evict_entry (entry, idx);
|
|
way = idx;
|
|
}
|
|
|
|
/* Set the empty entry's tag and fill it's cache line. */
|
|
|
|
SET_TAG (entry, way, tag);
|
|
entry->reserved[way] = 0;
|
|
|
|
/* Check if the address is just an effective address within the
|
|
SPU's local store. */
|
|
|
|
/* Because the LS is not 256k aligned, we can't do a nice and mask
|
|
here to compare, so we must check the whole range. */
|
|
|
|
if ((addr) ea >= (addr) __ea_local_store
|
|
&& (addr) ea < (addr) (__ea_local_store + 0x40000))
|
|
{
|
|
SET_IS_LS (entry, way);
|
|
entry->base[way] =
|
|
(void *) ((unsigned int) ((addr) ea -
|
|
(addr) __ea_local_store) & ~0x7f);
|
|
}
|
|
else
|
|
{
|
|
entry->base[way] = __cache_fill (way, tag);
|
|
}
|
|
}
|
|
|
|
void *
|
|
__cache_fetch_dirty (__ea void *ea, int n_bytes_dirty)
|
|
{
|
|
#ifdef __EA64__
|
|
unsigned int tag_hi;
|
|
qword etag_hi;
|
|
#endif
|
|
unsigned int tag_lo;
|
|
struct __cache_tag_array *entry;
|
|
|
|
qword etag_lo;
|
|
qword equal;
|
|
qword bit_mask;
|
|
qword way;
|
|
|
|
/* This first chunk, we merely fill the pointer and tag. */
|
|
|
|
entry = GET_ENTRY (ea);
|
|
|
|
#ifndef __EA64__
|
|
tag_lo =
|
|
si_to_uint (si_andc
|
|
(si_shufb
|
|
(si_from_uint ((addr) ea), si_from_uint (0),
|
|
si_from_uint (0x00010203)), si_from_uint (TAG_MASK)));
|
|
#else
|
|
tag_lo =
|
|
si_to_uint (si_andc
|
|
(si_shufb
|
|
(si_from_ullong ((addr) ea), si_from_uint (0),
|
|
si_from_uint (0x04050607)), si_from_uint (TAG_MASK)));
|
|
|
|
tag_hi =
|
|
si_to_uint (si_shufb
|
|
(si_from_ullong ((addr) ea), si_from_uint (0),
|
|
si_from_uint (0x00010203)));
|
|
#endif
|
|
|
|
/* Increment LRU in reserved bytes. */
|
|
si_stqd (si_ai (si_lqd (si_from_ptr (entry), 48), 1),
|
|
si_from_ptr (entry), 48);
|
|
|
|
missreturn:
|
|
/* Check if the entry's lo_tag is equal to the address' lo_tag. */
|
|
etag_lo = si_lqd (si_from_ptr (entry), 0);
|
|
equal = si_ceq (etag_lo, si_from_uint (tag_lo));
|
|
#ifdef __EA64__
|
|
/* And the high tag too. */
|
|
etag_hi = si_lqd (si_from_ptr (entry), 16);
|
|
equal = si_and (equal, (si_ceq (etag_hi, si_from_uint (tag_hi))));
|
|
#endif
|
|
|
|
if ((si_to_uint (si_orx (equal)) == 0))
|
|
goto misshandler;
|
|
|
|
if (n_bytes_dirty)
|
|
{
|
|
/* way = 0x40,0x50,0x60,0x70 for each way, which is also the
|
|
offset of the appropriate dirty bits. */
|
|
way = si_shli (si_clz (si_gbb (equal)), 2);
|
|
|
|
/* To create the bit_mask, we set it to all 1s (uint -1), then we
|
|
shift it over (128 - n_bytes_dirty) times. */
|
|
|
|
bit_mask = si_from_uint (-1);
|
|
|
|
bit_mask =
|
|
si_shlqby (bit_mask, si_from_uint ((LINE_SIZE - n_bytes_dirty) / 8));
|
|
|
|
bit_mask =
|
|
si_shlqbi (bit_mask, si_from_uint ((LINE_SIZE - n_bytes_dirty) % 8));
|
|
|
|
/* Rotate it around to the correct offset. */
|
|
bit_mask =
|
|
si_rotqby (bit_mask,
|
|
si_from_uint (-1 * ((addr) ea & TAG_MASK) / 8));
|
|
|
|
bit_mask =
|
|
si_rotqbi (bit_mask,
|
|
si_from_uint (-1 * ((addr) ea & TAG_MASK) % 8));
|
|
|
|
/* Update the dirty bits. */
|
|
si_stqx (si_or (si_lqx (si_from_ptr (entry), way), bit_mask),
|
|
si_from_ptr (entry), way);
|
|
};
|
|
|
|
/* We've definitely found the right entry, set LRU (reserved) to 0
|
|
maintaining the LS flag (MSB). */
|
|
|
|
si_stqd (si_andc
|
|
(si_lqd (si_from_ptr (entry), 48),
|
|
si_and (equal, si_from_uint (~(LS_FLAG)))),
|
|
si_from_ptr (entry), 48);
|
|
|
|
return (void *)
|
|
si_to_uint (si_a
|
|
(si_orx
|
|
(si_and (si_lqd (si_from_ptr (entry), 32), equal)),
|
|
si_from_uint (((unsigned int) (addr) ea) & TAG_MASK)));
|
|
|
|
misshandler:
|
|
equal = si_ceqi (etag_lo, 1);
|
|
__cache_miss (ea, entry, (si_to_uint (si_clz (si_gbb (equal))) - 16) >> 2);
|
|
goto missreturn;
|
|
}
|
|
|
|
void *
|
|
__cache_fetch (__ea void *ea)
|
|
{
|
|
return __cache_fetch_dirty (ea, 0);
|
|
}
|
|
|
|
void
|
|
__cache_touch (__ea void *ea __attribute__ ((unused)))
|
|
{
|
|
/* NO-OP for now. */
|
|
}
|
|
|
|
void __cache_flush (void) __attribute__ ((destructor));
|
|
void
|
|
__cache_flush (void)
|
|
{
|
|
struct __cache_tag_array *entry = __cache_tag_array;
|
|
unsigned int i;
|
|
int j;
|
|
|
|
/* Cycle through each cache entry and evict all used ways. */
|
|
|
|
for (i = 0; i < CACHE_LINES / WAYS; i++)
|
|
{
|
|
for (j = 0; j < WAYS; j++)
|
|
if (!CHECK_EMPTY (entry, j))
|
|
__cache_evict_entry (entry, j);
|
|
|
|
entry++;
|
|
}
|
|
}
|