fix size_t and memory types. We need to be careful, because gcc

calls memcpy etc itself. This is trivial (not easy), as it is just
reading man pages.

Signed-off-by: Stefan Reinauer <stepan@coresystems.de>
Acked-by: Stefan Reinauer <stepan@coresystems.de>



git-svn-id: svn://coreboot.org/repository/LinuxBIOSv3@308 f3766cd6-281f-0410-b1cd-43a5c92072e9
This commit is contained in:
Stefan Reinauer 2007-05-05 16:56:34 +00:00
commit 109adc1598
5 changed files with 21 additions and 17 deletions

View file

@ -171,7 +171,7 @@ void lb_strings(struct lb_header *header)
}
void lb_memory_range(struct lb_memory *mem,
static void lb_memory_range(struct lb_memory *mem,
u32 type, u64 start, u64 size)
{
int entries;

View file

@ -15,7 +15,7 @@ typedef signed int s32;
typedef signed short s16;
typedef signed char s8;
typedef u64 size_t;
typedef long unsigned int size_t;
#define NULL ((void *)0)

View file

@ -24,13 +24,13 @@
#include <arch/types.h>
/* Prototypes for functions from lib/mem.c. */
extern void *memcpy(void *dest, const void *src, size_t len);
extern void *memmove(void *dest, const void *src, size_t len);
extern void *memset(void *v, unsigned char a, size_t len);
extern int memcmp(const void *s1, const void *s2, size_t len);
void *memcpy(void *dest, const void *src, size_t len);
void *memmove(void *dest, const void *src, size_t len);
void *memset(void *s, int c, size_t len);
int memcmp(const void *s1, const void *s2, size_t len);
/* Prototypes for functions from console/vsprintf.c. */
extern int sprintf(char *buf, const char *fmt, ...);
int sprintf(char *buf, const char *fmt, ...);
/**
* Calculate the length of a fixed-size string.

View file

@ -245,8 +245,6 @@ struct lb_record *lb_last_record(struct lb_header *header);
struct lb_record *lb_next_record(struct lb_record *rec);
struct lb_record *lb_new_record(struct lb_header *header);
struct lb_memory *lb_memory(struct lb_header *header);
void lb_memory_range(struct lb_memory *mem,
u32 type, u64 start, u64 size);
struct lb_mainboard *lb_mainboard(struct lb_header *header);
unsigned long lb_table_fini(struct lb_header *header);
@ -255,7 +253,6 @@ unsigned long lb_table_fini(struct lb_header *header);
*/
struct lb_memory *get_lb_mem(void);
// extern struct cmos_option_table option_table;
struct cmos_option_table *get_option_table(void);

View file

@ -24,6 +24,7 @@
*/
#include <arch/types.h>
#include <string.h>
/**
* memcpy() and memmove() helper that uses unsigned long copying when dest and
@ -108,10 +109,12 @@ static void memcpy_helper(void *dest, const void *src, size_t len,
* @param dest Pointer to the destination memory area.
* @param src Pointer to the source memory area.
* @param len Number of bytes to copy.
* @return Pointer specified by parameter dest
*/
void memcpy(void *dest, const void *src, size_t len)
void *memcpy(void *dest, const void *src, size_t len)
{
memcpy_helper(dest, src, len, 0);
return dest;
}
/**
@ -122,24 +125,28 @@ void memcpy(void *dest, const void *src, size_t len)
* @param dest Pointer to the destination memory area.
* @param src Pointer to the source memory area.
* @param len Number of bytes to copy.
* @return Pointer specified by parameter dest
*/
void memmove(void *dest, const void *src, size_t len)
void *memmove(void *dest, const void *src, size_t len)
{
memcpy_helper(dest, src, len, dest > src && dest < (src + len));
return dest;
}
/**
* Fill a memory area with the specified byte.
*
* @param v Pointer to the beginning of the memory area.
* @param a The byte which is used for filling the memory area.
* @param s Pointer to the beginning of the memory area.
* @param c The byte which is used for filling the memory area.
* @param len The number of bytes to write.
* @return Pointer specified by parameter s
*/
void memset(void *v, unsigned char a, size_t len)
void *memset(void *s, int c, size_t len)
{
unsigned char *cp = v;
unsigned char *cp = s;
while (len--)
*cp++ = a;
*cp++ = (unsigned char)c;
return s;
}
/**