On Thu, 28 Sep 2000, Keith Owens wrote:
> http://oss.sgi.com/projects/kdb/download/ix86/ contains a patch for kdb
> v1.5-beta2 against 2.4.0-test9-pre7.
Hi Keith,
Just 5 minutes ago I made a patch for you against beta1 :(
Maybe it still applies to beta2, otherwise I can redo it on beta2.
Basically, I suggest to move kdb_vmlist_check() out of vmalloc.c because
it makes kdb patch less intrusive into non-kdb-specific code. I mentioned
this to Scott ages ago but he thinks it is better to stay inside vmalloc.c
in case vmlist semantics (or anything else relevant, in vmalloc.c)
changes. I disagree, not sure about you - hence the patch below. Also,
your latest kdb patch is part of my "vx-linux patch" (i.e. everything
needed for VERITAS Linux kernel work) and thus it is easier for me to keep
maintaining it when it touches as few common files as possible.
Regards,
Tigran
diff -urN -X dontdiff linux-kdb-keith/arch/i386/kdb/kdbasupport.c
linux-kdb/arch/i386/kdb/kdbasupport.c
--- linux-kdb-keith/arch/i386/kdb/kdbasupport.c Thu Sep 28 12:56:31 2000
+++ linux-kdb/arch/i386/kdb/kdbasupport.c Thu Sep 28 12:54:15 2000
@@ -27,6 +27,7 @@
#include <linux/init.h>
#include <linux/ptrace.h>
#include <linux/mm.h>
+#include <linux/vmalloc.h>
#include <linux/sched.h>
#include <linux/kdb.h>
#include <linux/kdbprivate.h>
@@ -35,7 +36,7 @@
#include <asm/msr.h>
#include <asm/uaccess.h>
-char *kdb_diemsg = NULL;
+char *kdb_diemsg;
/*
@@ -1223,6 +1224,51 @@
kdb_printf(" to: ");
kdb_symbol_print(to, NULL, KDB_SP_DEFAULT);
kdb_printf("\n");
+}
+
+/* kdb_vmlist_check
+ * Check to determine if an address is within a vmalloced range.
+ * Parameters:
+ * starta -- Starting address of region to check
+ * enda -- Ending address of region to check
+ * Returns:
+ * 0 -- [starta,enda] not within a vmalloc area
+ * 1 -- [starta,enda] within a vmalloc area
+ * Locking:
+ * None.
+ * Remarks:
+ * Shouldn't acquire locks. Always called with all interrupts
+ * disabled and other cpus halted. Yet, if a breakpoint or fault
+ * occurs while the vmlist is in an indeterminate state, this
+ * function could fail.
+ */
+static int
+kdb_vmlist_check(unsigned long starta, unsigned long enda)
+{
+ struct vm_struct *vp;
+
+ if (vmlist) {
+ for(vp=vmlist; vp; vp = vp->next) {
+ unsigned long end = (unsigned long)vp->addr + vp->size;
+
+ end -= PAGE_SIZE; /* Unbias for guard page */
+
+ if ((starta >= (unsigned long)vp->addr)
+ && (starta < end)
+ && (enda < end)) {
+ return 1;
+ }
+ }
+ }
+ else {
+ /* early kdb, no vmlist yet */
+ extern char _text, _end;
+ if (starta >= (unsigned long) &_text &&
+ enda < (unsigned long) &_end &&
+ starta <= enda)
+ return 1;
+ }
+ return 0;
}
/*
diff -urN -X dontdiff linux-kdb-keith/include/linux/kdb.h
linux-kdb/include/linux/kdb.h
--- linux-kdb-keith/include/linux/kdb.h Thu Sep 28 12:56:31 2000
+++ linux-kdb/include/linux/kdb.h Thu Sep 28 12:45:48 2000
@@ -210,12 +210,6 @@
extern int kdba_callback_debug(struct pt_regs *, int, long, void *);
/*
- * Determine if a kernel address is valid or not.
- */
-
-extern int kdb_vmlist_check(unsigned long, unsigned long);
-
- /*
* Routine for debugging the debugger state.
*/
diff -urN -X dontdiff linux-kdb-keith/kdb/gen-kdb_cmds.c
linux-kdb/kdb/gen-kdb_cmds.c
--- linux-kdb-keith/kdb/gen-kdb_cmds.c Thu Jan 1 01:00:00 1970
+++ linux-kdb/kdb/gen-kdb_cmds.c Thu Sep 28 12:52:13 2000
@@ -0,0 +1,4 @@
+#include <linux/init.h>
+char __initdata *kdb_cmds[] = {
+ 0
+};
diff -urN -X dontdiff linux-kdb-keith/mm/vmalloc.c linux-kdb/mm/vmalloc.c
--- linux-kdb-keith/mm/vmalloc.c Thu Sep 28 12:56:31 2000
+++ linux-kdb/mm/vmalloc.c Thu Sep 28 12:46:41 2000
@@ -16,53 +16,6 @@
rwlock_t vmlist_lock = RW_LOCK_UNLOCKED;
struct vm_struct * vmlist = NULL;
-#if defined(CONFIG_KDB)
-/* kdb_vmlist_check
- * Check to determine if an address is within a vmalloced range.
- * Parameters:
- * starta -- Starting address of region to check
- * enda -- Ending address of region to check
- * Returns:
- * 0 -- [starta,enda] not within a vmalloc area
- * 1 -- [starta,enda] within a vmalloc area
- * Locking:
- * None.
- * Remarks:
- * Shouldn't acquire locks. Always called with all interrupts
- * disabled and other cpus halted. Yet, if a breakpoint or fault
- * occurs while the vmlist is in an indeterminate state, this
- * function could fail.
- */
-int
-kdb_vmlist_check(unsigned long starta, unsigned long enda)
-{
- struct vm_struct *vp;
-
- if (vmlist) {
- for(vp=vmlist; vp; vp = vp->next) {
- unsigned long end = (unsigned long)vp->addr + vp->size;
-
- end -= PAGE_SIZE; /* Unbias for guard page */
-
- if ((starta >= (unsigned long)vp->addr)
- && (starta < end)
- && (enda < end)) {
- return 1;
- }
- }
- }
- else {
- /* early kdb, no vmlist yet */
- extern char _text, _end;
- if (starta >= (unsigned long) &_text &&
- enda < (unsigned long) &_end &&
- starta <= enda)
- return 1;
- }
- return 0;
-}
-#endif
-
static inline void free_area_pte(pmd_t * pmd, unsigned long address, unsigned
long size)
{
pte_t * pte;
|