ldls: the top-2 GB window Linux modules link against
A Linux module is built with -mcmodel=kernel and can only reach addresses in the top 2 GB, where this kernel is not linked. So the kernel image is mapped a second time at LDLS_KALIAS, with a vmemmap area and a module area beside it, in one PDPT shared by every address space. Nothing loads a module yet; this is the address-space groundwork, set up at every boot, and include/ldls/ is the interface the loader will use. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01S1giNvrHTrPMPw7V6x1kQ4
This commit is contained in:
parent
b524a73522
commit
65617710fa
4 changed files with 253 additions and 4 deletions
26
include/ldls/kldls.h
Normal file
26
include/ldls/kldls.h
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
#pragma once
|
||||
|
||||
// The kernel's side of LDLS, as the rest of the kernel sees it. The layer
|
||||
// itself is kernel/ldls/; this is the handful of places it is called from.
|
||||
|
||||
struct trapframe;
|
||||
|
||||
// kernel/arch/x86_64/vm.c -- the window in the top 2 GB.
|
||||
void ldls_vm_init(void);
|
||||
int kmap_page(uint64 va, addr_t pa);
|
||||
addr_t kmap_phys(uint64 va);
|
||||
addr_t kunmap_page(uint64 va);
|
||||
|
||||
// kernel/ldls/core.c
|
||||
void ldls_init(void);
|
||||
int ldls_ioctl(uint64 request, uint64 argp);
|
||||
|
||||
// A trap in kernel mode. Returns 1 if LDLS dealt with it -- a WARN() that was
|
||||
// reported and stepped over, or a hosted driver that faulted and has been
|
||||
// stopped -- and 0 if it is the kernel's own and should panic as before.
|
||||
int ldls_trap(struct trapframe *tf);
|
||||
|
||||
// The name of an address in a hosted module, for a backtrace. 0 if `a` is not
|
||||
// in one.
|
||||
int ldls_symbolize(uint64 a, char *out, int cap);
|
||||
Loading…
Reference in a new issue