From: Aravinda Prasad <aravinda@linux.vnet.ibm.com>
To: kexec@lists.infradead.org
Cc: ananth@in.ibm.com, mahesh@linux.vnet.ibm.com,
LChouinard@s2sys.com, tachibana@mxm.nes.nec.co.jp,
kumagai-atsushi@mxc.nes.nec.co.jp, buendgen@de.ibm.com
Subject: [PATCH 1/7] Initialize and setup eppic
Date: Wed, 06 Jun 2012 15:34:48 +0530 [thread overview]
Message-ID: <20120606100448.12534.22340.stgit@aravinda> (raw)
In-Reply-To: <20120606095709.12534.63967.stgit@aravinda>
This patch contains routines which initialize eppic and register call
back function which will be called whenever a new eppic macro is loaded
using eppic_load() API. The registered call back function executes the
eppic macro as soon as it is loaded.
The -ltinfo is included in LIBS in the Makefile, because eppic
currently calls few functions in libtinfo and the compiler complains
about it, if not included. I think the paths where libeppic calls
libtinfo functions are not exercised by makedumpfile.
Including -ltinfo will increase the size of makedumpfile static
version
TODO:
- Check out a way to get rid of -ltinfo
Signed-off-by: Aravinda Prasad <aravinda@linux.vnet.ibm.com>
---
Makefile | 6 ++--
extension_eppic.c | 84 +++++++++++++++++++++++++++++++++++++++++++++++++++++
extension_eppic.h | 23 +++++++++++++++
3 files changed, 110 insertions(+), 3 deletions(-)
create mode 100644 extension_eppic.c
create mode 100644 extension_eppic.h
diff --git a/Makefile b/Makefile
index 7337c58..bdfdbab 100644
--- a/Makefile
+++ b/Makefile
@@ -40,12 +40,12 @@ CFLAGS_ARCH += -m32
endif
SRC = makedumpfile.c makedumpfile.h diskdump_mod.h sadump_mod.h sadump_info.h
-SRC_PART = print_info.c dwarf_info.c elf_info.c erase_info.c sadump_info.c
-OBJ_PART = print_info.o dwarf_info.o elf_info.o erase_info.o sadump_info.o
+SRC_PART = print_info.c dwarf_info.c elf_info.c erase_info.c sadump_info.c extension_eppic.c
+OBJ_PART = print_info.o dwarf_info.o elf_info.o erase_info.o sadump_info.o extension_eppic.o
SRC_ARCH = arch/arm.c arch/x86.c arch/x86_64.c arch/ia64.c arch/ppc64.c arch/s390x.c arch/ppc.c
OBJ_ARCH = arch/arm.o arch/x86.o arch/x86_64.o arch/ia64.o arch/ppc64.o arch/s390x.o arch/ppc.o
-LIBS = -ldw -lbz2 -lebl -ldl -lelf -lz
+LIBS = -ldw -lbz2 -lebl -ldl -lelf -lz -leppic -ltinfo
ifneq ($(LINKTYPE), dynamic)
LIBS := -static $(LIBS)
endif
diff --git a/extension_eppic.c b/extension_eppic.c
new file mode 100644
index 0000000..f6c7ff1
--- /dev/null
+++ b/extension_eppic.c
@@ -0,0 +1,84 @@
+/*
+ * extension_eppic.c
+ *
+ * Created by: Aravinda Prasad <aravinda@linux.vnet.ibm.com>
+ *
+ * Copyright (C) 2012 IBM Corporation
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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.
+ */
+#include <stdio.h>
+#include <string.h>
+#include <sys/types.h>
+#include <fcntl.h>
+
+#include "extension_eppic.h"
+
+/*
+ * Most of the functions included in this file performs similar
+ * functionality as in the applications/crash/eppic.c file part of
+ * eppic, but uses DWARF instead of gdb. Few of the functions are
+ * reused directly which are acknowledged in the comment before the
+ * function.
+ */
+
+/*
+ * This is the call back function called when a new eppic macro is
+ * loaded. This will execute the loaded eppic macro.
+ *
+ * "fname" is considered as the entry point of an eppic macro only if
+ * the following functions are defined:
+ *
+ * fname_help()
+ * fname_usage()
+ *
+ * These functions have no relevance in makedumpfile context as
+ * makedumpfile automatically executes the eppic macro by calling the
+ * entry point and user will not have any option to execute the usage
+ * or help functions. However they are required to identify the entry
+ * points in the eppic macro.
+ */
+void
+reg_callback(char *name, int load)
+{
+ char fname[MAX_SYMNAMELEN];
+
+ /* Nothing to process for unload request */
+ if (!load)
+ return;
+
+ snprintf(fname, sizeof(fname), "%s_help", name);
+ if (eppic_chkfname(fname, 0)) {
+ snprintf(fname, sizeof(fname), "%s_usage", name);
+ if(eppic_chkfname(fname, 0))
+ eppic_cmd(name, NULL, 0);
+ }
+ return;
+}
+
+
+/* Initialize eppic */
+int
+eppic_init()
+{
+ if (eppic_open() >= 0) {
+
+ /* Register call back functions */
+ eppic_apiset(NULL, 3, sizeof(long), 0);
+
+ /* set the new function callback */
+ eppic_setcallback(reg_callback);
+
+ return 0;
+ }
+ return 1;
+}
+
diff --git a/extension_eppic.h b/extension_eppic.h
new file mode 100644
index 0000000..ca74ce4
--- /dev/null
+++ b/extension_eppic.h
@@ -0,0 +1,23 @@
+/*
+ * extension_eppic.h
+ *
+ * Created by: Aravinda Prasad <aravinda@linux.vnet.ibm.com>
+ *
+ * Copyright (C) 2012 IBM Corporation
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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.
+ */
+#ifndef _EXTENSION_EPPIC_H
+#define _EXTENSION_EPPIC_H
+
+#include "eppic_api.h"
+
+#endif /* _EXTENSION_EPPIC_H */
_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec
next prev parent reply other threads:[~2012-06-06 10:05 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-06 10:04 [PATCH 0/7] makedumpfile security key filtering with eppic Aravinda Prasad
2012-06-06 10:04 ` Aravinda Prasad [this message]
2012-06-06 10:05 ` [PATCH 2/7] makedumpfile and eppic interface layer Aravinda Prasad
2012-06-06 10:05 ` [PATCH 3/7] Eppic call back functions to query a dump image Aravinda Prasad
2012-06-06 10:06 ` [PATCH 4/7] Implement apigetctype call back function Aravinda Prasad
2012-10-29 8:06 ` Atsushi Kumagai
2012-06-06 10:06 ` [PATCH 5/7] Implement apimember and apigetrtype call back functions Aravinda Prasad
2012-06-06 10:06 ` [PATCH 6/7] Extend eppic built-in functions to include memset function Aravinda Prasad
2012-06-06 10:07 ` [PATCH 7/7] Support fully typed symbol access mode Aravinda Prasad
2012-06-11 8:44 ` [PATCH 0/7] makedumpfile security key filtering with eppic Atsushi Kumagai
2012-08-16 6:25 ` Aravinda Prasad
2012-08-17 4:16 ` Atsushi Kumagai
2012-10-12 5:29 ` Mahesh Jagannath Salgaonkar
2012-10-15 4:46 ` Atsushi Kumagai
2012-10-15 7:04 ` Aravinda Prasad
2012-10-29 8:06 ` Atsushi Kumagai
2012-10-29 10:15 ` Aravinda Prasad
2012-10-31 4:21 ` Atsushi Kumagai
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20120606100448.12534.22340.stgit@aravinda \
--to=aravinda@linux.vnet.ibm.com \
--cc=LChouinard@s2sys.com \
--cc=ananth@in.ibm.com \
--cc=buendgen@de.ibm.com \
--cc=kexec@lists.infradead.org \
--cc=kumagai-atsushi@mxc.nes.nec.co.jp \
--cc=mahesh@linux.vnet.ibm.com \
--cc=tachibana@mxm.nes.nec.co.jp \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).