2 * Copyright © 2009 Vladimir 'phcoder' Serbinenko <phcoder@gmail.com>
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
9 * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
12 * Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in
14 * the documentation and/or other materials provided with the
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
20 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
21 * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
22 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
26 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
28 * OF THE POSSIBILITY OF SUCH DAMAGE.
31 FILE_LICENCE ( BSD2
);
33 #include <gpxe/wrap.h>
34 #include <gpxe/uaccess.h>
37 memcpy_user (userptr_t dest
, off_t dest_off
,
38 userptr_t src
, off_t src_off
, size_t len
)
40 grub_memcpy ((void *) dest
+dest_off
, (void *) src
+src_off
, len
);
44 virt_to_user (volatile const void *in
)
50 free_memblock (void *ptr
, size_t size
__attribute__ ((unused
)))
56 memchr (void *s
, grub_uint8_t c
, grub_size_t size
)
58 for (;size
&& *(grub_uint8_t
*)s
!= c
; size
--, s
= (grub_uint8_t
*)s
+ 1);
65 strnlen (char *str
, grub_size_t n
)