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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [linux/] [linux-2.4/] [arch/] [x86_64/] [lib/] [putuser.S] - Blame information for rev 1781

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

Line No. Rev Author Line
1 1275 phoenix
/*
2
 * __put_user functions.
3
 *
4
 * (C) Copyright 1998 Linus Torvalds
5
 *
6
 * These functions have a non-standard call interface
7
 * to make them more efficient.
8
 */
9
 
10
/*
11
 * __put_user_X
12
 *
13
 * Inputs:      %rax contains the address
14
 *              %rdx contains the value
15
 *
16
 * Outputs:     %rax is error code (0 or -EFAULT)
17
 *              %rbx is corrupted (will contain "current_task").
18
 *
19
 * These functions should not modify any other registers,
20
 * as they get called from within inline assembly.
21
 */
22
 
23
/* FIXME: putuser.S should be really merged with getuser.S, and preprocessor should be used to keep code duplication lower */
24
 
25
#include 
26
#include 
27
#include 
28
#include 
29
#include 
30
 
31
.text
32
.p2align
33
.globl __put_user_1
34
__put_user_1:
35
        GET_CURRENT(%rbx)
36
        cmpq tsk_addr_limit(%rbx),%rax
37
        jae bad_put_user
38
1:      movb %dl,(%rax)
39
        xorq %rax,%rax
40
        ret
41
 
42
.p2align
43
.globl __put_user_2
44
__put_user_2:
45
        GET_CURRENT(%rbx)
46
        addq $1,%rax
47
        jc              bad_put_user
48
        cmpq    tsk_addr_limit(%rbx),%rax
49
        jae     bad_put_user
50
2:      movw %dx,-1(%rax)
51
        xorq %rax,%rax
52
        ret
53
 
54
.p2align
55
.globl __put_user_4
56
__put_user_4:
57
        GET_CURRENT(%rbx)
58
        addq $3,%rax
59
        jc              bad_put_user
60
        cmpq    tsk_addr_limit(%rbx),%rax
61
        jae     bad_put_user
62
3:      movl %edx,-3(%rax)
63
        xorq %rax,%rax
64
        ret
65
 
66
.p2align
67
.globl __put_user_8
68
__put_user_8:
69
        GET_CURRENT(%rbx)
70
        addq $7,%rax
71
        jc      bad_put_user
72
        cmpq    tsk_addr_limit(%rbx),%rax
73
        jae     bad_put_user
74
4:      movq %rdx,-7(%rax)
75
        xorq %rax,%rax
76
        ret
77
 
78
ENTRY(bad_put_user)
79
bad_put_user:
80
        movq $(-EFAULT),%rax
81
        ret
82
 
83
.section __ex_table,"a"
84
        .quad 1b,bad_put_user
85
        .quad 2b,bad_put_user
86
        .quad 3b,bad_put_user
87
        .quad 4b,bad_put_user
88
.previous

powered by: WebSVN 2.1.0

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