arch/sh/kernel/dwarf.c
Source file repositories/reference/linux-study-clean/arch/sh/kernel/dwarf.c
File Facts
- System
- Linux kernel
- Corpus path
arch/sh/kernel/dwarf.c- Extension
.c- Size
- 29729 bytes
- Lines
- 1207
- Domain
- Architecture Layer
- Bucket
- arch/sh
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/kernel.hlinux/io.hlinux/list.hlinux/mempool.hlinux/mm.hlinux/elf.hlinux/ftrace.hlinux/module.hlinux/slab.hasm/dwarf.hasm/unwinder.hasm/sections.hlinux/unaligned.hasm/stacktrace.h
Detected Declarations
function thefunction dwarf_frame_free_regsfunction list_for_each_entry_safefunction list_for_each_entryfunction dwarf_read_addrfunction dwarf_read_uleb128function dwarf_read_leb128function dwarf_read_encoded_valuefunction dwarf_entry_lenfunction dwarf_cfa_execute_insnsfunction dwarf_free_framefunction return_to_handlerfunction dwarf_parse_ciefunction dwarf_parse_fdefunction dwarf_unwinder_dumpfunction dwarf_unwinder_cleanupfunction dwarf_parse_sectionfunction module_dwarf_finalizefunction module_dwarf_cleanupfunction list_for_each_entry_safefunction list_for_each_entry_safefunction dwarf_unwinder_init
Annotated Snippet
if (initial_len == DW_EXT_DWARF64) {
*len = get_unaligned((u64 *)addr + 4);
count = 12;
} else {
printk(KERN_WARNING "Unknown DWARF extension\n");
count = 0;
}
} else
*len = initial_len;
return count;
}
/**
* dwarf_lookup_cie - locate the cie
* @cie_ptr: pointer to help with lookup
*/
static struct dwarf_cie *dwarf_lookup_cie(unsigned long cie_ptr)
{
struct rb_node **rb_node = &cie_root.rb_node;
struct dwarf_cie *cie = NULL;
unsigned long flags;
spin_lock_irqsave(&dwarf_cie_lock, flags);
/*
* We've cached the last CIE we looked up because chances are
* that the FDE wants this CIE.
*/
if (cached_cie && cached_cie->cie_pointer == cie_ptr) {
cie = cached_cie;
goto out;
}
while (*rb_node) {
struct dwarf_cie *cie_tmp;
cie_tmp = rb_entry(*rb_node, struct dwarf_cie, node);
BUG_ON(!cie_tmp);
if (cie_ptr == cie_tmp->cie_pointer) {
cie = cie_tmp;
cached_cie = cie_tmp;
goto out;
} else {
if (cie_ptr < cie_tmp->cie_pointer)
rb_node = &(*rb_node)->rb_left;
else
rb_node = &(*rb_node)->rb_right;
}
}
out:
spin_unlock_irqrestore(&dwarf_cie_lock, flags);
return cie;
}
/**
* dwarf_lookup_fde - locate the FDE that covers pc
* @pc: the program counter
*/
static struct dwarf_fde *dwarf_lookup_fde(unsigned long pc)
{
struct rb_node **rb_node = &fde_root.rb_node;
struct dwarf_fde *fde = NULL;
unsigned long flags;
spin_lock_irqsave(&dwarf_fde_lock, flags);
while (*rb_node) {
struct dwarf_fde *fde_tmp;
unsigned long tmp_start, tmp_end;
fde_tmp = rb_entry(*rb_node, struct dwarf_fde, node);
BUG_ON(!fde_tmp);
tmp_start = fde_tmp->initial_location;
tmp_end = fde_tmp->initial_location + fde_tmp->address_range;
if (pc < tmp_start) {
rb_node = &(*rb_node)->rb_left;
} else {
if (pc < tmp_end) {
fde = fde_tmp;
goto out;
} else
rb_node = &(*rb_node)->rb_right;
}
}
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/io.h`, `linux/list.h`, `linux/mempool.h`, `linux/mm.h`, `linux/elf.h`, `linux/ftrace.h`, `linux/module.h`.
- Detected declarations: `function the`, `function dwarf_frame_free_regs`, `function list_for_each_entry_safe`, `function list_for_each_entry`, `function dwarf_read_addr`, `function dwarf_read_uleb128`, `function dwarf_read_leb128`, `function dwarf_read_encoded_value`, `function dwarf_entry_len`, `function dwarf_cfa_execute_insns`.
- Atlas domain: Architecture Layer / arch/sh.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.