arch/m68k/include/asm/math-emu.h

Source file repositories/reference/linux-study-clean/arch/m68k/include/asm/math-emu.h

File Facts

System
Linux kernel
Corpus path
arch/m68k/include/asm/math-emu.h
Extension
.h
Size
6900 bytes
Lines
317
Domain
Architecture Layer
Bucket
arch/m68k
Inferred role
Architecture Layer: implementation source
Status
source implementation candidate

Why This File Exists

CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.

Dependency Surface

Detected Declarations

Annotated Snippet

struct fp_ext {
	unsigned char lowmant;
	unsigned char sign;
	unsigned short exp;
	union fp_mant64 mant;
};

/* C representation of FPU registers */
/* NOTE: if you change this, you have to change the assembler offsets
   below and the size in <asm/fpu.h>, too */
struct fp_data {
	struct fp_ext fpreg[8];
	unsigned int fpcr;
	unsigned int fpsr;
	unsigned int fpiar;
	unsigned short prec;
	unsigned short rnd;
	struct fp_ext temp[2];
};

#ifdef FPU_EMU_DEBUG
extern unsigned int fp_debugprint;

#define dprint(bit, fmt, ...) ({			\
	if (fp_debugprint & (1 << (bit)))		\
		pr_info(fmt, ##__VA_ARGS__);		\
})
#else
#define dprint(bit, fmt, ...)	no_printk(fmt, ##__VA_ARGS__)
#endif

#define uprint(str) ({					\
	static int __count = 3;				\
							\
	if (__count > 0) {				\
		pr_err("You just hit an unimplemented "	\
		       "fpu instruction (%s)\n", str);	\
		pr_err("Please report this to ....\n");	\
		__count--;				\
	}						\
})

#define FPDATA		((struct fp_data *)current->thread.fp)

#else	/* __ASSEMBLER__ */

#define FPDATA		%a2

/* offsets from the base register to the floating point data in the task struct */
#define FPD_FPREG	(TASK_THREAD+THREAD_FPREG+0)
#define FPD_FPCR	(TASK_THREAD+THREAD_FPREG+96)
#define FPD_FPSR	(TASK_THREAD+THREAD_FPREG+100)
#define FPD_FPIAR	(TASK_THREAD+THREAD_FPREG+104)
#define FPD_PREC	(TASK_THREAD+THREAD_FPREG+108)
#define FPD_RND		(TASK_THREAD+THREAD_FPREG+110)
#define FPD_TEMPFP1	(TASK_THREAD+THREAD_FPREG+112)
#define FPD_TEMPFP2	(TASK_THREAD+THREAD_FPREG+124)
#define FPD_SIZEOF	(TASK_THREAD+THREAD_FPREG+136)

/* offsets on the stack to access saved registers,
 * these are only used during instruction decoding
 * where we always know how deep we're on the stack.
 */
#define FPS_DO		(PT_OFF_D0)
#define FPS_D1		(PT_OFF_D1)
#define FPS_D2		(PT_OFF_D2)
#define FPS_A0		(PT_OFF_A0)
#define FPS_A1		(PT_OFF_A1)
#define FPS_A2		(PT_OFF_A2)
#define FPS_SR		(PT_OFF_SR)
#define FPS_PC		(PT_OFF_PC)
#define FPS_EA		(PT_OFF_PC+6)
#define FPS_PC2		(PT_OFF_PC+10)

.macro	fp_get_fp_reg
	lea	(FPD_FPREG,FPDATA,%d0.w*4),%a0
	lea	(%a0,%d0.w*8),%a0
.endm

/* Macros used to get/put the current program counter.
 * 020/030 use a different stack frame then 040/060, for the
 * 040/060 the return pc points already to the next location,
 * so this only needs to be modified for jump instructions.
 */
.macro	fp_get_pc dest
	move.l	(FPS_PC+4,%sp),\dest
.endm

.macro	fp_put_pc src,jump=0
	move.l	\src,(FPS_PC+4,%sp)

Annotation

Implementation Notes