#include #include #include unsigned long long source1 = 0x0102030405060708; unsigned long long source2 = 0x8070605040302010; int test_8(unsigned char *v, unsigned char *p) { return __get_user(*v, p); } int test_8_constp(unsigned char *v, const unsigned char *p) { return __get_user(*v, p); } int test_8_volatilep(unsigned char *v, volatile unsigned char *p) { return __get_user(*v, p); } int test_16(unsigned short *v, unsigned short *p) { return __get_user(*v, p); } int test_16_constp(unsigned short *v, const unsigned short *p) { return __get_user(*v, p); } int test_32(unsigned int *v, unsigned int *p) { return __get_user(*v, p); } int test_32_constp(unsigned int *v, const unsigned int *p) { return __get_user(*v, p); } int test_64(unsigned long long *v, unsigned long long *p) { return __get_user(*v, p); } int test_64_constp(unsigned long long *v, const unsigned long long *p) { return __get_user(*v, p); } int test_ptr(unsigned int **v, unsigned int **p) { return __get_user(*v, p); } int test_const(unsigned int *v, const unsigned int *p) { return __get_user(*v, p); } int test_64_narrow(unsigned long *v, unsigned long long *p) { return __get_user(*v, p); } int test_32_wide(unsigned long long *v, unsigned long *p) { return __get_user(*v, p); } // This one should warn #if 0 int test_wrong(char **v, const char **p) { return __get_user(*v, p); } #endif int my_init(void) { unsigned char c; unsigned short s; unsigned int l; unsigned long long ll; c = 0; test_8(&c, (unsigned char *)&source1); printk("c=%0x\n", c); test_8(&c, (unsigned char *)&source2); printk("c=%0x\n", c); s = 0; test_16(&s, (unsigned short *)&source1); printk("s=%0x\n", s); s = 0; test_16(&s, (unsigned short *)&source2); printk("s=%0x\n", s); l = 0; test_32(&l, (unsigned int *)&source1); printk("l=%0x\n", l); l = 0; test_32(&l, (unsigned int *)&source2); printk("l=%0x\n", l); ll = 0; test_64(&ll, (unsigned long long *)&source1); printk("l=%0Lx\n", ll); ll = 0; test_64(&ll, (unsigned long long *)&source2); printk("l=%0Lx\n", ll); return -EINVAL; } void my_exit(void) { return; } module_init(my_init); module_exit(my_exit);