modules: rename packages/kernel_modules to packages/lkmc

Then inside, split packages/lkmc into kernel_modules and userland,
to keep userland out of the kernel_modules parent path, which makes no
sense.

Copy built modules and userland to the output rootfs overlay.

Document Linux distro tradeoffs.
This commit is contained in:
Ciro Santilli 六四事件 法轮功
2018-10-10 00:00:00 +00:00
parent c1d5d7d166
commit dae60aa248
97 changed files with 216 additions and 175 deletions

58
packages/lkmc/ring0.h Normal file
View File

@@ -0,0 +1,58 @@
#if defined(__x86_64__) || defined(__i386__)
#ifdef THIS_MODULE
#include <linux/kernel.h>
#if defined(__x86_64__)
typedef u64 T;
#elif defined(__i386__)
typedef u32 T;
#endif
#else
#include <stdint.h>
#if defined(__x86_64__)
typedef uint64_t T;
#elif defined(__i386__)
typedef uint32_t T;
#endif
#endif
typedef struct {
T cr0;
T cr2;
T cr3;
} Ring0Regs;
void ring0_get_control_regs(Ring0Regs *ring0_regs)
{
#if defined(__x86_64__)
__asm__ __volatile__ (
"mov %%cr0, %%rax;"
"mov %%eax, %0;"
"mov %%cr2, %%rax;"
"mov %%eax, %1;"
"mov %%cr3, %%rax;"
"mov %%eax, %2;"
: "=m" (ring0_regs->cr0),
"=m" (ring0_regs->cr2),
"=m" (ring0_regs->cr3)
:
: "%rax"
);
#elif defined(__i386__)
__asm__ __volatile__ (
"mov %%cr0, %%eax;"
"mov %%eax, %0;"
"mov %%cr2, %%eax;"
"mov %%eax, %1;"
"mov %%cr3, %%eax;"
"mov %%eax, %2;"
: "=m" (ring0_regs->cr0),
"=m" (ring0_regs->cr2),
"=m" (ring0_regs->cr3)
:
: "%eax"
);
#endif
}
#endif