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 3/7] Eppic call back functions to query a dump image
Date: Wed, 06 Jun 2012 15:35:37 +0530 [thread overview]
Message-ID: <20120606100537.12534.61261.stgit@aravinda> (raw)
In-Reply-To: <20120606095709.12534.63967.stgit@aravinda>
This patch implements a series of apigetuint* call back functions
which are used to access data from the dump image. Eppic uses these
call back functions to fetch the actual value of the global variables.
This patch also adds other call back functions as a place holder which
will be implemented in later patches. This is mainly to avoid
compilation error while registering the call back functions using
eppic_apiset() function.
Signed-off-by: Aravinda Prasad <aravinda@linux.vnet.ibm.com>
---
extension_eppic.c | 128 +++++++++++++++++++++++++++++++++++++++++++++++++++++
extension_eppic.h | 50 ++++++++++++++++++++-
2 files changed, 176 insertions(+), 2 deletions(-)
diff --git a/extension_eppic.c b/extension_eppic.c
index f6c7ff1..2c01fdf 100644
--- a/extension_eppic.c
+++ b/extension_eppic.c
@@ -20,6 +20,7 @@
#include <sys/types.h>
#include <fcntl.h>
+#include "makedumpfile.h"
#include "extension_eppic.h"
/*
@@ -64,6 +65,131 @@ reg_callback(char *name, int load)
return;
}
+/*
+ * Call back functions for eppic to query the dump image
+ */
+
+static int
+apigetmem(ull iaddr, void *p, int nbytes)
+{
+ return readmem(VADDR, iaddr, p, nbytes);
+}
+
+static int
+apiputmem(ull iaddr, void *p, int nbytes)
+{
+ return 1;
+}
+
+static char *
+apimember(char *mname, ull pidx, type_t *tm,
+ member_t *m, ull *lidx)
+{
+ return 0;
+}
+
+static int
+apigetctype(int ctype, char *name, type_t *tout)
+{
+ return 0;
+}
+
+static char *
+apigetrtype(ull idx, type_t *t)
+{
+ return "";
+}
+
+static int
+apialignment(ull idx)
+{
+ return 0;
+}
+
+int
+apigetval(char *name, ull *val, VALUE_S *value)
+{
+ ull ptr = 0;
+
+ ptr = get_symbol_addr(name);
+ if (!ptr)
+ return 0;
+
+ *val = ptr;
+ return 1;
+}
+
+static enum_t *
+apigetenum(char *name)
+{
+ return 0;
+}
+
+static def_t *
+apigetdefs(void)
+{
+ return 0;
+}
+
+static uint8_t
+apigetuint8(void *ptr)
+{
+ uint8_t val;
+ if (!readmem(VADDR, (unsigned long)ptr, (char *)&val, sizeof val))
+ return (uint8_t) -1;
+ return val;
+}
+
+static uint16_t
+apigetuint16(void *ptr)
+{
+ uint16_t val;
+ if (!readmem(VADDR, (unsigned long)ptr, (char *)&val, sizeof val))
+ return (uint16_t) -1;
+ return val;
+}
+
+static uint32_t
+apigetuint32(void *ptr)
+{
+ uint32_t val;
+ if (!readmem(VADDR, (unsigned long)ptr, (char *)&val, sizeof val))
+ return (uint32_t) -1;
+ return val;
+}
+
+static uint64_t
+apigetuint64(void *ptr)
+{
+ uint64_t val;
+ if (!readmem(VADDR, (unsigned long)ptr, (char *)&val, sizeof val))
+ return (uint64_t) -1;
+ return val;
+}
+
+static char *
+apifindsym(char *p)
+{
+ return NULL;
+}
+
+apiops icops = {
+ apigetmem,
+ apiputmem,
+ apimember,
+ apigetctype,
+ apigetrtype,
+ apialignment,
+ apigetval,
+ apigetenum,
+ apigetdefs,
+ apigetuint8,
+ apigetuint16,
+ apigetuint32,
+ apigetuint64,
+ apifindsym
+};
+
/* Initialize eppic */
int
@@ -72,7 +198,7 @@ eppic_init()
if (eppic_open() >= 0) {
/* Register call back functions */
- eppic_apiset(NULL, 3, sizeof(long), 0);
+ eppic_apiset(&icops, 3, sizeof(long), 0);
/* set the new function callback */
eppic_setcallback(reg_callback);
diff --git a/extension_eppic.h b/extension_eppic.h
index 67efd11..45f4028 100644
--- a/extension_eppic.h
+++ b/extension_eppic.h
@@ -22,5 +22,53 @@
int eppic_init(void); /* Eppic initialize */
-#endif /* _EXTENSION_EPPIC_H */
+/*
+ * MEMBER_S, ENUM_S, DEF_S and TYPE_S are extracts from eppic header
+ * file eppic.h. The reason for not including the eppic.h header file
+ * in this file is because, lot of things in eppic.h are not required
+ * for makedumpfile extension.
+ */
+
+/* member information */
+typedef MEMBER_S {
+
+ char *name;
+ int offset; /* offset from top of structure */
+ int size; /* size in bytes of the member or of the bit array */
+ int fbit; /* fist bit (-1) is not a bit field */
+ int nbits; /* number of bits for this member */
+ int value; /* for a enum member, the corresponding value_t */
+
+} member_t;
+
+/* list to hold enum constant information */
+typedef ENUM_S {
+ struct enum_s *next;
+ char *name;
+ int value;
+
+} enum_t;
+
+/* list of macro symbols and there corresponding value_ts */
+typedef DEF_S {
+ struct def_s * next;
+ char *name;
+ char *val;
+
+} def_t;
+
+
+typedef TYPE_S {
+ int type; /* type_t of type_t */
+ ull idx; /* index to basetype_t or ctype_t */
+ int size; /* size of this item */
+ /* ... next fields are use internally */
+ int typattr; /* base type_t qualifiers */
+ int ref; /* level of reference */
+ int fct; /* 1 if function pointer */
+ int *idxlst; /* points to list of indexes if array */
+ ull rtype; /* type_t a reference refers too */
+} type_t;
+
+#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:06 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 ` [PATCH 1/7] Initialize and setup eppic Aravinda Prasad
2012-06-06 10:05 ` [PATCH 2/7] makedumpfile and eppic interface layer Aravinda Prasad
2012-06-06 10:05 ` Aravinda Prasad [this message]
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=20120606100537.12534.61261.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).