arch/m68k/math-emu/fp_scan.S

Source file repositories/reference/linux-study-clean/arch/m68k/math-emu/fp_scan.S

File Facts

System
Linux kernel
Corpus path
arch/m68k/math-emu/fp_scan.S
Extension
.S
Size
11682 bytes
Lines
479
Domain
Architecture Layer
Bucket
arch/m68k
Inferred role
Architecture Layer: arch/m68k
Status
atlas-only

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

#include "fp_emu.h"
#include "fp_decode.h"

	.globl	fp_scan, fp_datasize

	.data

| %d2 - first two instr words
| %d1 - operand size

/* operand formats are:

	Long = 0,		i.e. fmove.l
	Single,			i.e. fmove.s
	Extended,		i.e. fmove.x
	Packed-BCD,		i.e. fmove.p
	Word,			i.e. fmove.w
	Double,			i.e. fmove.d
*/

	.text

| On entry:
| FPDATA - base of emulated FPU registers

fp_scan:
| normal fpu instruction? (this excludes fsave/frestore)
	fp_get_pc %a0
	printf	PDECODE,"%08x: ",1,%a0
	getuser.b (%a0),%d0,fp_err_ua1,%a0
#if 1
	cmp.b	#0xf2,%d0		| cpid = 1
#else
	cmp.b	#0xfc,%d0		| cpid = 6
#endif
	jne	fp_nonstd
| first two instruction words are kept in %d2
	getuser.l (%a0)+,%d2,fp_err_ua1,%a0
	fp_put_pc %a0
fp_decode_cond:				| separate conditional instr
	fp_decode_cond_instr_type

	.long	fp_decode_move, fp_fscc
	.long	fp_fbccw, fp_fbccl

fp_decode_move:				| separate move instr
	fp_decode_move_instr_type

	.long	fp_fgen_fp, fp_ill
	.long	fp_fgen_ea, fp_fmove_fp2mem
	.long	fp_fmovem_cr, fp_fmovem_cr
	.long	fp_fmovem_fp, fp_fmovem_fp

| now all arithmetic instr and a few move instr are left
fp_fgen_fp:				| source is a fpu register
	clr.b	(FPD_FPSR+2,FPDATA)	| clear the exception byte
	fp_decode_sourcespec
	printf	PDECODE,"f<op>.x fp%d",1,%d0
	fp_get_fp_reg
	lea	(FPD_TEMPFP1,FPDATA),%a1 | copy src into a temp location
	move.l	(%a0)+,(%a1)+
	move.l	(%a0)+,(%a1)+
	move.l	(%a0),(%a1)
	lea	(-8,%a1),%a0
	jra	fp_getdest

fp_fgen_ea:				| source is <ea>
	clr.b	(FPD_FPSR+2,FPDATA)	| clear the exception byte
	| sort out fmovecr, keep data size in %d1
	fp_decode_sourcespec

Annotation

Implementation Notes