forked from Minki/linux
c91e02bd97
Use perf framework to manage hardware instruction and data breakpoints. Add two new ptrace calls: PTRACE_GETHBPREGS and PTRACE_SETHBPREGS to query and set instruction and data breakpoints. Address bit 0 choose instruction (0) or data (1) break register, bits 31..1 are the register number. Both calls transfer two 32-bit words: address (0) and control (1). Instruction breakpoint contorl word is 0 to clear breakpoint, 1 to set. Data breakpoint control word bit 31 is 'trigger on store', bit 30 is 'trigger on load, bits 29..0 are length. Length 0 is used to clear a breakpoint. To set a breakpoint length must be a power of 2 in the range 1..64 and the address must be length-aligned. Introduce new thread_info flag: TIF_DB_DISABLED. Set it if debug exception is raised by the kernel code accessing watched userspace address and disable corresponding data breakpoint. On exit to userspace check that flag and, if set, restore all data breakpoints. Handle debug exceptions raised with PS.EXCM set. This may happen when window overflow/underflow handler or fast exception handler hits data breakpoint, in which case save and disable all data breakpoints, single-step faulting instruction and restore data breakpoints. Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
44 lines
1.7 KiB
Makefile
44 lines
1.7 KiB
Makefile
#
|
|
# Makefile for the Linux/Xtensa kernel.
|
|
#
|
|
|
|
extra-y := head.o vmlinux.lds
|
|
|
|
obj-y := align.o coprocessor.o entry.o irq.o pci-dma.o platform.o process.o \
|
|
ptrace.o setup.o signal.o stacktrace.o syscall.o time.o traps.o \
|
|
vectors.o
|
|
|
|
obj-$(CONFIG_PCI) += pci.o
|
|
obj-$(CONFIG_MODULES) += xtensa_ksyms.o module.o
|
|
obj-$(CONFIG_FUNCTION_TRACER) += mcount.o
|
|
obj-$(CONFIG_SMP) += smp.o mxhead.o
|
|
obj-$(CONFIG_XTENSA_VARIANT_HAVE_PERF_EVENTS) += perf_event.o
|
|
obj-$(CONFIG_HAVE_HW_BREAKPOINT) += hw_breakpoint.o
|
|
|
|
AFLAGS_head.o += -mtext-section-literals
|
|
AFLAGS_mxhead.o += -mtext-section-literals
|
|
|
|
# In the Xtensa architecture, assembly generates literals which must always
|
|
# precede the L32R instruction with a relative offset less than 256 kB.
|
|
# Therefore, the .text and .literal section must be combined in parenthesis
|
|
# in the linker script, such as: *(.literal .text).
|
|
#
|
|
# We need to post-process the generated vmlinux.lds scripts to convert
|
|
# *(xxx.text) to *(xxx.literal xxx.text) for the following text sections:
|
|
# .text .ref.text .*init.text .*exit.text .text.*
|
|
#
|
|
# Replicate rules in scripts/Makefile.build
|
|
|
|
sed-y = -e ':a; s/\*(\([^)]*\)\.text\.unlikely/*(\1.literal.unlikely .{text}.unlikely/; ta; ' \
|
|
-e ':b; s/\*(\([^)]*\)\.text\(\.[a-z]*\)/*(\1.{text}\2.literal .{text}\2/; tb; ' \
|
|
-e ':c; s/\*(\([^)]*\)\(\.[a-z]*it\|\.ref\)\.text/*(\1\2.literal \2.{text}/; tc; ' \
|
|
-e ':d; s/\*(\([^)]\+ \|\)\.text/*(\1.literal .{text}/; td; ' \
|
|
-e 's/\.{text}/.text/g'
|
|
|
|
quiet_cmd__cpp_lds_S = LDS $@
|
|
cmd__cpp_lds_S = $(CPP) $(cpp_flags) -P -C -Uxtensa -D__ASSEMBLY__ $< \
|
|
| sed $(sed-y) >$@
|
|
|
|
$(obj)/vmlinux.lds: $(src)/vmlinux.lds.S FORCE
|
|
$(call if_changed_dep,_cpp_lds_S)
|