arch/m68k/math-emu/fp_emu.h
Source file repositories/reference/linux-study-clean/arch/m68k/math-emu/fp_emu.h
File Facts
- System
- Linux kernel
- Corpus path
arch/m68k/math-emu/fp_emu.h- Extension
.h- Size
- 4270 bytes
- Lines
- 147
- 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.
- CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
asm/asm-offsets.hasm/math-emu.h
Detected Declarations
- No top-level syscall, struct, function, initcall, or export declaration detected by the generator.
Annotated Snippet
#ifndef _FP_EMU_H
#define _FP_EMU_H
#ifdef __ASSEMBLER__
#include <asm/asm-offsets.h>
#endif
#include <asm/math-emu.h>
#ifndef __ASSEMBLER__
#define IS_INF(a) ((a)->exp == 0x7fff)
#define IS_ZERO(a) ((a)->mant.m64 == 0)
#define fp_set_sr(bit) ({ \
FPDATA->fpsr |= 1 << (bit); \
})
#define fp_set_quotient(quotient) ({ \
FPDATA->fpsr &= 0xff00ffff; \
FPDATA->fpsr |= ((quotient) & 0xff) << 16; \
})
/* linkage for several useful functions */
/* Normalize the extended struct, return 0 for a NaN */
#define fp_normalize_ext(fpreg) ({ \
register struct fp_ext *reg asm ("a0") = fpreg; \
register int res asm ("d0"); \
\
asm volatile ("jsr fp_conv_ext2ext" \
: "=d" (res) : "a" (reg) \
: "a1", "d1", "d2", "memory"); \
res; \
})
#define fp_copy_ext(dest, src) ({ \
*dest = *src; \
})
#define fp_monadic_check(dest, src) ({ \
fp_copy_ext(dest, src); \
if (!fp_normalize_ext(dest)) \
return dest; \
})
#define fp_dyadic_check(dest, src) ({ \
if (!fp_normalize_ext(dest)) \
return dest; \
if (!fp_normalize_ext(src)) { \
fp_copy_ext(dest, src); \
return dest; \
} \
})
extern const struct fp_ext fp_QNaN;
extern const struct fp_ext fp_Inf;
#define fp_set_nan(dest) ({ \
fp_set_sr(FPSR_EXC_OPERR); \
*dest = fp_QNaN; \
})
/* TODO check rounding mode? */
#define fp_set_ovrflw(dest) ({ \
fp_set_sr(FPSR_EXC_OVFL); \
dest->exp = 0x7fff; \
dest->mant.m64 = 0; \
})
#define fp_conv_ext2long(src) ({ \
register struct fp_ext *__src asm ("a0") = src; \
register int __res asm ("d0"); \
\
asm volatile ("jsr fp_conv_ext2long" \
: "=d" (__res) : "a" (__src) \
: "a1", "d1", "d2", "memory"); \
__res; \
})
#define fp_conv_long2ext(dest, src) ({ \
register struct fp_ext *__dest asm ("a0") = dest; \
register int __src asm ("d0") = src; \
\
asm volatile ("jsr fp_conv_ext2long" \
: : "d" (__src), "a" (__dest) \
: "a1", "d1", "d2", "memory"); \
})
#else /* __ASSEMBLER__ */
Annotation
- Immediate include surface: `asm/asm-offsets.h`, `asm/math-emu.h`.
- Atlas domain: Architecture Layer / arch/m68k.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.