tools: add userspace linker table sandbox
Add a userspace sandbox to allow easy experimentation and
test extensions with linker tables, section ranges and the
new section core definitions.
The userspace sandbox tries to mimic the Linux kernel development
flow as much as possible, it however relies on and uses libc. Support
is currently only provided to x86_64.
Demo run:
cd tools/linker-tables
make clean; make;
./demo
Initializing x86 bare metal world
x86-init: Number of init entries: 8
Initializing memory ...
Completed initializing memory !
Initializing pci ...
PCI fixup size: 1
Demo: Using LINKTABLE_FOR_EACH
foo_fixup
Demo: Using LINKTABLE_RUN_ALL
foo_fixup
Completed initializing pci !
Number of init entries: 1
Initializing kprobes ...
== OK: test_kprobe_0001 within range!
== OK: test_kprobe_0002 not in range as expected!
Completed initializing kprobes !
Initializing kasan ...
Early init for Kasan...
Completed initializing kasan !
Initializing beta ...
Completed initializing beta !
Initializing alpha ...
Completed initializing alpha !
Booting bare metal
Calling start_kernel()...
ACME: Initializing ...
ACME: Finished init ... !
Synthetics: synth_init_or(2) returns: 0xDEADBEEF
Synthetics: ps_shr(0xDEADBEEF, get_demo_shr) returns: 0x0000DEAD
v5:
o Use ..rng.* instead of .rng.* as suggested by Nicholas Piggin.
This is the typical way to avoid clashes with compiler generated
sections.
o moves tools/include/linux/printk.h to tools
linker-table/include/linux/printk.h -- we cannot generalize this
just yet, more work is needed in terms of providing a namespace for
headers for types of ports of kernel functionality to userspace.
o Adjust code according to the latest discussions for the linker
tables API (section name macros are now gone).
o Give CONFIG_HAVE_ARCH_PS_CONST for x86 another good 'ol college try,
still fails, but this is just a demo anyway. We can amend and fix
make this more optimized for x86 later. Thanks Boris!
v4: this patch is new in this series -- added to the kenrel as
suggested by Boris, as otherwise it'd be really hard to keep
an external userspace repository in sync.
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
Signed-off-by: Luis R. Rodriguez <mcgrof@kernel.org>
71 files changed