The core NLKD additions. With other debugging code living scattered across the (official or external) tree(s), this tries to atb once establish a common place for debugging code in a new debug/ directory. Note that this depends on the i386 cmpxchg adjustments patch, which isn't in 2.6.14, but has supposedly been merged already into 2.6.15. Signed-Off-By: Jan Beulich Index: 2.6.14-nlkd/Makefile =================================================================== --- 2.6.14-nlkd.orig/Makefile 2005-11-09 11:12:42.000000000 +0100 +++ 2.6.14-nlkd/Makefile 2005-11-04 16:20:57.000000000 +0100 @@ -592,6 +592,7 @@ export MODLIB ifeq ($(KBUILD_EXTMOD),) core-y += kernel/ mm/ fs/ ipc/ security/ crypto/ +core-$(CONFIG_DEBUG_KERNEL) += debug/ vmlinux-dirs := $(patsubst %/,%,$(filter %/, $(init-y) $(init-m) \ $(core-y) $(core-m) $(drivers-y) $(drivers-m) \ Index: 2.6.14-nlkd/debug/Kconfig =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ 2.6.14-nlkd/debug/Kconfig 2005-11-07 14:01:48.000000000 +0100 @@ -0,0 +1,22 @@ +choice + prompt "Kernel debugger" + optional + depends on DEBUG_KERNEL + ---help--- + Kernel debuggers contain commands which allow memory to be examined, + instructions to be disassembled and breakpoints to be set. + + If unsure, say N. + +config NLKD + bool "Novell Linux Kernel Debugger" + depends on DEBUG_KERNEL + depends on (X86_CMOVE && X86_CMPXCHG64 && X86_TSC) || X86_64 + depends on !X86 || !OPROFILE + ---help--- + This option provides a kernel debugger framework. Sub-component + selection will follow later. + +endchoice + +source "debug/nlkd/Kconfig" Index: 2.6.14-nlkd/debug/Makefile =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ 2.6.14-nlkd/debug/Makefile 2005-11-04 14:15:23.000000000 +0100 @@ -0,0 +1 @@ +obj-$(CONFIG_NLKD) += nlkd/ Index: 2.6.14-nlkd/debug/nlkd/Kconfig =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ 2.6.14-nlkd/debug/nlkd/Kconfig 2005-11-04 09:52:36.000000000 +0100 @@ -0,0 +1,71 @@ +#***************************************************************************** +#* +#* File Name: Kconfig +#* Created by: Jan Beulich +#* %version: 5 % +#* %derived_by: jbeulich % +#* %date_modified: Thu Nov 03 04:12:25 2005 % +#* +#***************************************************************************** +#***************************************************************************** +#* * +#* Copyright (c) 2004-2005 Novell, Inc. All Rights Reserved. * +#* * +#* This program is free software; you can redistribute it and/or * +#* modify it under the terms of version 2 of the GNU General Public License * +#* as published by the Free Software Foundation. * +#* * +#* This program is distributed in the hope that it will be useful, * +#* but WITHOUT ANY WARRANTY; without even the implied warranty of * +#* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * +#* GNU General Public License for more details. * +#* * +#* You should have received a copy of the GNU General Public License * +#* along with this program; if not, contact Novell, Inc. * +#* * +#* To contact Novell about this file by physical or electronic mail, * +#* you may find current contact information at www.novell.com. * +#* * +#***************************************************************************** +#***************************************************************************** +#* +#* File Description: +#* +#***************************************************************************** + +config DEBUGRTL + tristate + default n + +config CDE + tristate "Core Debug Engine" #todo if ??? + depends on NLKD + select DEBUGRTL + default NLKD + ---help--- + This enables NLKD's core component. Front-end (agent) selection + will follow later. + + If compiled as a module, the module will be called cde. + +config CDA + tristate "Console Debug Agent" + depends on CDE && (VGA_CONSOLE || FRAMEBUFFER_CONSOLE) && SERIO_I8042 + default CDE + ---help--- + This option provides a console based kernel debugger front-end. + See Documentation/cda.txt for additional information. + + To compile this agent as a module, choose M here: the + module will be called cda. + +config RDA + tristate "Remote Debug Agent (EXPERIMENTAL)" + depends on CDE && EXPERIMENTAL + default n + ---help--- + This option provides a remote kernel debugger interface supporting + gdb's protocol. + + To compile this agent as a module, choose M here: the + module will be called rda. Index: 2.6.14-nlkd/debug/nlkd/Makefile =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ 2.6.14-nlkd/debug/nlkd/Makefile 2005-11-09 10:50:39.000000000 +0100 @@ -0,0 +1,108 @@ +#***************************************************************************** +#* +#* File Name: Makefile +#* Created by: Jan Beulich +#* %version: 12 % +#* %derived_by: jbeulich % +#* %date_modified: Thu Nov 03 04:12:54 2005 % +#* +#***************************************************************************** +#***************************************************************************** +#* * +#* Copyright (c) 2004-2005 Novell, Inc. All Rights Reserved. * +#* * +#* This program is free software; you can redistribute it and/or * +#* modify it under the terms of version 2 of the GNU General Public License * +#* as published by the Free Software Foundation. * +#* * +#* This program is distributed in the hope that it will be useful, * +#* but WITHOUT ANY WARRANTY; without even the implied warranty of * +#* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * +#* GNU General Public License for more details. * +#* * +#* You should have received a copy of the GNU General Public License * +#* along with this program; if not, contact Novell, Inc. * +#* * +#* To contact Novell about this file by physical or electronic mail, * +#* you may find current contact information at www.novell.com. * +#* * +#***************************************************************************** +#***************************************************************************** +#* +#* File Description: +#* +#***************************************************************************** + +ifeq ($(CONFIG_DEBUGRTL),y) +dbg := obj +endif +ifeq ($(CONFIG_DEBUGRTL),m) +dbg := debugrtl +obj-m := debugrtl.o +dbg-y := +endif + +ifeq ($(CONFIG_CDE),y) +cde := obj +endif +ifeq ($(CONFIG_CDE),m) +cde := cde +obj-m := cde.o +cde-y := +endif + +arch-$(CONFIG_X86) := $(if $(CONFIG_X86_64),AMD64,IA32) +arch-$(CONFIG_IA64) := IA64 +export arch-y + +obj-y := nlkd.o nlkd$(arch-y).o +$(dbg)-$(CONFIG_DEBUGRTL) += dbgutil.o dbg$(arch-y).o +$(cde)-y += cde$(arch-y).o cdeext.o cdefocus.o cdemain.o \ + cde$(arch-y)lock.o cdemem.o cdestatemach.o \ + cdesym.o $(if $(CONFIG_IA64),,cdeunwind.o) \ + cdeutil.o cde$(arch-y)util.o +$(cde)-$(CONFIG_MODULES) += cde_syms.o +$(cde)-$(CONFIG_SMP) += cderendezvous.o cderpc.o +$(cde)-$(CONFIG_EFI) += cdeefi.o +$(cde)-$(CONFIG_X86) += cdeX86brkp.o +$(cde)-$(CONFIG_IA64) += cdeIA64brkp.o + +obj-$(CONFIG_CDA) += cda/ +obj-$(CONFIG_RDA) += rda/ + +EXTRA_AFLAGS := -Wa,--strip-local-absolute + +# Need a version of 'as' that supports various features not present or broken +# in older binutils versions. But since one can't tell gcc what assembler +# binary to use we have to use another compiler driver that will find the +# right assembler if the default one doesn't fit our needs. (Note that -Wa,-Z +# below is necessary because otherwise, up to version 2.15, it will [try to] +# unlink /dev/null [and succeed at least when run as root]). + +assembler_test_body-y := .altmacro; +assembler_test_body-y += .macro .xyz; .endm; .xyz; +assembler_test_body-y += .struct; .previous; +ifneq ($(CONFIG_IA64),y) +assembler_test_body-$(CONFIG_UNWIND_INFO) += .cfi_startproc; +ifeq ($(CONFIG_X86),y) +assembler_test_body-$(CONFIG_UNWIND_INFO) += .cfi_rel_offset $(if $(CONFIG_X86_64),r,e)flags, 0; +endif +assembler_test_body-$(CONFIG_UNWIND_INFO) += .cfi_endproc; +endif +assembler_test_body-$(CONFIG_X86) += .intel_syntax noprefix; +assembler_test_body-$(CONFIG_X86) += .bss; .previous; +assembler_test_body-$(CONFIG_X86) += push (1 shl 1) or not (1 shr 1) mod (1 and 1 xor 2); +assembler_test_body-$(CONFIG_X86) += .equiv dword, 4; .equiv reg, eax; lea reg, [reg*dword]; + +assembler_test = $(shell echo '$(assembler_test_body-y)' \ + | $(1) -c -o /dev/null -Wa,-Z -xassembler-with-cpp - 2>&1 >/dev/null) + +ifneq ($(call assembler_test,$(CC)),) +CCx := $(shell echo '$(CC)' | sed 's,\(^\|[[:space:]]\)\([^=[:space:]]\+\)\([[:space:]]\|$$\),\1\2x\3,') +ifneq ($(shell which $(filter-out -%,$(CCx)) 2>/dev/null | grep '/$(CCx)$$'),) +ifneq ($(call assembler_test,$(CCx)),) +CCx := echo "Assembler update needed" >&2 && /bin/false +endif +endif +override cmd_as_o_S = $(CCx) $(a_flags) -c -o $@ $< +endif Index: 2.6.14-nlkd/debug/nlkd/nlkd.c =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ 2.6.14-nlkd/debug/nlkd/nlkd.c 2005-11-03 12:23:43.000000000 +0100 @@ -0,0 +1,161 @@ +/***************************************************************************** + * + * File Name: nlkd.c + * Created by: Jan Beulich + * %version: 4 % + * %derived_by: jbeulich % + * %date_modified: Thu Nov 03 04:23:30 2005 % + * + *****************************************************************************/ +/***************************************************************************** + * * + * Copyright (c) 1999-2005 Novell, Inc. All Rights Reserved. * + * * + * This program is free software; you can redistribute it and/or * + * modify it under the terms of version 2 of the GNU General Public License * + * as published by the Free Software Foundation. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, contact Novell, Inc. * + * * + * To contact Novell about this file by physical or electronic mail, * + * you may find current contact information at www.novell.com. * + * * + *****************************************************************************/ +/***************************************************************************** + * + * File Description: + * + *****************************************************************************/ + +#include +#include +#include +#include +#include +#include "nlkd.h" + +#if defined(_M_IA64) || defined(__ia64__) +# include "nlkdIA64.h" +#elif defined(_M_IX86) || defined(__i386__) +# include "nlkdIA32.h" +#elif defined(_M_AMD64) || defined(__x86_64__) +# include "nlkdAMD64.h" +#endif + +EXPORT_SYMBOL(nlkdAssert); +EXPORT_SYMBOL(nlkdDebugEvent); +EXPORT_SYMBOL(nlkdEnterDebugger); +EXPORT_SYMBOL(nlkdPanic); + +#ifdef CONFIG_NLKD_FTA +struct notifier_block *nlkd_keypress_chain = NULL; +EXPORT_SYMBOL(nlkd_keypress_chain); +#endif + +volatile int nlkdAgentCount = -1; +#ifndef CONFIG_CDE +EXPORT_SYMBOL(nlkdAgentCount); +const struct nlkdBPXface_s*nlkdBPXface = NULL; +EXPORT_SYMBOL(nlkdBPXface); +#endif + +#ifndef CONFIG_CDE +# include +void (*set_debugreg)(uintptr_t value, nuint_t regnum) = _set_debugreg; +EXPORT_SYMBOL(set_debugreg); +static int _enable_debugreg(struct task_struct *task, nuint_t regnum, uintptr_t value) {} +int (*enable_debugreg)(struct task_struct *, nuint_t, uintptr_t) = _enable_debugreg; +EXPORT_SYMBOL(enable_debugreg); +int (*disable_debugreg)(struct pt_regs *, nuint_t) = _disable_debugreg; +EXPORT_SYMBOL(disable_debugreg); +int (*restore_debugreg)(void) = _restore_debugreg; +EXPORT_SYMBOL(restore_debugreg); +#endif + +#if defined(CONFIG_X86) +# ifdef CONFIG_X86_64 +# define PLT(x) AMD64_##x +# define PC rip +# else +# define PLT(x) IA32_##x +# define PC eip +# endif +# define TYPE PLT(BREAKPOINT) +# define SUBTYPE eax +# define TARGET _nlkdEnterDebuggerInstruction_ +# define EXTRA FRAME_PTREGS(frame, cs) == __KERNEL_CS +# define IPI_TYPE PLT(NMI) +# define IPI_SUBTYPE cr2 +#elif defined(CONFIG_IA64) +# define PC iip +# define TYPE IA64_BREAKFLT +# define SUBTYPE r8 +# define TARGET _nlkdEnterDebuggerBundle_ +# define EXTRA frame->iim == BREAK_ENTER_DEBUGGER +# define IPI_TYPE PLT(NMI) +# define IPI_SUBTYPE iim +#endif + +int nlkdIsDebugEvent(const struct ftaInterruptionCtx_s*frame) { + extern const char TARGET[]; + + return frame->type == TYPE + && FRAME_PTREGS(frame, PC) == (uintptr_t)TARGET + && EXTRA; +} +EXPORT_SYMBOL(nlkdIsDebugEvent); + +#ifndef CONFIG_NLKD_FTA +void nlkdSetDebugEventType(struct ftaInterruptionCtx_s*frame) { + if(!frame->sub_type) { + if(nlkdIsDebugEvent(frame)) + frame->sub_type = FRAME_PTREGS(frame, SUBTYPE); + else if(frame->type == IPI_TYPE) { + frame->sub_type = frame->IPI_SUBTYPE; + frame->IPI_SUBTYPE = 0; + } + } +} +EXPORT_SYMBOL(nlkdSetDebugEventType); +#endif + +#undef IPI_TYPE +#undef IPI_SUBTYPE +#undef EXTRA +#undef TARGET +#undef SUBTYPE +#undef TYPE +#undef PC +#undef PLT + +void nlkd_init() { + extern nlkdExtension_t __start_nlkd_ext[], __stop_nlkd_ext[]; + nlkdExtension_t*ext; + + for(ext = __start_nlkd_ext; ext < __stop_nlkd_ext; ++ext) { + LSTATUS status = nlkdExtRegister(ext->id, + ext->handler, + ext->handlerContext, + *ext->pModuleId, + ext->description, + ext->flags); + if(status != LSTATUS_SUCCESS) + printk(KERN_WARNING "Registration of %s debug extension failed (%08"NPRIX")\n", + ext->id, + status); + } + cde_init(); +} + +void nlkd_init_done() { + cde_init_done(); +} + +#define NLKD +#include "cdeext.c" Index: 2.6.14-nlkd/debug/nlkd/nlkd.h =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ 2.6.14-nlkd/debug/nlkd/nlkd.h 2005-10-07 17:18:18.000000000 +0200 @@ -0,0 +1,48 @@ +/***************************************************************************** + * + * File Name: nlkd.h + * Created by: Jan Beulich + * %version: 2 % + * %derived_by: jbeulich % + * %date_modified: Fri Oct 07 09:18:08 2005 % + * + *****************************************************************************/ +/***************************************************************************** + * * + * Copyright (c) 1999-2005 Novell, Inc. All Rights Reserved. * + * * + * This program is free software; you can redistribute it and/or * + * modify it under the terms of version 2 of the GNU General Public License * + * as published by the Free Software Foundation. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, contact Novell, Inc. * + * * + * To contact Novell about this file by physical or electronic mail, * + * you may find current contact information at www.novell.com. * + * * + *****************************************************************************/ +/***************************************************************************** + * + * File Description: + * + *****************************************************************************/ + +extern volatile int nlkdAgentCount; + +#ifdef CONFIG_CDE + +void cde_init(void); +void cde_init_done(void); + +#else + +# define cde_init() +# define cde_init_done() + +#endif Index: 2.6.14-nlkd/include/linux/fta.h =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ 2.6.14-nlkd/include/linux/fta.h 2005-11-03 12:03:37.000000000 +0100 @@ -0,0 +1,261 @@ +/***************************************************************************** + * + * File Name: fta.h + * Created by: Jan Beulich + * %version: 12 % + * %derived_by: jbeulich % + * %date_modified: Thu Nov 03 04:03:24 2005 % + * + *****************************************************************************/ +/***************************************************************************** + * * + * Copyright (c) 2004-2005 Novell, Inc. All Rights Reserved. * + * * + * This program is free software; you can redistribute it and/or * + * modify it under the terms of version 2 of the GNU General Public License * + * as published by the Free Software Foundation. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, contact Novell, Inc. * + * * + * To contact Novell about this file by physical or electronic mail, * + * you may find current contact information at www.novell.com. * + * * + *****************************************************************************/ +/***************************************************************************** + * + * File Description: + * + *****************************************************************************/ +#ifndef _LINUX_FTA_H +# define _LINUX_FTA_H + +# include +# include + +typedef enum ftaInterruptionId_e ftaInterruptionId_t; +typedef struct ftaInterruptionCtx_s ftaFullInterruptionCtx_t; + +# ifdef CONFIG_NLKD_FTA +# include +# include +# include +# include + +/* --------------------------------------------------------------------------- */ +/* LSTATUS Defines for */ +/* ftaFaultInterruption..., ftaTrapInterruption... and ftaAbortInterruption... */ +/* --------------------------------------------------------------------------- */ + +# define LSTATUS_FTA_HANDLED MAKE_LSTATUS(FTA, SUCCESS, 0) +# define LSTATUS_FTA_NOT_HANDLED MAKE_LSTATUS(FTA, INFORMATION, 0x0100) +# define LSTATUS_FTA_ID_INVALID MAKE_LSTATUS(FTA, ERROR, 0x0100) +# define LSTATUS_FTA_ROUTINE_ADDR_INVALID MAKE_LSTATUS(FTA, ERROR, 0x0101) +# define LSTATUS_FTA_STAGE_INVALID MAKE_LSTATUS(FTA, ERROR, 0x0102) +# define LSTATUS_FTA_STAGE_NOT_AVAILABLE MAKE_LSTATUS(FTA, ERROR, 0x0103) +# define LSTATUS_FTA_TAG_ALLOC_FAILURE MAKE_LSTATUS(FTA, ERROR, 0x0104) +# define LSTATUS_FTA_SIGNATURE_INVALID MAKE_LSTATUS(FTA, ERROR, 0x0105) +# define LSTATUS_FTA_TAG_INVALID MAKE_LSTATUS(FTA, ERROR, 0x0106) + +typedef enum ftaInterruptionId_e fta_id_t; +struct pt_regs; + +/* + * ftaInterruptionTag_t + * + * ftaInterruptionTag_t is used as a handle. When ftaInterruptionSetup() + * is called it is passed the address of a variable type of ftaInterruptionTag_t. + * + * When ftaInterruptionSetup() successfully completes ftaInterruptionTag_t + * contains a valid value that can should be used as a parameter when + * ftaInterruptionClear() is called. + */ +typedef struct ftaInterruption *ftaInterruptionTag_t, *fta_tag_t; + +/* + * Special flags for this interruption handler. + */ +typedef uint64_t ftaInterruptionFlags_t; + +/* + * ftaInterruptionStage_t + * + * ftaInterruptionStage_t is used as a parameter to ftaTrapInterruptionSetup(), + * ftaFaultInterruptionSetup() and ftaAbortInterruptionSetup(). + * + * It is used to indicate during which stage the interruption handler should + * be called. For each interruption there may be a specific order in which + * different handlers should be called. The callout order is referred to as + * the stage and may be interruption specific. Providing for a stage + * definition for handlers allows the infrastructure to prioritize the callout + * order of handlers by stage type. + * + * Interruption stages as defined as follows: + * + * FTA_INTERRUPTION_NOTIFIER_ENTRY + * Frame Modification: Not Allowed + * Number Of Handlers: Multiple + * Other Notes: Entry notifier slots are provided for debug purposes. + * The handler is invoked just after the frame has been + * saved but before any other handlers are called. + * These handlers may examine the frame but may not + * modify it in any way whatsoever. Notifiers are + * maintained on a linked list and are called on a + * first linked, first called basis. + * + * FTA_INTERRUPTION_NOTIFIER_EXIT + * Frame Modification: Not Allowed + * Number Of Handlers: Multiple + * Other Notes: Exit notifier slots are provided for debug purposes. + * The handler is invoked after other handlers have + * been called and just before the stack frame is + * restored prior to a return from interruption. + * These handlers may examine the frame but may not + * modify it in any way whatsoever. Notifiers are + * maintained on a linked list and are called on a + * first linked, first called basis. + * + * FTA_INTERRUPTION_HANDLER_DEFAULT + * Frame Modification: Allowed + * Number Of Handlers: One + * Other Notes: This is the OS default handler for the interruption. + * This handler slot is reserved for OS kernel use only. + * An attempt to register for this handler slot will fail + * until the previous handler has been cleared. + * + * FTA_INTERRUPTION_HANDLER_GENERAL_PURPOSE + * Frame Modification: Allowed + * Number Of Handlers: Multiple + * Other Notes: General purpose handlers are maintained on a + * linked list and are called on a first linked, first + * called basis. When a handler of this type claims + * the interruption has been handled by its return + * status other general purpose handlers will not be + * invoked. + * + * FTA_INTERRUPTION_HANDLER_HEALTH_MONITOR + * Frame Modification: Not Allowed + * Number Of Handlers: One + * Other Notes: The health driver may perform such actions as + * monitoring the health of the system or logging + * the cause of critical errors to NVRAM prior to a + * system crash. A health handler may view the contents + * of the frame but should not modify the frame contents. + * If modification of the frame is required a separate + * general purpose handler should be registered. + * An attempt to register for this handler slot will fail + * until the previous handler has been cleared. + * + * FTA_INTERRUPTION_HANDLER_APPLICATION_DEBUGGER + * Frame Modification: Allowed + * Number Of Handlers: Multiple + * Other Notes: An application level debugger registration will + * take precedence over kernel level debuggers. + * + * FTA_INTERRUPTION_HANDLER_CORE_DEBUG_ENGINE + * Frame Modification: Allowed + * Number Of Handlers: One + * Other Notes: The intention here is to allow the CDE an early peek at the + * the frame to recover from internally generated interruptions. + * + * FTA_INTERRUPTION_PATCH_REPLACEMENT + * Frame Modification: Allowed + * Number Of Handlers: One + * Other Notes: A patch replacement handler provides a mechanism whereby + * the infrastructure for a given interruption may be + * completely replaced. The writer of this handler should + * be intimately familiar with the requirements of the + * interruption event. This slot is provided as a means + * field replacement of the interruption handling infrastructure + * may be replaced. Please see ftaGetInterruptionHandlers() + * for more information on how to find and call registered + * handlers for the given interruption ID. + * An attempt to register for this handler slot will fail + * until the previous handler has been cleared. + */ +typedef enum { + FTA_INTERRUPTION_NOTIFIER_ENTRY, + FTA_INTERRUPTION_NOTIFIER_EXIT, + FTA_INTERRUPTION_HANDLER_DEFAULT, + FTA_INTERRUPTION_HANDLER_GENERAL_PURPOSE, + FTA_INTERRUPTION_HANDLER_HEALTH_MONITOR, + FTA_INTERRUPTION_HANDLER_APPLICATION_DEBUGGER, + FTA_INTERRUPTION_HANDLER_CORE_DEBUG_ENGINE, + FTA_INTERRUPTION_PATCH_REPLACEMENT +} ftaInterruptionStage_t; + +typedef enum { + FTA_NOTIFIER_ENTRY = FTA_INTERRUPTION_NOTIFIER_ENTRY, + FTA_NOTIFIER_EXIT = FTA_INTERRUPTION_NOTIFIER_EXIT, + FTA_HANDLER_DEFAULT = FTA_INTERRUPTION_HANDLER_DEFAULT, + FTA_HANDLER_GENERAL_PURPOSE = FTA_INTERRUPTION_HANDLER_GENERAL_PURPOSE, + FTA_HANDLER_HEALTH_MONITOR = FTA_INTERRUPTION_HANDLER_HEALTH_MONITOR, + FTA_HANDLER_APPLICATION_DEBUGGER = FTA_INTERRUPTION_HANDLER_APPLICATION_DEBUGGER +} fta_stage_t; + +typedef enum { + fta_no_async, + fta_async_breakpoints, + fta_async_interrupts, + fta_async_preemption +} fta_async_level_t; + +# ifndef MODULE +void asmlinkage ftaAbandonFrame(const ftaFullInterruptionCtx_t *); +# endif + +# ifndef FTA_EXPORT +# define FTA_EXPORT(type, name, ...) type name(__VA_ARGS__) +# endif + +# else /* CONFIG_NLKD_FTA */ +# undef FTA_EXPORT +# endif /* CONFIG_NLKD_FTA */ +#endif /* _LINUX_FTA_H */ + +#ifdef FTA_EXPORT +# include + +FTA_EXPORT(LSTATUS, ftaInterruptionSetup, + ftaInterruptionId_t, + LSTATUS (*)(void *, ftaFullInterruptionCtx_t *), + void *, + ftaInterruptionFlags_t, + ftaInterruptionStage_t, + moduleId_t, + ftaInterruptionTag_t *); +FTA_EXPORT(LSTATUS, ftaInterruptionClear, ftaInterruptionTag_t); + +FTA_EXPORT(fta_async_level_t, ftaEnable, + ftaFullInterruptionCtx_t *, + fta_async_level_t); +FTA_EXPORT(const char*, ftaGetInterruptionName, + const ftaFullInterruptionCtx_t *); +FTA_EXPORT(void, ftaRestore, ftaFullInterruptionCtx_t *, fta_async_level_t); + +FTA_EXPORT(int, fta_register_handler, + fta_id_t, + int(*)(struct pt_regs *, void *), + void *, + unsigned long flags, + fta_stage_t, + moduleId_t, + fta_tag_t *); +FTA_EXPORT(int, fta_deregister_handler, fta_tag_t); + +FTA_EXPORT(fta_id_t, fta_type, const struct pt_regs *); +FTA_EXPORT(int, fta_subtype, const struct pt_regs *); +FTA_EXPORT(void, fta_subtype_set, struct pt_regs *, int); +FTA_EXPORT(int, fta_from_kernel, const struct pt_regs *); + +FTA_EXPORT(void, fta_abandon, const struct pt_regs *); +FTA_EXPORT(fta_async_level_t, fta_enable, struct pt_regs *, fta_async_level_t); +FTA_EXPORT(void, fta_restore, struct pt_regs *, fta_async_level_t); + +# undef FTA_EXPORT +#endif /* FTA_EXPORT */ Index: 2.6.14-nlkd/include/linux/lstatus.h =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ 2.6.14-nlkd/include/linux/lstatus.h 2005-06-27 12:49:22.000000000 +0200 @@ -0,0 +1,241 @@ +/***************************************************************************** + * + * File Name: lstatus.h + * Created by: Clyde Griffin + * Date created: 11/1/1998 + * + * %version: 6 % + * %derived_by: jbeulich % + * %date_modified: Mon Jun 27 04:49:11 2005 % + * + *****************************************************************************/ +/***************************************************************************** + * * + * Copyright (c) 1998-2005 Novell, Inc. All Rights Reserved. * + * * + * This program is free software; you can redistribute it and/or * + * modify it under the terms of version 2 of the GNU General Public License * + * as published by the Free Software Foundation. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, contact Novell, Inc. * + * * + * To contact Novell about this file by physical or electronic mail, * + * you may find current contact information at www.novell.com. * + * * + *****************************************************************************/ +/***************************************************************************** + * + * File Description: + * + *****************************************************************************/ + +#ifndef _LINUX_LSTATUS_H +#define _LINUX_LSTATUS_H + +#include +#ifdef __ASSEMBLY__ +# define NUINT_C(v) v +#else +# include +#endif + +/* + * The purpose of this file is to provide a common format and encoding + * scheme for API status codes. + * The status classification and naming conventions used in this file are + * as follows. + * + * LSTATUS is defined as a native unsigned return code. There are four + * parts to the status. The low bits contain the status code. The next + * portion contains the sybsystem identifier, followed by an optional + * subsystem specific unique identifier. The top bits + * The unique ID may be used in a number of ways and is subsystem + * specific. It is optional and should be zero if not used. + * + * The LSTATUS return code may be viewed as a union defined as follows: + * + * typedef union { + * struct { + * nuint_t status:N1; + * nuint_t subsystem:N2; + * nuint_t uniqueId:N3; + * nuint_t category:N4; + * } fields; + * LSTATUS status; + * } lStatus_t; + * + * Each major subsystem within may allocate a range of status codes by + * adding a #define to the classification section below. + * The convention allows for 255/65535 subsystems in the system with each + * subsystem being allowed to define up to as many as 4095/65535 unique + * status codes or errors. This should be adequate. + * + * The first subsystem known as LSTATUS_ is a general purpose + * classification to be used for smaller subsystems, components or + * stand alone APIs which do not clearly fit into a larger grouping. + * Status code additions to the general area should be carefully chosen + * and somewhat generic in flavor as another developer of a different + * component may also use that defined status/error code. + * + * In general you are encouraged to create unique classifications + * for large and middle sized subcomponents of the kernel. + * + * Status code return types are 32/64 bits in size. + * + * Nano kernel subsystems are numbered using bits 31:16. + * + * Status codes within each subsystem are defined using bits 15:0. + * + * The status codes 0-255 in each {category,subsystem} must be identical + * to those in the generic subsystem. The first unique status code in any + * given subsystem should not be less than 256. This convention will + * allow us to become familiar with return codes < 256 regardless of what + * subsystem the status code came from. + * + * We do not expect to have more that 256 generic status codes. + * + * Specific status definitions within a general classification may be + * defined in another header file more specific to the subcomponent. + * However, general subsystem classifications must be defined in this + * file and listed in numeric order. Status code definitions in the generic + * classification, LSTATUS_, must also be listed in this file. + * + * APIs returning status codes defined by this file must be declared to + * return LSTATUS. LSTATUS is defined as a nuint_t. + * + * + * Naming: + * For the purposes of providing a common look and feel, and to avoid + * naming conflicts the defined names of each status code shall follow the + * rules below. + * + * 1) The status code will be described in all capital letters with the under + * score chararacter separating descriptive words. + * + * 2) The status code will be prefixed with the classification name. + * Example: Status codes in the SCHED subclassification will begin + * with LSTATUS_SCHED. + * + * 3) The descriptive portion of the status code definition will follow the + * the general classification. + * Example: LSTATUS_SCHED_PARAMETER_INVALID. + * + */ + +#if defined(CONFIG_X86_64) || !defined(CONFIG_64BIT) +# define LSTATUS_WIDTH_STATUS 12 +# define LSTATUS_WIDTH_SUBSYSTEM 8 +# define LSTATUS_WIDTH_UNIQUEID 9 +# define LSTATUS_WIDTH_CATEGORY 3 +#else +# define LSTATUS_WIDTH_STATUS 16 +# define LSTATUS_WIDTH_SUBSYSTEM 16 +# define LSTATUS_WIDTH_UNIQUEID 28 +# define LSTATUS_WIDTH_CATEGORY 4 +#endif + +#ifndef __ASSEMBLY__ +/* ----------------------------------------------------------------------- */ +/* */ +/* ----------------------------------------------------------------------- */ +/* + * + * Use LSTATUS when declaring APIs that return status code definitions defined + * using the conventions outlined in this file. + * + * Example: LSTATUS foo(void); + */ +typedef nuint_t LSTATUS; + +typedef union { + struct { + nuint_t status:LSTATUS_WIDTH_STATUS; + nuint_t subsystem:LSTATUS_WIDTH_SUBSYSTEM; + nuint_t uniqueId:LSTATUS_WIDTH_UNIQUEID; + nuint_t category:LSTATUS_WIDTH_CATEGORY; + } fields; + LSTATUS status; +} lStatus_t; + +typedef struct { int _:sizeof(lStatus_t) <= sizeof(LSTATUS); } lStatus_Size_Assert; + +#endif /* __ASSEMBLY__ */ + +/* ----------------------------------------------------------------------- */ +/* */ +/* ----------------------------------------------------------------------- */ +/* + * Status code category classifications. + */ +#define LSTATUS_CATEGORY_SUCCESS NUINT_C(0) +#define LSTATUS_CATEGORY_INFORMATION NUINT_C(1) +#define LSTATUS_CATEGORY_NOTICE NUINT_C(2) +#define LSTATUS_CATEGORY_WARNING NUINT_C(3) +#define LSTATUS_CATEGORY_ERROR ((NUINT_C(1) << LSTATUS_WIDTH_CATEGORY) - 4) +#define LSTATUS_CATEGORY_FATAL ((NUINT_C(1) << LSTATUS_WIDTH_CATEGORY) - 1) + +/* ----------------------------------------------------------------------- */ +/* */ +/* ----------------------------------------------------------------------- */ +/* + * Status code subsystem classifications. + */ +#define LSTATUS_SUBSYS_ 0x0000 +#define LSTATUS_SUBSYS_SCHED 0x0001 +#define LSTATUS_SUBSYS_MEMORY 0x0002 +#define LSTATUS_SUBSYS_MMU 0x0003 +#define LSTATUS_SUBSYS_INTR 0x0004 +#define LSTATUS_SUBSYS_FTA 0x0005 +#define LSTATUS_SUBSYS_CPU 0x0006 +#define LSTATUS_SUBSYS_RESOURCE 0x0007 +#define LSTATUS_SUBSYS_CONSOLE 0x0008 +#define LSTATUS_SUBSYS_CIOS 0x0009 +#define LSTATUS_SUBSYS_PSM 0x000A +#define LSTATUS_SUBSYS_TIMEOUT 0x000B + + +/* ----------------------------------------------------------------------- */ +/* */ +/* ----------------------------------------------------------------------- */ +/* + * LSTATUS construction. + */ +#define MAKE_LSTATUS(sub, cat, code) \ + (((((LSTATUS_CATEGORY_##cat << LSTATUS_WIDTH_UNIQUEID) \ + << LSTATUS_WIDTH_SUBSYSTEM) | LSTATUS_SUBSYS_##sub) \ + << LSTATUS_WIDTH_STATUS) | (code)) +#define MAKE_LSTATUS_UNIQUE(sub, cat, uid, code) \ + ((((((LSTATUS_CATEGORY_##cat \ + << LSTATUS_WIDTH_UNIQUEID) | (uid)) \ + << LSTATUS_WIDTH_SUBSYSTEM) | LSTATUS_SUBSYS_##sub) \ + << LSTATUS_WIDTH_STATUS) | (code)) + +/* ----------------------------------------------------------------------- */ +/* */ +/* ----------------------------------------------------------------------- */ +/* + * LSTATUS_ classification. + * + * LSTATUS_ is a generic classification. These definitions may be used + * by small subsystems or stand alone APIs which do not require status + * code definitions within a unique range. + */ +#define LSTATUS_SUCCESS MAKE_LSTATUS(, SUCCESS, 0x0000) +#define LSTATUS_DEFERRED MAKE_LSTATUS(, SUCCESS, 0x0001) +#define LSTATUS_FAILURE MAKE_LSTATUS(, ERROR, 0x0001) +#define LSTATUS_PARAMETER_INVALID MAKE_LSTATUS(, ERROR, 0x0002) +#define LSTATUS_PARAMETER_NULL MAKE_LSTATUS(, ERROR, 0x0003) +#define LSTATUS_PARAMETER_OUT_OF_RANGE MAKE_LSTATUS(, ERROR, 0x0004) +#define LSTATUS_PARAMETER_INCORRECT_TYPE MAKE_LSTATUS(, ERROR, 0x0005) +#define LSTATUS_INVALID_MODULE_ID MAKE_LSTATUS(, ERROR, 0x0006) +#define LSTATUS_BUFFER_MISALIGNED MAKE_LSTATUS(, ERROR, 0x0007) + +#define LSTATUS_MEMORY_UNAVAILABLE MAKE_LSTATUS(MEMORY, ERROR, 0x0000) + +#endif /* _LINUX_LSTATUS_H */ Index: 2.6.14-nlkd/include/linux/module-id.h =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ 2.6.14-nlkd/include/linux/module-id.h 2005-06-27 12:49:47.000000000 +0200 @@ -0,0 +1,53 @@ +/***************************************************************************** + * + * File Name: module-id.h + * Created by: Clyde Griffin + * Date created: 11/1/1998 + * + * %version: 5 % + * %derived_by: jbeulich % + * %date_modified: Mon Jun 27 04:49:36 2005 % + * + *****************************************************************************/ +/***************************************************************************** + * * + * Copyright (c) 1998-2005 Novell, Inc. All Rights Reserved. * + * * + * This program is free software; you can redistribute it and/or * + * modify it under the terms of version 2 of the GNU General Public License * + * as published by the Free Software Foundation. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, contact Novell, Inc. * + * * + * To contact Novell about this file by physical or electronic mail, * + * you may find current contact information at www.novell.com. * + * * + *****************************************************************************/ +/***************************************************************************** + * + * File Description: + * + *****************************************************************************/ + +#ifndef _LINUX_MODULE_ID_H +#define _LINUX_MODULE_ID_H + +typedef struct module * moduleId_t; + +/* Since THIS_MODULE is NULL for components not built as module, and + since we need a non-NULL unique per-component ID in various places, + we fake things here. */ +#ifdef MODULE +extern struct module __this_module; +# define THIS_MODULE_ID(ident) const moduleId_t ident = &__this_module +#else +# define THIS_MODULE_ID(ident) const moduleId_t ident = (moduleId_t)&ident +#endif + +#endif /* _LINUX_MODULE_ID_H */ Index: 2.6.14-nlkd/include/linux/nint.h =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ 2.6.14-nlkd/include/linux/nint.h 2005-06-27 14:05:48.000000000 +0200 @@ -0,0 +1,240 @@ +/***************************************************************************** + * + * File Name: nint.h + * Created by: Clyde Griffin + * Date created: 11/1/1998 + * + * %version: 5 % + * %derived_by: jbeulich % + * %date_modified: Mon Jun 27 04:50:01 2005 % + * + *****************************************************************************/ +/***************************************************************************** + * * + * Copyright (c) 1998-2005 Novell, Inc. All Rights Reserved. * + * * + * This program is free software; you can redistribute it and/or * + * modify it under the terms of version 2 of the GNU General Public License * + * as published by the Free Software Foundation. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, contact Novell, Inc. * + * * + * To contact Novell about this file by physical or electronic mail, * + * you may find current contact information at www.novell.com. * + * * + *****************************************************************************/ +/***************************************************************************** + * + * File Description: + * + *****************************************************************************/ + +#ifndef _LINUX_NINT_H +#define _LINUX_NINT_H + +#include +#include +#include +#include /* for wchar_t */ + +/* + * Alignment Macros for LoHi Machine Types + */ +#ifndef STRICT_ALIGNMENT +# if defined(_M_IX86) || defined(__i386__) \ + || defined(_M_AMD64) || defined(__x86_64__) +# define STRICT_ALIGNMENT 0 +# else +# define STRICT_ALIGNMENT 1 +# endif +#endif +#ifndef UNALIGNED_SUPPORT +# if defined(__INTEL_COMPILER) || (defined(_MSC_VER) && defined(_M_IA64)) +# define UNALIGNED_SUPPORT __unaligned +# elif !STRICT_ALIGNMENT +# define UNALIGNED_SUPPORT +# endif +#endif + +#if defined(_M_IA64) || defined(__ia64__) + +# define NATIVE_APPEND_(p) p##64 +# define NATIVE_EMBED_(p, s) p##64##s +# define PHYSADDR_APPEND_(p) p##64 +# define PHYSADDR_EMBED_(p, s) p##64##s + +#elif defined(_M_IX86) || defined(__i386__) \ + || defined(_M_AMD64) || defined(__x86_64__) + +# define NATIVE_APPEND_(p) p##32 +# define NATIVE_EMBED_(p, s) p##32##s +# define PHYSADDR_APPEND_(p) p##64 +# define PHYSADDR_EMBED_(p, s) p##64##s + +#elif !defined(NATIVE_APPEND_) || !defined(NATIVE_EMBED_) || !defined(PHYSADDR_APPEND_) || !defined(PHYSADDR_EMBED_) +# error Unimplemented! +#endif + +#ifdef CONFIG_64BIT +# define POINTER_APPEND_(p) p##64 +# define POINTER_EMBED_(p, s) p##64##s +#else +# define POINTER_APPEND_(p) p##32 +# define POINTER_EMBED_(p, s) p##32##s +#endif + +typedef POINTER_EMBED_(int, _t) intptr_t; +typedef POINTER_EMBED_(uint, _t) uintptr_t; +typedef NATIVE_EMBED_(int, _t) nint_t; +typedef NATIVE_EMBED_(uint, _t) nuint_t; +typedef PHYSADDR_EMBED_(uint, _t) physaddr_t; + +#if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) +# ifndef INT32_MAX +# define INT8_MAX INT8_C (0x7f) +# define INT8_MIN (-INT8_MAX-1) +# define INT16_MAX INT16_C(0x7fff) +# define INT16_MIN (-INT16_MAX-1) +# define INT32_MAX INT32_C(0x7fffffff) +# define INT32_MIN (-INT32_MAX-1) +# define INT64_MAX INT64_C(0x7fffffffffffffff) +# define INT64_MIN (-INT64_MAX-1) +# endif +# ifndef UINT32_MAX +# define UINT8_MAX UINT8_C (0xff) +# define UINT16_MAX UINT16_C(0xffff) +# define UINT32_MAX UINT32_C(0xffffffff) +# define UINT64_MAX UINT64_C(0xffffffffffffffff) +# endif +# define INTPTR_MIN POINTER_EMBED_(INT, _MIN) +# define INTPTR_MAX POINTER_EMBED_(INT, _MAX) +# define UINTPTR_MAX POINTER_EMBED_(UINT, _MAX) +# define NINT_MIN NATIVE_EMBED_(INT, _MIN) +# define NINT_MAX NATIVE_EMBED_(INT, _MAX) +# define NUINT_MAX NATIVE_EMBED_(UINT, _MAX) +# define PHYSADDR_MAX PHYSADDR_EMBED_(UINT, _MAX) +#endif + +#if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) +# ifndef INT32_C +# define INT8_C(n) (n) +# define INT16_C(n) (n) +# define INT32_C(n) (n) +# define INT64_C(n) (n##LL) +# endif +# ifndef UINT32_C +# define UINT8_C(n) (n) +# define UINT16_C(n) (n) +# define UINT32_C(n) (n##U) +# define UINT64_C(n) (n##ULL) +# endif +# define INTPTR_C POINTER_EMBED_(INT, _C) +# define UINTPTR_C POINTER_EMBED_(UINT, _C) +# define NINT_C NATIVE_EMBED_(INT, _C) +# define NUINT_C NATIVE_EMBED_(UINT, _C) +# define PHYSADDR_C PHYSADDR_EMBED_(UINT, _C) +#endif + +#if !defined(__cplusplus) || defined(__STDC_FORMAT_MACROS) +# ifndef PRId32 +# define PRI_8(t) #t +# define PRId8 PRI_8(d) +# define PRIi8 PRI_8(i) +# define PRIo8 PRI_8(o) +# define PRIu8 PRI_8(u) +# define PRIx8 PRI_8(x) +# define PRIX8 PRI_8(X) + +# define PRI_16(t) #t +# define PRId16 PRI_16(d) +# define PRIi16 PRI_16(i) +# define PRIo16 PRI_16(o) +# define PRIu16 PRI_16(u) +# define PRIx16 PRI_16(x) +# define PRIX16 PRI_16(X) + +# define PRI_32(t) #t +# define PRId32 PRI_32(d) +# define PRIi32 PRI_32(i) +# define PRIo32 PRI_32(o) +# define PRIu32 PRI_32(u) +# define PRIx32 PRI_32(x) +# define PRIX32 PRI_32(X) + +# define PRI_64(t) "L"#t +# define PRId64 PRI_64(d) +# define PRIi64 PRI_64(i) +# define PRIo64 PRI_64(o) +# define PRIu64 PRI_64(u) +# define PRIx64 PRI_64(x) +# define PRIX64 PRI_64(X) + +# endif +# define NPRId NATIVE_APPEND_(PRId) +# define NPRIi NATIVE_APPEND_(PRIi) +# define NPRIo NATIVE_APPEND_(PRIo) +# define NPRIu NATIVE_APPEND_(PRIu) +# define NPRIx NATIVE_APPEND_(PRIx) +# define NPRIX NATIVE_APPEND_(PRIX) +# define NSCNd NATIVE_APPEND_(SCNd) +# define NSCNi NATIVE_APPEND_(SCNi) +# define NSCNo NATIVE_APPEND_(SCNo) +# define NSCNu NATIVE_APPEND_(SCNu) +# define NSCNx NATIVE_APPEND_(SCNx) +# define PPRId PHYSADDR_APPEND_(PRId) +# define PPRIi PHYSADDR_APPEND_(PRIi) +# define PPRIo PHYSADDR_APPEND_(PRIo) +# define PPRIu PHYSADDR_APPEND_(PRIu) +# define PPRIx PHYSADDR_APPEND_(PRIx) +# define PPRIX PHYSADDR_APPEND_(PRIX) +# define PSCNd PHYSADDR_APPEND_(SCNd) +# define PSCNi PHYSADDR_APPEND_(SCNi) +# define PSCNo PHYSADDR_APPEND_(SCNo) +# define PSCNu PHYSADDR_APPEND_(SCNu) +# define PSCNx PHYSADDR_APPEND_(SCNx) +#endif + +#define GETPTR(addr) POINTER_APPEND_(GET)(addr) +#define PUTPTR(n, addr) POINTER_APPEND_(PUT)(n, addr) +#define GETN(addr) NATIVE_APPEND_(GET)(addr) +#define PUTN(n, addr) NATIVE_APPEND_(PUT)(n, addr) +#define GETPHYS(addr) PHYSADDR_APPEND_(GET)(addr) +#define PUTPHYS(pa, addr) PHYSADDR_APPEND_(PUT)(pa, addr) + +/* + * Define a type suitable for forcing 128-bit (16-byte) structure alignment + */ +#if defined(__INTEL_COMPILER) + +typedef long long __m128; +typedef __m128 align128_t; + +#elif defined(__ECL) + +typedef __int128 align128_t; + +#elif defined(__GNUC__) + +typedef struct { + char _; +} align128_t __attribute__((__aligned__(16))); + +#endif + +typedef union { +#if defined(_M_IA64) || defined(__ia64__) + align128_t fp128; +#endif + struct { + uint64_t loflt; + uint64_t hiflt; + } real_fp; +} float128_t; + +#endif /* _LINUX_NINT_H */ Index: 2.6.14-nlkd/include/linux/nlkd.h =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ 2.6.14-nlkd/include/linux/nlkd.h 2005-11-03 12:04:12.000000000 +0100 @@ -0,0 +1,241 @@ +/***************************************************************************** + * + * File Name: nlkd.h + * Created by: Jan Beulich + * %version: 17 % + * %derived_by: jbeulich % + * %date_modified: Thu Nov 03 04:03:57 2005 % + * + *****************************************************************************/ +/***************************************************************************** + * * + * Copyright (c) 1999-2005 Novell, Inc. All Rights Reserved. * + * * + * This program is free software; you can redistribute it and/or * + * modify it under the terms of version 2 of the GNU General Public License * + * as published by the Free Software Foundation. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, contact Novell, Inc. * + * * + * To contact Novell about this file by physical or electronic mail, * + * you may find current contact information at www.novell.com. * + * * + *****************************************************************************/ +/***************************************************************************** + * + * File Description: + * + *****************************************************************************/ + +#include + +#ifndef DEBUG_EVENT_ENTER_DEBUGGER +# define DEBUG_EVENT_ENTER_DEBUGGER 0 + +/* negative values are error conditions */ +# define DEBUG_EVENT_PANIC (-1) +# define DEBUG_EVENT_ASSERT (-2) + +/* positive values are informational */ +# define DEBUG_EVENT_MESSAGE 1 +# define DEBUG_EVENT_MODULE_LOAD 2 +# define DEBUG_EVENT_MODULE_UNLOAD 3 +# define DEBUG_EVENT_THREAD_CREATE 4 +# define DEBUG_EVENT_THREAD_DESTROY 5 + +# ifndef __ASSEMBLY__ +# ifdef CONFIG_NLKD + +# include +# include + +asmlinkage void nlkdAssert(const char*string, + const char*file, + const char*func, + unsigned line); +asmlinkage void nlkdDebugEvent(int eventCode, ...); +asmlinkage void nlkdEnterDebugger(void); +asmlinkage void nlkdPanic(const char*, ...); +struct ftaInterruptionCtx_s; +int nlkdIsDebugEvent(const struct ftaInterruptionCtx_s*); +# ifndef CONFIG_NLKD_FTA +void nlkdSetDebugEventType(struct ftaInterruptionCtx_s*); +# endif + +# if defined(__GNUC__) +# define rtASSERT(e) ((void)(likely(e) || (nlkdAssert(#e, __FILE__, __PRETTY_FUNCTION__, __LINE__), 0))) +# elif __STDC_VERSION__ >= 199901L +# define rtASSERT(e) ((void)(likely(e) || (nlkdAssert(#e, __FILE__, __func__, __LINE__), 0))) +# else +# define rtASSERT(e) ((void)(likely(e) || (nlkdAssert(#e, __FILE__, NULL, __LINE__), 0))) +# endif + +# else /* CONFIG_NLKD */ + +# include + +static inline void nlkdDebugEvent(int eventCode, ...) {} +# define nlkdPanic panic + +# endif /* CONFIG_NLKD */ +# endif /* !__ASSEMBLY__ */ +#endif /* DEBUG_EVENT_xxx */ + +#ifndef _LINUX_NLKD_H +#define _LINUX_NLKD_H +# ifndef __ASSEMBLY__ + +# ifdef CONFIG_NLKD + +# include +# include +# include +# include + +void nlkd_init(void); +void nlkd_init_done(void); + +# define NLKD_EXT_ID_MAX 32 + +typedef void nlkdExtHandler_t(void*context, const char*command); + +void nlkdExtInputString(char*buffer, nuint_t bufferSize); +void nlkdExtOutputString(const char*); +int nlkdExtPrintf(const char*, ...) __attribute__((__format__(__printf__, 1, 2))); +LSTATUS nlkdExtRegister(const char*id, + nlkdExtHandler_t*, + void*handlerContext, + moduleId_t, + const char*description, + nuint_t flags); +LSTATUS nlkdExtUnregister(const char*id, moduleId_t); +int nlkdExtVprintf(const char*, va_list); + +# ifndef MODULE +/* For code needing no initialization (e.g. printk), provide a way to store + the handler information without the need to call nlkdExtRegister(). */ +typedef const struct { + const char*id; + nlkdExtHandler_t*handler; + void*handlerContext; + const moduleId_t*pModuleId; + const char*description; + nuint_t flags; +} nlkdExtension_t; +# define NLKD_EXTENSION(id, handler, ctx, mod, descr, flg) \ + static nlkdExtension_t __nlkd_ext_##id \ + __attribute__((__section__(".nlkd.ext"))) \ + __attribute__((__aligned__(sizeof(void*)))) \ + __attribute_used__ = { \ + #id, handler, ctx, &mod, descr, flg \ + } +# endif + +struct pt_regs; +struct cdeBPStruct_s; + +# ifdef CONFIG_CDE +# define MAYBE_INDIR(x) cdeBP##x +# else +# define MAYBE_INDIR(x) (*x) +extern struct nlkdBPXface_s { +# endif + +/* + * + */ +void MAYBE_INDIR(Load)( + void); + +/* + * + */ +void MAYBE_INDIR(EnvClearAll)( + struct cdeBPStruct_s * * bpHead); + +/* + * + */ +void MAYBE_INDIR(EnvDisableAll)( + const struct cdeBPStruct_s * const * bpHead); + +/* + * + */ +void MAYBE_INDIR(EnvEnableAll)( + const struct cdeBPStruct_s * const * bpHead); + +/* + * + */ +int MAYBE_INDIR(EnvCheckAll)( + const struct pt_regs *, + const struct cdeBPStruct_s * const * bpHead); + +# undef MAYBE_INDIR +# ifndef CONFIG_CDE +} const * nlkdBPXface; +# endif + +# else + +# define nlkd_init() +# define nlkd_init_done() + +# endif + +# ifndef bp_list_handle +# if defined(CONFIG_CDE) +# define bp_list_handle(what, cond, obj) ((cond) \ + ? cdeBPEnv##what##All(&(obj)->bpList) \ + : (void)(obj)) +# define bp_list_clear(obj) bp_list_handle(Clear, (obj)->bpList, obj) +# define bp_list_check(regs, obj) ((obj)->bpList \ + ? cdeBPEnvCheckAll(regs, &(obj)->bpList) \ + : ((void)(regs), (void)(obj), -1)) +# define bp_load() cdeBPLoad() +# elif defined(CONFIG_NLKD) +# define bp_list_handle(what, cond, obj) ((cond) && nlkdBPXface \ + ? nlkdBPXface->Env##what##All(&(obj)->bpList) \ + : (void)(obj)) +# define bp_list_clear(obj) bp_list_handle(Clear, (obj)->bpList, obj) +# define bp_list_check(regs, obj) ((obj)->bpList && nlkdBPXface \ + ? nlkdBPXface->EnvCheckAll(regs, &(obj)->bpList) \ + : ((void)(regs), (void)(obj), 0)) +# define bp_load() (nlkdBPXface ? nlkdBPXface->Load() : (void)0) +# else +# define bp_list_handle(what, cond, obj) ((void)(cond), (void)(obj)) +# define bp_list_clear(obj) ((void)(obj)) +# define bp_list_check(regs, obj) ((void)(regs), (void)(obj), -1) +# define bp_load() ((void)0) +# endif +# define bp_list_disable(cond, obj) bp_list_handle(Disable, cond, obj) +# define bp_list_enable(cond, obj) bp_list_handle(Enable, cond, obj) +# endif + +# define ctASSERT_GLUE(x, y) x##y +# define ctASSERT_NAME(tag) ctASSERT_GLUE(_ctassert_, tag) +# define CTASSERT_DECL(e) struct ctASSERT_NAME(__LINE__) {unsigned _:!!(e);} +# define CTASSERT_TYPED_EXPR(t, e) ((t)sizeof(char[1 - 2 * !(e)])) +# define CTASSERT_EXPR(e) CTASSERT_TYPED_EXPR(void, e) + +# endif /* __ASSEMBLY__ */ +#endif /* _LINUX_NLKD_H */ + +#undef RTASSERT +#undef RTVERIFY +#ifndef __ASSEMBLY__ +# if !defined(CONFIG_NLKD) || !defined(CONFIG_DEBUG_KERNEL) || defined(NDEBUG) +# define RTASSERT(e) ((void)0) +# define RTVERIFY(e) ((void)(e)) +# else +# define RTASSERT rtASSERT +# define RTVERIFY rtASSERT +# endif +#endif /* !__ASSEMBLY__ */