* [PATCHv2] mini-os: build fixes for lwip 1.3.2
@ 2013-01-28 18:12 David Vrabel
2013-01-28 18:18 ` Samuel Thibault
0 siblings, 1 reply; 2+ messages in thread
From: David Vrabel @ 2013-01-28 18:12 UTC (permalink / raw)
To: xen-devel; +Cc: David Vrabel
From: David Vrabel <david.vrabel@citrix.com>
Various fixes to mini-os needed to build lwip 1.3.2:
- Don't build the tests.
- Add BSD-style endianness macros to endian.h.
- free() is called via a function pointer so it needs to be a real
function. Do the same for malloc() and realloc().
Signed-off-by: David Vrabel <david.vrabel@citrix.com>
---
| 2 +-
| 2 +-
| 4 ++++
| 10 +++++-----
| 12 +++++++++++-
5 files changed, 22 insertions(+), 8 deletions(-)
--git a/extras/mini-os/Makefile b/extras/mini-os/Makefile
index 2302a23..50d038b 100644
--- a/extras/mini-os/Makefile
+++ b/extras/mini-os/Makefile
@@ -136,7 +136,7 @@ arch_lib:
ifeq ($(CONFIG_LWIP),y)
# lwIP library
-LWC := $(shell find $(LWIPDIR)/ -type f -name '*.c')
+LWC := $(shell find $(LWIPDIR)/src -type f -name '*.c')
LWC := $(filter-out %6.c %ip6_addr.c %ethernetif.c, $(LWC))
LWO := $(patsubst %.c,%.o,$(LWC))
LWO += $(OBJ_DIR)/lwip-arch.o
--git a/extras/mini-os/README b/extras/mini-os/README
index 41573aa..710a303 100644
--- a/extras/mini-os/README
+++ b/extras/mini-os/README
@@ -19,7 +19,7 @@ This includes:
- to build it just type make.
-- to build it with TCP/IP support, download LWIP 1.3 source code and type
+- to build it with TCP/IP support, download LWIP 1.3.2 source code and type
make LWIPDIR=/path/to/lwip/source
--git a/extras/mini-os/include/endian.h b/extras/mini-os/include/endian.h
index cdf432b..5345517 100644
--- a/extras/mini-os/include/endian.h
+++ b/extras/mini-os/include/endian.h
@@ -12,4 +12,8 @@
#include <arch_wordsize.h>
+#define BYTE_ORDER __BYTE_ORDER
+#define BIG_ENDIAN __BIG_ENDIAN
+#define LITTLE_ENDIAN __LITTLE_ENDIAN
+
#endif /* endian.h */
--git a/extras/mini-os/include/xmalloc.h b/extras/mini-os/include/xmalloc.h
index 13b242e..11fb027 100644
--- a/extras/mini-os/include/xmalloc.h
+++ b/extras/mini-os/include/xmalloc.h
@@ -14,16 +14,16 @@
#include <limits.h>
#define DEFAULT_ALIGN (sizeof(unsigned long))
-#define malloc(size) _xmalloc(size, DEFAULT_ALIGN)
-#define free(ptr) xfree(ptr)
-#define realloc(ptr, size) _realloc(ptr, size)
-/* Free any of the above. */
+extern void *malloc(size_t size);
+extern void *realloc(void *ptr, size_t size);
+extern void free(void *ptr);
+
+/* Free memory from any xmalloc*() call. */
extern void xfree(const void *);
/* Underlying functions */
extern void *_xmalloc(size_t size, size_t align);
-extern void *_realloc(void *ptr, size_t size);
#endif
--git a/extras/mini-os/lib/xmalloc.c b/extras/mini-os/lib/xmalloc.c
index 015cd31..23e367d 100644
--- a/extras/mini-os/lib/xmalloc.c
+++ b/extras/mini-os/lib/xmalloc.c
@@ -267,7 +267,12 @@ void xfree(const void *p)
/* spin_unlock_irqrestore(&freelist_lock, flags); */
}
-void *_realloc(void *ptr, size_t size)
+void *malloc(size_t size)
+{
+ return _xmalloc(size, DEFAULT_ALIGN);
+}
+
+void *realloc(void *ptr, size_t size)
{
void *new;
struct xmalloc_hdr *hdr;
@@ -296,6 +301,11 @@ void *_realloc(void *ptr, size_t size)
return new;
}
+
+void free(void *ptr)
+{
+ xfree(ptr);
+}
#endif
/*
--
1.7.2.5
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCHv2] mini-os: build fixes for lwip 1.3.2
2013-01-28 18:12 [PATCHv2] mini-os: build fixes for lwip 1.3.2 David Vrabel
@ 2013-01-28 18:18 ` Samuel Thibault
0 siblings, 0 replies; 2+ messages in thread
From: Samuel Thibault @ 2013-01-28 18:18 UTC (permalink / raw)
To: David Vrabel; +Cc: xen-devel
David Vrabel, le Mon 28 Jan 2013 18:12:13 +0000, a écrit :
> From: David Vrabel <david.vrabel@citrix.com>
>
> Various fixes to mini-os needed to build lwip 1.3.2:
>
> - Don't build the tests.
> - Add BSD-style endianness macros to endian.h.
> - free() is called via a function pointer so it needs to be a real
> function. Do the same for malloc() and realloc().
>
> Signed-off-by: David Vrabel <david.vrabel@citrix.com>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
> ---
> extras/mini-os/Makefile | 2 +-
> extras/mini-os/README | 2 +-
> extras/mini-os/include/endian.h | 4 ++++
> extras/mini-os/include/xmalloc.h | 10 +++++-----
> extras/mini-os/lib/xmalloc.c | 12 +++++++++++-
> 5 files changed, 22 insertions(+), 8 deletions(-)
>
> diff --git a/extras/mini-os/Makefile b/extras/mini-os/Makefile
> index 2302a23..50d038b 100644
> --- a/extras/mini-os/Makefile
> +++ b/extras/mini-os/Makefile
> @@ -136,7 +136,7 @@ arch_lib:
>
> ifeq ($(CONFIG_LWIP),y)
> # lwIP library
> -LWC := $(shell find $(LWIPDIR)/ -type f -name '*.c')
> +LWC := $(shell find $(LWIPDIR)/src -type f -name '*.c')
> LWC := $(filter-out %6.c %ip6_addr.c %ethernetif.c, $(LWC))
> LWO := $(patsubst %.c,%.o,$(LWC))
> LWO += $(OBJ_DIR)/lwip-arch.o
> diff --git a/extras/mini-os/README b/extras/mini-os/README
> index 41573aa..710a303 100644
> --- a/extras/mini-os/README
> +++ b/extras/mini-os/README
> @@ -19,7 +19,7 @@ This includes:
>
> - to build it just type make.
>
> -- to build it with TCP/IP support, download LWIP 1.3 source code and type
> +- to build it with TCP/IP support, download LWIP 1.3.2 source code and type
>
> make LWIPDIR=/path/to/lwip/source
>
> diff --git a/extras/mini-os/include/endian.h b/extras/mini-os/include/endian.h
> index cdf432b..5345517 100644
> --- a/extras/mini-os/include/endian.h
> +++ b/extras/mini-os/include/endian.h
> @@ -12,4 +12,8 @@
>
> #include <arch_wordsize.h>
>
> +#define BYTE_ORDER __BYTE_ORDER
> +#define BIG_ENDIAN __BIG_ENDIAN
> +#define LITTLE_ENDIAN __LITTLE_ENDIAN
> +
> #endif /* endian.h */
> diff --git a/extras/mini-os/include/xmalloc.h b/extras/mini-os/include/xmalloc.h
> index 13b242e..11fb027 100644
> --- a/extras/mini-os/include/xmalloc.h
> +++ b/extras/mini-os/include/xmalloc.h
> @@ -14,16 +14,16 @@
> #include <limits.h>
>
> #define DEFAULT_ALIGN (sizeof(unsigned long))
> -#define malloc(size) _xmalloc(size, DEFAULT_ALIGN)
> -#define free(ptr) xfree(ptr)
> -#define realloc(ptr, size) _realloc(ptr, size)
>
> -/* Free any of the above. */
> +extern void *malloc(size_t size);
> +extern void *realloc(void *ptr, size_t size);
> +extern void free(void *ptr);
> +
> +/* Free memory from any xmalloc*() call. */
> extern void xfree(const void *);
>
> /* Underlying functions */
> extern void *_xmalloc(size_t size, size_t align);
> -extern void *_realloc(void *ptr, size_t size);
>
> #endif
>
> diff --git a/extras/mini-os/lib/xmalloc.c b/extras/mini-os/lib/xmalloc.c
> index 015cd31..23e367d 100644
> --- a/extras/mini-os/lib/xmalloc.c
> +++ b/extras/mini-os/lib/xmalloc.c
> @@ -267,7 +267,12 @@ void xfree(const void *p)
> /* spin_unlock_irqrestore(&freelist_lock, flags); */
> }
>
> -void *_realloc(void *ptr, size_t size)
> +void *malloc(size_t size)
> +{
> + return _xmalloc(size, DEFAULT_ALIGN);
> +}
> +
> +void *realloc(void *ptr, size_t size)
> {
> void *new;
> struct xmalloc_hdr *hdr;
> @@ -296,6 +301,11 @@ void *_realloc(void *ptr, size_t size)
>
> return new;
> }
> +
> +void free(void *ptr)
> +{
> + xfree(ptr);
> +}
> #endif
>
> /*
> --
> 1.7.2.5
>
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel
>
--
Samuel
<s> je la connaissais pas celle la : "make: Entering an unknown directory"
-+- #ens-mim -+-
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-01-28 18:18 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-28 18:12 [PATCHv2] mini-os: build fixes for lwip 1.3.2 David Vrabel
2013-01-28 18:18 ` Samuel Thibault
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).