|
@@ -120,7 +120,7 @@ typedef intptr_t userptr_t;
|
120
|
120
|
*/
|
121
|
121
|
static inline __attribute__ (( always_inline )) void
|
122
|
122
|
copy_to_user ( userptr_t buffer, off_t offset, const void *src, size_t len ) {
|
123
|
|
- memcpy ( ( void * ) buffer + offset, src, len );
|
|
123
|
+ memcpy ( ( ( void * ) buffer + offset ), src, len );
|
124
|
124
|
}
|
125
|
125
|
|
126
|
126
|
/**
|
|
@@ -133,7 +133,23 @@ copy_to_user ( userptr_t buffer, off_t offset, const void *src, size_t len ) {
|
133
|
133
|
*/
|
134
|
134
|
static inline __attribute__ (( always_inline )) void
|
135
|
135
|
copy_from_user ( void *dest, userptr_t buffer, off_t offset, size_t len ) {
|
136
|
|
- memcpy ( dest, ( void * ) buffer + offset, len );
|
|
136
|
+ memcpy ( dest, ( ( void * ) buffer + offset ), len );
|
|
137
|
+}
|
|
138
|
+
|
|
139
|
+/**
|
|
140
|
+ * Copy data between user buffers
|
|
141
|
+ *
|
|
142
|
+ * @v dest Destination user buffer
|
|
143
|
+ * @v dest_off Offset within destination buffer
|
|
144
|
+ * @v src Source user buffer
|
|
145
|
+ * @v src_off Offset within source buffer
|
|
146
|
+ * @v len Length
|
|
147
|
+ */
|
|
148
|
+static inline __attribute__ (( always_inline )) void
|
|
149
|
+copy_user ( userptr_t dest, off_t dest_off, userptr_t src, off_t src_off,
|
|
150
|
+ size_t len ) {
|
|
151
|
+ memcpy ( ( ( void * ) dest + dest_off ), ( ( void * ) src + src_off ),
|
|
152
|
+ len );
|
137
|
153
|
}
|
138
|
154
|
|
139
|
155
|
/**
|
|
@@ -163,6 +179,17 @@ real_to_user ( unsigned int segment, unsigned int offset ) {
|
163
|
179
|
return virt_to_user ( VIRTUAL ( segment, offset ) );
|
164
|
180
|
}
|
165
|
181
|
|
|
182
|
+/**
|
|
183
|
+ * Convert physical address to user buffer
|
|
184
|
+ *
|
|
185
|
+ * @v physical Physical address
|
|
186
|
+ * @ret buffer User buffer
|
|
187
|
+ */
|
|
188
|
+static inline __attribute__ (( always_inline )) userptr_t
|
|
189
|
+phys_to_user ( physaddr_t physical ) {
|
|
190
|
+ return virt_to_user ( phys_to_virt ( physical ) );
|
|
191
|
+}
|
|
192
|
+
|
166
|
193
|
/* Copy to/from real-mode stack */
|
167
|
194
|
extern uint16_t copy_to_rm_stack ( void *data, size_t size );
|
168
|
195
|
extern void remove_from_rm_stack ( void *data, size_t size );
|