debug messages: implement dynamic debug
Heavily inspired off linux kernel's dynamic debug: * add a /sys/kernel/debug/dynamic_debug/control file (accessible from linux side in /sys/class/mcos/mcos0/sys/kernel/debug/dynamic_debug/control) * read from file to list debug statements (currently limited to 4k in size) * write to file with '[file foo ][func bar ][line [x][-[y]]] [+-]p' to change values Side effects: * reindented all linker scripts, there is a new __verbose section * added string function strpbrk Change-Id: I36d7707274dcc3ecaf200075a31a2f0f76021059
This commit is contained in:
@@ -30,6 +30,7 @@
|
||||
#include <debug-monitors.h>
|
||||
#include <sysreg.h>
|
||||
#include <cpufeature.h>
|
||||
#include <debug.h>
|
||||
#ifdef POSTK_DEBUG_ARCH_DEP_65
|
||||
#include <hwcap.h>
|
||||
#endif /* POSTK_DEBUG_ARCH_DEP_65 */
|
||||
@@ -39,11 +40,8 @@
|
||||
#include "postk_print_sysreg.c"
|
||||
|
||||
#ifdef DEBUG_PRINT_CPU
|
||||
#define dkprintf kprintf
|
||||
#define ekprintf kprintf
|
||||
#else
|
||||
#define dkprintf(...) do { if (0) kprintf(__VA_ARGS__); } while (0)
|
||||
#define ekprintf kprintf
|
||||
#undef DDEBUG_DEFAULT
|
||||
#define DDEBUG_DEFAULT DDEBUG_PRINT
|
||||
#endif
|
||||
|
||||
#define BUG_ON(condition) do { if (condition) { kprintf("PANIC: %s: %s(line:%d)\n",\
|
||||
|
||||
@@ -9,15 +9,13 @@
|
||||
#include <prctl.h>
|
||||
#include <cpufeature.h>
|
||||
#include <kmalloc.h>
|
||||
#include <debug.h>
|
||||
|
||||
//#define DEBUG_PRINT_FPSIMD
|
||||
|
||||
#ifdef DEBUG_PRINT_FPSIMD
|
||||
#define dkprintf kprintf
|
||||
#define ekprintf kprintf
|
||||
#else
|
||||
#define dkprintf(...) do { if (0) kprintf(__VA_ARGS__); } while (0)
|
||||
#define ekprintf kprintf
|
||||
#undef DDEBUG_DEFAULT
|
||||
#define DDEBUG_DEFAULT DDEBUG_PRINT
|
||||
#endif
|
||||
|
||||
#define BUG_ON(condition) do { if (condition) { kprintf("PANIC: %s: %s(line:%d)\n",\
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include <process.h>
|
||||
#include <string.h>
|
||||
#include <elfcore.h>
|
||||
#include <debug.h>
|
||||
|
||||
#define align32(x) ((((x) + 3) / 4) * 4)
|
||||
#define alignpage(x) ((((x) + (PAGE_SIZE) - 1) / (PAGE_SIZE)) * (PAGE_SIZE))
|
||||
@@ -14,11 +15,8 @@
|
||||
//#define DEBUG_PRINT_GENCORE
|
||||
|
||||
#ifdef DEBUG_PRINT_GENCORE
|
||||
#define dkprintf(...) kprintf(__VA_ARGS__)
|
||||
#define ekprintf(...) kprintf(__VA_ARGS__)
|
||||
#else
|
||||
#define dkprintf(...) do { if (0) kprintf(__VA_ARGS__); } while (0)
|
||||
#define ekprintf(...) kprintf(__VA_ARGS__)
|
||||
#undef DDEBUG_DEFAULT
|
||||
#define DDEBUG_DEFAULT DDEBUG_PRINT
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
||||
@@ -7,15 +7,13 @@
|
||||
#include <arch/cpu.h>
|
||||
#include <memory.h>
|
||||
#include <syscall.h>
|
||||
#include <debug.h>
|
||||
|
||||
// #define DEBUG_GICV2
|
||||
|
||||
#ifdef DEBUG_GICV2
|
||||
#define dkprintf(...) kprintf(__VA_ARGS__)
|
||||
#define ekprintf(...) kprintf(__VA_ARGS__)
|
||||
#else
|
||||
#define dkprintf(...)
|
||||
#define ekprintf(...) kprintf(__VA_ARGS__)
|
||||
#undef DDEBUG_DEFAULT
|
||||
#define DDEBUG_DEFAULT DDEBUG_PRINT
|
||||
#endif
|
||||
|
||||
void *dist_base;
|
||||
|
||||
@@ -7,17 +7,15 @@
|
||||
#include <cputype.h>
|
||||
#include <process.h>
|
||||
#include <syscall.h>
|
||||
#include <debug.h>
|
||||
|
||||
//#define DEBUG_GICV3
|
||||
|
||||
#define USE_CAVIUM_THUNDER_X
|
||||
|
||||
#ifdef DEBUG_GICV3
|
||||
#define dkprintf(...) kprintf(__VA_ARGS__)
|
||||
#define ekprintf(...) kprintf(__VA_ARGS__)
|
||||
#else
|
||||
#define dkprintf(...)
|
||||
#define ekprintf(...) kprintf(__VA_ARGS__)
|
||||
#undef DDEBUG_DEFAULT
|
||||
#define DDEBUG_DEFAULT DDEBUG_PRINT
|
||||
#endif
|
||||
|
||||
#ifdef USE_CAVIUM_THUNDER_X
|
||||
|
||||
@@ -14,9 +14,7 @@
|
||||
#include <context.h>
|
||||
#include <kmalloc.h>
|
||||
#include <vdso.h>
|
||||
|
||||
#define dkprintf(...) do { if (0) kprintf(__VA_ARGS__); } while (0)
|
||||
#define ekprintf(...) kprintf(__VA_ARGS__)
|
||||
#include <debug.h>
|
||||
|
||||
#define NOT_IMPLEMENTED() do { kprintf("%s is not implemented\n", __func__); while(1);} while(0)
|
||||
|
||||
|
||||
@@ -4,16 +4,14 @@
|
||||
#include <ihk/perfctr.h>
|
||||
#include <errno.h>
|
||||
#include <ihk/debug.h>
|
||||
#include <debug.h>
|
||||
|
||||
#define BIT(nr) (1UL << (nr))
|
||||
|
||||
//#define DEBUG_PRINT_PMU
|
||||
#ifdef DEBUG_PRINT_PMU
|
||||
#define dkprintf(...) kprintf(__VA_ARGS__)
|
||||
#define ekprintf(...) kprintf(__VA_ARGS__)
|
||||
#else
|
||||
#define dkprintf(...) do { if (0) kprintf(__VA_ARGS__); } while (0)
|
||||
#define ekprintf(...) kprintf(__VA_ARGS__)
|
||||
#undef DDEBUG_DEFAULT
|
||||
#define DDEBUG_DEFAULT DDEBUG_PRINT
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
@@ -21,15 +21,13 @@
|
||||
#include <ihk/debug.h>
|
||||
#include <compiler.h>
|
||||
#include <lwk/compiler.h>
|
||||
#include <debug.h>
|
||||
|
||||
//#define DEBUG_PRINT_PSCI
|
||||
|
||||
#ifdef DEBUG_PRINT_PSCI
|
||||
#define dkprintf(...) kprintf(__VA_ARGS__)
|
||||
#define ekprintf(...) kprintf(__VA_ARGS__)
|
||||
#else
|
||||
#define dkprintf(...) do { if (0) kprintf(__VA_ARGS__); } while (0)
|
||||
#define ekprintf(...) kprintf(__VA_ARGS__)
|
||||
#undef DDEBUG_DEFAULT
|
||||
#define DDEBUG_DEFAULT DDEBUG_PRINT
|
||||
#endif
|
||||
|
||||
#define PSCI_POWER_STATE_TYPE_POWER_DOWN 1
|
||||
|
||||
@@ -11,15 +11,13 @@
|
||||
#include <hwcap.h>
|
||||
#include <string.h>
|
||||
#include <thread_info.h>
|
||||
#include <debug.h>
|
||||
|
||||
//#define DEBUG_PRINT_SC
|
||||
|
||||
#ifdef DEBUG_PRINT_SC
|
||||
#define dkprintf kprintf
|
||||
#define ekprintf(...) do { if (0) kprintf(__VA_ARGS__); } while (0)
|
||||
#else
|
||||
#define dkprintf(...) do { if (0) kprintf(__VA_ARGS__); } while (0)
|
||||
#define ekprintf(...) do { if (0) kprintf(__VA_ARGS__); } while (0)
|
||||
#undef DDEBUG_DEFAULT
|
||||
#define DDEBUG_DEFAULT DDEBUG_PRINT
|
||||
#endif
|
||||
|
||||
#define NOT_IMPLEMENTED() do { kprintf("%s is not implemented\n", __func__); while(1);} while(0)
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
#include <prctl.h>
|
||||
#include <limits.h>
|
||||
#include <syscall.h>
|
||||
#include <debug.h>
|
||||
|
||||
extern void ptrace_report_signal(struct thread *thread, int sig);
|
||||
extern void clear_single_step(struct thread *thread);
|
||||
@@ -27,11 +28,8 @@ static void __check_signal(unsigned long rc, void *regs, int num, int irq_disabl
|
||||
//#define DEBUG_PRINT_SC
|
||||
|
||||
#ifdef DEBUG_PRINT_SC
|
||||
#define dkprintf kprintf
|
||||
#define ekprintf(...) do { if (0) kprintf(__VA_ARGS__); } while (0)
|
||||
#else
|
||||
#define dkprintf(...) do { if (0) kprintf(__VA_ARGS__); } while (0)
|
||||
#define ekprintf(...) do { if (0) kprintf(__VA_ARGS__); } while (0)
|
||||
#undef DDEBUG_DEFAULT
|
||||
#define DDEBUG_DEFAULT DDEBUG_PRINT
|
||||
#endif
|
||||
|
||||
#define NOT_IMPLEMENTED() do { kprintf("%s is not implemented\n", __func__); while(1);} while(0)
|
||||
|
||||
@@ -14,15 +14,13 @@
|
||||
#include <ihk/debug.h>
|
||||
#include <ikc/queue.h>
|
||||
#include <vdso.h>
|
||||
#include <debug.h>
|
||||
|
||||
//#define DEBUG_PRINT_VDSO
|
||||
|
||||
#ifdef DEBUG_PRINT_VDSO
|
||||
#define dkprintf(...) kprintf(__VA_ARGS__)
|
||||
#define ekprintf(...) kprintf(__VA_ARGS__)
|
||||
#else
|
||||
#define dkprintf(...) do { if (0) kprintf(__VA_ARGS__); } while (0)
|
||||
#define ekprintf(...) kprintf(__VA_ARGS__)
|
||||
#undef DDEBUG_DEFAULT
|
||||
#define DDEBUG_DEFAULT DDEBUG_PRINT
|
||||
#endif
|
||||
|
||||
#ifdef POSTK_DEBUG_ARCH_DEP_52
|
||||
|
||||
@@ -9,29 +9,29 @@ PHDRS
|
||||
SECTIONS
|
||||
{
|
||||
. = SIZEOF_HEADERS;
|
||||
. = ALIGN(4096);
|
||||
. = ALIGN(4096);
|
||||
.text : {
|
||||
*(.text)
|
||||
*(.text)
|
||||
} :text
|
||||
.data : {
|
||||
*(.data)
|
||||
*(.data.*)
|
||||
*(.data)
|
||||
*(.data.*)
|
||||
} :data
|
||||
.rodata : {
|
||||
*(.rodata .rodata.*)
|
||||
*(.rodata .rodata.*)
|
||||
} :data
|
||||
|
||||
. = ALIGN(8);
|
||||
.bss : {
|
||||
_bss_start = .;
|
||||
*(.bss .bss.*)
|
||||
_bss_end = .;
|
||||
. = ALIGN(4096);
|
||||
_stack_end = .;
|
||||
} :data
|
||||
_bss_start = .;
|
||||
*(.bss .bss.*)
|
||||
_bss_end = .;
|
||||
. = ALIGN(4096);
|
||||
_stack_end = .;
|
||||
} :data
|
||||
|
||||
/DISCARD/ : {
|
||||
*(.eh_frame)
|
||||
*(.note.gnu.build-id)
|
||||
*(.eh_frame)
|
||||
*(.note.gnu.build-id)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
#include <prctl.h>
|
||||
#include <page.h>
|
||||
#include <kmalloc.h>
|
||||
#include <debug.h>
|
||||
|
||||
#define LAPIC_ID 0x020
|
||||
#define LAPIC_TIMER 0x320
|
||||
@@ -69,11 +70,8 @@
|
||||
//#define DEBUG_PRINT_CPU
|
||||
|
||||
#ifdef DEBUG_PRINT_CPU
|
||||
#define dkprintf kprintf
|
||||
#define ekprintf kprintf
|
||||
#else
|
||||
#define dkprintf(...) do { if (0) kprintf(__VA_ARGS__); } while (0)
|
||||
#define ekprintf kprintf
|
||||
#undef DDEBUG_DEFAULT
|
||||
#define DDEBUG_DEFAULT DDEBUG_PRINT
|
||||
#endif
|
||||
|
||||
static void *lapic_vp;
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include <process.h>
|
||||
#include <string.h>
|
||||
#include <elfcore.h>
|
||||
#include <debug.h>
|
||||
|
||||
#define align32(x) ((((x) + 3) / 4) * 4)
|
||||
#define alignpage(x) ((((x) + (PAGE_SIZE) - 1) / (PAGE_SIZE)) * (PAGE_SIZE))
|
||||
@@ -13,11 +14,8 @@
|
||||
//#define DEBUG_PRINT_GENCORE
|
||||
|
||||
#ifdef DEBUG_PRINT_GENCORE
|
||||
#define dkprintf(...) kprintf(__VA_ARGS__)
|
||||
#define ekprintf(...) kprintf(__VA_ARGS__)
|
||||
#else
|
||||
#define dkprintf(...) do { if (0) kprintf(__VA_ARGS__); } while (0)
|
||||
#define ekprintf(...) kprintf(__VA_ARGS__)
|
||||
#undef DDEBUG_DEFAULT
|
||||
#define DDEBUG_DEFAULT DDEBUG_PRINT
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
||||
@@ -25,15 +25,13 @@
|
||||
#include <cls.h>
|
||||
#include <kmalloc.h>
|
||||
#include <rusage_private.h>
|
||||
#include <debug.h>
|
||||
|
||||
//#define DEBUG
|
||||
|
||||
#ifdef DEBUG
|
||||
#define dkprintf(...) do { kprintf(__VA_ARGS__); } while (0)
|
||||
#define ekprintf(...) do { kprintf(__VA_ARGS__); } while (0)
|
||||
#else
|
||||
#define dkprintf(...) do { } while (0)
|
||||
#define ekprintf(...) do { kprintf(__VA_ARGS__); } while (0)
|
||||
#undef DDEBUG_DEFAULT
|
||||
#define DDEBUG_DEFAULT DDEBUG_PRINT
|
||||
#endif
|
||||
|
||||
static char *last_page;
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#include <registers.h>
|
||||
#include <mc_perf_event.h>
|
||||
#include <config.h>
|
||||
#include <debug.h>
|
||||
|
||||
extern unsigned int *x86_march_perfmap;
|
||||
extern int running_on_kvm(void);
|
||||
@@ -25,11 +26,8 @@ int ihk_mc_perfctr_fixed_init(int counter, int mode);
|
||||
|
||||
//#define PERFCTR_DEBUG
|
||||
#ifdef PERFCTR_DEBUG
|
||||
#define dkprintf(...) do { kprintf(__VA_ARGS__); } while (0)
|
||||
#define ekprintf(...) do { kprintf(__VA_ARGS__); } while (0)
|
||||
#else
|
||||
#define dkprintf(...) do { } while (0)
|
||||
#define ekprintf(...) do { kprintf(__VA_ARGS__); } while (0)
|
||||
#undef DDEBUG_DEFAULT
|
||||
#define DDEBUG_DEFAULT DDEBUG_PRINT
|
||||
#endif
|
||||
|
||||
#define X86_CR4_PCE 0x00000100
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
#include <page.h>
|
||||
#include <limits.h>
|
||||
#include <syscall.h>
|
||||
#include <debug.h>
|
||||
|
||||
void terminate_mcexec(int, int);
|
||||
extern long do_sigaction(int sig, struct k_sigaction *act, struct k_sigaction *oact);
|
||||
@@ -45,11 +46,8 @@ extern uint64_t get_xsave_mask();
|
||||
//#define DEBUG_PRINT_SC
|
||||
|
||||
#ifdef DEBUG_PRINT_SC
|
||||
#define dkprintf kprintf
|
||||
#define ekprintf(...) kprintf(__VA_ARGS__)
|
||||
#else
|
||||
#define dkprintf(...) do { if (0) kprintf(__VA_ARGS__); } while (0)
|
||||
#define ekprintf(...) kprintf(__VA_ARGS__)
|
||||
#undef DDEBUG_DEFAULT
|
||||
#define DDEBUG_DEFAULT DDEBUG_PRINT
|
||||
#endif
|
||||
|
||||
uintptr_t debug_constants[] = {
|
||||
|
||||
@@ -29,15 +29,13 @@
|
||||
#include <time.h>
|
||||
#include <syscall.h>
|
||||
#include <rusage_private.h>
|
||||
#include <debug.h>
|
||||
|
||||
//#define DEBUG_PRINT_AP
|
||||
|
||||
#ifdef DEBUG_PRINT_AP
|
||||
#define dkprintf(...) do { kprintf(__VA_ARGS__); } while (0)
|
||||
#define ekprintf(...) do { kprintf(__VA_ARGS__); } while (0)
|
||||
#else
|
||||
#define dkprintf(...) do { } while (0)
|
||||
#define ekprintf(...) do { kprintf(__VA_ARGS__); } while (0)
|
||||
#undef DDEBUG_DEFAULT
|
||||
#define DDEBUG_DEFAULT DDEBUG_PRINT
|
||||
#endif
|
||||
|
||||
int num_processors = 1;
|
||||
|
||||
@@ -1,24 +1,28 @@
|
||||
PHDRS
|
||||
{
|
||||
text PT_LOAD FLAGS(5);
|
||||
data PT_LOAD FLAGS(7);
|
||||
data PT_LOAD FLAGS(7);
|
||||
}
|
||||
SECTIONS
|
||||
{
|
||||
. = 0xffffffff80001000;
|
||||
_head = .;
|
||||
_head = .;
|
||||
|
||||
.text : {
|
||||
*(.text);
|
||||
} : text
|
||||
.text : {
|
||||
*(.text);
|
||||
} : text
|
||||
|
||||
. = ALIGN(4096);
|
||||
. = ALIGN(4096);
|
||||
.data : {
|
||||
*(.data)
|
||||
*(.data.*)
|
||||
*(.data)
|
||||
*(.data.*)
|
||||
. = ALIGN(8);
|
||||
__start___verbose = .;
|
||||
*(__verbose);
|
||||
__stop___verbose = .;
|
||||
} :data
|
||||
.rodata : {
|
||||
*(.rodata .rodata.*)
|
||||
*(.rodata .rodata.*)
|
||||
} :data
|
||||
|
||||
.vsyscall : ALIGN(0x1000) {
|
||||
@@ -37,14 +41,14 @@ SECTIONS
|
||||
. = ALIGN(4096);
|
||||
} : data = 0xf4
|
||||
|
||||
.bss : {
|
||||
*(.bss .bss.*)
|
||||
}
|
||||
. = ALIGN(4096);
|
||||
_end = .;
|
||||
.bss : {
|
||||
*(.bss .bss.*)
|
||||
}
|
||||
. = ALIGN(4096);
|
||||
_end = .;
|
||||
|
||||
/DISCARD/ : {
|
||||
*(.eh_frame)
|
||||
*(.note.gnu.build-id)
|
||||
*(.eh_frame)
|
||||
*(.note.gnu.build-id)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,24 +1,28 @@
|
||||
PHDRS
|
||||
{
|
||||
text PT_LOAD FLAGS(5);
|
||||
data PT_LOAD FLAGS(7);
|
||||
data PT_LOAD FLAGS(7);
|
||||
}
|
||||
SECTIONS
|
||||
{
|
||||
. = 0xffffffff80001000;
|
||||
_head = .;
|
||||
_head = .;
|
||||
|
||||
.text : {
|
||||
*(.text);
|
||||
} : text
|
||||
.text : {
|
||||
*(.text);
|
||||
} : text
|
||||
|
||||
. = ALIGN(4096);
|
||||
. = ALIGN(4096);
|
||||
.data : {
|
||||
*(.data)
|
||||
*(.data.*)
|
||||
*(.data)
|
||||
*(.data.*)
|
||||
. = ALIGN(8);
|
||||
__start___verbose = .;
|
||||
*(__verbose);
|
||||
__stop___verbose = .;
|
||||
} :data
|
||||
.rodata : {
|
||||
*(.rodata .rodata.*)
|
||||
*(.rodata .rodata.*)
|
||||
} :data
|
||||
|
||||
.vsyscall : ALIGN(0x1000) {
|
||||
@@ -37,14 +41,14 @@ SECTIONS
|
||||
. = ALIGN(4096);
|
||||
} : data = 0xf4
|
||||
|
||||
.bss : {
|
||||
*(.bss .bss.*)
|
||||
}
|
||||
. = ALIGN(4096);
|
||||
_end = .;
|
||||
.bss : {
|
||||
*(.bss .bss.*)
|
||||
}
|
||||
. = ALIGN(4096);
|
||||
_end = .;
|
||||
|
||||
/DISCARD/ : {
|
||||
*(.eh_frame)
|
||||
*(.note.gnu.build-id)
|
||||
*(.eh_frame)
|
||||
*(.note.gnu.build-id)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,24 +1,28 @@
|
||||
PHDRS
|
||||
{
|
||||
text PT_LOAD FLAGS(5);
|
||||
data PT_LOAD FLAGS(7);
|
||||
data PT_LOAD FLAGS(7);
|
||||
}
|
||||
SECTIONS
|
||||
{
|
||||
. = 0xffffffff80001000;
|
||||
_head = .;
|
||||
_head = .;
|
||||
|
||||
.text : {
|
||||
*(.text);
|
||||
} : text
|
||||
.text : {
|
||||
*(.text);
|
||||
} : text
|
||||
|
||||
. = ALIGN(4096);
|
||||
. = ALIGN(4096);
|
||||
.data : {
|
||||
*(.data)
|
||||
*(.data.*)
|
||||
*(.data)
|
||||
*(.data.*)
|
||||
. = ALIGN(8);
|
||||
__start___verbose = .;
|
||||
*(__verbose);
|
||||
__stop___verbose = .;
|
||||
} :data
|
||||
.rodata : {
|
||||
*(.rodata .rodata.*)
|
||||
*(.rodata .rodata.*)
|
||||
} :data
|
||||
|
||||
.vsyscall : ALIGN(0x1000) {
|
||||
@@ -37,10 +41,10 @@ SECTIONS
|
||||
. = ALIGN(4096);
|
||||
} : data = 0xf4
|
||||
|
||||
.bss : {
|
||||
*(.bss .bss.*)
|
||||
}
|
||||
. = ALIGN(4096);
|
||||
_end = .;
|
||||
.bss : {
|
||||
*(.bss .bss.*)
|
||||
}
|
||||
. = ALIGN(4096);
|
||||
_end = .;
|
||||
|
||||
}
|
||||
|
||||
@@ -16,6 +16,10 @@ SECTIONS
|
||||
.data : {
|
||||
*(.data)
|
||||
*(.data.*)
|
||||
. = ALIGN(8);
|
||||
__start___verbose = .;
|
||||
*(__verbose);
|
||||
__stop___verbose = .;
|
||||
} :data
|
||||
.rodata : {
|
||||
*(.rodata .rodata.*)
|
||||
|
||||
@@ -16,6 +16,10 @@ SECTIONS
|
||||
.data : {
|
||||
*(.data)
|
||||
*(.data.*)
|
||||
. = ALIGN(8);
|
||||
__start___verbose = .;
|
||||
*(__verbose);
|
||||
__stop___verbose = .;
|
||||
} :data
|
||||
.rodata : {
|
||||
*(.rodata .rodata.*)
|
||||
|
||||
@@ -16,6 +16,10 @@ SECTIONS
|
||||
.data : {
|
||||
*(.data)
|
||||
*(.data.*)
|
||||
. = ALIGN(8);
|
||||
__start___verbose = .;
|
||||
*(__verbose);
|
||||
__stop___verbose = .;
|
||||
} :data
|
||||
.rodata : {
|
||||
*(.rodata .rodata.*)
|
||||
|
||||
@@ -16,6 +16,10 @@ SECTIONS
|
||||
.data : {
|
||||
*(.data)
|
||||
*(.data.*)
|
||||
. = ALIGN(8);
|
||||
__start___verbose = .;
|
||||
*(__verbose);
|
||||
__stop___verbose = .;
|
||||
} :data
|
||||
.rodata : {
|
||||
*(.rodata .rodata.*)
|
||||
|
||||
@@ -1,24 +1,28 @@
|
||||
PHDRS
|
||||
{
|
||||
text PT_LOAD FLAGS(5);
|
||||
data PT_LOAD FLAGS(7);
|
||||
data PT_LOAD FLAGS(7);
|
||||
}
|
||||
SECTIONS
|
||||
{
|
||||
. = 0xffffffff80001000;
|
||||
_head = .;
|
||||
_head = .;
|
||||
|
||||
.text : {
|
||||
*(.text);
|
||||
} : text
|
||||
.text : {
|
||||
*(.text);
|
||||
} : text
|
||||
|
||||
. = ALIGN(4096);
|
||||
. = ALIGN(4096);
|
||||
.data : {
|
||||
*(.data)
|
||||
*(.data.*)
|
||||
*(.data)
|
||||
*(.data.*)
|
||||
. = ALIGN(8);
|
||||
__start___verbose = .;
|
||||
*(__verbose);
|
||||
__stop___verbose = .;
|
||||
} :data
|
||||
.rodata : {
|
||||
*(.rodata .rodata.*)
|
||||
*(.rodata .rodata.*)
|
||||
} :data
|
||||
|
||||
.vsyscall : ALIGN(0x1000) {
|
||||
@@ -37,9 +41,9 @@ SECTIONS
|
||||
. = ALIGN(4096);
|
||||
} : data = 0xf4
|
||||
|
||||
.bss : {
|
||||
*(.bss .bss.*)
|
||||
}
|
||||
. = ALIGN(4096);
|
||||
_end = .;
|
||||
.bss : {
|
||||
*(.bss .bss.*)
|
||||
}
|
||||
. = ALIGN(4096);
|
||||
_end = .;
|
||||
}
|
||||
|
||||
147
kernel/debug.c
147
kernel/debug.c
@@ -18,6 +18,9 @@
|
||||
#include <ihk/lock.h>
|
||||
#include <ihk/monitor.h>
|
||||
#include <errno.h>
|
||||
#include <sysfs.h>
|
||||
#include <debug.h>
|
||||
#include <limits.h>
|
||||
|
||||
struct ihk_kmsg_buf *kmsg_buf;
|
||||
|
||||
@@ -180,3 +183,147 @@ void kmsg_init()
|
||||
{
|
||||
ihk_mc_spinlock_init(&kmsg_lock);
|
||||
}
|
||||
|
||||
extern struct ddebug __start___verbose[];
|
||||
extern struct ddebug __stop___verbose[];
|
||||
|
||||
static ssize_t dynamic_debug_sysfs_show(struct sysfs_ops *ops,
|
||||
void *instance, void *buf, size_t size)
|
||||
{
|
||||
struct ddebug *dbg;
|
||||
ssize_t n = 0;
|
||||
|
||||
n = snprintf(buf, size, "# filename:lineno function flags format\n");
|
||||
|
||||
for (dbg = __start___verbose; dbg < __stop___verbose; dbg++) {
|
||||
n += snprintf(buf + n, size - n, "%s:%d %s =%s\n",
|
||||
dbg->file, dbg->line, dbg->func,
|
||||
dbg->flags ? "p" : "_");
|
||||
|
||||
if (n >= size)
|
||||
break;
|
||||
}
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
static ssize_t dynamic_debug_sysfs_store(struct sysfs_ops *ops,
|
||||
void *instance, void *buf, size_t size)
|
||||
{
|
||||
char *cur = buf;
|
||||
char *file = NULL, *func = NULL;
|
||||
long int line_start = 0, line_end = INT_MAX;
|
||||
int set_flag = -1;
|
||||
struct ddebug *dbg;
|
||||
|
||||
|
||||
// assume line was new-line terminated and squash last newline
|
||||
cur[size-1] = '\0';
|
||||
|
||||
/* basic line parsing, combinaisons of:
|
||||
* file <file>
|
||||
* func <func>
|
||||
* line <line|line-line|line-|-line>
|
||||
* and must end with [+-=][p_] (set/clear print flag)
|
||||
*/
|
||||
again:
|
||||
while (cur && cur < ((char *)buf) + size && *cur) {
|
||||
dkprintf("looking at %.*s, size left %d\n",
|
||||
size - (cur - (char *)buf), cur,
|
||||
(char *)buf - cur + size);
|
||||
|
||||
if (strncmp(cur, "func ", 5) == 0) {
|
||||
cur += 5;
|
||||
func = cur;
|
||||
} else if (strncmp(cur, "file ", 5) == 0) {
|
||||
cur += 5;
|
||||
file = cur;
|
||||
} else if (strncmp(cur, "line ", 5) == 0) {
|
||||
cur += 5;
|
||||
if (*cur != '-') {
|
||||
line_start = strtol(cur, &cur, 0);
|
||||
}
|
||||
if (*cur != '-') {
|
||||
line_end = line_start;
|
||||
} else {
|
||||
cur++;
|
||||
if (*cur == ' ' || *cur == '\0') {
|
||||
line_end = INT_MAX;
|
||||
} else {
|
||||
line_end = strtol(cur, &cur, 0);
|
||||
}
|
||||
}
|
||||
} else if (strchr("+-=", *cur)) {
|
||||
switch ((*cur) + 256 * (*(cur+1))) {
|
||||
case '+' + 256*'p':
|
||||
case '=' + 256*'p':
|
||||
set_flag = DDEBUG_PRINT;
|
||||
break;
|
||||
case '-' + 256*'p':
|
||||
case '=' + 256*'_':
|
||||
set_flag = DDEBUG_NONE;
|
||||
break;
|
||||
default:
|
||||
kprintf("invalid flag: %.*s\n",
|
||||
size - (cur - (char *)buf), cur);
|
||||
return -EINVAL;
|
||||
}
|
||||
/* XXX check 3rd char is end of input or \n or ; */
|
||||
cur += 3;
|
||||
break;
|
||||
|
||||
} else {
|
||||
kprintf("dynamic debug control: unrecognized keyword: %.*s\n",
|
||||
size - (cur - (char *)buf), cur);
|
||||
return -EINVAL;
|
||||
}
|
||||
cur = strpbrk(cur, " \n");
|
||||
if (cur) {
|
||||
*cur = '\0';
|
||||
cur++;
|
||||
}
|
||||
}
|
||||
dkprintf("func %s, file %s, lines %d-%d, flag %x\n",
|
||||
func, file, line_start, line_end, set_flag);
|
||||
|
||||
if (set_flag < 0) {
|
||||
kprintf("dynamic debug control: no flag set?\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
if (!func && !file) {
|
||||
kprintf("at least file or func should be set\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
for (dbg = __start___verbose; dbg < __stop___verbose; dbg++) {
|
||||
/* TODO: handle wildcards */
|
||||
if ((!func || strcmp(func, dbg->func) == 0) &&
|
||||
(!file || strcmp(file, dbg->file) == 0) &&
|
||||
dbg->line >= line_start &&
|
||||
dbg->line <= line_end) {
|
||||
dbg->flags = set_flag;
|
||||
}
|
||||
}
|
||||
|
||||
if (cur && cur < ((char *)buf) + size && *cur)
|
||||
goto again;
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
static struct sysfs_ops dynamic_debug_sysfs_ops = {
|
||||
.show = &dynamic_debug_sysfs_show,
|
||||
.store = &dynamic_debug_sysfs_store,
|
||||
};
|
||||
|
||||
void dynamic_debug_sysfs_setup(void)
|
||||
{
|
||||
int error;
|
||||
|
||||
error = sysfs_createf(&dynamic_debug_sysfs_ops, NULL, 0644,
|
||||
"/sys/kernel/debug/dynamic_debug/control");
|
||||
if (error) {
|
||||
kprintf("%s: ERROR: creating dynamic_debug/control sysfs file",
|
||||
__func__);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,15 +36,13 @@
|
||||
#include <syscall.h>
|
||||
#include <process.h>
|
||||
#include <rusage_private.h>
|
||||
#include <debug.h>
|
||||
|
||||
//#define DEBUG_PRINT_DEVOBJ
|
||||
|
||||
#ifdef DEBUG_PRINT_DEVOBJ
|
||||
#define dkprintf(...) kprintf(__VA_ARGS__)
|
||||
#define ekprintf(...) kprintf(__VA_ARGS__)
|
||||
#else
|
||||
#define dkprintf(...) do { if (0) kprintf(__VA_ARGS__); } while (0)
|
||||
#define ekprintf(...) kprintf(__VA_ARGS__)
|
||||
#undef DDEBUG_DEFAULT
|
||||
#define DDEBUG_DEFAULT DDEBUG_PRINT
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
@@ -27,15 +27,13 @@
|
||||
#include <string.h>
|
||||
#include <syscall.h>
|
||||
#include <rusage_private.h>
|
||||
#include <debug.h>
|
||||
|
||||
//#define DEBUG_PRINT_FILEOBJ
|
||||
|
||||
#ifdef DEBUG_PRINT_FILEOBJ
|
||||
#define dkprintf(...) do { if (1) kprintf(__VA_ARGS__); } while (0)
|
||||
#define ekprintf(...) kprintf(__VA_ARGS__)
|
||||
#else
|
||||
#define dkprintf(...) do { if (0) kprintf(__VA_ARGS__); } while (0)
|
||||
#define ekprintf(...) kprintf(__VA_ARGS__)
|
||||
#undef DDEBUG_DEFAULT
|
||||
#define DDEBUG_DEFAULT DDEBUG_PRINT
|
||||
#endif
|
||||
|
||||
mcs_lock_t fileobj_list_lock;
|
||||
|
||||
@@ -70,13 +70,13 @@
|
||||
#include <cls.h>
|
||||
#include <kmsg.h>
|
||||
#include <timer.h>
|
||||
#include <debug.h>
|
||||
|
||||
//#define DEBUG_PRINT_FUTEX
|
||||
|
||||
#ifdef DEBUG_PRINT_FUTEX
|
||||
#define dkprintf kprintf
|
||||
#else
|
||||
#define dkprintf(...) do { if (0) kprintf(__VA_ARGS__); } while (0)
|
||||
#undef DDEBUG_DEFAULT
|
||||
#define DDEBUG_DEFAULT DDEBUG_PRINT
|
||||
#endif
|
||||
|
||||
int futex_cmpxchg_enabled;
|
||||
|
||||
@@ -34,13 +34,13 @@
|
||||
#include <sysfs.h>
|
||||
#include <ihk/perfctr.h>
|
||||
#include <rusage_private.h>
|
||||
#include <debug.h>
|
||||
|
||||
//#define DEBUG_PRINT_HOST
|
||||
|
||||
#ifdef DEBUG_PRINT_HOST
|
||||
#define dkprintf kprintf
|
||||
#else
|
||||
#define dkprintf(...) do { if (0) kprintf(__VA_ARGS__); } while (0)
|
||||
#undef DDEBUG_DEFAULT
|
||||
#define DDEBUG_DEFAULT DDEBUG_PRINT
|
||||
#endif
|
||||
|
||||
/* Linux channel table, indexec by Linux CPU id */
|
||||
|
||||
40
kernel/include/debug.h
Normal file
40
kernel/include/debug.h
Normal file
@@ -0,0 +1,40 @@
|
||||
#ifndef DEBUG_H
|
||||
#define DEBUG_H
|
||||
|
||||
#include <lwk/compiler.h>
|
||||
|
||||
struct ddebug {
|
||||
const char *file;
|
||||
const char *func;
|
||||
const char *fmt;
|
||||
unsigned int line:24;
|
||||
unsigned int flags:8;
|
||||
} __aligned(8);
|
||||
|
||||
#define DDEBUG_NONE 0x0
|
||||
#define DDEBUG_PRINT 0x1
|
||||
|
||||
#define DDEBUG_DEFAULT DDEBUG_NONE
|
||||
|
||||
#define DDEBUG_SYMBOL() \
|
||||
static struct ddebug __aligned(8) \
|
||||
__attribute__((section("__verbose"))) ddebug = { \
|
||||
.file = __FILE__, \
|
||||
.func = __func__, \
|
||||
.line = __LINE__, \
|
||||
.flags = DDEBUG_DEFAULT, \
|
||||
}
|
||||
|
||||
#define DDEBUG_TEST ddebug.flags
|
||||
|
||||
|
||||
|
||||
#define dkprintf(fmt, args...) \
|
||||
do { \
|
||||
DDEBUG_SYMBOL(); \
|
||||
if (DDEBUG_TEST) \
|
||||
kprintf(fmt, ##args); \
|
||||
} while (0)
|
||||
#define ekprintf(fmt, args...) kprintf(fmt, ##args)
|
||||
|
||||
#endif
|
||||
@@ -33,6 +33,7 @@ extern void cpu_sysfs_setup(void);
|
||||
extern void numa_sysfs_setup(void);
|
||||
extern void rusage_sysfs_setup(void);
|
||||
extern void status_sysfs_setup(void);
|
||||
extern void dynamic_debug_sysfs_setup(void);
|
||||
|
||||
extern char *find_command_line(char *name);
|
||||
|
||||
|
||||
@@ -26,20 +26,17 @@
|
||||
|
||||
#include <mc_xpmem.h>
|
||||
#include <xpmem.h>
|
||||
#include <debug.h>
|
||||
|
||||
#define XPMEM_CURRENT_VERSION 0x00026003
|
||||
|
||||
//#define DEBUG_PRINT_XPMEM
|
||||
|
||||
#ifdef DEBUG_PRINT_XPMEM
|
||||
#define dkprintf(...) kprintf(__VA_ARGS__)
|
||||
#define ekprintf(...) kprintf(__VA_ARGS__)
|
||||
#define XPMEM_DEBUG(format, a...) kprintf("[%d] %s: "format"\n", cpu_local_var(current)->proc->rgid, __func__, ##a)
|
||||
#else
|
||||
#define dkprintf(...) do { if (0) kprintf(__VA_ARGS__); } while (0)
|
||||
#define ekprintf(...) kprintf(__VA_ARGS__)
|
||||
#define XPMEM_DEBUG(format, a...) do { if (0) kprintf("\n"); } while (0)
|
||||
#undef DDEBUG_DEFAULT
|
||||
#define DDEBUG_DEFAULT DDEBUG_PRINT
|
||||
#endif
|
||||
#define XPMEM_DEBUG(format, a...) dkprintf("[%d] %s: "format"\n", cpu_local_var(current)->proc->rgid, __func__, ##a)
|
||||
|
||||
//#define USE_DBUG_ON
|
||||
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
#include <syscall.h>
|
||||
#include <sysfs.h>
|
||||
#include <ihk/monitor.h>
|
||||
#include <debug.h>
|
||||
|
||||
//#define IOCTL_FUNC_EXTENSION
|
||||
#ifdef IOCTL_FUNC_EXTENSION
|
||||
@@ -41,11 +42,8 @@
|
||||
//#define DEBUG_PRINT_INIT
|
||||
|
||||
#ifdef DEBUG_PRINT_INIT
|
||||
#define dkprintf(...) do { kprintf(__VA_ARGS__); } while (0)
|
||||
#define ekprintf(...) do { kprintf(__VA_ARGS__); } while (0)
|
||||
#else
|
||||
#define dkprintf(...) do { } while (0)
|
||||
#define ekprintf(...) do { kprintf(__VA_ARGS__); } while (0)
|
||||
#undef DDEBUG_DEFAULT
|
||||
#define DDEBUG_DEFAULT DDEBUG_PRINT
|
||||
#endif
|
||||
|
||||
#define DUMP_LEVEL_USER_UNUSED_EXCLUDE 24
|
||||
@@ -331,6 +329,7 @@ static void populate_sysfs(void)
|
||||
{
|
||||
cpu_sysfs_setup();
|
||||
numa_sysfs_setup();
|
||||
dynamic_debug_sysfs_setup();
|
||||
//setup_remote_snooping_samples();
|
||||
} /* populate_sysfs() */
|
||||
|
||||
|
||||
@@ -19,15 +19,13 @@
|
||||
#include <ihk/ikc.h>
|
||||
#include <ikc/master.h>
|
||||
#include <arch/cpu.h>
|
||||
#include <debug.h>
|
||||
|
||||
//#define DEBUG_LISTENERS
|
||||
|
||||
#ifdef DEBUG_LISTENERS
|
||||
#define dkprintf(...) kprintf(__VA_ARGS__)
|
||||
#define ekprintf(...) kprintf(__VA_ARGS__)
|
||||
#else
|
||||
#define dkprintf(...) do { if (0) kprintf(__VA_ARGS__); } while (0)
|
||||
#define ekprintf(...) kprintf(__VA_ARGS__)
|
||||
#undef DDEBUG_DEFAULT
|
||||
#define DDEBUG_DEFAULT DDEBUG_PRINT
|
||||
#endif
|
||||
|
||||
void testmem(void *v, unsigned long size)
|
||||
|
||||
@@ -44,15 +44,13 @@
|
||||
#include <process.h>
|
||||
#include <limits.h>
|
||||
#include <sysfs.h>
|
||||
#include <debug.h>
|
||||
|
||||
//#define DEBUG_PRINT_MEM
|
||||
|
||||
#ifdef DEBUG_PRINT_MEM
|
||||
#define dkprintf(...) kprintf(__VA_ARGS__)
|
||||
#define ekprintf(...) kprintf(__VA_ARGS__)
|
||||
#else
|
||||
#define dkprintf(...) do { if (0) kprintf(__VA_ARGS__); } while (0)
|
||||
#define ekprintf(...) kprintf(__VA_ARGS__)
|
||||
#undef DDEBUG_DEFAULT
|
||||
#define DDEBUG_DEFAULT DDEBUG_PRINT
|
||||
#endif
|
||||
|
||||
static unsigned long pa_start, pa_end;
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include <kmalloc.h>
|
||||
#include <process.h>
|
||||
#include <swapfmt.h>
|
||||
#include <debug.h>
|
||||
|
||||
#define O_RDONLY 00000000
|
||||
#define O_WRONLY 00000001
|
||||
@@ -44,11 +45,8 @@
|
||||
//#define DEBUG_PRINT_PROCESS
|
||||
|
||||
#ifdef DEBUG_PRINT_PROCESS
|
||||
#define dkprintf(...) kprintf(__VA_ARGS__)
|
||||
#define ekprintf(...) kprintf(__VA_ARGS__)
|
||||
#else
|
||||
#define dkprintf(...) do { if (0) kprintf(__VA_ARGS__); } while (0)
|
||||
#define ekprintf(...) kprintf(__VA_ARGS__)
|
||||
#undef DDEBUG_DEFAULT
|
||||
#define DDEBUG_DEFAULT DDEBUG_PRINT
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
||||
@@ -38,12 +38,13 @@
|
||||
#include <xpmem.h>
|
||||
#include <rusage_private.h>
|
||||
#include <ihk/monitor.h>
|
||||
#include <debug.h>
|
||||
|
||||
//#define DEBUG_PRINT_PROCESS
|
||||
|
||||
#ifdef DEBUG_PRINT_PROCESS
|
||||
#define dkprintf(...) kprintf(__VA_ARGS__)
|
||||
#define ekprintf(...) kprintf(__VA_ARGS__)
|
||||
#undef DDEBUG_DEFAULT
|
||||
#define DDEBUG_DEFAULT DDEBUG_PRINT
|
||||
static void dtree(struct rb_node *node, int l) {
|
||||
struct vm_range *range;
|
||||
if (!node)
|
||||
@@ -60,8 +61,6 @@ static void dump_tree(struct process_vm *vm) {
|
||||
dtree(vm->vm_range_tree.rb_node, 1);
|
||||
}
|
||||
#else
|
||||
#define dkprintf(...) do { if (0) kprintf(__VA_ARGS__); } while (0)
|
||||
#define ekprintf(...) kprintf(__VA_ARGS__)
|
||||
static void dump_tree(struct process_vm *vm) {}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
#include <limits.h>
|
||||
#include <march.h>
|
||||
#include <process.h>
|
||||
#include <debug.h>
|
||||
|
||||
extern char *syscall_name[];
|
||||
|
||||
@@ -47,11 +48,8 @@ extern char *syscall_name[];
|
||||
//#define DEBUG_PRINT_PROFILE
|
||||
|
||||
#ifdef DEBUG_PRINT_PROFILE
|
||||
#define dkprintf(...) kprintf(__VA_ARGS__)
|
||||
#define ekprintf(...) kprintf(__VA_ARGS__)
|
||||
#else
|
||||
#define dkprintf(...) do { if (0) kprintf(__VA_ARGS__); } while (0)
|
||||
#define ekprintf(...) kprintf(__VA_ARGS__)
|
||||
#undef DDEBUG_DEFAULT
|
||||
#define DDEBUG_DEFAULT DDEBUG_PRINT
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
@@ -23,10 +23,8 @@
|
||||
#include <shm.h>
|
||||
#include <string.h>
|
||||
#include <rusage_private.h>
|
||||
#include <debug.h>
|
||||
|
||||
#define dkprintf(...) do { if (0) kprintf(__VA_ARGS__); } while (0)
|
||||
#define ekprintf(...) kprintf(__VA_ARGS__)
|
||||
#define fkprintf(...) kprintf(__VA_ARGS__)
|
||||
|
||||
static LIST_HEAD(shmobj_list_head);
|
||||
static ihk_spinlock_t shmobj_list_lock_body = SPIN_LOCK_UNLOCKED;
|
||||
@@ -273,7 +271,7 @@ void shmobj_destroy(struct shmobj *obj)
|
||||
page->mode, page->count);
|
||||
count = ihk_atomic_sub_return(1, &page->count);
|
||||
if (!((page->mode == PM_MAPPED) && (count == 0))) {
|
||||
fkprintf("shmobj_destroy(%p): "
|
||||
ekprintf("shmobj_destroy(%p): "
|
||||
"page %p phys %#lx mode %#x"
|
||||
" count %d off %#lx\n",
|
||||
obj, page,
|
||||
@@ -335,7 +333,7 @@ static void shmobj_release(struct memobj *memobj)
|
||||
newref = --obj->ds.shm_nattch;
|
||||
if (newref <= 0) {
|
||||
if (newref < 0) {
|
||||
fkprintf("shmobj_release(%p):ref %ld\n",
|
||||
ekprintf("shmobj_release(%p):ref %ld\n",
|
||||
memobj, newref);
|
||||
panic("shmobj_release:freeing free shmobj");
|
||||
}
|
||||
@@ -430,7 +428,7 @@ static int shmobj_get_page(struct memobj *memobj, off_t off, int p2align,
|
||||
Add when setting the PTE for a page with count of one in ihk_mc_pt_set_range(). */
|
||||
|
||||
if (page->mode != PM_NONE) {
|
||||
fkprintf("shmobj_get_page(%p,%#lx,%d,%p):"
|
||||
ekprintf("shmobj_get_page(%p,%#lx,%d,%p):"
|
||||
"page %p %#lx %d %d %#lx\n",
|
||||
memobj, off, p2align, physp,
|
||||
page, page_to_phys(page), page->mode,
|
||||
|
||||
@@ -59,6 +59,7 @@
|
||||
#include <rusage_private.h>
|
||||
#include <ihk/monitor.h>
|
||||
#include <profile.h>
|
||||
#include <debug.h>
|
||||
|
||||
/* Headers taken from kitten LWK */
|
||||
#include <lwk/stddef.h>
|
||||
@@ -69,11 +70,8 @@
|
||||
//#define DEBUG_PRINT_SC
|
||||
|
||||
#ifdef DEBUG_PRINT_SC
|
||||
#define dkprintf(...) kprintf(__VA_ARGS__)
|
||||
#define ekprintf(...) kprintf(__VA_ARGS__)
|
||||
#else
|
||||
#define dkprintf(...) do { if (0) kprintf(__VA_ARGS__); } while (0)
|
||||
#define ekprintf(...) kprintf(__VA_ARGS__)
|
||||
#undef DDEBUG_DEFAULT
|
||||
#define DDEBUG_DEFAULT DDEBUG_PRINT
|
||||
#endif
|
||||
|
||||
//static ihk_atomic_t pid_cnt = IHK_ATOMIC_INIT(1024);
|
||||
|
||||
@@ -23,9 +23,7 @@
|
||||
#include <sysfs.h>
|
||||
#include <sysfs_msg.h>
|
||||
#include <vsprintf.h>
|
||||
|
||||
#define dkprintf(...) do { if (0) kprintf(__VA_ARGS__); } while (0)
|
||||
#define ekprintf(...) do { if (1) kprintf(__VA_ARGS__); } while (0)
|
||||
#include <debug.h>
|
||||
|
||||
static size_t sysfs_data_bufsize;
|
||||
static void *sysfs_data_buf;
|
||||
|
||||
@@ -32,13 +32,13 @@
|
||||
#include <futex.h>
|
||||
#include <bitops.h>
|
||||
#include <timer.h>
|
||||
#include <debug.h>
|
||||
|
||||
//#define DEBUG_PRINT_TIMER
|
||||
|
||||
#ifdef DEBUG_PRINT_TIMER
|
||||
#define dkprintf kprintf
|
||||
#else
|
||||
#define dkprintf(...) do { if (0) kprintf(__VA_ARGS__); } while (0)
|
||||
#undef DDEBUG_DEFAULT
|
||||
#define DDEBUG_DEFAULT DDEBUG_PRINT
|
||||
#endif
|
||||
|
||||
#define LOOP_TIMEOUT 500
|
||||
|
||||
@@ -283,7 +283,8 @@ static int xpmem_close(
|
||||
int n_opened;
|
||||
|
||||
XPMEM_DEBUG("call: fd=%d, pid=%d, rgid=%d",
|
||||
mckfd->fd, proc->pid, proc->rgid);
|
||||
mckfd->fd, cpu_local_var(current)->proc->pid,
|
||||
cpu_local_var(current)->proc->rgid);
|
||||
|
||||
n_opened = ihk_atomic_dec_return(&xpmem_my_part->n_opened);
|
||||
XPMEM_DEBUG("n_opened=%d", n_opened);
|
||||
|
||||
@@ -21,10 +21,7 @@
|
||||
#include <memory.h>
|
||||
#include <page.h>
|
||||
#include <string.h>
|
||||
|
||||
#define dkprintf(...) do { if (0) kprintf(__VA_ARGS__); } while (0)
|
||||
#define ekprintf(...) kprintf(__VA_ARGS__)
|
||||
#define fkprintf(...) kprintf(__VA_ARGS__)
|
||||
#include <debug.h>
|
||||
|
||||
struct zeroobj {
|
||||
struct memobj memobj; /* must be first */
|
||||
@@ -117,7 +114,7 @@ static int alloc_zeroobj(void)
|
||||
page = phys_to_page_insert_hash(phys);
|
||||
|
||||
if (page->mode != PM_NONE) {
|
||||
fkprintf("alloc_zeroobj():"
|
||||
ekprintf("alloc_zeroobj():"
|
||||
"page %p %#lx %d %d %#lx\n",
|
||||
page, page_to_phys(page), page->mode,
|
||||
page->count, page->offset);
|
||||
|
||||
@@ -23,6 +23,7 @@ char *strncpy(char *dest, const char *src, size_t maxlen);
|
||||
int strcmp(const char *s1, const char *s2);
|
||||
int strncmp(const char *s1, const char *s2, size_t n);
|
||||
char *strstr(const char *haystack, const char *needle);
|
||||
char *strpbrk(const char *haystack, const char *accept);
|
||||
char *strchr(const char *s, int n);
|
||||
char *strrchr(const char *s, int n);
|
||||
void *memcpy(void *dest, const void *src, size_t n);
|
||||
|
||||
13
lib/string.c
13
lib/string.c
@@ -112,6 +112,19 @@ strrchr(const char *s, int c)
|
||||
return (char *)last;
|
||||
} /* strrchr() */
|
||||
|
||||
char *strpbrk(const char *s, const char *accept)
|
||||
{
|
||||
const char *a;
|
||||
|
||||
do {
|
||||
for (a = accept; *a; a++)
|
||||
if (*s == *a)
|
||||
return (char *)s;
|
||||
} while (*(s++));
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
char *strstr(const char *haystack, const char *needle)
|
||||
{
|
||||
int len = strlen(needle);
|
||||
|
||||
Reference in New Issue
Block a user