1/* 2 * COPYRIGHT: See COPYING in the top level directory 3 * PROJECT: ReactOS kernel 4 * FILE: ntoskrnl/ex/i386/ioport.S 5 * PURPOSE: FASTCALL Interlocked Functions 6 * PROGRAMMERS: Alex Ionescu (alex@relsoft.net) 7 */ 8 9/* INCLUDES ******************************************************************/ 10 11#include <asm.inc> 12#include <ks386.inc> 13 14/* GLOBALS *******************************************************************/ 15 16PUBLIC _READ_REGISTER_UCHAR@4 17PUBLIC _READ_REGISTER_USHORT@4 18PUBLIC _READ_REGISTER_ULONG@4 19PUBLIC _READ_REGISTER_BUFFER_UCHAR@12 20PUBLIC _READ_REGISTER_BUFFER_USHORT@12 21PUBLIC _READ_REGISTER_BUFFER_ULONG@12 22PUBLIC _WRITE_REGISTER_UCHAR@8 23PUBLIC _WRITE_REGISTER_USHORT@8 24PUBLIC _WRITE_REGISTER_ULONG@8 25PUBLIC _WRITE_REGISTER_BUFFER_UCHAR@12 26PUBLIC _WRITE_REGISTER_BUFFER_USHORT@12 27PUBLIC _WRITE_REGISTER_BUFFER_ULONG@12 28 29/* FUNCTIONS *****************************************************************/ 30 31.code 32 33_READ_REGISTER_UCHAR@4: 34 35 /* Return the requested memory location */ 36 mov edx, [esp+4] 37 mov al, [edx] 38 ret 4 39 40 41_READ_REGISTER_USHORT@4: 42 43 /* Return the requested memory location */ 44 mov edx, [esp+4] 45 mov ax, [edx] 46 ret 4 47 48 49_READ_REGISTER_ULONG@4: 50 51 /* Return the requested memory location */ 52 mov edx, [esp+4] 53 mov eax, [edx] 54 ret 4 55 56 57_READ_REGISTER_BUFFER_UCHAR@12: 58 59 /* Save volatiles */ 60 mov eax, esi 61 mov edx, edi 62 63 /* Do the transfer */ 64 mov ecx, [esp+12] 65 mov esi, [esp+4] 66 mov edi, [esp+8] 67 rep movsb 68 69 /* Restore volatiles and return */ 70 mov edi, edx 71 mov esi, eax 72 ret 12 73 74 75_READ_REGISTER_BUFFER_USHORT@12: 76 77 /* Save volatiles */ 78 mov eax, esi 79 mov edx, edi 80 81 /* Do the transfer */ 82 mov ecx, [esp+12] 83 mov esi, [esp+4] 84 mov edi, [esp+8] 85 rep movsw 86 87 /* Restore volatiles and return */ 88 mov edi, edx 89 mov esi, eax 90 ret 12 91 92 93_READ_REGISTER_BUFFER_ULONG@12: 94 95 /* Save volatiles */ 96 mov eax, esi 97 mov edx, edi 98 99 /* Do the transfer */ 100 mov ecx, [esp+12] 101 mov esi, [esp+4] 102 mov edi, [esp+8] 103 rep movsd 104 105 /* Restore volatiles and return */ 106 mov edi, edx 107 mov esi, eax 108 ret 12 109 110 111_WRITE_REGISTER_UCHAR@8: 112 113 /* Write to memory */ 114 mov edx, [esp+4] 115 mov al, [esp+8] 116 mov [edx], al 117 118 /* Flush posted write buffers and return */ 119 lock or [esp+4], edx 120 ret 8 121 122 123_WRITE_REGISTER_USHORT@8: 124 125 /* Write to memory */ 126 mov edx, [esp+4] 127 mov eax, [esp+8] 128 mov [edx], ax 129 130 /* Flush posted write buffers and return */ 131 lock or [esp+4], edx 132 ret 8 133 134 135_WRITE_REGISTER_ULONG@8: 136 137 /* Write to memory */ 138 mov edx, [esp+4] 139 mov eax, [esp+8] 140 mov [edx], eax 141 142 /* Flush posted write buffers and return */ 143 lock or [esp+4], edx 144 ret 8 145 146 147_WRITE_REGISTER_BUFFER_UCHAR@12: 148 149 /* Save volatiles */ 150 mov eax, esi 151 mov edx, edi 152 153 /* Do the transfer */ 154 mov ecx, [esp+12] 155 mov esi, [esp+8] 156 mov edi, [esp+4] 157 rep movsb 158 159 /* Flush posted write buffers */ 160 lock or [esp+4], ecx 161 162 /* Restore volatiles and return */ 163 mov edi, edx 164 mov esi, eax 165 ret 12 166 167 168_WRITE_REGISTER_BUFFER_USHORT@12: 169 170 /* Save volatiles */ 171 mov eax, esi 172 mov edx, edi 173 174 /* Do the transfer */ 175 mov ecx, [esp+12] 176 mov esi, [esp+8] 177 mov edi, [esp+4] 178 rep movsw 179 180 /* Flush posted write buffers */ 181 lock or [esp+4], ecx 182 183 /* Restore volatiles and return */ 184 mov edi, edx 185 mov esi, eax 186 ret 12 187 188 189_WRITE_REGISTER_BUFFER_ULONG@12: 190 191 /* Save volatiles */ 192 mov eax, esi 193 mov edx, edi 194 195 /* Do the transfer */ 196 mov ecx, [esp+12] 197 mov esi, [esp+8] 198 mov edi, [esp+4] 199 rep movsd 200 201 /* Flush posted write buffers */ 202 lock or [esp+4], ecx 203 204 /* Restore volatiles and return */ 205 mov edi, edx 206 mov esi, eax 207 ret 12 208 209END 210/* EOF */ 211