/* * This file is subject to the terms and conditions of the GNU General Public * License. See the file "COPYING" in the main directory of this archive * for more details. * * Copyright (C) 2003, 04, 07 Ralf Baechle <ralf@linux-mips.org> * Copyright (C) MIPS Technologies, Inc. * written by Ralf Baechle <ralf@linux-mips.org>
*/ #ifndef _ASM_HAZARDS_H #define _ASM_HAZARDS_H
/* * gcc has a tradition of misscompiling the previous construct using the * address of a label as argument to inline assembler. Gas otoh has the * annoying difference between la and dla which are only usable for 32-bit * rsp. 64-bit code, so can't be used without conditional compilation. * The alternative is switching the assembler to 64-bit code which happens * to work right even for 32-bit code...
*/ #define instruction_hazard() \ do { \ unsignedlong tmp; \
\
__asm__ __volatile__( \ " .set push \n" \ " .set "MIPS_ISA_LEVEL" \n" \ " dla %0, 1f \n" \ " jr.hb %0 \n" \ " .set pop \n" \ "1: \n" \
: "=r" (tmp)); \
} while (0)
/* * gcc has a tradition of misscompiling the previous construct using the * address of a label as argument to inline assembler. Gas otoh has the * annoying difference between la and dla which are only usable for 32-bit * rsp. 64-bit code, so can't be used without conditional compilation. * The alternative is switching the assembler to 64-bit code which happens * to work right even for 32-bit code...
*/ #define __instruction_hazard() \ do { \ unsignedlong tmp; \
\
__asm__ __volatile__( \ " .set push \n" \ " .set mips64r2 \n" \ " dla %0, 1f \n" \ " jr.hb %0 \n" \ " .set pop \n" \ "1: \n" \
: "=r" (tmp)); \
} while (0)
#define instruction_hazard() \ do { \ if (cpu_has_mips_r2_r6) \
__instruction_hazard(); \
} while (0)
/* * Finally the catchall case for all other processors including R4000, R4400, * R4600, R4700, R5000, RM7000, NEC VR41xx etc. * * The taken branch will result in a two cycle penalty for the two killed * instructions on R4000 / R4400. Other processors only have a single cycle * hazard so this is nice trick to have an optimal code for a range of * processors.
*/ #define __mtc0_tlbw_hazard \
nop; \
nop
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.