2
* GRUB -- GRand Unified Bootloader
3
* Copyright (C) 2010 Free Software Foundation, Inc.
5
* GRUB is free software: you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License as published by
7
* the Free Software Foundation, either version 3 of the License, or
8
* (at your option) any later version.
10
* GRUB is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
15
* You should have received a copy of the GNU General Public License
16
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
19
#include <grub/types.h>
20
#include <grub/misc.h>
21
#include <grub/decompressor.h>
24
memset (void *s, int c, grub_size_t len)
27
for (ptr = s; len; ptr++, len--)
33
grub_memmove (void *dest, const void *src, grub_size_t n)
35
char *d = (char *) dest;
36
const char *s = (const char *) src;
54
grub_memcmp (const void *s1, const void *s2, grub_size_t n)
62
return (int) *t1 - (int) *t2;
71
int memcmp (const void *s1, const void *s2, grub_size_t n)
72
__attribute__ ((alias ("grub_memcmp")));
74
void *memmove (void *dest, const void *src, grub_size_t n)
75
__attribute__ ((alias ("grub_memmove")));
77
void *memcpy (void *dest, const void *src, grub_size_t n)
78
__attribute__ ((alias ("grub_memmove")));
80
void *grub_decompressor_scratch;
83
find_scratch (void *src, void *dst, unsigned long srcsize,
84
unsigned long dstsize)
87
/* Decoding from ROM. */
88
if (((grub_addr_t) src & 0x10000000))
90
grub_decompressor_scratch = (void *) ALIGN_UP((grub_addr_t) dst + dstsize,
95
if ((char *) src + srcsize > (char *) dst + dstsize)
96
grub_decompressor_scratch = (void *) ALIGN_UP ((grub_addr_t) src + srcsize,
99
grub_decompressor_scratch = (void *) ALIGN_UP ((grub_addr_t) dst + dstsize,