* include/grub/misc.h [__APPLE__]: Do not add regparm(0) on x86_64.

* grub-core/kern/misc.c (__bzero) [__APPLE__]: New function.
This commit is contained in:
Vladimir Serbinenko 2013-11-11 22:53:30 +01:00
parent 66acd9d64c
commit 8506a64149
3 changed files with 29 additions and 13 deletions

View file

@ -1,3 +1,8 @@
2013-11-11 Vladimir Serbinenko <phcoder@gmail.com>
* include/grub/misc.h [__APPLE__]: Do not add regparm(0) on x86_64.
* grub-core/kern/misc.c (__bzero) [__APPLE__]: New function.
2013-11-11 Vladimir Serbinenko <phcoder@gmail.com>
* util/getroot.c (grub_util_biosdisk_get_grub_dev) [__APPLE__]:

View file

@ -71,12 +71,12 @@ void *memmove (void *dest, const void *src, grub_size_t n)
void *memcpy (void *dest, const void *src, grub_size_t n)
__attribute__ ((alias ("grub_memmove")));
#else
void * __attribute__ ((regparm(0)))
void * GRUB_BUILTIN_ATTR
memcpy (void *dest, const void *src, grub_size_t n)
{
return grub_memmove (dest, src, n);
}
void * __attribute__ ((regparm(0)))
void * GRUB_BUILTIN_ATTR
memmove (void *dest, const void *src, grub_size_t n)
{
return grub_memmove (dest, src, n);
@ -225,7 +225,7 @@ grub_memcmp (const void *s1, const void *s2, grub_size_t n)
int memcmp (const void *s1, const void *s2, grub_size_t n)
__attribute__ ((alias ("grub_memcmp")));
#else
int __attribute__ ((regparm(0)))
int GRUB_BUILTIN_ATTR
memcmp (const void *s1, const void *s2, grub_size_t n)
{
return grub_memcmp (s1, s2, n);
@ -504,11 +504,18 @@ grub_memset (void *s, int c, grub_size_t len)
void *memset (void *s, int c, grub_size_t n)
__attribute__ ((alias ("grub_memset")));
#else
void * __attribute__ ((regparm(0)))
void * GRUB_BUILTIN_ATTR
memset (void *s, int c, grub_size_t n)
{
return grub_memset (s, c, n);
}
void GRUB_BUILTIN_ATTR
__bzero (void *s, grub_size_t n)
{
grub_memset (s, 0, n);
}
#endif
grub_size_t

View file

@ -98,19 +98,23 @@ grub_memcpy (void *dest, const void *src, grub_size_t n)
return grub_memmove (dest, src, n);
}
#if defined (__APPLE__) && defined(__i386__) && !defined (GRUB_UTIL)
#define GRUB_BUILTIN_ATTR __attribute__ ((regparm(0)))
#else
#define GRUB_BUILTIN_ATTR
#endif
/* Prototypes for aliases. */
#ifndef GRUB_UTIL
int GRUB_BUILTIN_ATTR EXPORT_FUNC(memcmp) (const void *s1, const void *s2, grub_size_t n);
void *GRUB_BUILTIN_ATTR EXPORT_FUNC(memmove) (void *dest, const void *src, grub_size_t n);
void *GRUB_BUILTIN_ATTR EXPORT_FUNC(memcpy) (void *dest, const void *src, grub_size_t n);
void *GRUB_BUILTIN_ATTR EXPORT_FUNC(memset) (void *s, int c, grub_size_t n);
#ifdef __APPLE__
int __attribute__ ((regparm(0))) EXPORT_FUNC(memcmp) (const void *s1, const void *s2, grub_size_t n);
void *__attribute__ ((regparm(0))) EXPORT_FUNC(memmove) (void *dest, const void *src, grub_size_t n);
void *__attribute__ ((regparm(0))) EXPORT_FUNC(memcpy) (void *dest, const void *src, grub_size_t n);
void *__attribute__ ((regparm(0))) EXPORT_FUNC(memset) (void *s, int c, grub_size_t n);
#else
int EXPORT_FUNC(memcmp) (const void *s1, const void *s2, grub_size_t n);
void *EXPORT_FUNC(memmove) (void *dest, const void *src, grub_size_t n);
void *EXPORT_FUNC(memcpy) (void *dest, const void *src, grub_size_t n);
void *EXPORT_FUNC(memset) (void *s, int c, grub_size_t n);
void GRUB_BUILTIN_ATTR EXPORT_FUNC (__bzero) (void *s, grub_size_t n);
#endif
#endif
int EXPORT_FUNC(grub_memcmp) (const void *s1, const void *s2, grub_size_t n);