arch/microblaze/include/asm/flat.h
Source file repositories/reference/linux-study-clean/arch/microblaze/include/asm/flat.h
File Facts
- System
- Linux kernel
- Corpus path
arch/microblaze/include/asm/flat.h- Extension
.h- Size
- 1984 bytes
- Lines
- 82
- Domain
- Architecture Layer
- Bucket
- arch/microblaze
- 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.
Dependency Surface
linux/unaligned.h
Detected Declarations
function Copyrightfunction flat_put_addr_at_rp
Annotated Snippet
#ifndef _ASM_MICROBLAZE_FLAT_H
#define _ASM_MICROBLAZE_FLAT_H
#include <linux/unaligned.h>
/*
* Microblaze works a little differently from other arches, because
* of the MICROBLAZE_64 reloc type. Here, a 32 bit address is split
* over two instructions, an 'imm' instruction which provides the top
* 16 bits, then the instruction "proper" which provides the low 16
* bits.
*/
/*
* Crack open a symbol reference and extract the address to be
* relocated. rp is a potentially unaligned pointer to the
* reference
*/
static inline int flat_get_addr_from_rp(u32 __user *rp, u32 relval, u32 flags,
u32 *addr)
{
u32 *p = (__force u32 *)rp;
/* Is it a split 64/32 reference? */
if (relval & 0x80000000) {
/* Grab the two halves of the reference */
u32 val_hi, val_lo;
val_hi = get_unaligned(p);
val_lo = get_unaligned(p+1);
/* Crack the address out */
*addr = ((val_hi & 0xffff) << 16) + (val_lo & 0xffff);
} else {
/* Get the address straight out */
*addr = get_unaligned(p);
}
return 0;
}
/*
* Insert an address into the symbol reference at rp. rp is potentially
* unaligned.
*/
static inline int
flat_put_addr_at_rp(u32 __user *rp, u32 addr, u32 relval)
{
u32 *p = (__force u32 *)rp;
/* Is this a split 64/32 reloc? */
if (relval & 0x80000000) {
/* Get the two "halves" */
unsigned long val_hi = get_unaligned(p);
unsigned long val_lo = get_unaligned(p + 1);
/* insert the address */
val_hi = (val_hi & 0xffff0000) | addr >> 16;
val_lo = (val_lo & 0xffff0000) | (addr & 0xffff);
/* store the two halves back into memory */
put_unaligned(val_hi, p);
put_unaligned(val_lo, p+1);
} else {
/* Put it straight in, no messing around */
put_unaligned(addr, p);
}
return 0;
}
#define flat_get_relocate_addr(rel) (rel & 0x7fffffff)
#endif /* _ASM_MICROBLAZE_FLAT_H */
Annotation
- Immediate include surface: `linux/unaligned.h`.
- Detected declarations: `function Copyright`, `function flat_put_addr_at_rp`.
- Atlas domain: Architecture Layer / arch/microblaze.
- 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.