OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [rc203soc/] [sw/] [uClinux/] [include/] [asm-armnommu/] [proc-armo/] [segment.h] - Blame information for rev 1777

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1633 jcastillo
/*
2
 * linux/include/asm-arm/proc-armo/segment.h
3
 *
4
 * Copyright (C) 1996 Russell King
5
 */
6
 
7
#ifndef __ASM_PROC_SEGMENT_H
8
#define __ASM_PROC_SEGMENT_H
9
 
10
static __inline__ void __put_user(unsigned long x, void * y, int size)
11
{
12
        switch (size) {
13
        case 1:
14
        __asm__(
15
       "teq     %2, #0\n"
16
       "strnebt %0, [%1]\n"
17
       "streqb  %0, [%1]\n"
18
        : : "r" (x), "r" (y), "r" (current->tss.fs)
19
        : "lr", "cc");
20
        break;
21
        case 2:
22
        { register unsigned long tmp1 = x; void *tmp2 = y;
23
        __asm__ __volatile__(
24
       "teq     %4, #0\n"
25
       "strnebt %0, [%1], #1\n"
26
       "streqb  %0, [%1], #1\n"
27
       "mov     %0, %0, lsr #8\n"
28
       "strnebt %0, [%1]\n"
29
       "streqb  %0, [%1]\n"
30
        : "=&r" (tmp1), "=&r" (tmp2)
31
        : "0" (tmp1), "1" (tmp2), "r" (current->tss.fs)
32
        : "lr", "cc");
33
        }
34
        break;
35
        case 4:
36
        __asm__(
37
       "teq     %2, #0\n"
38
       "strnet  %0, [%1]\n"
39
       "streq   %0, [%1]\n"
40
        : : "r" (x), "r" (y), "r" (current->tss.fs)
41
        : "lr", "cc");
42
        break;
43
        default:
44
        bad_user_access_length ();
45
        }
46
}
47
 
48
static __inline__ unsigned long __get_user(const void *y, int size)
49
{
50
        unsigned long result;
51
 
52
        switch (size) {
53
        case 1:
54
        __asm__(
55
       "teq     %2, #0\n"
56
       "ldrnebt %0, [%1]\n"
57
       "ldreqb  %0, [%1]\n"
58
        : "=r" (result)
59
        : "r" (y), "r" (current->tss.fs)
60
        : "lr", "cc");
61
        return result;
62
        case 2:
63
        __asm__(
64
       "teq     %2, #0\n"
65
       "ldrnet  %0, [%1]\n"
66
       "ldreq   %0, [%1]\n"
67
       "mov     %0, %0, lsl #16\n"
68
       "mov     %0, %0, lsr #16\n"
69
        : "=&r" (result)
70
        : "r" (y), "r" (current->tss.fs)
71
        : "lr", "cc");
72
        return result;
73
        case 4:
74
        __asm__(
75
       "teq     %2, #0\n"
76
       "ldrnet  %0, [%1]\n"
77
       "ldreq   %0, [%1]\n"
78
        : "=r" (result)
79
        : "r" (y), "r" (current->tss.fs)
80
        : "lr", "cc");
81
        return result;
82
        default:
83
        return bad_user_access_length ();
84
        }
85
}
86
 
87
#endif /* __ASM_PROC_SEGMENT_H */
88
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.