#ifndef _PLE_BUILD_H_ #define _PLE_BUILD_H_ /* ** 这个文件相当于linux的make config生成的配置文件吧? ** 因没有环境,我们手工编写的。 ** 我们把它插入到了所有模块上。纯粹出于简单的目地,未必正确! */ //抽取32位的cpu #define __i386__ //__x86_64__ #define CONFIG_X86_32 // #define __KERNEL__ //需要提前定义 #define __always_inline inline //涉及include\linux\iocontext.h io_context结构体 #define CONFIG_BLOCK #define __must_be_array(a) 0 /* add version 4.3-rc */ #define CONFIG_TEST_STATIC_KEYS #define CONFIG_SG_SPLIT #define CONFIG_MODIFY_LDT_SYSCALL #define CONFIG_KEXEC_CORE #define CONFIG_X86_PMEM_LEGACY_DEVICE #define CONFIG_CGROUP_PIDS #define CONFIG_MEMBARRIER /* end add version 4.3-rc */ /* add version 4.2 */ #define CONFIG_842_COMPRESS #define CONFIG_842_DECOMPRESS #define CONFIG_QUEUED_RWLOCKS //<< CONFIG_QUEUE_RWLOCK #define CONFIG_IRQ_DOMAIN_HIERARCHY #define CONFIG_SCHED_INFO //F:\linux-4\kernel\sched\stats.h #define CONFIG_IRQ_DOMAIN_HIERARCHY // [1210]F:\linux-4\kernel\irq\irqdomain.c //[10]F:\linux-4\include\linux\jiffies.h#include//del struct msi_alloc_info_t; //[37]F:\linux-4\kernel\time\timer_list.cstatic void SEQ_printf(struct seq_file *m, const char *fmt, ...) //add #undef SEQ_printf /* end version 4.2 */ //copy asm-generic/early_ioremap.h x86/include/asm/early_ioremap.h //[9]F:\linux-4\arch\x86\include\asm\ia32_unistd.h#include "asm/unistd_32_ia32.h" 没有 //del #include "asm/unistd_32_ia32.h" //[9]F:\linux-4\include\linux\scatterlist.h#include "asm/scatterlist.h" 没有 v4.2取消了 //copy include\asm-generic/scatterlist.h to x86/include/asm/scatterlist.h //注释掉linux\compat.h 124-126行,原因:定义的是空间 //[47]F:\linux-4\lib\crc32.c#include "crc32table.h" //del #include "crc32table.h" //[14]F:\linux-4\lib\raid6\neon.c#include "asm/neon.h" //copy arm/include/asm to x86 //[11]F:\linux-4\arch\x86\include\asm\neon.h#include "asm/hwcap.h" //copy arm/include/asm to x86 //[4]F:\linux-4\arch\x86\include\asm\hwcap.h#include //del //[3]F:\linux-4\lib\compat_audit.c#include "asm/unistd32.h" //copy arm64 to x86 //[83]F:\linux-4\include\trace\define_trace.h#include TRACE_INCLUDE(TRACE_INCLUDE_FILE) //[134]F:\linux-4\include\trace\ftrace.h#include TRACE_INCLUDE(TRACE_INCLUDE_FILE) //modify #include "trace/events/system.h" 没有 del //v4.2分成perf.h和trace_events.h //[18]F:\linux-4\lib\oid_registry.c#include "oid_registry_data.c" //del //[24]F:\linux-4\arch\x86\lib\inat.c#include "inat-tables.c" //del //[4]F:\linux-4\arch\x86\boot\ctype.hstatic inline int isdigit(int ch) //add #undef isdigit #undef isxdigit //[91]F:\linux-4\arch\x86\boot\boot.hstatic inline void set_fs(u16 seg) //add #undef set_fs //[20]F:\linux-4\arch\x86\boot\cpu.c#include "cpustr.h" //del add const char** x86_cap_strs; //[17]F:\linux-4\arch\x86\kernel\syscall_32.c#include "asm/syscalls_32.h" //copy arch/sh/include/asm to x86 //[69]F:\linux-4\arch\x86\include\asm\highmem.hvoid *kmap_atomic_pfn(unsigned long pfn); //add #undef kmap_atomic_pfn #undef kmap_atomic_to_page //[552]F:\linux-4\kernel\smp.cint nr_cpu_ids __read_mostly = NR_CPUS; //add #undef nr_cpu_ids //[466]F:\linux-4\kernel\trace\trace_irqsoff.cvoid trace_softirqs_on(unsigned long ip) //add #undef trace_softirqs_on #undef trace_softirqs_off #undef trace_hardirqs_on // #undef trace_hardirqs_off //[194]F:\linux-4\kernel\trace\trace_uprobe.cDEFINE_BASIC_FETCH_FUNCS(file_offset) //add #undef fetch_file_offset_u8 #undef fetch_file_offset_u16 #undef fetch_file_offset_u32 #undef fetch_file_offset_u64 //#undef fetch_file_offset_string #undef fetch_file_offset_string_size /*需要将arch\x86\include\asm\kexec.h kimage_arch 结构在 !CONFIG_X86_32 下的 unsigned long backup_src_start; unsigned long backup_src_sz; unsigned long backup_load_addr; void *elf_headers; unsigned long elf_headers_sz; unsigned long elf_load_addr; 复制到#ifdef CONFIG_X86_32 块内,否则 x86/kernel/crash.c无法解释 */ //add /include/linux/version.h //[44]F:\linux-4\kernel\time\time.c#include "timeconst.h" //del //[48]F:\linux-4\kernel\configs.c#include "config_data.h" //del //[67]F:\linux-4\kernel\livepatch\core.c struct klp_func *func; //取消 include\linux\livepatch.h的#if IS_ENABLED(CONFIG_LIVEPATCH)条件 //需要定义,否则不能正确解释相关函数 #define CONFIG_USER_STACKTRACE_SUPPORT #define CONFIG_MTRR #define CONFIG_DEBUG_TLBFLUSH #define CONFIG_BUG #define CONFIG_DEBUG_LOCK_ALLOC #define CONFIG_XFRM #define CONFIG_NF_CONNTRACK #define CONFIG_NET_NS #define CONFIG_SLAB #define raw_smp_processor_id() 0 #define CONFIG_HAVE_MEMBLOCK #define CONFIG_NEED_SG_DMA_LENGTH #define CONFIG_HAVE_UNSTABLE_SCHED_CLOCK #define CONFIG_DEFAULT_IO_DELAY_TYPE #define CONFIG_IO_DELAY_TYPE_0X80 #define CONFIG_IO_DELAY_TYPE_0XED #define CONFIG_IO_DELAY_TYPE_UDELAY #define CONFIG_IO_DELAY_TYPE_NONE #define CONFIG_HAVE_ARCH_SECCOMP_FILTER #define CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK #define CONFIG_NEED_PER_CPU_PAGE_FIRST_CHUNK #define CONFIG_GENERIC_IRQ_LEGACY_ALLOC_HWIRQ #define R_X86_64_NONE 0 /* No reloc */ #define R_X86_64_64 1 /* Direct 64 bit */ #define R_X86_64_32 10 /* Direct 32 bit zero extended */ #define R_X86_64_32S 11 /* Direct 32 bit sign extended */ #define R_X86_64_PC32 2 /* PC relative 32 bit signed */ #define CONFIG_KEYS //kernel/lgdb.c add #include "asm/kgbd.h" #define CONFIG_TASKS_RCU //没有包含定义,但有使用 #define PTRACE_GETFDPIC 31 /* get the ELF fdpic loadmap address */ #define PTRACE_GETFDPIC_EXEC 0 /* [addr] request the executable loadmap */ #define PTRACE_GETFDPIC_INTERP 1 /* [addr] request the interpreter loadmap */ //include\trace\events\signal.h #ifndef TRACE_HEADER_MULTI_READ 需要注掉 #define CONFIG_CGROUP_SCHED //需要包含arch\x86\include\asm\rwsem.h、del linux/rwsem.h的CONFIG_RWSEM_GENERIC_SPINLOCK条件的否则//#else wss //linux/livepatch.h #if IS_ENABLED(CONFIG_LIVEPATCH) >> #if !IS_ENABLED(CONFIG_LIVEPATCH) #define CONFIG_SPARSEMEM #define CONFIG_SWAP #define CONFIG_RCU_STALL_COMMON #define CONFIG_RCU_FANOUT_LEAF 1 #define CONFIG_RCU_FANOUT 1 #define CONFIG_RCU_TRACE #define CONFIG_GENERIC_CLOCKEVENTS_BROADCAST #define CONFIG_KERNFS #define CONFIG_FSNOTIFY #define CONFIG_HAVE_ARCH_KGDB #define CONFIG_BINARY_PRINTF #define CONFIG_TRACER_MAX_TRACE #define CONFIG_FTRACE_MCOUNT_RECORD #define DEBUG_ZLIB /* 以下宏是根据makefile中的选项宏定义,我们没有逐一核对是否必要 */ /* from lib/Makefile */ #define CONFIG_ARCH_HAS_DEBUG_STRICT_USER_COPY_CHECKS #define CONFIG_MMU #define CONFIG_SMP #define CONFIG_TEST_STRING_HELPERS #define CONFIG_TEST_HEXDUMP #define CONFIG_TEST_BPF #define CONFIG_TEST_FIRMWARE #define CONFIG_TEST_KASAN #define CONFIG_TEST_KSTRTOX #define CONFIG_TEST_LKM #define CONFIG_TEST_RHASHTABLE #define CONFIG_TEST_USER_COPY #define CONFIG_GENERIC_IOMAP #define CONFIG_GENERIC_PCI_IOMAP #define CONFIG_HAS_IOMEM #define CONFIG_CHECK_SIGNATURE #define CONFIG_DEBUG_LOCKING_API_SELFTESTS #define CONFIG_GENERIC_HWEIGHT #define CONFIG_BTREE #define CONFIG_INTERVAL_TREE #define CONFIG_ASSOCIATIVE_ARRAY #define CONFIG_DEBUG_PREEMPT #define CONFIG_DEBUG_LIST #define CONFIG_DEBUG_OBJECTS #define CONFIG_HAVE_DEC_LOCK #define CONFIG_BITREVERSE #define CONFIG_RATIONAL #define CONFIG_CRC_CCITT #define CONFIG_CRC16 #define CONFIG_CRC_T10DIF #define CONFIG_CRC_ITU_T #define CONFIG_CRC32 #define CONFIG_CRC7 #define CONFIG_LIBCRC32C #define CONFIG_CRC8 #define CONFIG_GENERIC_ALLOCATOR #define CONFIG_ZLIB_INFLATE #define CONFIG_ZLIB_DEFLATE #define CONFIG_REED_SOLOMON #define CONFIG_BCH #define CONFIG_LZO_COMPRESS #define CONFIG_LZ4_COMPRESS #define CONFIG_XZ_DEC #define CONFIG_RAID6_PQ #define CONFIG_DECOMPRESS_GZIP #define CONFIG_DECOMPRESS_BZIP2 #define CONFIG_DECOMPRESS_LZMA #define CONFIG_DECOMPRESS_XZ #define CONFIG_DECOMPRESS_LZO #define CONFIG_DECOMPRESS_LZ4 #define CONFIG_TEXTSEARCH #define CONFIG_TEXTSEARCH_KMP #define CONFIG_TEXTSEARCH_BM #define CONFIG_TEXTSEARCH_FSM #define CONFIG_SMP #define CONFIG_AUDIT_GENERIC #define CONFIG_AUDIT_COMPAT_GENERIC #define CONFIG_SWIOTLB #define CONFIG_IOMMU_HELPER #define CONFIG_FAULT_INJECTION #define CONFIG_NOTIFIER_ERROR_INJECTION #define CONFIG_CPU_NOTIFIER_ERROR_INJECT #define CONFIG_PM_NOTIFIER_ERROR_INJECT #define CONFIG_MEMORY_NOTIFIER_ERROR_INJECT #define CONFIG_OF_RECONFIG_NOTIFIER_ERROR_INJECT #define CONFIG_GENERIC_BUG #define CONFIG_HAVE_ARCH_TRACEHOOK #define CONFIG_DYNAMIC_DEBUG #define CONFIG_NLATTR #define CONFIG_LRU_CACHE #define CONFIG_DMA_API_DEBUG #define CONFIG_GENERIC_CSUM #define CONFIG_GENERIC_ATOMIC64 #define CONFIG_ATOMIC64_SELFTEST #define CONFIG_AVERAGE #define CONFIG_CPU_RMAP #define CONFIG_CORDIC #define CONFIG_DQL #define CONFIG_GLOB #define CONFIG_MPILIB #define CONFIG_SIGNATURE #define CONFIG_CLZ_TAB #define CONFIG_DDR #define CONFIG_GENERIC_STRNCPY_FROM_USER #define CONFIG_GENERIC_STRNLEN_USER #define CONFIG_GENERIC_NET_UTILS #define CONFIG_STMP_DEVICE #define CONFIG_LIBFDT #define CONFIG_RBTREE_TEST #define CONFIG_INTERVAL_TREE_TEST #define CONFIG_PERCPU_TEST #define CONFIG_ASN1 #define CONFIG_FONT_SUPPORT #define CONFIG_OID_REGISTRY #define CONFIG_UCS2_STRING /* from arch/x86/lib/Makefile */ #define CONFIG_RWSEM_XCHGADD_ALGORITHM #define CONFIG_INSTRUCTION_DECODER #define CONFIG_X86_CMPXCHG64 #define CONFIG_X86_USE_3DNOW /* from arch/x86/boot/Makefile */ #define CONFIG_X86_APM_BOOT /* from arch/x86/kernel/Makefile */ #define CONFIG_IRQ_WORK #define CONFIG_X86_VSYSCALL_EMULATION #define CONFIG_X86_ESPFIX64 #define CONFIG_SYSFS //#define CONFIG_IA32_EMULATION 不能使用 #define CONFIG_INTEL_TXT #define CONFIG_ISA_DMA_API #define CONFIG_STACKTRACE #define CONFIG_X86_MSR #define CONFIG_X86_CPUID #define CONFIG_PCI #define CONFIG_APM #define CONFIG_SMP #define CONFIG_X86_MPPARSE #define CONFIG_X86_REBOOTFIXUPS #define CONFIG_DYNAMIC_FTRACE #define CONFIG_LIVEPATCH #define CONFIG_FUNCTION_GRAPH_TRACER #define CONFIG_FTRACE_SYSCALLS #define CONFIG_FTRACE_SYSCALLS #define CONFIG_KEXEC #define CONFIG_KEXEC_FILE #define CONFIG_CRASH_DUMP #define CONFIG_MODULES #define CONFIG_DOUBLEFAULT #define CONFIG_KGDB #define CONFIG_VM86 #define CONFIG_EARLY_PRINTK #define CONFIG_HPET_TIMER #define CONFIG_APB_TIMER #define CONFIG_AMD_NB #define CONFIG_DEBUG_RODATA_TEST #define CONFIG_DEBUG_NX_TEST #define CONFIG_DEBUG_NMI_SELFTEST #define CONFIG_KVM_GUEST #define CONFIG_PARAVIRT #define CONFIG_PARAVIRT_SPINLOCKS #define CONFIG_PARAVIRT_CLOCK #define CONFIG_PCSPKR_PLATFORM #define CONFIG_X86_CHECK_BIOS_CORRUPTION #define CONFIG_SWIOTLB #define CONFIG_OF #define CONFIG_UPROBES #define CONFIG_X86_SYSFB #define CONFIG_EFI #define CONFIG_PERF_EVENTS #define CONFIG_TRACING #define CONFIG_IOSF_MBI #define CONFIG_PMC_ATOM #define CONFIG_X86_PMEM_LEGACY /* from arch/x86/kernel/cpu/Makefile */ #define CONFIG_PROC_FS #define CONFIG_X86_FEATURE_NAMES #define CONFIG_CPU_SUP_INTEL #define CONFIG_CPU_SUP_AMD #define CONFIG_CPU_SUP_CYRIX_32 #define CONFIG_CPU_SUP_CENTAUR #define CONFIG_CPU_SUP_TRANSMETA_32 #define CONFIG_CPU_SUP_UMC_32 #define CONFIG_PERF_EVENTS #define CONFIG_PERF_EVENTS_INTEL_UNCORE #define CONFIG_X86_MCE #define CONFIG_MTRR #define CONFIG_MICROCODE #define CONFIG_X86_LOCAL_APIC #define CONFIG_HYPERVISOR_GUEST /* from arch/x86/kernel/cpu/mcheck/Makefile */ #define CONFIG_X86_ANCIENT_MCE #define CONFIG_X86_MCE_INTEL #define CONFIG_X86_MCE_AMD #define CONFIG_X86_MCE_THRESHOLD #define CONFIG_X86_MCE_INJECT #define CONFIG_X86_THERMAL_VECTOR #define CONFIG_ACPI_APEI /* from arch/x86/kernel/cpu/microcode/Makefile */ #define CONFIG_MICROCODE_INTEL #define CONFIG_MICROCODE_AMD #define CONFIG_MICROCODE_EARLY #define CONFIG_MICROCODE_INTEL_EARLY #define CONFIG_MICROCODE_AMD_EARLY /* from arch/x86/kernel/acpi/Makefile */ #define CONFIG_ACPI #define CONFIG_ACPI_SLEEP #define CONFIG_ACPI_APEI #define CONFIG_ACPI_PROCESSOR /* from arch/x86/kernel/apic/Makefile */ #define CONFIG_X86_LOCAL_APIC #define CONFIG_X86_IO_APIC #define CONFIG_PCI_MSI #define CONFIG_HT_IRQ #define CONFIG_SMP #define CONFIG_X86_BIGSMP #define CONFIG_X86_LOCAL_APIC /* from arch/x86/kernel/kprobes/Makefile */ #define CONFIG_KPROBES #define CONFIG_OPTPROBES #define CONFIG_KPROBES_ON_FTRACE /* from init/Makefile */ #define CONFIG_BLK_DEV_INITRD M #define CONFIG_GENERIC_CALIBRATE_DELAY #define CONFIG_ARCH_INIT_TASK #define CONFIG_BLK_DEV_RAM #define CONFIG_BLK_DEV_INITRD #define CONFIG_BLK_DEV_MD /* from kernel/sched/Makefile */ #define CONFIG_SMP #define CONFIG_SCHED_AUTOGROUP #define CONFIG_SCHEDSTATS #define CONFIG_SCHED_DEBUG #define CONFIG_CGROUP_CPUACCT /* from kernel/locking/Makefile */ #define CONFIG_DEBUG_MUTEXES #define CONFIG_LOCKDEP #define CONFIG_LOCKDEP #define CONFIG_SMP #define CONFIG_LOCK_SPIN_ON_OWNER //#define CONFIG_PROVE_LOCKING #define CONFIG_RT_MUTEXES #define CONFIG_DEBUG_RT_MUTEXES #define CONFIG_RT_MUTEX_TESTER #define CONFIG_DEBUG_SPINLOCK #define CONFIG_DEBUG_SPINLOCK #define CONFIG_RWSEM_GENERIC_SPINLOCK #define CONFIG_RWSEM_XCHGADD_ALGORITHM #define CONFIG_PERCPU_RWSEM #define CONFIG_QUEUE_RWLOCK #define CONFIG_LOCK_TORTURE_TEST /* from kernel/power/Makefile */ #define CONFIG_PM #define CONFIG_VT_CONSOLE_SLEEP #define CONFIG_FREEZER #define CONFIG_SUSPEND #define CONFIG_PM_TEST_SUSPEND #define CONFIG_HIBERNATION #define CONFIG_PM_AUTOSLEEP #define CONFIG_PM_WAKELOCKS #define CONFIG_MAGIC_SYSRQ /* from kernel/printk/Makefile */ #define CONFIG_A11Y_BRAILLE_CONSOLE /* from kernel/irq/Makefile */ #define CONFIG_GENERIC_IRQ_CHIP #define CONFIG_GENERIC_IRQ_PROBE #define CONFIG_IRQ_DOMAIN #define CONFIG_PROC_FS #define CONFIG_GENERIC_PENDING_IRQ #define CONFIG_PM_SLEEP #define CONFIG_GENERIC_MSI_IRQ /* from kernel/rcu/Makefile */ #define CONFIG_SRCU #define CONFIG_RCU_TORTURE_TEST #define CONFIG_TREE_RCU #define CONFIG_PREEMPT_RCU #define CONFIG_TREE_RCU_TRACE #define CONFIG_TINY_RCU /* from kernel/time/Makefile */ #define CONFIG_GENERIC_CLOCKEVENTS_BUILD #define CONFIG_GENERIC_CLOCKEVENTS #define CONFIG_TICK_ONESHOT #define CONFIG_GENERIC_SCHED_CLOCK #define CONFIG_TICK_ONESHOT #define CONFIG_TIMER_STATS #define CONFIG_DEBUG_FS #define CONFIG_TEST_UDELAY /* from kernel/debug/Makefile */ #define CONFIG_KGDB #define CONFIG_KGDB_KDB #define CONFIG_KDB_KEYBOARD /* from kernel/trace/Makefile */ #define CONFIG_TRACE_CLOCK #define CONFIG_FUNCTION_TRACER #define CONFIG_RING_BUFFER #define CONFIG_RING_BUFFER_BENCHMARK #define CONFIG_TRACING #define CONFIG_CONTEXT_SWITCH_TRACER #define CONFIG_FUNCTION_TRACER #define CONFIG_IRQSOFF_TRACER #define CONFIG_PREEMPT_TRACER #define CONFIG_SCHED_TRACER #define CONFIG_NOP_TRACER #define CONFIG_STACK_TRACER #define CONFIG_MMIOTRACE #define CONFIG_FUNCTION_GRAPH_TRACER #define CONFIG_TRACE_BRANCH_PROFILING #define CONFIG_BLK_DEV_IO_TRACE #define CONFIG_EVENT_TRACING #define CONFIG_FTRACE_SYSCALLS #define CONFIG_KPROBE_EVENT #define CONFIG_TRACEPOINTS #define CONFIG_TRACEPOINTS #define CONFIG_PROBE_EVENTS #define CONFIG_UPROBE_EVENT #define CONFIG_TRACEPOINT_BENCHMARK /* from kernel/bpf/Makefile */ #define CONFIG_TEST_BPF #define CONFIG_BPF_SYSCALL /* from kernel/events/Makefile */ #define CONFIG_HAVE_HW_BREAKPOINT #define CONFIG_UPROBES /* from kernel/Makefile */ #define CONFIG_CHECKPOINT_RESTORE #define CONFIG_FREEZER #define CONFIG_PROFILING #define CONFIG_STACKTRACE #define CONFIG_FUTEX #define CONFIG_GENERIC_ISA_DMA #define CONFIG_SMP #define CONFIG_UID16 #define CONFIG_SYSTEM_TRUSTED_KEYRING #define CONFIG_MODULES #define CONFIG_MODULE_SIG #define CONFIG_KALLSYMS #define CONFIG_BSD_PROCESS_ACCT #define CONFIG_BACKTRACE_SELF_TEST #define CONFIG_COMPAT #define CONFIG_CGROUPS #define CONFIG_CGROUP_FREEZER #define CONFIG_CPUSETS #define CONFIG_UTS_NS #define CONFIG_USER_NS #define CONFIG_PID_NS #define CONFIG_IKCONFIG #define CONFIG_SMP #define CONFIG_KPROBES_SANITY_TEST #define CONFIG_AUDIT #define CONFIG_AUDITSYSCALL #define CONFIG_AUDIT_WATCH #define CONFIG_AUDIT_TREE #define CONFIG_KPROBES #define CONFIG_DETECT_HUNG_TASK #define CONFIG_LOCKUP_DETECTOR #define CONFIG_SECCOMP #define CONFIG_RELAY #define CONFIG_SYSCTL #define CONFIG_TASK_DELAY_ACCT #define CONFIG_TASKSTATS #define CONFIG_TRACEPOINTS #define CONFIG_LATENCYTOP #define CONFIG_BINFMT_ELF #define CONFIG_COMPAT_BINFMT_ELF #define CONFIG_BINFMT_ELF_FDPIC #define CONFIG_FUNCTION_TRACER #define CONFIG_TRACING #define CONFIG_TRACE_CLOCK #define CONFIG_RING_BUFFER #define CONFIG_TRACEPOINTS #define CONFIG_USER_RETURN_NOTIFIER #define CONFIG_PADATA #define CONFIG_CRASH_DUMP #define CONFIG_JUMP_LABEL #define CONFIG_CONTEXT_TRACKING #define CONFIG_TORTURE_TEST #define MODULE_DESCRIPTION(x) #define MODULE_AUTHOR(x) #define MODULE_LICENSE(x) #define EXPORT_SYMBOL_GPL(x) #define EXPORT_PER_CPU_SYMBOL(x) #define EXPORT_SYMBOL(x) #define PV_CALLEE_SAVE_REGS_THUNK(x) /* 以下声明是在抽取4.0.4时经验定义,在当前版本没有验证是否需要提前声明 */ //[134]F:\linux-4\include\linux\string.hextern ssize_t memory_read_from_buffer(void *to, size_t count, loff_t *ppos, typedef long long loff_t; //[255]F:\linux-4\include\linux\timer.hextern enum hrtimer_restart it_real_fn(struct hrtimer *); enum hrtimer_restart { HRTIMER_NORESTART, /* Timer is not restarted */ HRTIMER_RESTART, /* Timer must be restarted */ }; //[240]F:\linux-4\include\acpi\acpiosxf.h acpi_osd_handler service_routine, typedef int acpi_osd_handler; //[86]F:\linux-4\arch\x86\kernel\crash.ccrash_vmclear_fn __rcu *crash_vmclear_loaded_vmcss = NULL; typedef void crash_vmclear_fn(void); //[430]F:\linux-4\include\linux\ftrace.hextern ftrace_func_t ftrace_trace_function; typedef void (*ftrace_func_t)(unsigned long ip, unsigned long parent_ip, struct ftrace_ops *op, struct pt_regs *regs); //asm-generic/mmu.h typedef struct { unsigned long end_brk; #ifdef CONFIG_BINFMT_ELF_FDPIC unsigned long exec_fdpic_loadmap; unsigned long interp_fdpic_loadmap; #endif } mm_context_t; //gcc 内建函数 需要声明。注:声明的未必正确,请谅解 void * __builtin_memcpy(void *to, const void *from, size_t n); int __builtin_constant_p(void *); int __builtin_return_address(void *); void *__builtin_extract_return_addr(void *); void *__builtin_expect(void *); void *__builtin_types_compatible_p(void *); #define uninitialized_var(x) x int inat_primary_table[];//F:\linux-4\arch\x86\lib\inat.c int inat_escape_tables[][]; int inat_group_tables[][]; int inat_avx_tables[][]; #include "linux/kconfig.h" //在arch\x86\include\asm\dma.h插入 #include "asm/dma-mapping.h" //否则get_dma_ops等函数找不到 #include "linux/syscalls.h" //drivers/xen/swiotlb-xen.c static unsigned long dma_alloc_coherent_mask(struct device *dev, gfp); //\arch\microblaze\include\asm\dma-mapping.h #define DMA_ERROR_CODE 0 void trace_sys_enter(regs, scno); void trace_sys_exit(regs, scno); //#ifdef CONFIG_X86_64 extern void init_espfix_bsp(void); extern void init_espfix_ap(void);