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)
Sat, Jan 25, 3:31 AM
Unknown Object (File)
Thu, Jan 23, 10:12 PM
Unknown Object (File)
Thu, Jan 23, 4:30 PM
Unknown Object (File)
Thu, Jan 23, 6:52 AM
Unknown Object (File)
Thu, Jan 23, 3:42 AM
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
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

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable