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
Unknown Object (File)
Mon, Jan 20, 10:30 AM
Unknown Object (File)
Sun, Jan 19, 4:13 AM
Unknown Object (File)
Sat, Jan 18, 6:20 PM
Unknown Object (File)
Nov 26 2024, 8:59 AM
Unknown Object (File)
Nov 12 2024, 11:04 AM
Unknown Object (File)
Oct 28 2024, 12:58 AM
Unknown Object (File)
Oct 18 2024, 9:06 PM
Unknown Object (File)
Oct 2 2024, 4:44 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