arch/powerpc/lib/test_emulate_step.c
Source file repositories/reference/linux-study-clean/arch/powerpc/lib/test_emulate_step.c
File Facts
- System
- Linux kernel
- Corpus path
arch/powerpc/lib/test_emulate_step.c- Extension
.c- Size
- 37745 bytes
- Lines
- 1742
- Domain
- Architecture Layer
- Bucket
- arch/powerpc
- 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
linux/ptrace.hasm/cpu_has_feature.hasm/sstep.hasm/ppc-opcode.hasm/text-patching.hasm/inst.h
Detected Declarations
struct compute_testfunction PPC_RAW_LWZfunction show_resultfunction show_result_with_descrfunction test_ldfunction test_pldfunction test_lwzfunction test_plwzfunction test_lwzxfunction test_stdfunction test_pstdfunction test_ldarx_stdcxfunction test_lfsx_stfsxfunction test_plfs_pstfsfunction test_lfdx_stfdxfunction test_plfd_pstfdfunction test_lfsx_stfsxfunction test_plfs_pstfsfunction test_lfdx_stfdxfunction test_plfd_pstfdfunction test_lvx_stvxfunction test_lvx_stvxfunction test_lxvd2x_stxvd2xfunction test_lxvd2x_stxvd2xfunction test_lxvp_stxvpfunction test_lxvp_stxvpfunction test_lxvpx_stxvpxfunction test_lxvpx_stxvpxfunction test_plxvp_pstxvpfunction test_plxvp_pstxvpfunction run_tests_load_storefunction emulate_compute_instrfunction execute_compute_instrfunction run_tests_computefunction test_emulate_step
Annotated Snippet
struct compute_test {
char *mnemonic;
unsigned long cpu_feature;
struct {
char *descr;
unsigned long flags;
ppc_inst_t instr;
struct pt_regs regs;
} subtests[MAX_SUBTESTS + 1];
};
/* Extreme values for si0||si1 (the MLS:D-form 34 bit immediate field) */
#define SI_MIN BIT(33)
#define SI_MAX (BIT(33) - 1)
#define SI_UMAX (BIT(34) - 1)
static struct compute_test compute_tests[] = {
{
.mnemonic = "nop",
.subtests = {
{
.descr = "R0 = LONG_MAX",
.instr = ppc_inst(PPC_RAW_NOP()),
.regs = {
.gpr[0] = LONG_MAX,
}
}
}
},
{
.mnemonic = "setb",
.cpu_feature = CPU_FTR_ARCH_300,
.subtests = {
{
.descr = "BFA = 1, CR = GT",
.instr = ppc_inst(PPC_RAW_SETB(20, 1)),
.regs = {
.ccr = 0x4000000,
}
},
{
.descr = "BFA = 4, CR = LT",
.instr = ppc_inst(PPC_RAW_SETB(20, 4)),
.regs = {
.ccr = 0x8000,
}
},
{
.descr = "BFA = 5, CR = EQ",
.instr = ppc_inst(PPC_RAW_SETB(20, 5)),
.regs = {
.ccr = 0x200,
}
}
}
},
{
.mnemonic = "add",
.subtests = {
{
.descr = "RA = LONG_MIN, RB = LONG_MIN",
.instr = ppc_inst(PPC_RAW_ADD(20, 21, 22)),
.regs = {
.gpr[21] = LONG_MIN,
.gpr[22] = LONG_MIN,
}
},
{
.descr = "RA = LONG_MIN, RB = LONG_MAX",
.instr = ppc_inst(PPC_RAW_ADD(20, 21, 22)),
.regs = {
.gpr[21] = LONG_MIN,
.gpr[22] = LONG_MAX,
}
},
{
.descr = "RA = LONG_MAX, RB = LONG_MAX",
.instr = ppc_inst(PPC_RAW_ADD(20, 21, 22)),
.regs = {
.gpr[21] = LONG_MAX,
.gpr[22] = LONG_MAX,
}
},
{
.descr = "RA = ULONG_MAX, RB = ULONG_MAX",
.instr = ppc_inst(PPC_RAW_ADD(20, 21, 22)),
.regs = {
.gpr[21] = ULONG_MAX,
.gpr[22] = ULONG_MAX,
}
Annotation
- Immediate include surface: `linux/ptrace.h`, `asm/cpu_has_feature.h`, `asm/sstep.h`, `asm/ppc-opcode.h`, `asm/text-patching.h`, `asm/inst.h`.
- Detected declarations: `struct compute_test`, `function PPC_RAW_LWZ`, `function show_result`, `function show_result_with_descr`, `function test_ld`, `function test_pld`, `function test_lwz`, `function test_plwz`, `function test_lwzx`, `function test_std`.
- Atlas domain: Architecture Layer / arch/powerpc.
- 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.