Page MenuHomeFreeBSD

Add SYSCTL to get KERNBASE and relocated KERNBASE
ClosedPublic

Authored by luporl on Jan 20 2020, 7:10 PM.
Tags
None
Referenced Files
F103546698: D23284.diff
Tue, Nov 26, 8:59 AM
Unknown Object (File)
Tue, Nov 12, 11:04 AM
Unknown Object (File)
Mon, Oct 28, 12:58 AM
Unknown Object (File)
Oct 18 2024, 9:06 PM
Unknown Object (File)
Oct 2 2024, 4:44 AM
Unknown Object (File)
Sep 24 2024, 1:16 PM
Unknown Object (File)
Sep 17 2024, 12:32 PM
Unknown Object (File)
Sep 16 2024, 8:43 AM
Subscribers

Details

Summary

This change adds 2 new SYSCTLs, to retrieve the original and relocated KERNBASE values.
This provides an easy, architecture independent way to calculate the running kernel displacement (current/load address minus original base address).

The initial goal for this change is to add a new libkvm function that returns the kernel displacement, both for live kernels and crashdumps.
This would in turn be used by kgdb to find out how to relocate kernel symbols (if needed).

Test Plan

On PowerPC, the new sysctl's are expected to return entries like the following:

kern.relbase_address: 0xc000000000100100
kern.base_address: 0x0000000000100100

In other architectures base_address will be equal to relbase_address, resulting in a 0 displacement and no need to relocate symbols.

Diff Detail

Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 28793
Build 26802: arc lint + arc unit