update for HEAD-2003091401
[reactos.git] / ntoskrnl / mm / i386 / memsafe.s
1 .globl _MmSafeCopyFromUser
2 .globl _MmSafeCopyFromUserUnsafeStart
3 .globl _MmSafeCopyFromUserRestart
4 .globl _MmSafeCopyToUser
5 .globl _MmSafeCopyToUserUnsafeStart
6 .globl _MmSafeCopyToUserRestart
7
8         /*
9          * NTSTATUS MmSafeCopyFromUser(PVOID Dest, PVOID Src, 
10          *                             ULONG NumberOfBytes)
11          */
12 _MmSafeCopyFromUser:
13         pushl   %ebp
14         movl    %esp,%ebp
15
16         pushl   %esi
17         pushl   %edi
18         pushl   %ecx
19         
20         movl    8(%ebp),%edi
21         movl    12(%ebp),%esi
22         movl    16(%ebp),%ecx
23
24         /*
25          * Default return code
26          */ 
27         movl    $0,%eax
28
29 _MmSafeCopyFromUserUnsafeStart:         
30         /*
31          * This is really a synthetic instruction since if we incur a
32          * pagefault then eax will be set to an appropiate STATUS code
33          */
34         cld 
35         rep movsb
36
37 _MmSafeCopyFromUserRestart:
38
39         popl    %ecx
40         popl    %edi
41         popl    %esi
42
43         popl    %ebp
44         ret
45
46 /*****************************************************************************/
47
48         /*
49          * NTSTATUS MmSafeCopyToUser(PVOID Dest, PVOID Src, 
50          *                      ULONG NumberOfBytes)
51          */ 
52 _MmSafeCopyToUser:
53         pushl   %ebp
54         movl    %esp,%ebp
55
56         pushl   %esi
57         pushl   %edi
58         pushl   %ecx
59         
60         movl    8(%ebp),%edi
61         movl    12(%ebp),%esi
62         movl    16(%ebp),%ecx
63
64         /*
65          * Default return code
66          */ 
67         movl    $0,%eax
68
69 _MmSafeCopyToUserUnsafeStart:            
70         /*
71          * This is really a synthetic instruction since if we incur a
72          * pagefault then eax will be set to an appropiate STATUS code
73          */
74         cld 
75         rep movsb
76
77 _MmSafeCopyToUserRestart:
78
79         popl    %ecx
80         popl    %edi
81         popl    %esi
82         
83         popl    %ebp
84         ret
85