Skip to contentSkip to conversation

uaccess.h patch for new evms-1.1.0: correct?

parisc-linux [email protected] 2 participants 2 messages Sep 26, 2002 – Sep 28, 2002

lore
Share & tools
lore
#0 lore raw

Hi all,

As I not find "std" emulation (gcc report 'Internal compiler error... PLease submit a full bug report...) and not more the D, M, L mips prefix (to access different 32bits part of a 64bits lon long), here is what I proprose as uaccess.h patch.

Can someone have a look and advise me if I made any error?

Thanks in advance for help,
Joel

PS: Functionaly it seems to work to make evms 1.1.0 works

uaccess.h renamed from uaccess.h.orig +62 -2
@@ -35,10 +35,41 @@
 #define get_user __get_user
 
 #if BITS_PER_LONG == 32
+
 #define LDD_KERNEL(ptr)		BUG()
 #define LDD_USER(ptr)		BUG()
-#define STD_KERNEL(x, ptr)	BUG()
-#define STD_USER(x, ptr)	BUG()
+#define STD_KERNEL(x, ptr)                    \
+({                                            \
+    union                                     \
+    {                                         \
+        unsigned long long U64;               \
+        struct                                \
+        {                                     \
+            unsigned int xh;                  \
+            unsigned int xl;                  \
+        }                                     \
+	U64XhXl;                              \
+    }Ulli; /* Union long long int */          \
+    Ulli.U64=(unsigned long long) x;          \
+    __put_kernel_asm_64(Ulli.U64XhXl.xh, Ulli.U64XhXl.xl, ptr);           \
+})
+
+#define STD_USER(x, ptr)                      \
+({                                            \
+    union                                     \
+    {                                         \
+        unsigned long long U64;               \
+        struct                                \
+        {                                     \
+            unsigned int xh;                  \
+            unsigned int xl;                  \
+        }                                     \
+	U64XhXl;                              \
+    }Ulli; /* Union long long int */          \
+    Ulli.U64=(unsigned long long) x;          \
+    __put_user_asm_64(Ulli.U64XhXl.xh, Ulli.U64XhXl.xl, ptr);           \
+})
+
 #else
 #define LDD_KERNEL(ptr) __get_kernel_asm("ldd",ptr)
 #define LDD_USER(ptr) __get_user_asm("ldd",ptr)
@@ -200,6 +231,20 @@
 		: "=r"(__pu_err)                            \
 		: "r"(ptr), "r"(x), "0"(__pu_err))
 
+#define __put_kernel_asm_64(xh, xl, ptr)                    \
+        __asm__ __volatile__ (                              \
+                "\n1:\tstw\t%2,0(%1)\n"                     \
+                "2:\tstw\t%3,4(%1)\n"                       \
+                "3:\n"                                      \
+                "\t.section __ex_table,\"a\"\n"             \
+                 "\t.word\t1b\n"                            \
+                 "\t.word\t(3b-1b)+1\n"                     \
+                 "\t.word\t2b\n"                            \
+                 "\t.word\t(3b-2b)+1\n"                     \
+                 "\t.previous"                              \
+                : "=r"(__pu_err)                            \
+                : "r"(ptr), "r"(xh), "r"(xl), "0"(__pu_err))
+
 #define __put_user_asm(stx,x,ptr)                           \
 	__asm__ __volatile__ (                              \
 		"\n1:\t" stx "\t%2,0(%%sr3,%1)\n"           \
@@ -210,6 +255,21 @@
 		 "\t.previous"                              \
 		: "=r"(__pu_err)                            \
 		: "r"(ptr), "r"(x), "0"(__pu_err))
+
+#define __put_user_asm_64(xh, xl, ptr)                      \
+        __asm__ __volatile__ (                              \
+                "\n1:\tstw\t%2,0(%%sr3,%1)\n"               \
+                "2:\tstw\t%3,4(%%sr3,%1)\n"                 \
+                "3:\n"                                      \
+                "\t.section __ex_table,\"a\"\n"             \
+                 "\t.word\t1b\n"                            \
+                 "\t.word\t(3b-1b)+1\n"                     \
+                 "\t.word\t2b\n"                            \
+                 "\t.word\t(3b-2b)+1\n"                     \
+                 "\t.previous"                              \
+                : "=r"(__pu_err)                            \
+                : "r"(ptr), "r"(xh), "r"(xl), "0"(__pu_err))
+
 #endif
 
 
#1 lore raw

Hi all,

Is somebody have some sample test program to stress this patch (so that I can consumme all available vm) to verify that it reports well the erronious memory access?

Thanks in advance,
Joel

Quoted 15 lines · [email protected] wrote:

Hi all,

As I not find "std" emulation (gcc report 'Internal compiler error... PLease submit a full bug report...) and not more the D, M, L mips prefix (to access different 32bits part of a 64bits lon long), here is what I proprose as uaccess.h patch.

Can someone have a look and advise me if I made any error?

Thanks in advance for help,
Joel

PS: Functionaly it seems to work to make evms 1.1.0 works