mirror of
https://github.com/ventoy/Ventoy.git
synced 2025-06-03 08:28:50 -04:00
Fix the VTOY_LINUX_REMOUNT option for new linux kernel in intel 11th(and later) gen CPU.
This commit is contained in:
parent
e743f7c15f
commit
b32eda4262
12 changed files with 277 additions and 9 deletions
|
@ -2,12 +2,12 @@
|
|||
|
||||
rm -f vtoytool/00/*
|
||||
|
||||
/opt/diet64/bin/diet -Os gcc -D_FILE_OFFSET_BITS=64 *.c BabyISO/*.c -IBabyISO -Wall -DBUILD_VTOY_TOOL -DUSE_DIET_C -o vtoytool_64
|
||||
/opt/diet32/bin/diet -Os gcc -D_FILE_OFFSET_BITS=64 -m32 *.c BabyISO/*.c -IBabyISO -Wall -DBUILD_VTOY_TOOL -DUSE_DIET_C -o vtoytool_32
|
||||
/opt/diet64/bin/diet -Os gcc -DVTOY_X86_64 -D_FILE_OFFSET_BITS=64 *.c BabyISO/*.c -IBabyISO -Wall -DBUILD_VTOY_TOOL -DUSE_DIET_C -o vtoytool_64
|
||||
/opt/diet32/bin/diet -Os gcc -DVTOY_I386 -D_FILE_OFFSET_BITS=64 -m32 *.c BabyISO/*.c -IBabyISO -Wall -DBUILD_VTOY_TOOL -DUSE_DIET_C -o vtoytool_32
|
||||
|
||||
aarch64-buildroot-linux-uclibc-gcc -Os -static -D_FILE_OFFSET_BITS=64 *.c BabyISO/*.c -IBabyISO -Wall -DBUILD_VTOY_TOOL -o vtoytool_aa64
|
||||
aarch64-buildroot-linux-uclibc-gcc -Os -static -DVTOY_AA64 -D_FILE_OFFSET_BITS=64 *.c BabyISO/*.c -IBabyISO -Wall -DBUILD_VTOY_TOOL -o vtoytool_aa64
|
||||
|
||||
mips64el-linux-musl-gcc -mips64r2 -mabi=64 -Os -static -D_FILE_OFFSET_BITS=64 *.c BabyISO/*.c -IBabyISO -Wall -DBUILD_VTOY_TOOL -o vtoytool_m64e
|
||||
mips64el-linux-musl-gcc -mips64r2 -mabi=64 -Os -static -DVTOY_MIPS64 -D_FILE_OFFSET_BITS=64 *.c BabyISO/*.c -IBabyISO -Wall -DBUILD_VTOY_TOOL -o vtoytool_m64e
|
||||
|
||||
#gcc -D_FILE_OFFSET_BITS=64 -static -Wall -DBUILD_VTOY_TOOL *.c BabyISO/*.c -IBabyISO -o vtoytool_64
|
||||
#gcc -D_FILE_OFFSET_BITS=64 -Wall -DBUILD_VTOY_TOOL -m32 *.c BabyISO/*.c -IBabyISO -o vtoytool_32
|
||||
|
|
|
@ -24,6 +24,9 @@
|
|||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
#ifdef VTOY_X86_64
|
||||
#include <cpuid.h>
|
||||
#endif
|
||||
|
||||
#define _ull unsigned long long
|
||||
|
||||
|
@ -177,7 +180,8 @@ typedef struct ko_param
|
|||
unsigned long sym_put_addr;
|
||||
unsigned long sym_put_size;
|
||||
unsigned long kv_major;
|
||||
unsigned long padding[2];
|
||||
unsigned long ibt;
|
||||
unsigned long padding[1];
|
||||
}ko_param;
|
||||
|
||||
#pragma pack()
|
||||
|
@ -486,6 +490,7 @@ int vtoykmod_fill_param(char **argv)
|
|||
param->reg_kprobe_addr = strtoul(argv[9], NULL, 16);
|
||||
param->unreg_kprobe_addr = strtoul(argv[10], NULL, 16);
|
||||
param->kv_major = (unsigned long)(argv[11][0] - '0');
|
||||
param->ibt = strtoul(argv[12], NULL, 16);;
|
||||
|
||||
debug("pgsize=%lu (%s)\n", param->pgsize, argv[1]);
|
||||
debug("printk_addr=0x%lx (%s)\n", param->printk_addr, argv[2]);
|
||||
|
@ -498,6 +503,7 @@ int vtoykmod_fill_param(char **argv)
|
|||
debug("reg_kprobe_addr=0x%lx (%s)\n", param->reg_kprobe_addr, argv[9]);
|
||||
debug("unreg_kprobe_addr=0x%lx (%s)\n", param->unreg_kprobe_addr, argv[10]);
|
||||
debug("kv_major=%lu (%s)\n", param->kv_major, argv[11]);
|
||||
debug("ibt=0x%lx (%s)\n", param->ibt, argv[11]);
|
||||
|
||||
break;
|
||||
}
|
||||
|
@ -514,6 +520,26 @@ int vtoykmod_fill_param(char **argv)
|
|||
return 0;
|
||||
}
|
||||
|
||||
#ifdef VTOY_X86_64
|
||||
static int vtoykmod_check_ibt(void)
|
||||
{
|
||||
uint32_t eax = 0, ebx = 0, ecx = 0, edx = 0;
|
||||
|
||||
__cpuid_count(7, 0, eax, ebx, ecx, edx);
|
||||
|
||||
if (edx & (1 << 20))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
#else
|
||||
static int vtoykmod_check_ibt(void)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
int vtoykmod_main(int argc, char **argv)
|
||||
{
|
||||
int i;
|
||||
|
@ -535,6 +561,10 @@ int vtoykmod_main(int argc, char **argv)
|
|||
{
|
||||
return vtoykmod_update(argv[2], argv[3]);
|
||||
}
|
||||
else if (argv[1][0] == '-' && argv[1][1] == 'I')
|
||||
{
|
||||
return vtoykmod_check_ibt();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue