arch/arm/nwfpe/fpa11_cpdt.c

Source file repositories/reference/linux-study-clean/arch/arm/nwfpe/fpa11_cpdt.c

File Facts

System
Linux kernel
Corpus path
arch/arm/nwfpe/fpa11_cpdt.c
Extension
.c
Size
8414 bytes
Lines
396
Domain
Architecture Layer
Bucket
arch/arm
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

// SPDX-License-Identifier: GPL-2.0-or-later
/*
    NetWinder Floating Point Emulator
    (c) Rebel.com, 1998-1999
    (c) Philip Blundell, 1998, 2001

    Direct questions, comments to Scott Bambrough <scottb@netwinder.org>

*/

#include "fpa11.h"
#include "softfloat.h"
#include "fpopcode.h"
#include "fpmodule.h"
#include "fpmodule.inl"

#include <linux/uaccess.h>

static inline void loadSingle(const unsigned int Fn, const unsigned int __user *pMem)
{
	FPA11 *fpa11 = GET_FPA11();
	fpa11->fType[Fn] = typeSingle;
	get_user(fpa11->fpreg[Fn].fSingle, pMem);
}

static inline void loadDouble(const unsigned int Fn, const unsigned int __user *pMem)
{
	FPA11 *fpa11 = GET_FPA11();
	unsigned int *p;
	p = (unsigned int *) &fpa11->fpreg[Fn].fDouble;
	fpa11->fType[Fn] = typeDouble;
#ifdef __ARMEB__
	get_user(p[0], &pMem[0]);	/* sign & exponent */
	get_user(p[1], &pMem[1]);
#else
	get_user(p[0], &pMem[1]);
	get_user(p[1], &pMem[0]);	/* sign & exponent */
#endif
}

#ifdef CONFIG_FPE_NWFPE_XP
static inline void loadExtended(const unsigned int Fn, const unsigned int __user *pMem)
{
	FPA11 *fpa11 = GET_FPA11();
	unsigned int *p;
	p = (unsigned int *) &fpa11->fpreg[Fn].fExtended;
	fpa11->fType[Fn] = typeExtended;
	get_user(p[0], &pMem[0]);	/* sign & exponent */
#ifdef __ARMEB__
	get_user(p[1], &pMem[1]);	/* ms bits */
	get_user(p[2], &pMem[2]);	/* ls bits */
#else
	get_user(p[1], &pMem[2]);	/* ls bits */
	get_user(p[2], &pMem[1]);	/* ms bits */
#endif
}
#endif

static inline void loadMultiple(const unsigned int Fn, const unsigned int __user *pMem)
{
	FPA11 *fpa11 = GET_FPA11();
	register unsigned int *p;
	unsigned long x;

	p = (unsigned int *) &(fpa11->fpreg[Fn]);
	get_user(x, &pMem[0]);
	fpa11->fType[Fn] = (x >> 14) & 0x00000003;

	switch (fpa11->fType[Fn]) {
	case typeSingle:
	case typeDouble:
		{
			get_user(p[0], &pMem[2]);	/* Single */
			get_user(p[1], &pMem[1]);	/* double msw */
			p[2] = 0;			/* empty */
		}
		break;

#ifdef CONFIG_FPE_NWFPE_XP
	case typeExtended:
		{
			get_user(p[1], &pMem[2]);
			get_user(p[2], &pMem[1]);	/* msw */
			p[0] = (x & 0x80003fff);
		}
		break;
#endif
	}
}

Annotation

Implementation Notes