[PATCH] access user space addresses/switch process context

Vamsi Krishna S . vamsi at in.ibm.com
Wed Apr 16 22:39:00 PDT 2003


On Thu, Apr 17, 2003 at 08:51:30AM +0800, Dong, Eddie wrote:
> Do you have any interests in applying this feature to XScale architecture? 
> The xscale patch is under KDB4.0 folder.
> 
Sure.. here it is. I think (addr < PAGE_OFFSET) is the correct test
to determine user space addresses in arm arch too. Please verify
this.

This patch should be applied on top of my earlier patch + kdb 4.0 xscale.

Thanks,
Vamsi.
-- 
Vamsi Krishna S.
IBM Software Lab, Bangalore.
Ph: +91 80 5044959
Internet: vamsi at in.ibm.com
--
diff -urN -X /home/vamsi/.dontdiff 2420-kdb4.1-pure/arch/arm/kdb/kdbasupport.c 2420-kdb4.1/arch/arm/kdb/kdbasupport.c
--- 2420-kdb4.1-pure/arch/arm/kdb/kdbasupport.c	2003-04-17 09:39:34.000000000 +0530
+++ 2420-kdb4.1/arch/arm/kdb/kdbasupport.c	2003-04-17 09:39:25.000000000 +0530
@@ -694,9 +694,9 @@
 	 && (type[0] == 'u')) {
 	 	struct context_save_struct  *pSave;
 		type = NULL;
-		pSave = current->thread.save;
+		pSave = kdb_current_task->thread.save;
 		if ( !pSave ) {
-			kdb_printf("Uninitialized current->thread.save!!!\n");
+			kdb_printf("Uninitialized current->thread.save (pid=%d)!!!\n", kdb_current_task->pid);
 			return 0;
 		}
 		for (i=0; i<KDB_THREAD_REGNUM; i++) {
diff -urN -X /home/vamsi/.dontdiff 2420-kdb4.1-pure/include/asm-arm/kdb.h 2420-kdb4.1/include/asm-arm/kdb.h
--- 2420-kdb4.1-pure/include/asm-arm/kdb.h	2003-04-17 09:37:53.000000000 +0530
+++ 2420-kdb4.1/include/asm-arm/kdb.h	2003-04-17 09:38:08.000000000 +0530
@@ -84,6 +84,9 @@
 
 #include <asm/uaccess.h>
 
+extern int kdb_getuserarea_size(void *, unsigned long, size_t);
+extern int kdb_putuserarea_size(unsigned long, void *, size_t);
+
 static inline int
 __kdba_putarea_size(unsigned long to_xxx, void *from, size_t size)
 {
@@ -92,6 +95,11 @@
 	char c;
 	c = *((volatile char *)from);
 	c = *((volatile char *)from + size - 1);
+      
+	if (to_xxx < PAGE_OFFSET) {
+		return kdb_putuserarea_size(to_xxx, from, size);
+	}
+
 #ifdef VPERNODE_BASE /* if present, the new CONFIG_NUMA code */
 	if (to_xxx >= VPERNODE_BASE && to_xxx < VGLOBAL_BASE) {
 		to_xxx = __imva(to_xxx);
@@ -110,6 +118,11 @@
 	int r;
 	*((volatile char *)to) = '\0';
 	*((volatile char *)to + size - 1) = '\0';
+
+	if (from_xxx < PAGE_OFFSET) {
+		return kdb_getuserarea_size(to, from_xxx, size);
+	}
+
 	set_fs(KERNEL_DS);
 	switch (size) {
 	case 1:



More information about the kdb mailing list