arch/m68k/emu/natfeat.c
Source file repositories/reference/linux-study-clean/arch/m68k/emu/natfeat.c
File Facts
- System
- Linux kernel
- Corpus path
arch/m68k/emu/natfeat.c- Extension
.c- Size
- 1929 bytes
- Lines
- 95
- Domain
- Architecture Layer
- Bucket
- arch/m68k
- Inferred role
- Architecture Layer: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
Dependency Surface
linux/init.hlinux/types.hlinux/console.hlinux/string.hlinux/kernel.hlinux/module.hlinux/reboot.hlinux/io.hasm/machdep.hasm/natfeat.h
Detected Declarations
function nf_get_idfunction nfprintfunction nf_powerofffunction nf_initexport nf_callexport nf_get_id
Annotated Snippet
#include <linux/init.h>
#include <linux/types.h>
#include <linux/console.h>
#include <linux/string.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/reboot.h>
#include <linux/io.h>
#include <asm/machdep.h>
#include <asm/natfeat.h>
extern long nf_get_id_phys(unsigned long feature_name);
asm("\n"
" .global nf_get_id_phys,nf_call\n"
"nf_get_id_phys:\n"
" .short 0x7300\n"
" rts\n"
"nf_call:\n"
" .short 0x7301\n"
" rts\n"
"1: moveq.l #0,%d0\n"
" rts\n"
" .section __ex_table,\"a\"\n"
" .long nf_get_id_phys,1b\n"
" .long nf_call,1b\n"
" .previous");
EXPORT_SYMBOL_GPL(nf_call);
long nf_get_id(const char *feature_name)
{
/* feature_name may be in vmalloc()ed memory, so make a copy */
char name_copy[32];
ssize_t n;
n = strscpy(name_copy, feature_name, sizeof(name_copy));
if (n < 0)
return 0;
return nf_get_id_phys(virt_to_phys(name_copy));
}
EXPORT_SYMBOL_GPL(nf_get_id);
void nfprint(const char *fmt, ...)
{
static char buf[256];
va_list ap;
va_start(ap, fmt);
vsnprintf(buf, 256, fmt, ap);
nf_call(nf_get_id("NF_STDERR"), virt_to_phys(buf));
va_end(ap);
}
static void nf_poweroff(void)
{
long id = nf_get_id("NF_SHUTDOWN");
if (id)
nf_call(id);
}
void __init nf_init(void)
{
unsigned long id, version;
char buf[256];
id = nf_get_id("NF_VERSION");
if (!id)
return;
version = nf_call(id);
id = nf_get_id("NF_NAME");
if (!id)
return;
nf_call(id, virt_to_phys(buf), 256);
buf[255] = 0;
pr_info("NatFeats found (%s, %lu.%lu)\n", buf, version >> 16,
version & 0xffff);
register_platform_power_off(nf_poweroff);
}
Annotation
- Immediate include surface: `linux/init.h`, `linux/types.h`, `linux/console.h`, `linux/string.h`, `linux/kernel.h`, `linux/module.h`, `linux/reboot.h`, `linux/io.h`.
- Detected declarations: `function nf_get_id`, `function nfprint`, `function nf_poweroff`, `function nf_init`, `export nf_call`, `export nf_get_id`.
- Atlas domain: Architecture Layer / arch/m68k.
- Implementation status: integration 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.