/* * symbols.c: in-kernel printing of symbolic oopses and stack traces. * * Copyright 2002 Rusty Russell IBM Corporation * * ChangeLog: * * (25/Aug/2004) Paulo Marques * Changed the compression method from stem compression to "table lookup" * compression (see tools/symbols.c for a more complete description) */ #include #include #include #include #include #include #include extern unsigned long symbols_addresses[]; extern unsigned long symbols_num_syms; extern u8 symbols_names[]; extern u8 symbols_token_table[]; extern u16 symbols_token_index[]; extern unsigned long symbols_markers[]; /* expand a compressed symbol data into the resulting uncompressed string, given the offset to where the symbol is in the compressed stream */ static unsigned int symbols_expand_symbol(unsigned int off, char *result) { int len, skipped_first = 0; u8 *tptr, *data; /* get the compressed symbol length from the first symbol byte */ data = &symbols_names[off]; len = *data; data++; /* update the offset to return the offset for the next symbol on * the compressed stream */ off += len + 1; /* for every byte on the compressed symbol data, copy the table entry for that byte */ while(len) { tptr = &symbols_token_table[ symbols_token_index[*data] ]; data++; len--; while (*tptr) { if(skipped_first) { *result = *tptr; result++; } else skipped_first = 1; tptr++; } } *result = '\0'; /* return to offset to the next symbol */ return off; } /* find the offset on the compressed stream given and index in the * symbols array */ static unsigned int get_symbol_offset(unsigned long pos) { u8 *name; int i; /* use the closest marker we have. We have markers every 256 positions, * so that should be close enough */ name = &symbols_names[ symbols_markers[pos>>8] ]; /* sequentially scan all the symbols up to the point we're searching for. * Every symbol is stored in a [][ bytes of data] format, so we * just need to add the len to the current pointer for every symbol we * wish to skip */ for(i = 0; i < (pos&0xFF); i++) name = name + (*name) + 1; return name - symbols_names; } const char *symbols_lookup(unsigned long addr, unsigned long *symbolsize, unsigned long *offset, char *namebuf) { unsigned long i, low, high, mid; unsigned long symbol_end = 0; namebuf[KSYM_NAME_LEN] = 0; namebuf[0] = 0; if (!is_kernel_text(addr) && !is_kernel_inittext(addr)) return NULL; /* do a binary search on the sorted symbols_addresses array */ low = 0; high = symbols_num_syms; while (high-low > 1) { mid = (low + high) / 2; if (symbols_addresses[mid] <= addr) low = mid; else high = mid; } /* search for the first aliased symbol. Aliased symbols are symbols with the same address */ while (low && symbols_addresses[low - 1] == symbols_addresses[low]) --low; /* Grab name */ symbols_expand_symbol(get_symbol_offset(low), namebuf); /* Search for next non-aliased symbol */ for (i = low + 1; i < symbols_num_syms; i++) { if (symbols_addresses[i] > symbols_addresses[low]) { symbol_end = symbols_addresses[i]; break; } } /* if we found no next symbol, we use the end of the section */ if (!symbol_end) symbol_end = is_kernel_inittext(addr) ? (unsigned long)_einittext : (unsigned long)_etext; *symbolsize = symbol_end - symbols_addresses[low]; *offset = addr - symbols_addresses[low]; return namebuf; } /* Replace "%s" in format with address, or returns -errno. */ void __print_symbol(const char *fmt, unsigned long address) { const char *name; unsigned long offset, size, flags; static DEFINE_SPINLOCK(lock); static char namebuf[KSYM_NAME_LEN+1]; #define BUFFER_SIZE sizeof("%s+%#lx/%#lx [%s]") + KSYM_NAME_LEN + \ 2*(BITS_PER_LONG*3/10) + 1 static char buffer[BUFFER_SIZE]; spin_lock_irqsave(&lock, flags); name = symbols_lookup(address, &size, &offset, namebuf); if (!name) snprintf(buffer, BUFFER_SIZE, "???"); else snprintf(buffer, BUFFER_SIZE, "%s+%#lx/%#lx", name, offset, size); printk(fmt, buffer); spin_unlock_irqrestore(&lock, flags); } 3 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73
#
# Copyright (C) 2016 Yousong Zhou <yszhou4tech@gmail.com>
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
define KernelPackage/irqbypass
  SUBMENU:=Virtualization
  TITLE:=IRQ offload/bypass manager
  KCONFIG:=CONFIG_IRQ_BYPASS_MANAGER
  HIDDEN:=1
  FILES:= $(LINUX_DIR)/virt/lib/irqbypass.ko
  AUTOLOAD:=$(call AutoProbe,irqbypass.ko)
endef
$(eval $(call KernelPackage,irqbypass))


define KernelPackage/kvm-x86
  SUBMENU:=Virtualization
  TITLE:=Kernel-based Virtual Machine (KVM) support
  DEPENDS:=@TARGET_x86_generic||TARGET_x86_64 +kmod-irqbypass
  KCONFIG:=\
	  CONFIG_VIRTUALIZATION=y \
	  CONFIG_KVM
  FILES:= $(LINUX_DIR)/arch/$(LINUX_KARCH)/kvm/kvm.ko
  AUTOLOAD:=$(call AutoProbe,kvm.ko)
endef

define KernelPackage/kvm-x86/description
  Support hosting fully virtualized guest machines using hardware
  virtualization extensions.  You will need a fairly recent
  processor equipped with virtualization extensions. You will also
  need to select one or more of the processor modules.

  This module provides access to the hardware capabilities through
  a character device node named /dev/kvm.
endef

$(eval $(call KernelPackage,kvm-x86))


define KernelPackage/kvm-intel
  SUBMENU:=Virtualization
  TITLE:=KVM for Intel processors support
  DEPENDS:=+kmod-kvm-x86
  KCONFIG:=CONFIG_KVM_INTEL
  FILES:= $(LINUX_DIR)/arch/$(LINUX_KARCH)/kvm/kvm-intel.ko
  AUTOLOAD:=$(call AutoProbe,kvm-intel.ko)
endef

define KernelPackage/kvm-intel/description
  Provides support for KVM on Intel processors equipped with the VT
  extensions.
endef

$(eval $(call KernelPackage,kvm-intel))


define KernelPackage/kvm-amd
  SUBMENU:=Virtualization
  TITLE:=KVM for AMD processors support
  DEPENDS:=+kmod-kvm-x86
  KCONFIG:=CONFIG_KVM_AMD
  FILES:= $(LINUX_DIR)/arch/$(LINUX_KARCH)/kvm/kvm-amd.ko
  AUTOLOAD:=$(call AutoProbe,kvm-amd.ko)
endef

define KernelPackage/kvm-amd/description
  Provides support for KVM on AMD processors equipped with the AMD-V
  (SVM) extensions.
endef

$(eval $(call KernelPackage,kvm-amd))