arch/openrisc/kernel/module.c

Source file repositories/reference/linux-study-clean/arch/openrisc/kernel/module.c

File Facts

System
Linux kernel
Corpus path
arch/openrisc/kernel/module.c
Extension
.c
Size
2173 bytes
Lines
81
Domain
Architecture Layer
Bucket
arch/openrisc
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.

Dependency Surface

Detected Declarations

Annotated Snippet

switch (ELF32_R_TYPE(rel[i].r_info)) {
		case R_OR1K_32:
			*location = value;
			break;
		case R_OR1K_LO_16_IN_INSN:
			*((uint16_t *)location + 1) = value;
			break;
		case R_OR1K_HI_16_IN_INSN:
			*((uint16_t *)location + 1) = value >> 16;
			break;
		case R_OR1K_INSN_REL_26:
			value -= (uint32_t)location;
			value >>= 2;
			value &= 0x03ffffff;
			value |= *location & 0xfc000000;
			*location = value;
			break;
		case R_OR1K_32_PCREL:
			value -= (uint32_t)location;
			*location = value;
			break;
		case R_OR1K_AHI16:
			/* Adjust the operand to match with a signed LO16.  */
			value += 0x8000;
			*((uint16_t *)location + 1) = value >> 16;
			break;
		case R_OR1K_SLO16:
			/* Split value lower 16-bits.  */
			value = ((value & 0xf800) << 10) | (value & 0x7ff);
			*location = (*location & ~0x3e007ff) | value;
			break;
		default:
			pr_err("module %s: Unknown relocation: %u\n",
			       me->name, ELF32_R_TYPE(rel[i].r_info));
			break;
		}
	}

	return 0;
}

Annotation

Implementation Notes