diff options
30 files changed, 0 insertions, 4641 deletions
diff --git a/recipes-extended/xen/files/lwip.dhcp_create_request-hwaddr_len.patch b/recipes-extended/xen/files/lwip.dhcp_create_request-hwaddr_len.patch deleted file mode 100644 index 4bbf21a1..00000000 --- a/recipes-extended/xen/files/lwip.dhcp_create_request-hwaddr_len.patch +++ /dev/null | |||
@@ -1,13 +0,0 @@ | |||
1 | Index: src/core/dhcp.c | ||
2 | =================================================================== | ||
3 | --- a/src/core/dhcp.c | ||
4 | +++ b/src/core/dhcp.c | ||
5 | @@ -1356,7 +1358,7 @@ dhcp_create_request(struct netif *netif) | ||
6 | dhcp->msg_out->giaddr.addr = 0; | ||
7 | for (i = 0; i < DHCP_CHADDR_LEN; i++) { | ||
8 | /* copy netif hardware address, pad with zeroes */ | ||
9 | - dhcp->msg_out->chaddr[i] = (i < netif->hwaddr_len) ? netif->hwaddr[i] : 0/* pad byte*/; | ||
10 | + dhcp->msg_out->chaddr[i] = (i < (netif->hwaddr_len > NETIF_MAX_HWADDR_LEN ? NETIF_MAX_HWADDR_LEN : netif->hwaddr_len)) ? netif->hwaddr[i] : 0/* pad byte*/; | ||
11 | } | ||
12 | for (i = 0; i < DHCP_SNAME_LEN; i++) { | ||
13 | dhcp->msg_out->sname[i] = 0; | ||
diff --git a/recipes-extended/xen/files/lwip.patch-cvs b/recipes-extended/xen/files/lwip.patch-cvs deleted file mode 100644 index b2718778..00000000 --- a/recipes-extended/xen/files/lwip.patch-cvs +++ /dev/null | |||
@@ -1,2398 +0,0 @@ | |||
1 | ? .ChangeLog.swp | ||
2 | ? ChangeLog | ||
3 | Index: CHANGELOG | ||
4 | =================================================================== | ||
5 | RCS file: /sources/lwip/lwip/CHANGELOG,v | ||
6 | retrieving revision 1.300 | ||
7 | retrieving revision 1.318 | ||
8 | diff -u -p -r1.300 -r1.318 | ||
9 | --- a/CHANGELOG 23 Mar 2008 13:49:39 -0000 1.300 | ||
10 | +++ b/CHANGELOG 14 Jul 2008 20:12:36 -0000 1.318 | ||
11 | @@ -19,9 +19,77 @@ HISTORY | ||
12 | |||
13 | ++ New features: | ||
14 | |||
15 | + 2008-06-30 Simon Goldschmidt | ||
16 | + * mem.c, opt.h, stats.h: fixed bug #21433: Calling mem_free/pbuf_free from | ||
17 | + interrupt context isn't safe: LWIP_ALLOW_MEM_FREE_FROM_OTHER_CONTEXT allows | ||
18 | + mem_free to run between mem_malloc iterations. Added illegal counter for | ||
19 | + mem stats. | ||
20 | + | ||
21 | + 2008-06-27 Simon Goldschmidt | ||
22 | + * stats.h/.c, some other files: patch #6483: stats module improvement: | ||
23 | + Added defines to display each module's statistic individually, added stats | ||
24 | + defines for MEM, MEMP and SYS modules, removed (unused) rexmit counter. | ||
25 | + | ||
26 | + 2008-06-17 Simon Goldschmidt | ||
27 | + * err.h: patch #6459: Made err_t overridable to use a more efficient type | ||
28 | + (define LWIP_ERR_T in cc.h) | ||
29 | + | ||
30 | + 2008-06-17 Simon Goldschmidt | ||
31 | + * slipif.c: patch #6480: Added a configuration option for slipif for symmetry | ||
32 | + to loopif | ||
33 | + | ||
34 | + 2008-06-17 Simon Goldschmidt (patch by Luca Ceresoli) | ||
35 | + * netif.c, loopif.c, ip.c, netif.h, loopif.h, opt.h: Checked in slightly | ||
36 | + modified version of patch # 6370: Moved loopif code to netif.c so that | ||
37 | + loopback traffic is supported on all netifs (all local IPs). | ||
38 | + Added option to limit loopback packets for each netifs. | ||
39 | + | ||
40 | |||
41 | ++ Bugfixes: | ||
42 | |||
43 | + 2008-08-14 Simon Goldschmidt | ||
44 | + * api_msg.c: fixed bug #23847: do_close_internal references freed memory (when | ||
45 | + tcp_close returns != ERR_OK) | ||
46 | + | ||
47 | + 2008-07-08 Frédéric Bernon | ||
48 | + * stats.h: Fix some build bugs introduced with patch #6483 (missing some parameters | ||
49 | + in macros, mainly if MEM_STATS=0 and MEMP_STATS=0). | ||
50 | + | ||
51 | + 2008-06-24 Jonathan Larmour | ||
52 | + * tcp_in.c: Fix for bug #23693 as suggested by Art R. Ensure cseg is unused | ||
53 | + if tcp_seg_copy fails. | ||
54 | + | ||
55 | + 2008-06-17 Simon Goldschmidt | ||
56 | + * inet_chksum.c: Checked in some ideas of patch #6460 (loop optimizations) | ||
57 | + and created defines for swapping bytes and folding u32 to u16. | ||
58 | + | ||
59 | + 2008-05-30 Kieran Mansley | ||
60 | + * tcp_in.c Remove redundant "if" statement, and use real rcv_wnd | ||
61 | + rather than rcv_ann_wnd when deciding if packets are in-window. | ||
62 | + Contributed by <arasmussen@consultant.datasys.swri.edu> | ||
63 | + | ||
64 | + 2008-05-30 Kieran Mansley | ||
65 | + * mem.h: Fix BUG#23254. Change macro definition of mem_* to allow | ||
66 | + passing as function pointers when MEM_LIBC_MALLOC is defined. | ||
67 | + | ||
68 | + 2008-05-09 Jonathan Larmour | ||
69 | + * err.h, err.c, sockets.c: Fix bug #23119: Reorder timeout error code to | ||
70 | + stop it being treated as a fatal error. | ||
71 | + | ||
72 | + 2008-04-15 Simon Goldschmidt | ||
73 | + * dhcp.c: fixed bug #22804: dhcp_stop doesn't clear NETIF_FLAG_DHCP | ||
74 | + (flag now cleared) | ||
75 | + | ||
76 | + 2008-03-27 Simon Goldschmidt | ||
77 | + * mem.c, tcpip.c, tcpip.h, opt.h: fixed bug #21433 (Calling mem_free/pbuf_free | ||
78 | + from interrupt context isn't safe): set LWIP_USE_HEAP_FROM_INTERRUPT to 1 | ||
79 | + in lwipopts.h or use pbuf_free_callback(p)/mem_free_callback(m) to free pbufs | ||
80 | + or heap memory from interrupt context | ||
81 | + | ||
82 | + 2008-03-26 Simon Goldschmidt | ||
83 | + * tcp_in.c, tcp.c: fixed bug #22249: division by zero could occur if a remote | ||
84 | + host sent a zero mss as TCP option. | ||
85 | + | ||
86 | |||
87 | (STABLE-1.3.0) | ||
88 | |||
89 | Index: src/api/api_msg.c | ||
90 | =================================================================== | ||
91 | RCS file: /sources/lwip/lwip/src/api/api_msg.c,v | ||
92 | retrieving revision 1.102 | ||
93 | retrieving revision 1.104 | ||
94 | diff -u -p -r1.102 -r1.104 | ||
95 | --- a/src/api/api_msg.c 21 Mar 2008 16:23:14 -0000 1.102 | ||
96 | +++ b/src/api/api_msg.c 15 Jul 2008 11:18:58 -0000 1.104 | ||
97 | @@ -598,11 +598,16 @@ do_close_internal(struct netconn *conn) | ||
98 | LWIP_ASSERT("pcb already closed", (conn->pcb.tcp != NULL)); | ||
99 | |||
100 | /* Set back some callback pointers */ | ||
101 | + tcp_arg(conn->pcb.tcp, NULL); | ||
102 | if (conn->pcb.tcp->state == LISTEN) { | ||
103 | - tcp_arg(conn->pcb.tcp, NULL); | ||
104 | tcp_accept(conn->pcb.tcp, NULL); | ||
105 | } else { | ||
106 | tcp_recv(conn->pcb.tcp, NULL); | ||
107 | + tcp_accept(conn->pcb.tcp, NULL); | ||
108 | + /* some callbacks have to be reset if tcp_close is not successful */ | ||
109 | + tcp_sent(conn->pcb.tcp, NULL); | ||
110 | + tcp_poll(conn->pcb.tcp, NULL, 4); | ||
111 | + tcp_err(conn->pcb.tcp, NULL); | ||
112 | } | ||
113 | /* Try to close the connection */ | ||
114 | err = tcp_close(conn->pcb.tcp); | ||
115 | @@ -610,11 +615,6 @@ do_close_internal(struct netconn *conn) | ||
116 | /* Closing succeeded */ | ||
117 | conn->state = NETCONN_NONE; | ||
118 | /* Set back some callback pointers as conn is going away */ | ||
119 | - tcp_err(conn->pcb.tcp, NULL); | ||
120 | - tcp_poll(conn->pcb.tcp, NULL, 4); | ||
121 | - tcp_sent(conn->pcb.tcp, NULL); | ||
122 | - tcp_recv(conn->pcb.tcp, NULL); | ||
123 | - tcp_arg(conn->pcb.tcp, NULL); | ||
124 | conn->pcb.tcp = NULL; | ||
125 | conn->err = ERR_OK; | ||
126 | /* Trigger select() in socket layer. This send should something else so the | ||
127 | @@ -623,6 +623,14 @@ do_close_internal(struct netconn *conn) | ||
128 | API_EVENT(conn, NETCONN_EVT_SENDPLUS, 0); | ||
129 | /* wake up the application task */ | ||
130 | sys_sem_signal(conn->op_completed); | ||
131 | + } else { | ||
132 | + /* Closing failed, restore some of the callbacks */ | ||
133 | + /* Closing of listen pcb will never fail! */ | ||
134 | + LWIP_ASSERT("Closing a listen pcb may not fail!", (conn->pcb.tcp->state != LISTEN)); | ||
135 | + tcp_sent(conn->pcb.tcp, sent_tcp); | ||
136 | + tcp_poll(conn->pcb.tcp, poll_tcp, 4); | ||
137 | + tcp_err(conn->pcb.tcp, err_tcp); | ||
138 | + tcp_arg(conn->pcb.tcp, conn); | ||
139 | } | ||
140 | /* If closing didn't succeed, we get called again either | ||
141 | from poll_tcp or from sent_tcp */ | ||
142 | Index: src/api/err.c | ||
143 | =================================================================== | ||
144 | RCS file: /sources/lwip/lwip/src/api/err.c,v | ||
145 | retrieving revision 1.11 | ||
146 | retrieving revision 1.12 | ||
147 | diff -u -p -r1.11 -r1.12 | ||
148 | --- a/src/api/err.c 13 Dec 2007 23:06:50 -0000 1.11 | ||
149 | +++ b/src/api/err.c 9 May 2008 12:14:23 -0000 1.12 | ||
150 | @@ -44,17 +44,17 @@ static const char *err_strerr[] = { | ||
151 | "Ok.", /* ERR_OK 0 */ | ||
152 | "Out of memory error.", /* ERR_MEM -1 */ | ||
153 | "Buffer error.", /* ERR_BUF -2 */ | ||
154 | - "Routing problem.", /* ERR_RTE -3 */ | ||
155 | - "Connection aborted.", /* ERR_ABRT -4 */ | ||
156 | - "Connection reset.", /* ERR_RST -5 */ | ||
157 | - "Connection closed.", /* ERR_CLSD -6 */ | ||
158 | - "Not connected.", /* ERR_CONN -7 */ | ||
159 | - "Illegal value.", /* ERR_VAL -8 */ | ||
160 | - "Illegal argument.", /* ERR_ARG -9 */ | ||
161 | - "Address in use.", /* ERR_USE -10 */ | ||
162 | - "Low-level netif error.", /* ERR_IF -11 */ | ||
163 | - "Already connected.", /* ERR_ISCONN -12 */ | ||
164 | - "Timeout.", /* ERR_TIMEOUT -13 */ | ||
165 | + "Timeout.", /* ERR_TIMEOUT -3 */ | ||
166 | + "Routing problem.", /* ERR_RTE -4 */ | ||
167 | + "Connection aborted.", /* ERR_ABRT -5 */ | ||
168 | + "Connection reset.", /* ERR_RST -6 */ | ||
169 | + "Connection closed.", /* ERR_CLSD -7 */ | ||
170 | + "Not connected.", /* ERR_CONN -8 */ | ||
171 | + "Illegal value.", /* ERR_VAL -9 */ | ||
172 | + "Illegal argument.", /* ERR_ARG -10 */ | ||
173 | + "Address in use.", /* ERR_USE -11 */ | ||
174 | + "Low-level netif error.", /* ERR_IF -12 */ | ||
175 | + "Already connected.", /* ERR_ISCONN -13 */ | ||
176 | "Operation in progress." /* ERR_INPROGRESS -14 */ | ||
177 | }; | ||
178 | |||
179 | Index: src/api/netdb.c | ||
180 | =================================================================== | ||
181 | RCS file: /sources/lwip/lwip/src/api/netdb.c,v | ||
182 | retrieving revision 1.4 | ||
183 | retrieving revision 1.5 | ||
184 | diff -u -p -r1.4 -r1.5 | ||
185 | --- a/src/api/netdb.c 26 Jan 2008 16:11:39 -0000 1.4 | ||
186 | +++ b/src/api/netdb.c 16 Jul 2008 20:36:12 -0000 1.5 | ||
187 | @@ -326,7 +326,8 @@ lwip_getaddrinfo(const char *nodename, c | ||
188 | if (nodename != NULL) { | ||
189 | /* copy nodename to canonname if specified */ | ||
190 | size_t namelen = strlen(nodename); | ||
191 | - ai->ai_canonname = mem_malloc(namelen + 1); | ||
192 | + LWIP_ASSERT("namelen is too long", (namelen + 1) <= (mem_size_t)-1); | ||
193 | + ai->ai_canonname = mem_malloc((mem_size_t)(namelen + 1)); | ||
194 | if (ai->ai_canonname == NULL) { | ||
195 | goto memerr; | ||
196 | } | ||
197 | Index: src/api/sockets.c | ||
198 | =================================================================== | ||
199 | RCS file: /sources/lwip/lwip/src/api/sockets.c,v | ||
200 | retrieving revision 1.116 | ||
201 | retrieving revision 1.117 | ||
202 | diff -u -p -r1.116 -r1.117 | ||
203 | --- a/src/api/sockets.c 13 Mar 2008 20:03:57 -0000 1.116 | ||
204 | +++ b/src/api/sockets.c 9 May 2008 12:14:24 -0000 1.117 | ||
205 | @@ -128,17 +128,17 @@ static const int err_to_errno_table[] = | ||
206 | 0, /* ERR_OK 0 No error, everything OK. */ | ||
207 | ENOMEM, /* ERR_MEM -1 Out of memory error. */ | ||
208 | ENOBUFS, /* ERR_BUF -2 Buffer error. */ | ||
209 | - EHOSTUNREACH, /* ERR_RTE -3 Routing problem. */ | ||
210 | - ECONNABORTED, /* ERR_ABRT -4 Connection aborted. */ | ||
211 | - ECONNRESET, /* ERR_RST -5 Connection reset. */ | ||
212 | - ESHUTDOWN, /* ERR_CLSD -6 Connection closed. */ | ||
213 | - ENOTCONN, /* ERR_CONN -7 Not connected. */ | ||
214 | - EINVAL, /* ERR_VAL -8 Illegal value. */ | ||
215 | - EIO, /* ERR_ARG -9 Illegal argument. */ | ||
216 | - EADDRINUSE, /* ERR_USE -10 Address in use. */ | ||
217 | - -1, /* ERR_IF -11 Low-level netif error */ | ||
218 | - -1, /* ERR_ISCONN -12 Already connected. */ | ||
219 | - ETIMEDOUT, /* ERR_TIMEOUT -13 Timeout */ | ||
220 | + ETIMEDOUT, /* ERR_TIMEOUT -3 Timeout */ | ||
221 | + EHOSTUNREACH, /* ERR_RTE -4 Routing problem. */ | ||
222 | + ECONNABORTED, /* ERR_ABRT -5 Connection aborted. */ | ||
223 | + ECONNRESET, /* ERR_RST -6 Connection reset. */ | ||
224 | + ESHUTDOWN, /* ERR_CLSD -7 Connection closed. */ | ||
225 | + ENOTCONN, /* ERR_CONN -8 Not connected. */ | ||
226 | + EINVAL, /* ERR_VAL -9 Illegal value. */ | ||
227 | + EIO, /* ERR_ARG -10 Illegal argument. */ | ||
228 | + EADDRINUSE, /* ERR_USE -11 Address in use. */ | ||
229 | + -1, /* ERR_IF -12 Low-level netif error */ | ||
230 | + -1, /* ERR_ISCONN -13 Already connected. */ | ||
231 | EINPROGRESS /* ERR_INPROGRESS -14 Operation in progress */ | ||
232 | }; | ||
233 | |||
234 | Index: src/api/tcpip.c | ||
235 | =================================================================== | ||
236 | RCS file: /sources/lwip/lwip/src/api/tcpip.c,v | ||
237 | retrieving revision 1.70 | ||
238 | retrieving revision 1.73 | ||
239 | diff -u -p -r1.70 -r1.73 | ||
240 | --- a/src/api/tcpip.c 12 Jan 2008 11:52:22 -0000 1.70 | ||
241 | +++ b/src/api/tcpip.c 27 Jun 2008 20:34:51 -0000 1.73 | ||
242 | @@ -518,4 +518,42 @@ tcpip_init(void (* initfunc)(void *), vo | ||
243 | sys_thread_new(TCPIP_THREAD_NAME, tcpip_thread, NULL, TCPIP_THREAD_STACKSIZE, TCPIP_THREAD_PRIO); | ||
244 | } | ||
245 | |||
246 | +/** | ||
247 | + * Simple callback function used with tcpip_callback to free a pbuf | ||
248 | + * (pbuf_free has a wrong signature for tcpip_callback) | ||
249 | + * | ||
250 | + * @param p The pbuf (chain) to be dereferenced. | ||
251 | + */ | ||
252 | +static void | ||
253 | +pbuf_free_int(void *p) | ||
254 | +{ | ||
255 | + struct pbuf *q = p; | ||
256 | + pbuf_free(q); | ||
257 | +} | ||
258 | + | ||
259 | +/** | ||
260 | + * A simple wrapper function that allows you to free a pbuf from interrupt context. | ||
261 | + * | ||
262 | + * @param p The pbuf (chain) to be dereferenced. | ||
263 | + * @return ERR_OK if callback could be enqueued, an err_t if not | ||
264 | + */ | ||
265 | +err_t | ||
266 | +pbuf_free_callback(struct pbuf *p) | ||
267 | +{ | ||
268 | + return tcpip_callback_with_block(pbuf_free_int, p, 0); | ||
269 | +} | ||
270 | + | ||
271 | +/** | ||
272 | + * A simple wrapper function that allows you to free heap memory from | ||
273 | + * interrupt context. | ||
274 | + * | ||
275 | + * @param m the heap memory to free | ||
276 | + * @return ERR_OK if callback could be enqueued, an err_t if not | ||
277 | + */ | ||
278 | +err_t | ||
279 | +mem_free_callback(void *m) | ||
280 | +{ | ||
281 | + return tcpip_callback_with_block(mem_free, m, 0); | ||
282 | +} | ||
283 | + | ||
284 | #endif /* !NO_SYS */ | ||
285 | Index: src/core/dhcp.c | ||
286 | =================================================================== | ||
287 | RCS file: /sources/lwip/lwip/src/core/dhcp.c,v | ||
288 | retrieving revision 1.86 | ||
289 | retrieving revision 1.87 | ||
290 | diff -u -p -r1.86 -r1.87 | ||
291 | --- a/src/core/dhcp.c 4 Mar 2008 14:25:58 -0000 1.86 | ||
292 | +++ b/src/core/dhcp.c 15 Apr 2008 17:24:55 -0000 1.87 | ||
293 | @@ -568,6 +568,8 @@ dhcp_start(struct netif *netif) | ||
294 | LWIP_ERROR("netif != NULL", (netif != NULL), return ERR_ARG;); | ||
295 | dhcp = netif->dhcp; | ||
296 | LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_STATE, ("dhcp_start(netif=%p) %c%c%"U16_F"\n", (void*)netif, netif->name[0], netif->name[1], (u16_t)netif->num)); | ||
297 | + /* Remove the flag that says this netif is handled by DHCP, | ||
298 | + it is set when we succeeded starting. */ | ||
299 | netif->flags &= ~NETIF_FLAG_DHCP; | ||
300 | |||
301 | /* no DHCP client attached yet? */ | ||
302 | @@ -609,6 +611,7 @@ dhcp_start(struct netif *netif) | ||
303 | dhcp_stop(netif); | ||
304 | return ERR_MEM; | ||
305 | } | ||
306 | + /* Set the flag that says this netif is handled by DHCP. */ | ||
307 | netif->flags |= NETIF_FLAG_DHCP; | ||
308 | return result; | ||
309 | } | ||
310 | @@ -1063,6 +1066,8 @@ dhcp_stop(struct netif *netif) | ||
311 | { | ||
312 | struct dhcp *dhcp = netif->dhcp; | ||
313 | LWIP_ERROR("dhcp_stop: netif != NULL", (netif != NULL), return;); | ||
314 | + /* Remove the flag that says this netif is handled by DHCP. */ | ||
315 | + netif->flags &= ~NETIF_FLAG_DHCP; | ||
316 | |||
317 | LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE | 3, ("dhcp_stop()\n")); | ||
318 | /* netif is DHCP configured? */ | ||
319 | Index: src/core/mem.c | ||
320 | =================================================================== | ||
321 | RCS file: /sources/lwip/lwip/src/core/mem.c,v | ||
322 | retrieving revision 1.59 | ||
323 | retrieving revision 1.62 | ||
324 | diff -u -p -r1.59 -r1.62 | ||
325 | --- a/src/core/mem.c 4 Mar 2008 16:31:32 -0000 1.59 | ||
326 | +++ b/src/core/mem.c 30 Jun 2008 18:16:51 -0000 1.62 | ||
327 | @@ -177,9 +177,36 @@ static u8_t *ram; | ||
328 | static struct mem *ram_end; | ||
329 | /** pointer to the lowest free block, this is used for faster search */ | ||
330 | static struct mem *lfree; | ||
331 | + | ||
332 | /** concurrent access protection */ | ||
333 | static sys_sem_t mem_sem; | ||
334 | |||
335 | +#if LWIP_ALLOW_MEM_FREE_FROM_OTHER_CONTEXT | ||
336 | + | ||
337 | +static volatile u8_t mem_free_count; | ||
338 | + | ||
339 | +/* Allow mem_free from other (e.g. interrupt) context */ | ||
340 | +#define LWIP_MEM_FREE_DECL_PROTECT() SYS_ARCH_DECL_PROTECT(lev_free) | ||
341 | +#define LWIP_MEM_FREE_PROTECT() SYS_ARCH_PROTECT(lev_free) | ||
342 | +#define LWIP_MEM_FREE_UNPROTECT() SYS_ARCH_UNPROTECT(lev_free) | ||
343 | +#define LWIP_MEM_ALLOC_DECL_PROTECT() SYS_ARCH_DECL_PROTECT(lev_alloc) | ||
344 | +#define LWIP_MEM_ALLOC_PROTECT() SYS_ARCH_PROTECT(lev_alloc) | ||
345 | +#define LWIP_MEM_ALLOC_UNPROTECT() SYS_ARCH_UNPROTECT(lev_alloc) | ||
346 | + | ||
347 | +#else /* LWIP_ALLOW_MEM_FREE_FROM_OTHER_CONTEXT */ | ||
348 | + | ||
349 | +/* Protect the heap only by using a semaphore */ | ||
350 | +#define LWIP_MEM_FREE_DECL_PROTECT() | ||
351 | +#define LWIP_MEM_FREE_PROTECT() sys_arch_sem_wait(mem_sem, 0) | ||
352 | +#define LWIP_MEM_FREE_UNPROTECT() sys_sem_signal(mem_sem) | ||
353 | +/* mem_malloc is protected using semaphore AND LWIP_MEM_ALLOC_PROTECT */ | ||
354 | +#define LWIP_MEM_ALLOC_DECL_PROTECT() | ||
355 | +#define LWIP_MEM_ALLOC_PROTECT() | ||
356 | +#define LWIP_MEM_ALLOC_UNPROTECT() | ||
357 | + | ||
358 | +#endif /* LWIP_ALLOW_MEM_FREE_FROM_OTHER_CONTEXT */ | ||
359 | + | ||
360 | + | ||
361 | /** | ||
362 | * "Plug holes" by combining adjacent empty struct mems. | ||
363 | * After this function is through, there should not exist | ||
364 | @@ -255,9 +282,7 @@ mem_init(void) | ||
365 | /* initialize the lowest-free pointer to the start of the heap */ | ||
366 | lfree = (struct mem *)ram; | ||
367 | |||
368 | -#if MEM_STATS | ||
369 | - lwip_stats.mem.avail = MEM_SIZE_ALIGNED; | ||
370 | -#endif /* MEM_STATS */ | ||
371 | + MEM_STATS_AVAIL(avail, MEM_SIZE_ALIGNED); | ||
372 | } | ||
373 | |||
374 | /** | ||
375 | @@ -270,6 +295,7 @@ void | ||
376 | mem_free(void *rmem) | ||
377 | { | ||
378 | struct mem *mem; | ||
379 | + LWIP_MEM_FREE_DECL_PROTECT(); | ||
380 | |||
381 | if (rmem == NULL) { | ||
382 | LWIP_DEBUGF(MEM_DEBUG | LWIP_DBG_TRACE | 2, ("mem_free(p == NULL) was called.\n")); | ||
383 | @@ -277,20 +303,20 @@ mem_free(void *rmem) | ||
384 | } | ||
385 | LWIP_ASSERT("mem_free: sanity check alignment", (((mem_ptr_t)rmem) & (MEM_ALIGNMENT-1)) == 0); | ||
386 | |||
387 | - /* protect the heap from concurrent access */ | ||
388 | - sys_arch_sem_wait(mem_sem, 0); | ||
389 | - | ||
390 | LWIP_ASSERT("mem_free: legal memory", (u8_t *)rmem >= (u8_t *)ram && | ||
391 | (u8_t *)rmem < (u8_t *)ram_end); | ||
392 | |||
393 | if ((u8_t *)rmem < (u8_t *)ram || (u8_t *)rmem >= (u8_t *)ram_end) { | ||
394 | + SYS_ARCH_DECL_PROTECT(lev); | ||
395 | LWIP_DEBUGF(MEM_DEBUG | 3, ("mem_free: illegal memory\n")); | ||
396 | -#if MEM_STATS | ||
397 | - ++lwip_stats.mem.err; | ||
398 | -#endif /* MEM_STATS */ | ||
399 | - sys_sem_signal(mem_sem); | ||
400 | + /* protect mem stats from concurrent access */ | ||
401 | + SYS_ARCH_PROTECT(lev); | ||
402 | + MEM_STATS_INC(illegal); | ||
403 | + SYS_ARCH_UNPROTECT(lev); | ||
404 | return; | ||
405 | } | ||
406 | + /* protect the heap from concurrent access */ | ||
407 | + LWIP_MEM_FREE_PROTECT(); | ||
408 | /* Get the corresponding struct mem ... */ | ||
409 | mem = (struct mem *)((u8_t *)rmem - SIZEOF_STRUCT_MEM); | ||
410 | /* ... which has to be in a used state ... */ | ||
411 | @@ -303,13 +329,14 @@ mem_free(void *rmem) | ||
412 | lfree = mem; | ||
413 | } | ||
414 | |||
415 | -#if MEM_STATS | ||
416 | - lwip_stats.mem.used -= mem->next - ((u8_t *)mem - ram); | ||
417 | -#endif /* MEM_STATS */ | ||
418 | + MEM_STATS_DEC_USED(used, mem->next - ((u8_t *)mem - ram)); | ||
419 | |||
420 | /* finally, see if prev or next are free also */ | ||
421 | plug_holes(mem); | ||
422 | - sys_sem_signal(mem_sem); | ||
423 | +#if LWIP_ALLOW_MEM_FREE_FROM_OTHER_CONTEXT | ||
424 | + mem_free_count = 1; | ||
425 | +#endif /* LWIP_ALLOW_MEM_FREE_FROM_OTHER_CONTEXT */ | ||
426 | + LWIP_MEM_FREE_UNPROTECT(); | ||
427 | } | ||
428 | |||
429 | /** | ||
430 | @@ -321,6 +348,8 @@ mem_free(void *rmem) | ||
431 | * @param newsize required size after shrinking (needs to be smaller than or | ||
432 | * equal to the previous size) | ||
433 | * @return for compatibility reasons: is always == rmem, at the moment | ||
434 | + * or NULL if newsize is > old size, in which case rmem is NOT touched | ||
435 | + * or freed! | ||
436 | */ | ||
437 | void * | ||
438 | mem_realloc(void *rmem, mem_size_t newsize) | ||
439 | @@ -328,6 +357,8 @@ mem_realloc(void *rmem, mem_size_t newsi | ||
440 | mem_size_t size; | ||
441 | mem_size_t ptr, ptr2; | ||
442 | struct mem *mem, *mem2; | ||
443 | + /* use the FREE_PROTECT here: it protects with sem OR SYS_ARCH_PROTECT */ | ||
444 | + LWIP_MEM_FREE_DECL_PROTECT(); | ||
445 | |||
446 | /* Expand the size of the allocated memory region so that we can | ||
447 | adjust for alignment. */ | ||
448 | @@ -346,7 +377,12 @@ mem_realloc(void *rmem, mem_size_t newsi | ||
449 | (u8_t *)rmem < (u8_t *)ram_end); | ||
450 | |||
451 | if ((u8_t *)rmem < (u8_t *)ram || (u8_t *)rmem >= (u8_t *)ram_end) { | ||
452 | + SYS_ARCH_DECL_PROTECT(lev); | ||
453 | LWIP_DEBUGF(MEM_DEBUG | 3, ("mem_realloc: illegal memory\n")); | ||
454 | + /* protect mem stats from concurrent access */ | ||
455 | + SYS_ARCH_PROTECT(lev); | ||
456 | + MEM_STATS_INC(illegal); | ||
457 | + SYS_ARCH_UNPROTECT(lev); | ||
458 | return rmem; | ||
459 | } | ||
460 | /* Get the corresponding struct mem ... */ | ||
461 | @@ -366,11 +402,9 @@ mem_realloc(void *rmem, mem_size_t newsi | ||
462 | } | ||
463 | |||
464 | /* protect the heap from concurrent access */ | ||
465 | - sys_arch_sem_wait(mem_sem, 0); | ||
466 | + LWIP_MEM_FREE_PROTECT(); | ||
467 | |||
468 | -#if MEM_STATS | ||
469 | - lwip_stats.mem.used -= (size - newsize); | ||
470 | -#endif /* MEM_STATS */ | ||
471 | + MEM_STATS_DEC_USED(used, (size - newsize)); | ||
472 | |||
473 | mem2 = (struct mem *)&ram[mem->next]; | ||
474 | if(mem2->used == 0) { | ||
475 | @@ -426,7 +460,10 @@ mem_realloc(void *rmem, mem_size_t newsi | ||
476 | -> don't do anyhting. | ||
477 | -> the remaining space stays unused since it is too small | ||
478 | } */ | ||
479 | - sys_sem_signal(mem_sem); | ||
480 | +#if LWIP_ALLOW_MEM_FREE_FROM_OTHER_CONTEXT | ||
481 | + mem_free_count = 1; | ||
482 | +#endif /* LWIP_ALLOW_MEM_FREE_FROM_OTHER_CONTEXT */ | ||
483 | + LWIP_MEM_FREE_UNPROTECT(); | ||
484 | return rmem; | ||
485 | } | ||
486 | |||
487 | @@ -444,6 +481,10 @@ mem_malloc(mem_size_t size) | ||
488 | { | ||
489 | mem_size_t ptr, ptr2; | ||
490 | struct mem *mem, *mem2; | ||
491 | +#if LWIP_ALLOW_MEM_FREE_FROM_OTHER_CONTEXT | ||
492 | + u8_t local_mem_free_count = 0; | ||
493 | +#endif /* LWIP_ALLOW_MEM_FREE_FROM_OTHER_CONTEXT */ | ||
494 | + LWIP_MEM_ALLOC_DECL_PROTECT(); | ||
495 | |||
496 | if (size == 0) { | ||
497 | return NULL; | ||
498 | @@ -464,88 +505,101 @@ mem_malloc(mem_size_t size) | ||
499 | |||
500 | /* protect the heap from concurrent access */ | ||
501 | sys_arch_sem_wait(mem_sem, 0); | ||
502 | + LWIP_MEM_ALLOC_PROTECT(); | ||
503 | +#if LWIP_ALLOW_MEM_FREE_FROM_OTHER_CONTEXT | ||
504 | + /* run as long as a mem_free disturbed mem_malloc */ | ||
505 | + do { | ||
506 | + local_mem_free_count = 0; | ||
507 | +#endif /* LWIP_ALLOW_MEM_FREE_FROM_OTHER_CONTEXT */ | ||
508 | + | ||
509 | + /* Scan through the heap searching for a free block that is big enough, | ||
510 | + * beginning with the lowest free block. | ||
511 | + */ | ||
512 | + for (ptr = (u8_t *)lfree - ram; ptr < MEM_SIZE_ALIGNED - size; | ||
513 | + ptr = ((struct mem *)&ram[ptr])->next) { | ||
514 | + mem = (struct mem *)&ram[ptr]; | ||
515 | +#if LWIP_ALLOW_MEM_FREE_FROM_OTHER_CONTEXT | ||
516 | + mem_free_count = 0; | ||
517 | + LWIP_MEM_ALLOC_UNPROTECT(); | ||
518 | + /* allow mem_free to run */ | ||
519 | + LWIP_MEM_ALLOC_PROTECT(); | ||
520 | + if (mem_free_count != 0) { | ||
521 | + local_mem_free_count = mem_free_count; | ||
522 | + } | ||
523 | + mem_free_count = 0; | ||
524 | +#endif /* LWIP_ALLOW_MEM_FREE_FROM_OTHER_CONTEXT */ | ||
525 | |||
526 | - /* Scan through the heap searching for a free block that is big enough, | ||
527 | - * beginning with the lowest free block. | ||
528 | - */ | ||
529 | - for (ptr = (u8_t *)lfree - ram; ptr < MEM_SIZE_ALIGNED - size; | ||
530 | - ptr = ((struct mem *)&ram[ptr])->next) { | ||
531 | - mem = (struct mem *)&ram[ptr]; | ||
532 | - | ||
533 | - if ((!mem->used) && | ||
534 | - (mem->next - (ptr + SIZEOF_STRUCT_MEM)) >= size) { | ||
535 | - /* mem is not used and at least perfect fit is possible: | ||
536 | - * mem->next - (ptr + SIZEOF_STRUCT_MEM) gives us the 'user data size' of mem */ | ||
537 | - | ||
538 | - if (mem->next - (ptr + SIZEOF_STRUCT_MEM) >= (size + SIZEOF_STRUCT_MEM + MIN_SIZE_ALIGNED)) { | ||
539 | - /* (in addition to the above, we test if another struct mem (SIZEOF_STRUCT_MEM) containing | ||
540 | - * at least MIN_SIZE_ALIGNED of data also fits in the 'user data space' of 'mem') | ||
541 | - * -> split large block, create empty remainder, | ||
542 | - * remainder must be large enough to contain MIN_SIZE_ALIGNED data: if | ||
543 | - * mem->next - (ptr + (2*SIZEOF_STRUCT_MEM)) == size, | ||
544 | - * struct mem would fit in but no data between mem2 and mem2->next | ||
545 | - * @todo we could leave out MIN_SIZE_ALIGNED. We would create an empty | ||
546 | - * region that couldn't hold data, but when mem->next gets freed, | ||
547 | - * the 2 regions would be combined, resulting in more free memory | ||
548 | - */ | ||
549 | - ptr2 = ptr + SIZEOF_STRUCT_MEM + size; | ||
550 | - /* create mem2 struct */ | ||
551 | - mem2 = (struct mem *)&ram[ptr2]; | ||
552 | - mem2->used = 0; | ||
553 | - mem2->next = mem->next; | ||
554 | - mem2->prev = ptr; | ||
555 | - /* and insert it between mem and mem->next */ | ||
556 | - mem->next = ptr2; | ||
557 | - mem->used = 1; | ||
558 | - | ||
559 | - if (mem2->next != MEM_SIZE_ALIGNED) { | ||
560 | - ((struct mem *)&ram[mem2->next])->prev = ptr2; | ||
561 | - } | ||
562 | -#if MEM_STATS | ||
563 | - lwip_stats.mem.used += (size + SIZEOF_STRUCT_MEM); | ||
564 | - if (lwip_stats.mem.max < lwip_stats.mem.used) { | ||
565 | - lwip_stats.mem.max = lwip_stats.mem.used; | ||
566 | + if ((!mem->used) && | ||
567 | + (mem->next - (ptr + SIZEOF_STRUCT_MEM)) >= size) { | ||
568 | + /* mem is not used and at least perfect fit is possible: | ||
569 | + * mem->next - (ptr + SIZEOF_STRUCT_MEM) gives us the 'user data size' of mem */ | ||
570 | + | ||
571 | + if (mem->next - (ptr + SIZEOF_STRUCT_MEM) >= (size + SIZEOF_STRUCT_MEM + MIN_SIZE_ALIGNED)) { | ||
572 | + /* (in addition to the above, we test if another struct mem (SIZEOF_STRUCT_MEM) containing | ||
573 | + * at least MIN_SIZE_ALIGNED of data also fits in the 'user data space' of 'mem') | ||
574 | + * -> split large block, create empty remainder, | ||
575 | + * remainder must be large enough to contain MIN_SIZE_ALIGNED data: if | ||
576 | + * mem->next - (ptr + (2*SIZEOF_STRUCT_MEM)) == size, | ||
577 | + * struct mem would fit in but no data between mem2 and mem2->next | ||
578 | + * @todo we could leave out MIN_SIZE_ALIGNED. We would create an empty | ||
579 | + * region that couldn't hold data, but when mem->next gets freed, | ||
580 | + * the 2 regions would be combined, resulting in more free memory | ||
581 | + */ | ||
582 | + ptr2 = ptr + SIZEOF_STRUCT_MEM + size; | ||
583 | + /* create mem2 struct */ | ||
584 | + mem2 = (struct mem *)&ram[ptr2]; | ||
585 | + mem2->used = 0; | ||
586 | + mem2->next = mem->next; | ||
587 | + mem2->prev = ptr; | ||
588 | + /* and insert it between mem and mem->next */ | ||
589 | + mem->next = ptr2; | ||
590 | + mem->used = 1; | ||
591 | + | ||
592 | + if (mem2->next != MEM_SIZE_ALIGNED) { | ||
593 | + ((struct mem *)&ram[mem2->next])->prev = ptr2; | ||
594 | + } | ||
595 | + MEM_STATS_INC_USED(used, (size + SIZEOF_STRUCT_MEM)); | ||
596 | + } else { | ||
597 | + /* (a mem2 struct does no fit into the user data space of mem and mem->next will always | ||
598 | + * be used at this point: if not we have 2 unused structs in a row, plug_holes should have | ||
599 | + * take care of this). | ||
600 | + * -> near fit or excact fit: do not split, no mem2 creation | ||
601 | + * also can't move mem->next directly behind mem, since mem->next | ||
602 | + * will always be used at this point! | ||
603 | + */ | ||
604 | + mem->used = 1; | ||
605 | + MEM_STATS_INC_USED(used, mem->next - ((u8_t *)mem - ram)); | ||
606 | } | ||
607 | -#endif /* MEM_STATS */ | ||
608 | - } else { | ||
609 | - /* (a mem2 struct does no fit into the user data space of mem and mem->next will always | ||
610 | - * be used at this point: if not we have 2 unused structs in a row, plug_holes should have | ||
611 | - * take care of this). | ||
612 | - * -> near fit or excact fit: do not split, no mem2 creation | ||
613 | - * also can't move mem->next directly behind mem, since mem->next | ||
614 | - * will always be used at this point! | ||
615 | - */ | ||
616 | - mem->used = 1; | ||
617 | -#if MEM_STATS | ||
618 | - lwip_stats.mem.used += mem->next - ((u8_t *)mem - ram); | ||
619 | - if (lwip_stats.mem.max < lwip_stats.mem.used) { | ||
620 | - lwip_stats.mem.max = lwip_stats.mem.used; | ||
621 | - } | ||
622 | -#endif /* MEM_STATS */ | ||
623 | - } | ||
624 | |||
625 | - if (mem == lfree) { | ||
626 | - /* Find next free block after mem and update lowest free pointer */ | ||
627 | - while (lfree->used && lfree != ram_end) { | ||
628 | - lfree = (struct mem *)&ram[lfree->next]; | ||
629 | + if (mem == lfree) { | ||
630 | + /* Find next free block after mem and update lowest free pointer */ | ||
631 | + while (lfree->used && lfree != ram_end) { | ||
632 | + LWIP_MEM_ALLOC_UNPROTECT(); | ||
633 | + /* prevent high interrupt latency... */ | ||
634 | + LWIP_MEM_ALLOC_PROTECT(); | ||
635 | + lfree = (struct mem *)&ram[lfree->next]; | ||
636 | + } | ||
637 | + LWIP_ASSERT("mem_malloc: !lfree->used", ((lfree == ram_end) || (!lfree->used))); | ||
638 | } | ||
639 | - LWIP_ASSERT("mem_malloc: !lfree->used", ((lfree == ram_end) || (!lfree->used))); | ||
640 | - } | ||
641 | - sys_sem_signal(mem_sem); | ||
642 | - LWIP_ASSERT("mem_malloc: allocated memory not above ram_end.", | ||
643 | - (mem_ptr_t)mem + SIZEOF_STRUCT_MEM + size <= (mem_ptr_t)ram_end); | ||
644 | - LWIP_ASSERT("mem_malloc: allocated memory properly aligned.", | ||
645 | - (unsigned long)((u8_t *)mem + SIZEOF_STRUCT_MEM) % MEM_ALIGNMENT == 0); | ||
646 | - LWIP_ASSERT("mem_malloc: sanity check alignment", | ||
647 | - (((mem_ptr_t)mem) & (MEM_ALIGNMENT-1)) == 0); | ||
648 | + LWIP_MEM_ALLOC_UNPROTECT(); | ||
649 | + sys_sem_signal(mem_sem); | ||
650 | + LWIP_ASSERT("mem_malloc: allocated memory not above ram_end.", | ||
651 | + (mem_ptr_t)mem + SIZEOF_STRUCT_MEM + size <= (mem_ptr_t)ram_end); | ||
652 | + LWIP_ASSERT("mem_malloc: allocated memory properly aligned.", | ||
653 | + (unsigned long)((u8_t *)mem + SIZEOF_STRUCT_MEM) % MEM_ALIGNMENT == 0); | ||
654 | + LWIP_ASSERT("mem_malloc: sanity check alignment", | ||
655 | + (((mem_ptr_t)mem) & (MEM_ALIGNMENT-1)) == 0); | ||
656 | |||
657 | - return (u8_t *)mem + SIZEOF_STRUCT_MEM; | ||
658 | + return (u8_t *)mem + SIZEOF_STRUCT_MEM; | ||
659 | + } | ||
660 | } | ||
661 | - } | ||
662 | +#if LWIP_ALLOW_MEM_FREE_FROM_OTHER_CONTEXT | ||
663 | + /* if we got interrupted by a mem_free, try again */ | ||
664 | + } while(local_mem_free_count != 0); | ||
665 | +#endif /* LWIP_ALLOW_MEM_FREE_FROM_OTHER_CONTEXT */ | ||
666 | LWIP_DEBUGF(MEM_DEBUG | 2, ("mem_malloc: could not allocate %"S16_F" bytes\n", (s16_t)size)); | ||
667 | -#if MEM_STATS | ||
668 | - ++lwip_stats.mem.err; | ||
669 | -#endif /* MEM_STATS */ | ||
670 | + MEM_STATS_INC(err); | ||
671 | + LWIP_MEM_ALLOC_UNPROTECT(); | ||
672 | sys_sem_signal(mem_sem); | ||
673 | return NULL; | ||
674 | } | ||
675 | Index: src/core/memp.c | ||
676 | =================================================================== | ||
677 | RCS file: /sources/lwip/lwip/src/core/memp.c,v | ||
678 | retrieving revision 1.55 | ||
679 | retrieving revision 1.56 | ||
680 | diff -u -p -r1.55 -r1.56 | ||
681 | --- a/src/core/memp.c 25 Nov 2007 10:43:28 -0000 1.55 | ||
682 | +++ b/src/core/memp.c 27 Jun 2008 18:37:54 -0000 1.56 | ||
683 | @@ -252,13 +252,12 @@ memp_init(void) | ||
684 | struct memp *memp; | ||
685 | u16_t i, j; | ||
686 | |||
687 | -#if MEMP_STATS | ||
688 | for (i = 0; i < MEMP_MAX; ++i) { | ||
689 | - lwip_stats.memp[i].used = lwip_stats.memp[i].max = | ||
690 | - lwip_stats.memp[i].err = 0; | ||
691 | - lwip_stats.memp[i].avail = memp_num[i]; | ||
692 | + MEMP_STATS_AVAIL(used, i, 0); | ||
693 | + MEMP_STATS_AVAIL(max, i, 0); | ||
694 | + MEMP_STATS_AVAIL(err, i, 0); | ||
695 | + MEMP_STATS_AVAIL(avail, i, memp_num[i]); | ||
696 | } | ||
697 | -#endif /* MEMP_STATS */ | ||
698 | |||
699 | memp = LWIP_MEM_ALIGN(memp_memory); | ||
700 | /* for every pool: */ | ||
701 | @@ -315,20 +314,13 @@ memp_malloc_fn(memp_t type, const char* | ||
702 | memp->file = file; | ||
703 | memp->line = line; | ||
704 | #endif /* MEMP_OVERFLOW_CHECK */ | ||
705 | -#if MEMP_STATS | ||
706 | - ++lwip_stats.memp[type].used; | ||
707 | - if (lwip_stats.memp[type].used > lwip_stats.memp[type].max) { | ||
708 | - lwip_stats.memp[type].max = lwip_stats.memp[type].used; | ||
709 | - } | ||
710 | -#endif /* MEMP_STATS */ | ||
711 | + MEMP_STATS_INC_USED(used, type); | ||
712 | LWIP_ASSERT("memp_malloc: memp properly aligned", | ||
713 | ((mem_ptr_t)memp % MEM_ALIGNMENT) == 0); | ||
714 | memp = (struct memp*)((u8_t*)memp + MEMP_SIZE); | ||
715 | } else { | ||
716 | LWIP_DEBUGF(MEMP_DEBUG | 2, ("memp_malloc: out of memory in pool %s\n", memp_desc[type])); | ||
717 | -#if MEMP_STATS | ||
718 | - ++lwip_stats.memp[type].err; | ||
719 | -#endif /* MEMP_STATS */ | ||
720 | + MEMP_STATS_INC(err, type); | ||
721 | } | ||
722 | |||
723 | SYS_ARCH_UNPROTECT(old_level); | ||
724 | @@ -365,9 +357,7 @@ memp_free(memp_t type, void *mem) | ||
725 | #endif /* MEMP_OVERFLOW_CHECK >= 2 */ | ||
726 | #endif /* MEMP_OVERFLOW_CHECK */ | ||
727 | |||
728 | -#if MEMP_STATS | ||
729 | - lwip_stats.memp[type].used--; | ||
730 | -#endif /* MEMP_STATS */ | ||
731 | + MEMP_STATS_DEC(used, type); | ||
732 | |||
733 | memp->next = memp_tab[type]; | ||
734 | memp_tab[type] = memp; | ||
735 | Index: src/core/netif.c | ||
736 | =================================================================== | ||
737 | RCS file: /sources/lwip/lwip/src/core/netif.c,v | ||
738 | retrieving revision 1.65 | ||
739 | retrieving revision 1.68 | ||
740 | diff -u -p -r1.65 -r1.68 | ||
741 | --- a/src/core/netif.c 9 Oct 2007 20:00:55 -0000 1.65 | ||
742 | +++ b/src/core/netif.c 19 Jun 2008 16:27:18 -0000 1.68 | ||
743 | @@ -45,6 +45,12 @@ | ||
744 | #include "lwip/snmp.h" | ||
745 | #include "lwip/igmp.h" | ||
746 | #include "netif/etharp.h" | ||
747 | +#if ENABLE_LOOPBACK | ||
748 | +#include "lwip/sys.h" | ||
749 | +#if LWIP_NETIF_LOOPBACK_MULTITHREADING | ||
750 | +#include "lwip/tcpip.h" | ||
751 | +#endif /* LWIP_NETIF_LOOPBACK_MULTITHREADING */ | ||
752 | +#endif /* ENABLE_LOOPBACK */ | ||
753 | |||
754 | #if LWIP_NETIF_STATUS_CALLBACK | ||
755 | #define NETIF_STATUS_CALLBACK(n) { if (n->status_callback) (n->status_callback)(n); } | ||
756 | @@ -106,6 +112,10 @@ netif_add(struct netif *netif, struct ip | ||
757 | #if LWIP_IGMP | ||
758 | netif->igmp_mac_filter = NULL; | ||
759 | #endif /* LWIP_IGMP */ | ||
760 | +#if ENABLE_LOOPBACK | ||
761 | + netif->loop_first = NULL; | ||
762 | + netif->loop_last = NULL; | ||
763 | +#endif /* ENABLE_LOOPBACK */ | ||
764 | |||
765 | /* remember netif specific state information data */ | ||
766 | netif->state = state; | ||
767 | @@ -114,6 +124,9 @@ netif_add(struct netif *netif, struct ip | ||
768 | #if LWIP_NETIF_HWADDRHINT | ||
769 | netif->addr_hint = NULL; | ||
770 | #endif /* LWIP_NETIF_HWADDRHINT*/ | ||
771 | +#if ENABLE_LOOPBACK && LWIP_LOOPBACK_MAX_PBUFS | ||
772 | + netif->loop_cnt_current = 0; | ||
773 | +#endif /* ENABLE_LOOPBACK && LWIP_LOOPBACK_MAX_PBUFS */ | ||
774 | |||
775 | netif_set_addr(netif, ipaddr, netmask, gw); | ||
776 | |||
777 | @@ -493,7 +506,158 @@ u8_t netif_is_link_up(struct netif *neti | ||
778 | */ | ||
779 | void netif_set_link_callback(struct netif *netif, void (* link_callback)(struct netif *netif )) | ||
780 | { | ||
781 | - if ( netif ) | ||
782 | - netif->link_callback = link_callback; | ||
783 | + if (netif) { | ||
784 | + netif->link_callback = link_callback; | ||
785 | + } | ||
786 | } | ||
787 | #endif /* LWIP_NETIF_LINK_CALLBACK */ | ||
788 | + | ||
789 | +#if ENABLE_LOOPBACK | ||
790 | +/** | ||
791 | + * Send an IP packet to be received on the same netif (loopif-like). | ||
792 | + * The pbuf is simply copied and handed back to netif->input. | ||
793 | + * In multithreaded mode, this is done directly since netif->input must put | ||
794 | + * the packet on a queue. | ||
795 | + * In callback mode, the packet is put on an internal queue and is fed to | ||
796 | + * netif->input by netif_poll(). | ||
797 | + * | ||
798 | + * @param netif the lwip network interface structure | ||
799 | + * @param p the (IP) packet to 'send' | ||
800 | + * @param ipaddr the ip address to send the packet to (not used) | ||
801 | + * @return ERR_OK if the packet has been sent | ||
802 | + * ERR_MEM if the pbuf used to copy the packet couldn't be allocated | ||
803 | + */ | ||
804 | +err_t | ||
805 | +netif_loop_output(struct netif *netif, struct pbuf *p, | ||
806 | + struct ip_addr *ipaddr) | ||
807 | +{ | ||
808 | + struct pbuf *r; | ||
809 | + err_t err; | ||
810 | + struct pbuf *last; | ||
811 | +#if LWIP_LOOPBACK_MAX_PBUFS | ||
812 | + u8_t clen = 0; | ||
813 | +#endif /* LWIP_LOOPBACK_MAX_PBUFS */ | ||
814 | + SYS_ARCH_DECL_PROTECT(lev); | ||
815 | + LWIP_UNUSED_ARG(ipaddr); | ||
816 | + | ||
817 | + /* Allocate a new pbuf */ | ||
818 | + r = pbuf_alloc(PBUF_LINK, p->tot_len, PBUF_RAM); | ||
819 | + if (r == NULL) { | ||
820 | + return ERR_MEM; | ||
821 | + } | ||
822 | +#if LWIP_LOOPBACK_MAX_PBUFS | ||
823 | + clen = pbuf_clen(r); | ||
824 | + /* check for overflow or too many pbuf on queue */ | ||
825 | + if(((netif->loop_cnt_current + clen) < netif->loop_cnt_current) || | ||
826 | + ((netif->loop_cnt_current + clen) > LWIP_LOOPBACK_MAX_PBUFS)) { | ||
827 | + pbuf_free(r); | ||
828 | + r = NULL; | ||
829 | + return ERR_MEM; | ||
830 | + } | ||
831 | + netif->loop_cnt_current += clen; | ||
832 | +#endif /* LWIP_LOOPBACK_MAX_PBUFS */ | ||
833 | + | ||
834 | + /* Copy the whole pbuf queue p into the single pbuf r */ | ||
835 | + if ((err = pbuf_copy(r, p)) != ERR_OK) { | ||
836 | + pbuf_free(r); | ||
837 | + r = NULL; | ||
838 | + return err; | ||
839 | + } | ||
840 | + | ||
841 | + /* Put the packet on a linked list which gets emptied through calling | ||
842 | + netif_poll(). */ | ||
843 | + | ||
844 | + /* let last point to the last pbuf in chain r */ | ||
845 | + for (last = r; last->next != NULL; last = last->next); | ||
846 | + | ||
847 | + SYS_ARCH_PROTECT(lev); | ||
848 | + if(netif->loop_first != NULL) { | ||
849 | + LWIP_ASSERT("if first != NULL, last must also be != NULL", netif->loop_last != NULL); | ||
850 | + netif->loop_last->next = r; | ||
851 | + netif->loop_last = last; | ||
852 | + } else { | ||
853 | + netif->loop_first = r; | ||
854 | + netif->loop_last = last; | ||
855 | + } | ||
856 | + SYS_ARCH_UNPROTECT(lev); | ||
857 | + | ||
858 | +#if LWIP_NETIF_LOOPBACK_MULTITHREADING | ||
859 | + /* For multithreading environment, schedule a call to netif_poll */ | ||
860 | + tcpip_callback(netif_poll, netif); | ||
861 | +#endif /* LWIP_NETIF_LOOPBACK_MULTITHREADING */ | ||
862 | + | ||
863 | + return ERR_OK; | ||
864 | +} | ||
865 | + | ||
866 | +/** | ||
867 | + * Call netif_poll() in the main loop of your application. This is to prevent | ||
868 | + * reentering non-reentrant functions like tcp_input(). Packets passed to | ||
869 | + * netif_loop_output() are put on a list that is passed to netif->input() by | ||
870 | + * netif_poll(). | ||
871 | + */ | ||
872 | +void | ||
873 | +netif_poll(struct netif *netif) | ||
874 | +{ | ||
875 | + struct pbuf *in; | ||
876 | + SYS_ARCH_DECL_PROTECT(lev); | ||
877 | + | ||
878 | + do { | ||
879 | + /* Get a packet from the list. With SYS_LIGHTWEIGHT_PROT=1, this is protected */ | ||
880 | + SYS_ARCH_PROTECT(lev); | ||
881 | + in = netif->loop_first; | ||
882 | + if(in != NULL) { | ||
883 | + struct pbuf *in_end = in; | ||
884 | +#if LWIP_LOOPBACK_MAX_PBUFS | ||
885 | + u8_t clen = pbuf_clen(in); | ||
886 | + /* adjust the number of pbufs on queue */ | ||
887 | + LWIP_ASSERT("netif->loop_cnt_current underflow", | ||
888 | + ((netif->loop_cnt_current - clen) < netif->loop_cnt_current)); | ||
889 | + netif->loop_cnt_current -= clen; | ||
890 | +#endif /* LWIP_LOOPBACK_MAX_PBUFS */ | ||
891 | + while(in_end->len != in_end->tot_len) { | ||
892 | + LWIP_ASSERT("bogus pbuf: len != tot_len but next == NULL!", in_end->next != NULL); | ||
893 | + in_end = in_end->next; | ||
894 | + } | ||
895 | + /* 'in_end' now points to the last pbuf from 'in' */ | ||
896 | + if(in_end == netif->loop_last) { | ||
897 | + /* this was the last pbuf in the list */ | ||
898 | + netif->loop_first = netif->loop_last = NULL; | ||
899 | + } else { | ||
900 | + /* pop the pbuf off the list */ | ||
901 | + netif->loop_first = in_end->next; | ||
902 | + LWIP_ASSERT("should not be null since first != last!", netif->loop_first != NULL); | ||
903 | + } | ||
904 | + /* De-queue the pbuf from its successors on the 'loop_' list. */ | ||
905 | + in_end->next = NULL; | ||
906 | + } | ||
907 | + SYS_ARCH_UNPROTECT(lev); | ||
908 | + | ||
909 | + if(in != NULL) { | ||
910 | + /* loopback packets are always IP packets! */ | ||
911 | + if(ip_input(in, netif) != ERR_OK) { | ||
912 | + pbuf_free(in); | ||
913 | + } | ||
914 | + /* Don't reference the packet any more! */ | ||
915 | + in = NULL; | ||
916 | + } | ||
917 | + /* go on while there is a packet on the list */ | ||
918 | + } while(netif->loop_first != NULL); | ||
919 | +} | ||
920 | + | ||
921 | +#if !LWIP_NETIF_LOOPBACK_MULTITHREADING | ||
922 | +/** | ||
923 | + * Calls netif_poll() for every netif on the netif_list. | ||
924 | + */ | ||
925 | +void | ||
926 | +netif_poll_all(void) | ||
927 | +{ | ||
928 | + struct netif *netif = netif_list; | ||
929 | + /* loop through netifs */ | ||
930 | + while (netif != NULL) { | ||
931 | + netif_poll(netif); | ||
932 | + /* proceed to next network interface */ | ||
933 | + netif = netif->next; | ||
934 | + } | ||
935 | +} | ||
936 | +#endif /* !LWIP_NETIF_LOOPBACK_MULTITHREADING */ | ||
937 | +#endif /* ENABLE_LOOPBACK */ | ||
938 | Index: src/core/pbuf.c | ||
939 | =================================================================== | ||
940 | RCS file: /sources/lwip/lwip/src/core/pbuf.c,v | ||
941 | retrieving revision 1.127 | ||
942 | retrieving revision 1.128 | ||
943 | diff -u -p -r1.127 -r1.128 | ||
944 | --- a/src/core/pbuf.c 4 Mar 2008 16:37:46 -0000 1.127 | ||
945 | +++ b/src/core/pbuf.c 1 Apr 2008 19:05:40 -0000 1.128 | ||
946 | @@ -667,8 +667,8 @@ pbuf_dechain(struct pbuf *p) | ||
947 | * | ||
948 | * @note Only one packet is copied, no packet queue! | ||
949 | * | ||
950 | - * @param p_to pbuf source of the copy | ||
951 | - * @param p_from pbuf destination of the copy | ||
952 | + * @param p_to pbuf destination of the copy | ||
953 | + * @param p_from pbuf source of the copy | ||
954 | * | ||
955 | * @return ERR_OK if pbuf was copied | ||
956 | * ERR_ARG if one of the pbufs is NULL or p_to is not big | ||
957 | Index: src/core/stats.c | ||
958 | =================================================================== | ||
959 | RCS file: /sources/lwip/lwip/src/core/stats.c,v | ||
960 | retrieving revision 1.27 | ||
961 | retrieving revision 1.28 | ||
962 | diff -u -p -r1.27 -r1.28 | ||
963 | --- a/src/core/stats.c 4 Mar 2008 16:31:32 -0000 1.27 | ||
964 | +++ b/src/core/stats.c 27 Jun 2008 18:37:54 -0000 1.28 | ||
965 | @@ -54,7 +54,6 @@ stats_display_proto(struct stats_proto * | ||
966 | { | ||
967 | LWIP_PLATFORM_DIAG(("\n%s\n\t", name)); | ||
968 | LWIP_PLATFORM_DIAG(("xmit: %"STAT_COUNTER_F"\n\t", proto->xmit)); | ||
969 | - LWIP_PLATFORM_DIAG(("rexmit: %"STAT_COUNTER_F"\n\t", proto->rexmit)); | ||
970 | LWIP_PLATFORM_DIAG(("recv: %"STAT_COUNTER_F"\n\t", proto->recv)); | ||
971 | LWIP_PLATFORM_DIAG(("fw: %"STAT_COUNTER_F"\n\t", proto->fw)); | ||
972 | LWIP_PLATFORM_DIAG(("drop: %"STAT_COUNTER_F"\n\t", proto->drop)); | ||
973 | @@ -68,6 +67,7 @@ stats_display_proto(struct stats_proto * | ||
974 | LWIP_PLATFORM_DIAG(("cachehit: %"STAT_COUNTER_F"\n", proto->cachehit)); | ||
975 | } | ||
976 | |||
977 | +#if IGMP_STATS | ||
978 | void | ||
979 | stats_display_igmp(struct stats_igmp *igmp) | ||
980 | { | ||
981 | @@ -82,7 +82,9 @@ stats_display_igmp(struct stats_igmp *ig | ||
982 | LWIP_PLATFORM_DIAG(("report_rxed: %"STAT_COUNTER_F"\n\t", igmp->report_rxed)); | ||
983 | LWIP_PLATFORM_DIAG(("group_query_rxed: %"STAT_COUNTER_F"\n", igmp->group_query_rxed)); | ||
984 | } | ||
985 | +#endif /* IGMP_STATS */ | ||
986 | |||
987 | +#if MEM_STATS || MEMP_STATS | ||
988 | void | ||
989 | stats_display_mem(struct stats_mem *mem, char *name) | ||
990 | { | ||
991 | @@ -93,48 +95,53 @@ stats_display_mem(struct stats_mem *mem, | ||
992 | LWIP_PLATFORM_DIAG(("err: %"U32_F"\n", (u32_t)mem->err)); | ||
993 | } | ||
994 | |||
995 | +#if MEMP_STATS | ||
996 | void | ||
997 | -stats_display(void) | ||
998 | +stats_display_memp(struct stats_mem *mem, int index) | ||
999 | { | ||
1000 | -#if MEMP_STATS | ||
1001 | - s16_t i; | ||
1002 | char * memp_names[] = { | ||
1003 | #define LWIP_MEMPOOL(name,num,size,desc) desc, | ||
1004 | #include "lwip/memp_std.h" | ||
1005 | }; | ||
1006 | -#endif | ||
1007 | -#if LINK_STATS | ||
1008 | - stats_display_proto(&lwip_stats.link, "LINK"); | ||
1009 | -#endif | ||
1010 | -#if ETHARP_STATS | ||
1011 | - stats_display_proto(&lwip_stats.etharp, "ETHARP"); | ||
1012 | -#endif | ||
1013 | -#if IPFRAG_STATS | ||
1014 | - stats_display_proto(&lwip_stats.ip_frag, "IP_FRAG"); | ||
1015 | -#endif | ||
1016 | -#if IP_STATS | ||
1017 | - stats_display_proto(&lwip_stats.ip, "IP"); | ||
1018 | -#endif | ||
1019 | -#if ICMP_STATS | ||
1020 | - stats_display_proto(&lwip_stats.icmp, "ICMP"); | ||
1021 | -#endif | ||
1022 | -#if IGMP_STATS | ||
1023 | - stats_display_igmp(&lwip_stats.igmp); | ||
1024 | -#endif | ||
1025 | -#if UDP_STATS | ||
1026 | - stats_display_proto(&lwip_stats.udp, "UDP"); | ||
1027 | -#endif | ||
1028 | -#if TCP_STATS | ||
1029 | - stats_display_proto(&lwip_stats.tcp, "TCP"); | ||
1030 | -#endif | ||
1031 | -#if MEM_STATS | ||
1032 | - stats_display_mem(&lwip_stats.mem, "HEAP"); | ||
1033 | -#endif | ||
1034 | -#if MEMP_STATS | ||
1035 | + if(index < MEMP_MAX) { | ||
1036 | + stats_display_mem(mem, memp_names[index]); | ||
1037 | + } | ||
1038 | +} | ||
1039 | +#endif /* MEMP_STATS */ | ||
1040 | +#endif /* MEM_STATS || MEMP_STATS */ | ||
1041 | + | ||
1042 | +#if SYS_STATS | ||
1043 | +void | ||
1044 | +stats_display_sys(struct stats_sys *sys) | ||
1045 | +{ | ||
1046 | + LWIP_PLATFORM_DIAG(("\nSYS\n\t")); | ||
1047 | + LWIP_PLATFORM_DIAG(("sem.used: %"U32_F"\n\t", (u32_t)sys->sem.used)); | ||
1048 | + LWIP_PLATFORM_DIAG(("sem.max: %"U32_F"\n\t", (u32_t)sys->sem.max)); | ||
1049 | + LWIP_PLATFORM_DIAG(("sem.err: %"U32_F"\n\t", (u32_t)sys->sem.err)); | ||
1050 | + LWIP_PLATFORM_DIAG(("mbox.used: %"U32_F"\n\t", (u32_t)sys->mbox.used)); | ||
1051 | + LWIP_PLATFORM_DIAG(("mbox.max: %"U32_F"\n\t", (u32_t)sys->mbox.max)); | ||
1052 | + LWIP_PLATFORM_DIAG(("mbox.err: %"U32_F"\n\t", (u32_t)sys->mbox.err)); | ||
1053 | +} | ||
1054 | +#endif /* SYS_STATS */ | ||
1055 | + | ||
1056 | +void | ||
1057 | +stats_display(void) | ||
1058 | +{ | ||
1059 | + s16_t i; | ||
1060 | + | ||
1061 | + LINK_STATS_DISPLAY(); | ||
1062 | + ETHARP_STATS_DISPLAY(); | ||
1063 | + IPFRAG_STATS_DISPLAY(); | ||
1064 | + IP_STATS_DISPLAY(); | ||
1065 | + IGMP_STATS_DISPLAY(); | ||
1066 | + ICMP_STATS_DISPLAY(); | ||
1067 | + UDP_STATS_DISPLAY(); | ||
1068 | + TCP_STATS_DISPLAY(); | ||
1069 | + MEM_STATS_DISPLAY(); | ||
1070 | for (i = 0; i < MEMP_MAX; i++) { | ||
1071 | - stats_display_mem(&lwip_stats.memp[i], memp_names[i]); | ||
1072 | + MEMP_STATS_DISPLAY(i); | ||
1073 | } | ||
1074 | -#endif | ||
1075 | + SYS_STATS_DISPLAY(); | ||
1076 | } | ||
1077 | #endif /* LWIP_STATS_DISPLAY */ | ||
1078 | |||
1079 | Index: src/core/sys.c | ||
1080 | =================================================================== | ||
1081 | RCS file: /sources/lwip/lwip/src/core/sys.c,v | ||
1082 | retrieving revision 1.32 | ||
1083 | retrieving revision 1.33 | ||
1084 | diff -u -p -r1.32 -r1.33 | ||
1085 | --- a/src/core/sys.c 25 Nov 2007 13:57:05 -0000 1.32 | ||
1086 | +++ b/src/core/sys.c 16 Jul 2008 20:36:12 -0000 1.33 | ||
1087 | @@ -65,7 +65,7 @@ struct sswt_cb | ||
1088 | void | ||
1089 | sys_mbox_fetch(sys_mbox_t mbox, void **msg) | ||
1090 | { | ||
1091 | - u32_t time; | ||
1092 | + u32_t time_needed; | ||
1093 | struct sys_timeouts *timeouts; | ||
1094 | struct sys_timeo *tmptimeout; | ||
1095 | sys_timeout_handler h; | ||
1096 | @@ -76,18 +76,18 @@ sys_mbox_fetch(sys_mbox_t mbox, void **m | ||
1097 | |||
1098 | if (!timeouts || !timeouts->next) { | ||
1099 | UNLOCK_TCPIP_CORE(); | ||
1100 | - time = sys_arch_mbox_fetch(mbox, msg, 0); | ||
1101 | + time_needed = sys_arch_mbox_fetch(mbox, msg, 0); | ||
1102 | LOCK_TCPIP_CORE(); | ||
1103 | } else { | ||
1104 | if (timeouts->next->time > 0) { | ||
1105 | UNLOCK_TCPIP_CORE(); | ||
1106 | - time = sys_arch_mbox_fetch(mbox, msg, timeouts->next->time); | ||
1107 | + time_needed = sys_arch_mbox_fetch(mbox, msg, timeouts->next->time); | ||
1108 | LOCK_TCPIP_CORE(); | ||
1109 | } else { | ||
1110 | - time = SYS_ARCH_TIMEOUT; | ||
1111 | + time_needed = SYS_ARCH_TIMEOUT; | ||
1112 | } | ||
1113 | |||
1114 | - if (time == SYS_ARCH_TIMEOUT) { | ||
1115 | + if (time_needed == SYS_ARCH_TIMEOUT) { | ||
1116 | /* If time == SYS_ARCH_TIMEOUT, a timeout occured before a message | ||
1117 | could be fetched. We should now call the timeout handler and | ||
1118 | deallocate the memory allocated for the timeout. */ | ||
1119 | @@ -107,8 +107,8 @@ sys_mbox_fetch(sys_mbox_t mbox, void **m | ||
1120 | /* If time != SYS_ARCH_TIMEOUT, a message was received before the timeout | ||
1121 | occured. The time variable is set to the number of | ||
1122 | milliseconds we waited for the message. */ | ||
1123 | - if (time < timeouts->next->time) { | ||
1124 | - timeouts->next->time -= time; | ||
1125 | + if (time_needed < timeouts->next->time) { | ||
1126 | + timeouts->next->time -= time_needed; | ||
1127 | } else { | ||
1128 | timeouts->next->time = 0; | ||
1129 | } | ||
1130 | @@ -125,7 +125,7 @@ sys_mbox_fetch(sys_mbox_t mbox, void **m | ||
1131 | void | ||
1132 | sys_sem_wait(sys_sem_t sem) | ||
1133 | { | ||
1134 | - u32_t time; | ||
1135 | + u32_t time_needed; | ||
1136 | struct sys_timeouts *timeouts; | ||
1137 | struct sys_timeo *tmptimeout; | ||
1138 | sys_timeout_handler h; | ||
1139 | @@ -139,12 +139,12 @@ sys_sem_wait(sys_sem_t sem) | ||
1140 | sys_arch_sem_wait(sem, 0); | ||
1141 | } else { | ||
1142 | if (timeouts->next->time > 0) { | ||
1143 | - time = sys_arch_sem_wait(sem, timeouts->next->time); | ||
1144 | + time_needed = sys_arch_sem_wait(sem, timeouts->next->time); | ||
1145 | } else { | ||
1146 | - time = SYS_ARCH_TIMEOUT; | ||
1147 | + time_needed = SYS_ARCH_TIMEOUT; | ||
1148 | } | ||
1149 | |||
1150 | - if (time == SYS_ARCH_TIMEOUT) { | ||
1151 | + if (time_needed == SYS_ARCH_TIMEOUT) { | ||
1152 | /* If time == SYS_ARCH_TIMEOUT, a timeout occured before a message | ||
1153 | could be fetched. We should now call the timeout handler and | ||
1154 | deallocate the memory allocated for the timeout. */ | ||
1155 | @@ -164,8 +164,8 @@ sys_sem_wait(sys_sem_t sem) | ||
1156 | /* If time != SYS_ARCH_TIMEOUT, a message was received before the timeout | ||
1157 | occured. The time variable is set to the number of | ||
1158 | milliseconds we waited for the message. */ | ||
1159 | - if (time < timeouts->next->time) { | ||
1160 | - timeouts->next->time -= time; | ||
1161 | + if (time_needed < timeouts->next->time) { | ||
1162 | + timeouts->next->time -= time_needed; | ||
1163 | } else { | ||
1164 | timeouts->next->time = 0; | ||
1165 | } | ||
1166 | Index: src/core/tcp.c | ||
1167 | =================================================================== | ||
1168 | RCS file: /sources/lwip/lwip/src/core/tcp.c,v | ||
1169 | retrieving revision 1.85 | ||
1170 | retrieving revision 1.86 | ||
1171 | diff -u -p -r1.85 -r1.86 | ||
1172 | --- a/src/core/tcp.c 22 Jan 2008 21:15:15 -0000 1.85 | ||
1173 | +++ b/src/core/tcp.c 26 Mar 2008 11:57:13 -0000 1.86 | ||
1174 | @@ -509,7 +509,8 @@ tcp_connect(struct tcp_pcb *pcb, struct | ||
1175 | pcb->rcv_wnd = TCP_WND; | ||
1176 | pcb->rcv_ann_wnd = TCP_WND; | ||
1177 | pcb->snd_wnd = TCP_WND; | ||
1178 | - /* The send MSS is updated when an MSS option is received. */ | ||
1179 | + /* As initial send MSS, we use TCP_MSS but limit it to 536. | ||
1180 | + The send MSS is updated when an MSS option is received. */ | ||
1181 | pcb->mss = (TCP_MSS > 536) ? 536 : TCP_MSS; | ||
1182 | #if TCP_CALCULATE_EFF_SEND_MSS | ||
1183 | pcb->mss = tcp_eff_send_mss(pcb->mss, ipaddr); | ||
1184 | @@ -991,7 +992,8 @@ tcp_alloc(u8_t prio) | ||
1185 | pcb->rcv_ann_wnd = TCP_WND; | ||
1186 | pcb->tos = 0; | ||
1187 | pcb->ttl = TCP_TTL; | ||
1188 | - /* The send MSS is updated when an MSS option is received. */ | ||
1189 | + /* As initial send MSS, we use TCP_MSS but limit it to 536. | ||
1190 | + The send MSS is updated when an MSS option is received. */ | ||
1191 | pcb->mss = (TCP_MSS > 536) ? 536 : TCP_MSS; | ||
1192 | pcb->rto = 3000 / TCP_SLOW_INTERVAL; | ||
1193 | pcb->sa = 0; | ||
1194 | Index: src/core/tcp_in.c | ||
1195 | =================================================================== | ||
1196 | RCS file: /sources/lwip/lwip/src/core/tcp_in.c,v | ||
1197 | retrieving revision 1.97 | ||
1198 | retrieving revision 1.100 | ||
1199 | diff -u -p -r1.97 -r1.100 | ||
1200 | --- a/src/core/tcp_in.c 22 Jan 2008 21:15:15 -0000 1.97 | ||
1201 | +++ b/src/core/tcp_in.c 24 Jun 2008 15:46:39 -0000 1.100 | ||
1202 | @@ -511,7 +511,7 @@ tcp_process(struct tcp_pcb *pcb) | ||
1203 | } | ||
1204 | } else { | ||
1205 | if (TCP_SEQ_BETWEEN(seqno, pcb->rcv_nxt, | ||
1206 | - pcb->rcv_nxt+pcb->rcv_ann_wnd)) { | ||
1207 | + pcb->rcv_nxt+pcb->rcv_wnd)) { | ||
1208 | acceptable = 1; | ||
1209 | } | ||
1210 | } | ||
1211 | @@ -1038,7 +1038,7 @@ tcp_receive(struct tcp_pcb *pcb) | ||
1212 | and below rcv_nxt + rcv_wnd) in order to be further | ||
1213 | processed. */ | ||
1214 | if (TCP_SEQ_BETWEEN(seqno, pcb->rcv_nxt, | ||
1215 | - pcb->rcv_nxt + pcb->rcv_ann_wnd - 1)){ | ||
1216 | + pcb->rcv_nxt + pcb->rcv_wnd - 1)){ | ||
1217 | if (pcb->rcv_nxt == seqno) { | ||
1218 | accepted_inseq = 1; | ||
1219 | /* The incoming segment is the next in sequence. We check if | ||
1220 | @@ -1195,14 +1195,14 @@ tcp_receive(struct tcp_pcb *pcb) | ||
1221 | } else { | ||
1222 | pcb->ooseq = cseg; | ||
1223 | } | ||
1224 | - } | ||
1225 | - tcp_seg_free(next); | ||
1226 | - if (cseg->next != NULL) { | ||
1227 | - next = cseg->next; | ||
1228 | - if (TCP_SEQ_GT(seqno + cseg->len, next->tcphdr->seqno)) { | ||
1229 | - /* We need to trim the incoming segment. */ | ||
1230 | - cseg->len = (u16_t)(next->tcphdr->seqno - seqno); | ||
1231 | - pbuf_realloc(cseg->p, cseg->len); | ||
1232 | + tcp_seg_free(next); | ||
1233 | + if (cseg->next != NULL) { | ||
1234 | + next = cseg->next; | ||
1235 | + if (TCP_SEQ_GT(seqno + cseg->len, next->tcphdr->seqno)) { | ||
1236 | + /* We need to trim the incoming segment. */ | ||
1237 | + cseg->len = (u16_t)(next->tcphdr->seqno - seqno); | ||
1238 | + pbuf_realloc(cseg->p, cseg->len); | ||
1239 | + } | ||
1240 | } | ||
1241 | } | ||
1242 | break; | ||
1243 | @@ -1282,10 +1282,7 @@ tcp_receive(struct tcp_pcb *pcb) | ||
1244 | |||
1245 | } | ||
1246 | } else { | ||
1247 | - if(!TCP_SEQ_BETWEEN(seqno, pcb->rcv_nxt, | ||
1248 | - pcb->rcv_nxt + pcb->rcv_ann_wnd-1)){ | ||
1249 | - tcp_ack_now(pcb); | ||
1250 | - } | ||
1251 | + tcp_ack_now(pcb); | ||
1252 | } | ||
1253 | } else { | ||
1254 | /* Segments with length 0 is taken care of here. Segments that | ||
1255 | @@ -1331,7 +1328,8 @@ tcp_parseopt(struct tcp_pcb *pcb) | ||
1256 | opts[c + 1] == 0x04) { | ||
1257 | /* An MSS option with the right option length. */ | ||
1258 | mss = (opts[c + 2] << 8) | opts[c + 3]; | ||
1259 | - pcb->mss = mss > TCP_MSS? TCP_MSS: mss; | ||
1260 | + /* Limit the mss to the configured TCP_MSS and prevent division by zero */ | ||
1261 | + pcb->mss = ((mss > TCP_MSS) || (mss == 0)) ? TCP_MSS : mss; | ||
1262 | |||
1263 | /* And we are done processing options. */ | ||
1264 | break; | ||
1265 | Index: src/core/ipv4/autoip.c | ||
1266 | =================================================================== | ||
1267 | RCS file: /sources/lwip/lwip/src/core/ipv4/autoip.c,v | ||
1268 | retrieving revision 1.16 | ||
1269 | retrieving revision 1.17 | ||
1270 | diff -u -p -r1.16 -r1.17 | ||
1271 | --- a/src/core/ipv4/autoip.c 26 Jan 2008 16:11:40 -0000 1.16 | ||
1272 | +++ b/src/core/ipv4/autoip.c 17 Jun 2008 20:16:23 -0000 1.17 | ||
1273 | @@ -395,8 +395,8 @@ autoip_arp_reply(struct netif *netif, st | ||
1274 | /* Copy struct ip_addr2 to aligned ip_addr, to support compilers without | ||
1275 | * structure packing (not using structure copy which breaks strict-aliasing rules). | ||
1276 | */ | ||
1277 | - MEMCPY(&sipaddr, &hdr->sipaddr, sizeof(sipaddr)); | ||
1278 | - MEMCPY(&dipaddr, &hdr->dipaddr, sizeof(dipaddr)); | ||
1279 | + SMEMCPY(&sipaddr, &hdr->sipaddr, sizeof(sipaddr)); | ||
1280 | + SMEMCPY(&dipaddr, &hdr->dipaddr, sizeof(dipaddr)); | ||
1281 | |||
1282 | if ((netif->autoip->state == AUTOIP_STATE_PROBING) || | ||
1283 | ((netif->autoip->state == AUTOIP_STATE_ANNOUNCING) && | ||
1284 | Index: src/core/ipv4/inet_chksum.c | ||
1285 | =================================================================== | ||
1286 | RCS file: /sources/lwip/lwip/src/core/ipv4/inet_chksum.c,v | ||
1287 | retrieving revision 1.4 | ||
1288 | retrieving revision 1.5 | ||
1289 | diff -u -p -r1.4 -r1.5 | ||
1290 | --- a/src/core/ipv4/inet_chksum.c 10 Mar 2008 16:12:31 -0000 1.4 | ||
1291 | +++ b/src/core/ipv4/inet_chksum.c 17 Jun 2008 20:06:25 -0000 1.5 | ||
1292 | @@ -41,8 +41,6 @@ | ||
1293 | #include "lwip/inet_chksum.h" | ||
1294 | #include "lwip/inet.h" | ||
1295 | |||
1296 | -#include <string.h> | ||
1297 | - | ||
1298 | /* These are some reference implementations of the checksum algorithm, with the | ||
1299 | * aim of being simple, correct and fully portable. Checksumming is the | ||
1300 | * first thing you would want to optimize for your platform. If you create | ||
1301 | @@ -65,6 +63,11 @@ | ||
1302 | # define LWIP_CHKSUM_ALGORITHM 0 | ||
1303 | #endif | ||
1304 | |||
1305 | +/** Like the name says... */ | ||
1306 | +#define SWAP_BYTES_IN_WORD(w) ((w & 0xff) << 8) | ((w & 0xff00) >> 8) | ||
1307 | +/** Split an u32_t in two u16_ts and add them up */ | ||
1308 | +#define FOLD_U32T(u) ((u >> 16) + (u & 0x0000ffffUL)) | ||
1309 | + | ||
1310 | #if (LWIP_CHKSUM_ALGORITHM == 1) /* Version #1 */ | ||
1311 | /** | ||
1312 | * lwip checksum | ||
1313 | @@ -86,8 +89,7 @@ lwip_standard_chksum(void *dataptr, u16_ | ||
1314 | acc = 0; | ||
1315 | /* dataptr may be at odd or even addresses */ | ||
1316 | octetptr = (u8_t*)dataptr; | ||
1317 | - while (len > 1) | ||
1318 | - { | ||
1319 | + while (len > 1) { | ||
1320 | /* declare first octet as most significant | ||
1321 | thus assume network order, ignoring host order */ | ||
1322 | src = (*octetptr) << 8; | ||
1323 | @@ -98,8 +100,7 @@ lwip_standard_chksum(void *dataptr, u16_ | ||
1324 | acc += src; | ||
1325 | len -= 2; | ||
1326 | } | ||
1327 | - if (len > 0) | ||
1328 | - { | ||
1329 | + if (len > 0) { | ||
1330 | /* accumulate remaining octet */ | ||
1331 | src = (*octetptr) << 8; | ||
1332 | acc += src; | ||
1333 | @@ -154,19 +155,22 @@ lwip_standard_chksum(void *dataptr, int | ||
1334 | } | ||
1335 | |||
1336 | /* Consume left-over byte, if any */ | ||
1337 | - if (len > 0) | ||
1338 | + if (len > 0) { | ||
1339 | ((u8_t *)&t)[0] = *(u8_t *)ps;; | ||
1340 | + } | ||
1341 | |||
1342 | /* Add end bytes */ | ||
1343 | sum += t; | ||
1344 | |||
1345 | - /* Fold 32-bit sum to 16 bits */ | ||
1346 | - while ((sum >> 16) != 0) | ||
1347 | - sum = (sum & 0xffff) + (sum >> 16); | ||
1348 | + /* Fold 32-bit sum to 16 bits | ||
1349 | + calling this twice is propably faster than if statements... */ | ||
1350 | + sum = FOLD_U32T(sum); | ||
1351 | + sum = FOLD_U32T(sum); | ||
1352 | |||
1353 | /* Swap if alignment was odd */ | ||
1354 | - if (odd) | ||
1355 | - sum = ((sum & 0xff) << 8) | ((sum & 0xff00) >> 8); | ||
1356 | + if (odd) { | ||
1357 | + sum = SWAP_BYTES_IN_WORD(sum); | ||
1358 | + } | ||
1359 | |||
1360 | return sum; | ||
1361 | } | ||
1362 | @@ -211,18 +215,20 @@ lwip_standard_chksum(void *dataptr, int | ||
1363 | |||
1364 | while (len > 7) { | ||
1365 | tmp = sum + *pl++; /* ping */ | ||
1366 | - if (tmp < sum) | ||
1367 | + if (tmp < sum) { | ||
1368 | tmp++; /* add back carry */ | ||
1369 | + } | ||
1370 | |||
1371 | sum = tmp + *pl++; /* pong */ | ||
1372 | - if (sum < tmp) | ||
1373 | + if (sum < tmp) { | ||
1374 | sum++; /* add back carry */ | ||
1375 | + } | ||
1376 | |||
1377 | len -= 8; | ||
1378 | } | ||
1379 | |||
1380 | /* make room in upper bits */ | ||
1381 | - sum = (sum >> 16) + (sum & 0xffff); | ||
1382 | + sum = FOLD_U32T(sum); | ||
1383 | |||
1384 | ps = (u16_t *)pl; | ||
1385 | |||
1386 | @@ -233,16 +239,20 @@ lwip_standard_chksum(void *dataptr, int | ||
1387 | } | ||
1388 | |||
1389 | /* dangling tail byte remaining? */ | ||
1390 | - if (len > 0) /* include odd byte */ | ||
1391 | + if (len > 0) { /* include odd byte */ | ||
1392 | ((u8_t *)&t)[0] = *(u8_t *)ps; | ||
1393 | + } | ||
1394 | |||
1395 | sum += t; /* add end bytes */ | ||
1396 | |||
1397 | - while ((sum >> 16) != 0) /* combine halves */ | ||
1398 | - sum = (sum >> 16) + (sum & 0xffff); | ||
1399 | + /* Fold 32-bit sum to 16 bits | ||
1400 | + calling this twice is propably faster than if statements... */ | ||
1401 | + sum = FOLD_U32T(sum); | ||
1402 | + sum = FOLD_U32T(sum); | ||
1403 | |||
1404 | - if (odd) | ||
1405 | - sum = ((sum & 0xff) << 8) | ((sum & 0xff00) >> 8); | ||
1406 | + if (odd) { | ||
1407 | + sum = SWAP_BYTES_IN_WORD(sum); | ||
1408 | + } | ||
1409 | |||
1410 | return sum; | ||
1411 | } | ||
1412 | @@ -277,18 +287,18 @@ inet_chksum_pseudo(struct pbuf *p, | ||
1413 | (void *)q, (void *)q->next)); | ||
1414 | acc += LWIP_CHKSUM(q->payload, q->len); | ||
1415 | /*LWIP_DEBUGF(INET_DEBUG, ("inet_chksum_pseudo(): unwrapped lwip_chksum()=%"X32_F" \n", acc));*/ | ||
1416 | - while ((acc >> 16) != 0) { | ||
1417 | - acc = (acc & 0xffffUL) + (acc >> 16); | ||
1418 | - } | ||
1419 | + /* just executing this next line is probably faster that the if statement needed | ||
1420 | + to check whether we really need to execute it, and does no harm */ | ||
1421 | + acc = FOLD_U32T(acc); | ||
1422 | if (q->len % 2 != 0) { | ||
1423 | swapped = 1 - swapped; | ||
1424 | - acc = ((acc & 0xff) << 8) | ((acc & 0xff00UL) >> 8); | ||
1425 | + acc = SWAP_BYTES_IN_WORD(acc); | ||
1426 | } | ||
1427 | /*LWIP_DEBUGF(INET_DEBUG, ("inet_chksum_pseudo(): wrapped lwip_chksum()=%"X32_F" \n", acc));*/ | ||
1428 | } | ||
1429 | |||
1430 | if (swapped) { | ||
1431 | - acc = ((acc & 0xff) << 8) | ((acc & 0xff00UL) >> 8); | ||
1432 | + acc = SWAP_BYTES_IN_WORD(acc); | ||
1433 | } | ||
1434 | acc += (src->addr & 0xffffUL); | ||
1435 | acc += ((src->addr >> 16) & 0xffffUL); | ||
1436 | @@ -297,9 +307,10 @@ inet_chksum_pseudo(struct pbuf *p, | ||
1437 | acc += (u32_t)htons((u16_t)proto); | ||
1438 | acc += (u32_t)htons(proto_len); | ||
1439 | |||
1440 | - while ((acc >> 16) != 0) { | ||
1441 | - acc = (acc & 0xffffUL) + (acc >> 16); | ||
1442 | - } | ||
1443 | + /* Fold 32-bit sum to 16 bits | ||
1444 | + calling this twice is propably faster than if statements... */ | ||
1445 | + acc = FOLD_U32T(acc); | ||
1446 | + acc = FOLD_U32T(acc); | ||
1447 | LWIP_DEBUGF(INET_DEBUG, ("inet_chksum_pseudo(): pbuf chain lwip_chksum()=%"X32_F"\n", acc)); | ||
1448 | return (u16_t)~(acc & 0xffffUL); | ||
1449 | } | ||
1450 | @@ -340,18 +351,17 @@ inet_chksum_pseudo_partial(struct pbuf * | ||
1451 | chksum_len -= chklen; | ||
1452 | LWIP_ASSERT("delete me", chksum_len < 0x7fff); | ||
1453 | /*LWIP_DEBUGF(INET_DEBUG, ("inet_chksum_pseudo(): unwrapped lwip_chksum()=%"X32_F" \n", acc));*/ | ||
1454 | - while ((acc >> 16) != 0) { | ||
1455 | - acc = (acc & 0xffffUL) + (acc >> 16); | ||
1456 | - } | ||
1457 | + /* fold the upper bit down */ | ||
1458 | + acc = FOLD_U32T(acc); | ||
1459 | if (q->len % 2 != 0) { | ||
1460 | swapped = 1 - swapped; | ||
1461 | - acc = ((acc & 0xff) << 8) | ((acc & 0xff00UL) >> 8); | ||
1462 | + acc = SWAP_BYTES_IN_WORD(acc); | ||
1463 | } | ||
1464 | /*LWIP_DEBUGF(INET_DEBUG, ("inet_chksum_pseudo(): wrapped lwip_chksum()=%"X32_F" \n", acc));*/ | ||
1465 | } | ||
1466 | |||
1467 | if (swapped) { | ||
1468 | - acc = ((acc & 0xff) << 8) | ((acc & 0xff00UL) >> 8); | ||
1469 | + acc = SWAP_BYTES_IN_WORD(acc); | ||
1470 | } | ||
1471 | acc += (src->addr & 0xffffUL); | ||
1472 | acc += ((src->addr >> 16) & 0xffffUL); | ||
1473 | @@ -360,9 +370,10 @@ inet_chksum_pseudo_partial(struct pbuf * | ||
1474 | acc += (u32_t)htons((u16_t)proto); | ||
1475 | acc += (u32_t)htons(proto_len); | ||
1476 | |||
1477 | - while ((acc >> 16) != 0) { | ||
1478 | - acc = (acc & 0xffffUL) + (acc >> 16); | ||
1479 | - } | ||
1480 | + /* Fold 32-bit sum to 16 bits | ||
1481 | + calling this twice is propably faster than if statements... */ | ||
1482 | + acc = FOLD_U32T(acc); | ||
1483 | + acc = FOLD_U32T(acc); | ||
1484 | LWIP_DEBUGF(INET_DEBUG, ("inet_chksum_pseudo(): pbuf chain lwip_chksum()=%"X32_F"\n", acc)); | ||
1485 | return (u16_t)~(acc & 0xffffUL); | ||
1486 | } | ||
1487 | @@ -380,13 +391,7 @@ inet_chksum_pseudo_partial(struct pbuf * | ||
1488 | u16_t | ||
1489 | inet_chksum(void *dataptr, u16_t len) | ||
1490 | { | ||
1491 | - u32_t acc; | ||
1492 | - | ||
1493 | - acc = LWIP_CHKSUM(dataptr, len); | ||
1494 | - while ((acc >> 16) != 0) { | ||
1495 | - acc = (acc & 0xffff) + (acc >> 16); | ||
1496 | - } | ||
1497 | - return (u16_t)~(acc & 0xffff); | ||
1498 | + return ~LWIP_CHKSUM(dataptr, len); | ||
1499 | } | ||
1500 | |||
1501 | /** | ||
1502 | @@ -407,17 +412,15 @@ inet_chksum_pbuf(struct pbuf *p) | ||
1503 | swapped = 0; | ||
1504 | for(q = p; q != NULL; q = q->next) { | ||
1505 | acc += LWIP_CHKSUM(q->payload, q->len); | ||
1506 | - while ((acc >> 16) != 0) { | ||
1507 | - acc = (acc & 0xffffUL) + (acc >> 16); | ||
1508 | - } | ||
1509 | + acc = FOLD_U32T(acc); | ||
1510 | if (q->len % 2 != 0) { | ||
1511 | swapped = 1 - swapped; | ||
1512 | - acc = (acc & 0x00ffUL << 8) | (acc & 0xff00UL >> 8); | ||
1513 | + acc = SWAP_BYTES_IN_WORD(acc); | ||
1514 | } | ||
1515 | } | ||
1516 | |||
1517 | if (swapped) { | ||
1518 | - acc = ((acc & 0x00ffUL) << 8) | ((acc & 0xff00UL) >> 8); | ||
1519 | + acc = SWAP_BYTES_IN_WORD(acc); | ||
1520 | } | ||
1521 | return (u16_t)~(acc & 0xffffUL); | ||
1522 | } | ||
1523 | Index: src/core/ipv4/ip.c | ||
1524 | =================================================================== | ||
1525 | RCS file: /sources/lwip/lwip/src/core/ipv4/ip.c,v | ||
1526 | retrieving revision 1.66 | ||
1527 | retrieving revision 1.68 | ||
1528 | diff -u -p -r1.66 -r1.68 | ||
1529 | --- a/src/core/ipv4/ip.c 14 Jan 2008 20:53:23 -0000 1.66 | ||
1530 | +++ b/src/core/ipv4/ip.c 17 Jun 2008 19:39:22 -0000 1.68 | ||
1531 | @@ -531,9 +531,19 @@ ip_output_if(struct pbuf *p, struct ip_a | ||
1532 | LWIP_DEBUGF(IP_DEBUG, ("ip_output_if: %c%c%"U16_F"\n", netif->name[0], netif->name[1], netif->num)); | ||
1533 | ip_debug_print(p); | ||
1534 | |||
1535 | - LWIP_DEBUGF(IP_DEBUG, ("netif->output()")); | ||
1536 | +#if (LWIP_NETIF_LOOPBACK || LWIP_HAVE_LOOPIF) | ||
1537 | + if (ip_addr_cmp(dest, &netif->ip_addr)) { | ||
1538 | + /* Packet to self, enqueue it for loopback */ | ||
1539 | + LWIP_DEBUGF(IP_DEBUG, ("netif_loop_output()")); | ||
1540 | + | ||
1541 | + return netif_loop_output(netif, p, dest); | ||
1542 | + } else | ||
1543 | +#endif /* (LWIP_NETIF_LOOPBACK || LWIP_HAVE_LOOPIF) */ | ||
1544 | + { | ||
1545 | + LWIP_DEBUGF(IP_DEBUG, ("netif->output()")); | ||
1546 | |||
1547 | - return netif->output(netif, p, dest); | ||
1548 | + return netif->output(netif, p, dest); | ||
1549 | + } | ||
1550 | } | ||
1551 | |||
1552 | /** | ||
1553 | Index: src/include/lwip/debug.h | ||
1554 | =================================================================== | ||
1555 | RCS file: /sources/lwip/lwip/src/include/lwip/debug.h,v | ||
1556 | retrieving revision 1.37 | ||
1557 | retrieving revision 1.39 | ||
1558 | diff -u -p -r1.37 -r1.39 | ||
1559 | --- a/src/include/lwip/debug.h 22 Sep 2007 11:16:07 -0000 1.37 | ||
1560 | +++ b/src/include/lwip/debug.h 16 Jul 2008 20:36:22 -0000 1.39 | ||
1561 | @@ -61,26 +61,28 @@ | ||
1562 | #define LWIP_DBG_HALT 0x08U | ||
1563 | |||
1564 | #ifndef LWIP_NOASSERT | ||
1565 | -#define LWIP_ASSERT(x,y) do { if(!(y)) LWIP_PLATFORM_ASSERT(x); } while(0) | ||
1566 | +#define LWIP_ASSERT(message, assertion) do { if(!(assertion)) \ | ||
1567 | + LWIP_PLATFORM_ASSERT(message); } while(0) | ||
1568 | #else /* LWIP_NOASSERT */ | ||
1569 | -#define LWIP_ASSERT(x,y) | ||
1570 | +#define LWIP_ASSERT(message, assertion) | ||
1571 | #endif /* LWIP_NOASSERT */ | ||
1572 | |||
1573 | -/** print "m" message only if "e" is true, and execute "h" expression */ | ||
1574 | +/** if "expression" isn't true, then print "message" and execute "handler" expression */ | ||
1575 | #ifndef LWIP_ERROR | ||
1576 | -#define LWIP_ERROR(m,e,h) do { if (!(e)) { LWIP_PLATFORM_ASSERT(m); h;}} while(0) | ||
1577 | +#define LWIP_ERROR(message, expression, handler) do { if (!(expression)) { \ | ||
1578 | + LWIP_PLATFORM_ASSERT(message); handler;}} while(0) | ||
1579 | #endif /* LWIP_ERROR */ | ||
1580 | |||
1581 | #ifdef LWIP_DEBUG | ||
1582 | /** print debug message only if debug message type is enabled... | ||
1583 | * AND is of correct type AND is at least LWIP_DBG_LEVEL | ||
1584 | */ | ||
1585 | -#define LWIP_DEBUGF(debug,x) do { \ | ||
1586 | +#define LWIP_DEBUGF(debug, message) do { \ | ||
1587 | if ( \ | ||
1588 | ((debug) & LWIP_DBG_ON) && \ | ||
1589 | ((debug) & LWIP_DBG_TYPES_ON) && \ | ||
1590 | ((s16_t)((debug) & LWIP_DBG_MASK_LEVEL) >= LWIP_DBG_MIN_LEVEL)) { \ | ||
1591 | - LWIP_PLATFORM_DIAG(x); \ | ||
1592 | + LWIP_PLATFORM_DIAG(message); \ | ||
1593 | if ((debug) & LWIP_DBG_HALT) { \ | ||
1594 | while(1); \ | ||
1595 | } \ | ||
1596 | @@ -88,7 +90,7 @@ | ||
1597 | } while(0) | ||
1598 | |||
1599 | #else /* LWIP_DEBUG */ | ||
1600 | -#define LWIP_DEBUGF(debug,x) | ||
1601 | +#define LWIP_DEBUGF(debug, message) | ||
1602 | #endif /* LWIP_DEBUG */ | ||
1603 | |||
1604 | #endif /* __LWIP_DEBUG_H__ */ | ||
1605 | Index: src/include/lwip/err.h | ||
1606 | =================================================================== | ||
1607 | RCS file: /sources/lwip/lwip/src/include/lwip/err.h,v | ||
1608 | retrieving revision 1.13 | ||
1609 | retrieving revision 1.15 | ||
1610 | diff -u -p -r1.13 -r1.15 | ||
1611 | --- a/src/include/lwip/err.h 13 Dec 2007 23:06:50 -0000 1.13 | ||
1612 | +++ b/src/include/lwip/err.h 17 Jun 2008 20:27:32 -0000 1.15 | ||
1613 | @@ -33,37 +33,43 @@ | ||
1614 | #define __LWIP_ERR_H__ | ||
1615 | |||
1616 | #include "lwip/opt.h" | ||
1617 | +#include "lwip/arch.h" | ||
1618 | |||
1619 | #ifdef __cplusplus | ||
1620 | extern "C" { | ||
1621 | #endif | ||
1622 | |||
1623 | -typedef s8_t err_t; | ||
1624 | +/** Define LWIP_ERR_T in cc.h if you want to use | ||
1625 | + * a different type for your platform (must be signed). */ | ||
1626 | +#ifdef LWIP_ERR_T | ||
1627 | +typedef LWIP_ERR_T err_t; | ||
1628 | +#else /* LWIP_ERR_T */ | ||
1629 | + typedef s8_t err_t; | ||
1630 | +#endif /* LWIP_ERR_T*/ | ||
1631 | |||
1632 | /* Definitions for error constants. */ | ||
1633 | |||
1634 | #define ERR_OK 0 /* No error, everything OK. */ | ||
1635 | #define ERR_MEM -1 /* Out of memory error. */ | ||
1636 | #define ERR_BUF -2 /* Buffer error. */ | ||
1637 | -#define ERR_RTE -3 /* Routing problem. */ | ||
1638 | +#define ERR_TIMEOUT -3 /* Timeout. */ | ||
1639 | +#define ERR_RTE -4 /* Routing problem. */ | ||
1640 | |||
1641 | #define ERR_IS_FATAL(e) ((e) < ERR_RTE) | ||
1642 | |||
1643 | -#define ERR_ABRT -4 /* Connection aborted. */ | ||
1644 | -#define ERR_RST -5 /* Connection reset. */ | ||
1645 | -#define ERR_CLSD -6 /* Connection closed. */ | ||
1646 | -#define ERR_CONN -7 /* Not connected. */ | ||
1647 | +#define ERR_ABRT -5 /* Connection aborted. */ | ||
1648 | +#define ERR_RST -6 /* Connection reset. */ | ||
1649 | +#define ERR_CLSD -7 /* Connection closed. */ | ||
1650 | +#define ERR_CONN -8 /* Not connected. */ | ||
1651 | |||
1652 | -#define ERR_VAL -8 /* Illegal value. */ | ||
1653 | +#define ERR_VAL -9 /* Illegal value. */ | ||
1654 | |||
1655 | -#define ERR_ARG -9 /* Illegal argument. */ | ||
1656 | +#define ERR_ARG -10 /* Illegal argument. */ | ||
1657 | |||
1658 | -#define ERR_USE -10 /* Address in use. */ | ||
1659 | +#define ERR_USE -11 /* Address in use. */ | ||
1660 | |||
1661 | -#define ERR_IF -11 /* Low-level netif error */ | ||
1662 | -#define ERR_ISCONN -12 /* Already connected. */ | ||
1663 | - | ||
1664 | -#define ERR_TIMEOUT -13 /* Timeout. */ | ||
1665 | +#define ERR_IF -12 /* Low-level netif error */ | ||
1666 | +#define ERR_ISCONN -13 /* Already connected. */ | ||
1667 | |||
1668 | #define ERR_INPROGRESS -14 /* Operation in progress */ | ||
1669 | |||
1670 | Index: src/include/lwip/mem.h | ||
1671 | =================================================================== | ||
1672 | RCS file: /sources/lwip/lwip/src/include/lwip/mem.h,v | ||
1673 | retrieving revision 1.21 | ||
1674 | retrieving revision 1.22 | ||
1675 | diff -u -p -r1.21 -r1.22 | ||
1676 | --- a/src/include/lwip/mem.h 4 Mar 2008 16:31:32 -0000 1.21 | ||
1677 | +++ b/src/include/lwip/mem.h 30 May 2008 11:37:15 -0000 1.22 | ||
1678 | @@ -50,16 +50,16 @@ typedef size_t mem_size_t; | ||
1679 | * allow these defines to be overridden. | ||
1680 | */ | ||
1681 | #ifndef mem_free | ||
1682 | -#define mem_free(x) free(x) | ||
1683 | +#define mem_free free | ||
1684 | #endif | ||
1685 | #ifndef mem_malloc | ||
1686 | -#define mem_malloc(x) malloc(x) | ||
1687 | +#define mem_malloc malloc | ||
1688 | #endif | ||
1689 | #ifndef mem_calloc | ||
1690 | -#define mem_calloc(x, y) calloc(x, y) | ||
1691 | +#define mem_calloc calloc | ||
1692 | #endif | ||
1693 | #ifndef mem_realloc | ||
1694 | -#define mem_realloc(x, size) (x) | ||
1695 | +#define mem_realloc realloc | ||
1696 | #endif | ||
1697 | #else /* MEM_LIBC_MALLOC */ | ||
1698 | |||
1699 | Index: src/include/lwip/netif.h | ||
1700 | =================================================================== | ||
1701 | RCS file: /sources/lwip/lwip/src/include/lwip/netif.h,v | ||
1702 | retrieving revision 1.43 | ||
1703 | retrieving revision 1.46 | ||
1704 | diff -u -p -r1.43 -r1.46 | ||
1705 | --- a/src/include/lwip/netif.h 9 Oct 2007 19:59:59 -0000 1.43 | ||
1706 | +++ b/src/include/lwip/netif.h 19 Jun 2008 16:27:23 -0000 1.46 | ||
1707 | @@ -34,6 +34,8 @@ | ||
1708 | |||
1709 | #include "lwip/opt.h" | ||
1710 | |||
1711 | +#define ENABLE_LOOPBACK (LWIP_NETIF_LOOPBACK || LWIP_HAVE_LOOPIF) | ||
1712 | + | ||
1713 | #include "lwip/err.h" | ||
1714 | |||
1715 | #include "lwip/ip_addr.h" | ||
1716 | @@ -165,6 +167,14 @@ struct netif { | ||
1717 | #if LWIP_NETIF_HWADDRHINT | ||
1718 | u8_t *addr_hint; | ||
1719 | #endif /* LWIP_NETIF_HWADDRHINT */ | ||
1720 | +#if ENABLE_LOOPBACK | ||
1721 | + /* List of packets to be queued for ourselves. */ | ||
1722 | + struct pbuf *loop_first; | ||
1723 | + struct pbuf *loop_last; | ||
1724 | +#if LWIP_LOOPBACK_MAX_PBUFS | ||
1725 | + u16_t loop_cnt_current; | ||
1726 | +#endif /* LWIP_LOOPBACK_MAX_PBUFS */ | ||
1727 | +#endif /* ENABLE_LOOPBACK */ | ||
1728 | }; | ||
1729 | |||
1730 | #if LWIP_SNMP | ||
1731 | @@ -242,4 +252,12 @@ void netif_set_link_callback(struct neti | ||
1732 | } | ||
1733 | #endif | ||
1734 | |||
1735 | +#if ENABLE_LOOPBACK | ||
1736 | +err_t netif_loop_output(struct netif *netif, struct pbuf *p, struct ip_addr *dest_ip); | ||
1737 | +void netif_poll(struct netif *netif); | ||
1738 | +#if !LWIP_NETIF_LOOPBACK_MULTITHREADING | ||
1739 | +void netif_poll_all(void); | ||
1740 | +#endif /* !LWIP_NETIF_LOOPBACK_MULTITHREADING */ | ||
1741 | +#endif /* ENABLE_LOOPBACK */ | ||
1742 | + | ||
1743 | #endif /* __LWIP_NETIF_H__ */ | ||
1744 | Index: src/include/lwip/opt.h | ||
1745 | =================================================================== | ||
1746 | RCS file: /sources/lwip/lwip/src/include/lwip/opt.h,v | ||
1747 | retrieving revision 1.116 | ||
1748 | retrieving revision 1.122 | ||
1749 | diff -u -p -r1.116 -r1.122 | ||
1750 | --- a/src/include/lwip/opt.h 31 Jan 2008 18:19:29 -0000 1.116 | ||
1751 | +++ b/src/include/lwip/opt.h 30 Jun 2008 18:16:52 -0000 1.122 | ||
1752 | @@ -155,6 +155,27 @@ | ||
1753 | #define MEMP_USE_CUSTOM_POOLS 0 | ||
1754 | #endif | ||
1755 | |||
1756 | +/** | ||
1757 | + * Set this to 1 if you want to free PBUF_RAM pbufs (or call mem_free()) from | ||
1758 | + * interrupt context (or another context that doesn't allow waiting for a | ||
1759 | + * semaphore). | ||
1760 | + * If set to 1, mem_malloc will be protected by a semaphore and SYS_ARCH_PROTECT, | ||
1761 | + * while mem_free will only use SYS_ARCH_PROTECT. mem_malloc SYS_ARCH_UNPROTECTs | ||
1762 | + * with each loop so that mem_free can run. | ||
1763 | + * | ||
1764 | + * ATTENTION: As you can see from the above description, this leads to dis-/ | ||
1765 | + * enabling interrupts often, which can be slow! Also, on low memory, mem_malloc | ||
1766 | + * can need longer. | ||
1767 | + * | ||
1768 | + * If you don't want that, at least for NO_SYS=0, you can still use the following | ||
1769 | + * functions to enqueue a deallocation call which then runs in the tcpip_thread | ||
1770 | + * context: | ||
1771 | + * - pbuf_free_callback(p); | ||
1772 | + * - mem_free_callback(m); | ||
1773 | + */ | ||
1774 | +#ifndef LWIP_ALLOW_MEM_FREE_FROM_OTHER_CONTEXT | ||
1775 | +#define LWIP_ALLOW_MEM_FREE_FROM_OTHER_CONTEXT 0 | ||
1776 | +#endif | ||
1777 | |||
1778 | /* | ||
1779 | ------------------------------------------------ | ||
1780 | @@ -815,6 +836,39 @@ | ||
1781 | #define LWIP_NETIF_HWADDRHINT 0 | ||
1782 | #endif | ||
1783 | |||
1784 | +/** | ||
1785 | + * LWIP_NETIF_LOOPBACK==1: Support sending packets with a destination IP | ||
1786 | + * address equal to the netif IP address, looping them back up the stack. | ||
1787 | + */ | ||
1788 | +#ifndef LWIP_NETIF_LOOPBACK | ||
1789 | +#define LWIP_NETIF_LOOPBACK 0 | ||
1790 | +#endif | ||
1791 | + | ||
1792 | +/** | ||
1793 | + * LWIP_LOOPBACK_MAX_PBUFS: Maximum number of pbufs on queue for loopback | ||
1794 | + * sending for each netif (0 = disabled) | ||
1795 | + */ | ||
1796 | +#ifndef LWIP_LOOPBACK_MAX_PBUFS | ||
1797 | +#define LWIP_LOOPBACK_MAX_PBUFS 0 | ||
1798 | +#endif | ||
1799 | + | ||
1800 | +/** | ||
1801 | + * LWIP_NETIF_LOOPBACK_MULTITHREADING: Indicates whether threading is enabled in | ||
1802 | + * the system, as netifs must change how they behave depending on this setting | ||
1803 | + * for the LWIP_NETIF_LOOPBACK option to work. | ||
1804 | + * Setting this is needed to avoid reentering non-reentrant functions like | ||
1805 | + * tcp_input(). | ||
1806 | + * LWIP_NETIF_LOOPBACK_MULTITHREADING==1: Indicates that the user is using a | ||
1807 | + * multithreaded environment like tcpip.c. In this case, netif->input() | ||
1808 | + * is called directly. | ||
1809 | + * LWIP_NETIF_LOOPBACK_MULTITHREADING==0: Indicates a polling (or NO_SYS) setup. | ||
1810 | + * The packets are put on a list and netif_poll() must be called in | ||
1811 | + * the main application loop. | ||
1812 | + */ | ||
1813 | +#ifndef LWIP_NETIF_LOOPBACK_MULTITHREADING | ||
1814 | +#define LWIP_NETIF_LOOPBACK_MULTITHREADING (!NO_SYS) | ||
1815 | +#endif | ||
1816 | + | ||
1817 | /* | ||
1818 | ------------------------------------ | ||
1819 | ---------- LOOPIF options ---------- | ||
1820 | @@ -827,20 +881,16 @@ | ||
1821 | #define LWIP_HAVE_LOOPIF 0 | ||
1822 | #endif | ||
1823 | |||
1824 | +/* | ||
1825 | + ------------------------------------ | ||
1826 | + ---------- SLIPIF options ---------- | ||
1827 | + ------------------------------------ | ||
1828 | +*/ | ||
1829 | /** | ||
1830 | - * LWIP_LOOPIF_MULTITHREADING: Indicates whether threading is enabled in | ||
1831 | - * the system, as LOOPIF must change how it behaves depending on this setting. | ||
1832 | - * Setting this is needed to avoid reentering non-reentrant functions like | ||
1833 | - * tcp_input(). | ||
1834 | - * LWIP_LOOPIF_MULTITHREADING==1: Indicates that the user is using a | ||
1835 | - * multithreaded environment like tcpip.c. In this case, netif->input() | ||
1836 | - * is called directly. | ||
1837 | - * LWIP_LOOPIF_MULTITHREADING==0: Indicates a polling (or NO_SYS) setup. | ||
1838 | - * The packets are put on a list and loopif_poll() must be called in | ||
1839 | - * the main application loop. | ||
1840 | + * LWIP_HAVE_SLIPIF==1: Support slip interface and slipif.c | ||
1841 | */ | ||
1842 | -#ifndef LWIP_LOOPIF_MULTITHREADING | ||
1843 | -#define LWIP_LOOPIF_MULTITHREADING 1 | ||
1844 | +#ifndef LWIP_HAVE_SLIPIF | ||
1845 | +#define LWIP_HAVE_SLIPIF 0 | ||
1846 | #endif | ||
1847 | |||
1848 | /* | ||
1849 | Index: src/include/lwip/sio.h | ||
1850 | =================================================================== | ||
1851 | RCS file: /sources/lwip/lwip/src/include/lwip/sio.h,v | ||
1852 | retrieving revision 1.7 | ||
1853 | retrieving revision 1.8 | ||
1854 | diff -u -p -r1.7 -r1.8 | ||
1855 | --- a/src/include/lwip/sio.h 6 Sep 2007 16:43:44 -0000 1.7 | ||
1856 | +++ b/src/include/lwip/sio.h 27 Mar 2008 18:06:02 -0000 1.8 | ||
1857 | @@ -32,16 +32,24 @@ | ||
1858 | * It needs to be implemented by those platforms which need SLIP or PPP | ||
1859 | */ | ||
1860 | |||
1861 | +#ifndef __SIO_H__ | ||
1862 | +#define __SIO_H__ | ||
1863 | + | ||
1864 | #include "lwip/arch.h" | ||
1865 | |||
1866 | #ifdef __cplusplus | ||
1867 | extern "C" { | ||
1868 | #endif | ||
1869 | |||
1870 | +/* If you want to define sio_fd_t elsewhere or differently, | ||
1871 | + define this in your cc.h file. */ | ||
1872 | #ifndef __sio_fd_t_defined | ||
1873 | typedef void * sio_fd_t; | ||
1874 | #endif | ||
1875 | |||
1876 | +/* The following functions can be defined to something else in your cc.h file | ||
1877 | + or be implemented in your custom sio.c file. */ | ||
1878 | + | ||
1879 | #ifndef sio_open | ||
1880 | sio_fd_t sio_open(u8_t); | ||
1881 | #endif | ||
1882 | @@ -69,3 +77,5 @@ void sio_read_abort(sio_fd_t); | ||
1883 | #ifdef __cplusplus | ||
1884 | } | ||
1885 | #endif | ||
1886 | + | ||
1887 | +#endif /* __SIO_H__ */ | ||
1888 | Index: src/include/lwip/sockets.h | ||
1889 | =================================================================== | ||
1890 | RCS file: /sources/lwip/lwip/src/include/lwip/sockets.h,v | ||
1891 | retrieving revision 1.38 | ||
1892 | retrieving revision 1.39 | ||
1893 | diff -u -p -r1.38 -r1.39 | ||
1894 | --- a/src/include/lwip/sockets.h 2 Dec 2007 15:24:02 -0000 1.38 | ||
1895 | +++ b/src/include/lwip/sockets.h 26 Apr 2008 10:46:23 -0000 1.39 | ||
1896 | @@ -177,7 +177,22 @@ typedef struct ip_mreq { | ||
1897 | } ip_mreq; | ||
1898 | #endif /* LWIP_IGMP */ | ||
1899 | |||
1900 | -/* Unimplemented for now... */ | ||
1901 | +/* | ||
1902 | + * The Type of Service provides an indication of the abstract | ||
1903 | + * parameters of the quality of service desired. These parameters are | ||
1904 | + * to be used to guide the selection of the actual service parameters | ||
1905 | + * when transmitting a datagram through a particular network. Several | ||
1906 | + * networks offer service precedence, which somehow treats high | ||
1907 | + * precedence traffic as more important than other traffic (generally | ||
1908 | + * by accepting only traffic above a certain precedence at time of high | ||
1909 | + * load). The major choice is a three way tradeoff between low-delay, | ||
1910 | + * high-reliability, and high-throughput. | ||
1911 | + * The use of the Delay, Throughput, and Reliability indications may | ||
1912 | + * increase the cost (in some sense) of the service. In many networks | ||
1913 | + * better performance for one of these parameters is coupled with worse | ||
1914 | + * performance on another. Except for very unusual cases at most two | ||
1915 | + * of these three indications should be set. | ||
1916 | + */ | ||
1917 | #define IPTOS_TOS_MASK 0x1E | ||
1918 | #define IPTOS_TOS(tos) ((tos) & IPTOS_TOS_MASK) | ||
1919 | #define IPTOS_LOWDELAY 0x10 | ||
1920 | @@ -187,7 +202,13 @@ typedef struct ip_mreq { | ||
1921 | #define IPTOS_MINCOST IPTOS_LOWCOST | ||
1922 | |||
1923 | /* | ||
1924 | - * Definitions for IP precedence (also in ip_tos) (Unimplemented) | ||
1925 | + * The Network Control precedence designation is intended to be used | ||
1926 | + * within a network only. The actual use and control of that | ||
1927 | + * designation is up to each network. The Internetwork Control | ||
1928 | + * designation is intended for use by gateway control originators only. | ||
1929 | + * If the actual use of these precedence designations is of concern to | ||
1930 | + * a particular network, it is the responsibility of that network to | ||
1931 | + * control the access to, and use of, those precedence designations. | ||
1932 | */ | ||
1933 | #define IPTOS_PREC_MASK 0xe0 | ||
1934 | #define IPTOS_PREC(tos) ((tos) & IPTOS_PREC_MASK) | ||
1935 | Index: src/include/lwip/stats.h | ||
1936 | =================================================================== | ||
1937 | RCS file: /sources/lwip/lwip/src/include/lwip/stats.h,v | ||
1938 | retrieving revision 1.19 | ||
1939 | retrieving revision 1.23 | ||
1940 | diff -u -p -r1.19 -r1.23 | ||
1941 | --- a/src/include/lwip/stats.h 28 Nov 2007 21:25:07 -0000 1.19 | ||
1942 | +++ b/src/include/lwip/stats.h 8 Jul 2008 09:15:57 -0000 1.23 | ||
1943 | @@ -57,7 +57,6 @@ extern "C" { | ||
1944 | |||
1945 | struct stats_proto { | ||
1946 | STAT_COUNTER xmit; /* Transmitted packets. */ | ||
1947 | - STAT_COUNTER rexmit; /* Retransmitted packets. */ | ||
1948 | STAT_COUNTER recv; /* Received packets. */ | ||
1949 | STAT_COUNTER fw; /* Forwarded packets. */ | ||
1950 | STAT_COUNTER drop; /* Dropped packets. */ | ||
1951 | @@ -87,7 +86,8 @@ struct stats_mem { | ||
1952 | mem_size_t avail; | ||
1953 | mem_size_t used; | ||
1954 | mem_size_t max; | ||
1955 | - mem_size_t err; | ||
1956 | + STAT_COUNTER err; | ||
1957 | + STAT_COUNTER illegal; | ||
1958 | }; | ||
1959 | |||
1960 | struct stats_syselem { | ||
1961 | @@ -142,64 +142,138 @@ extern struct stats_ lwip_stats; | ||
1962 | #define stats_init() /* Compatibility define, not init needed. */ | ||
1963 | |||
1964 | #define STATS_INC(x) ++lwip_stats.x | ||
1965 | +#define STATS_DEC(x) --lwip_stats.x | ||
1966 | #else | ||
1967 | #define stats_init() | ||
1968 | #define STATS_INC(x) | ||
1969 | +#define STATS_DEC(x) | ||
1970 | #endif /* LWIP_STATS */ | ||
1971 | |||
1972 | #if TCP_STATS | ||
1973 | #define TCP_STATS_INC(x) STATS_INC(x) | ||
1974 | +#define TCP_STATS_DISPLAY() stats_display_proto(&lwip_stats.tcp, "TCP") | ||
1975 | #else | ||
1976 | #define TCP_STATS_INC(x) | ||
1977 | +#define TCP_STATS_DISPLAY() | ||
1978 | #endif | ||
1979 | |||
1980 | #if UDP_STATS | ||
1981 | #define UDP_STATS_INC(x) STATS_INC(x) | ||
1982 | +#define UDP_STATS_DISPLAY() stats_display_proto(&lwip_stats.udp, "UDP") | ||
1983 | #else | ||
1984 | #define UDP_STATS_INC(x) | ||
1985 | +#define UDP_STATS_DISPLAY() | ||
1986 | #endif | ||
1987 | |||
1988 | #if ICMP_STATS | ||
1989 | #define ICMP_STATS_INC(x) STATS_INC(x) | ||
1990 | +#define ICMP_STATS_DISPLAY() stats_display_proto(&lwip_stats.icmp, "ICMP") | ||
1991 | #else | ||
1992 | #define ICMP_STATS_INC(x) | ||
1993 | +#define ICMP_STATS_DISPLAY() | ||
1994 | #endif | ||
1995 | |||
1996 | #if IGMP_STATS | ||
1997 | #define IGMP_STATS_INC(x) STATS_INC(x) | ||
1998 | +#define IGMP_STATS_DISPLAY() stats_display_igmp(&lwip_stats.igmp) | ||
1999 | #else | ||
2000 | #define IGMP_STATS_INC(x) | ||
2001 | +#define IGMP_STATS_DISPLAY() | ||
2002 | #endif | ||
2003 | |||
2004 | #if IP_STATS | ||
2005 | #define IP_STATS_INC(x) STATS_INC(x) | ||
2006 | +#define IP_STATS_DISPLAY() stats_display_proto(&lwip_stats.ip, "IP") | ||
2007 | #else | ||
2008 | #define IP_STATS_INC(x) | ||
2009 | +#define IP_STATS_DISPLAY() | ||
2010 | #endif | ||
2011 | |||
2012 | #if IPFRAG_STATS | ||
2013 | #define IPFRAG_STATS_INC(x) STATS_INC(x) | ||
2014 | +#define IPFRAG_STATS_DISPLAY() stats_display_proto(&lwip_stats.ip_frag, "IP_FRAG") | ||
2015 | #else | ||
2016 | #define IPFRAG_STATS_INC(x) | ||
2017 | +#define IPFRAG_STATS_DISPLAY() | ||
2018 | #endif | ||
2019 | |||
2020 | #if ETHARP_STATS | ||
2021 | #define ETHARP_STATS_INC(x) STATS_INC(x) | ||
2022 | +#define ETHARP_STATS_DISPLAY() stats_display_proto(&lwip_stats.etharp, "ETHARP") | ||
2023 | #else | ||
2024 | #define ETHARP_STATS_INC(x) | ||
2025 | +#define ETHARP_STATS_DISPLAY() | ||
2026 | #endif | ||
2027 | |||
2028 | #if LINK_STATS | ||
2029 | #define LINK_STATS_INC(x) STATS_INC(x) | ||
2030 | +#define LINK_STATS_DISPLAY() stats_display_proto(&lwip_stats.link, "LINK") | ||
2031 | #else | ||
2032 | #define LINK_STATS_INC(x) | ||
2033 | +#define LINK_STATS_DISPLAY() | ||
2034 | +#endif | ||
2035 | + | ||
2036 | +#if MEM_STATS | ||
2037 | +#define MEM_STATS_AVAIL(x, y) lwip_stats.mem.x = y | ||
2038 | +#define MEM_STATS_INC(x) STATS_INC(mem.x) | ||
2039 | +#define MEM_STATS_INC_USED(x, y) do { lwip_stats.mem.used += y; \ | ||
2040 | + if (lwip_stats.mem.max < lwip_stats.mem.used) { \ | ||
2041 | + lwip_stats.mem.max = lwip_stats.mem.used; \ | ||
2042 | + } \ | ||
2043 | + } while(0) | ||
2044 | +#define MEM_STATS_DEC_USED(x, y) lwip_stats.mem.x -= y | ||
2045 | +#define MEM_STATS_DISPLAY() stats_display_mem(&lwip_stats.mem, "HEAP") | ||
2046 | +#else | ||
2047 | +#define MEM_STATS_AVAIL(x, y) | ||
2048 | +#define MEM_STATS_INC(x) | ||
2049 | +#define MEM_STATS_INC_USED(x, y) | ||
2050 | +#define MEM_STATS_DEC_USED(x, y) | ||
2051 | +#define MEM_STATS_DISPLAY() | ||
2052 | +#endif | ||
2053 | + | ||
2054 | +#if MEMP_STATS | ||
2055 | +#define MEMP_STATS_AVAIL(x, i, y) lwip_stats.memp[i].x = y | ||
2056 | +#define MEMP_STATS_INC(x, i) STATS_INC(memp[i].x) | ||
2057 | +#define MEMP_STATS_DEC(x, i) STATS_DEC(memp[i].x) | ||
2058 | +#define MEMP_STATS_INC_USED(x, i) do { ++lwip_stats.memp[i].used; \ | ||
2059 | + if (lwip_stats.memp[i].max < lwip_stats.memp[i].used) { \ | ||
2060 | + lwip_stats.memp[i].max = lwip_stats.memp[i].used; \ | ||
2061 | + } \ | ||
2062 | + } while(0) | ||
2063 | +#define MEMP_STATS_DISPLAY(i) stats_display_memp(&lwip_stats.memp[i], i) | ||
2064 | +#else | ||
2065 | +#define MEMP_STATS_AVAIL(x, i, y) | ||
2066 | +#define MEMP_STATS_INC(x, i) | ||
2067 | +#define MEMP_STATS_DEC(x, i) | ||
2068 | +#define MEMP_STATS_INC_USED(x, i) | ||
2069 | +#define MEMP_STATS_DISPLAY(i) | ||
2070 | +#endif | ||
2071 | + | ||
2072 | +#if SYS_STATS | ||
2073 | +#define SYS_STATS_INC(x) STATS_INC(sys.x) | ||
2074 | +#define SYS_STATS_DEC(x) STATS_DEC(sys.x) | ||
2075 | +#define SYS_STATS_DISPLAY() stats_display_sys(&lwip_stats.sys) | ||
2076 | +#else | ||
2077 | +#define SYS_STATS_INC(x) | ||
2078 | +#define SYS_STATS_DEC(x) | ||
2079 | +#define SYS_STATS_DISPLAY() | ||
2080 | #endif | ||
2081 | |||
2082 | /* Display of statistics */ | ||
2083 | #if LWIP_STATS_DISPLAY | ||
2084 | void stats_display(void); | ||
2085 | +void stats_display_proto(struct stats_proto *proto, char *name); | ||
2086 | +void stats_display_igmp(struct stats_igmp *igmp); | ||
2087 | +void stats_display_mem(struct stats_mem *mem, char *name); | ||
2088 | +void stats_display_memp(struct stats_mem *mem, int index); | ||
2089 | +void stats_display_sys(struct stats_sys *sys); | ||
2090 | #else | ||
2091 | #define stats_display() | ||
2092 | +#define stats_display_proto(proto, name) | ||
2093 | +#define stats_display_igmp(igmp) | ||
2094 | +#define stats_display_mem(mem, name) | ||
2095 | +#define stats_display_memp(mem, index) | ||
2096 | +#define stats_display_sys(sys) | ||
2097 | #endif /* LWIP_STATS_DISPLAY */ | ||
2098 | |||
2099 | #ifdef __cplusplus | ||
2100 | Index: src/include/lwip/tcpip.h | ||
2101 | =================================================================== | ||
2102 | RCS file: /sources/lwip/lwip/src/include/lwip/tcpip.h,v | ||
2103 | retrieving revision 1.24 | ||
2104 | retrieving revision 1.27 | ||
2105 | diff -u -p -r1.24 -r1.27 | ||
2106 | --- a/src/include/lwip/tcpip.h 12 Jan 2008 11:52:22 -0000 1.24 | ||
2107 | +++ b/src/include/lwip/tcpip.h 27 Jun 2008 20:34:55 -0000 1.27 | ||
2108 | @@ -83,7 +83,11 @@ err_t tcpip_netifapi_lock(struct netifap | ||
2109 | #endif /* LWIP_NETIF_API */ | ||
2110 | |||
2111 | err_t tcpip_callback_with_block(void (*f)(void *ctx), void *ctx, u8_t block); | ||
2112 | -#define tcpip_callback(f,ctx) tcpip_callback_with_block(f,ctx,1) | ||
2113 | +#define tcpip_callback(f, ctx) tcpip_callback_with_block(f, ctx, 1) | ||
2114 | + | ||
2115 | +/* free pbufs or heap memory from another context without blocking */ | ||
2116 | +err_t pbuf_free_callback(struct pbuf *p); | ||
2117 | +err_t mem_free_callback(void *m); | ||
2118 | |||
2119 | err_t tcpip_timeout(u32_t msecs, sys_timeout_handler h, void *arg); | ||
2120 | #define tcpip_untimeout(h, arg) tcpip_timeout(0xffffffff, h, arg) | ||
2121 | Index: src/include/netif/loopif.h | ||
2122 | =================================================================== | ||
2123 | RCS file: /sources/lwip/lwip/src/include/netif/loopif.h,v | ||
2124 | retrieving revision 1.7 | ||
2125 | retrieving revision 1.9 | ||
2126 | diff -u -p -r1.7 -r1.9 | ||
2127 | --- a/src/include/netif/loopif.h 10 May 2007 10:59:20 -0000 1.7 | ||
2128 | +++ b/src/include/netif/loopif.h 17 Jun 2008 20:12:22 -0000 1.9 | ||
2129 | @@ -32,6 +32,7 @@ | ||
2130 | #ifndef __NETIF_LOOPIF_H__ | ||
2131 | #define __NETIF_LOOPIF_H__ | ||
2132 | |||
2133 | +#include "lwip/opt.h" | ||
2134 | #include "lwip/netif.h" | ||
2135 | #include "lwip/err.h" | ||
2136 | |||
2137 | @@ -39,9 +40,9 @@ | ||
2138 | extern "C" { | ||
2139 | #endif | ||
2140 | |||
2141 | -#if !LWIP_LOOPIF_MULTITHREADING | ||
2142 | -void loopif_poll(struct netif *netif); | ||
2143 | -#endif | ||
2144 | +#if !LWIP_NETIF_LOOPBACK_MULTITHREADING | ||
2145 | +#define loopif_poll netif_poll | ||
2146 | +#endif /* !LWIP_NETIF_LOOPBACK_MULTITHREADING */ | ||
2147 | |||
2148 | err_t loopif_init(struct netif *netif); | ||
2149 | |||
2150 | Index: src/netif/etharp.c | ||
2151 | =================================================================== | ||
2152 | RCS file: /sources/lwip/lwip/src/netif/etharp.c,v | ||
2153 | retrieving revision 1.145 | ||
2154 | retrieving revision 1.148 | ||
2155 | diff -u -p -r1.145 -r1.148 | ||
2156 | --- a/src/netif/etharp.c 4 Mar 2008 13:41:24 -0000 1.145 | ||
2157 | +++ b/src/netif/etharp.c 19 Jun 2008 16:40:59 -0000 1.148 | ||
2158 | @@ -353,7 +353,7 @@ find_entry(struct ip_addr *ipaddr, u8_t | ||
2159 | * 1) empty entry | ||
2160 | * 2) oldest stable entry | ||
2161 | * 3) oldest pending entry without queued packets | ||
2162 | - * 4) oldest pending entry without queued packets | ||
2163 | + * 4) oldest pending entry with queued packets | ||
2164 | * | ||
2165 | * { ETHARP_TRY_HARD is set at this point } | ||
2166 | */ | ||
2167 | @@ -1130,7 +1130,14 @@ ethernet_input(struct pbuf *p, struct ne | ||
2168 | |||
2169 | /* points to packet payload, which starts with an Ethernet header */ | ||
2170 | ethhdr = p->payload; | ||
2171 | - | ||
2172 | + LWIP_DEBUGF(ETHARP_DEBUG | LWIP_DBG_TRACE, | ||
2173 | + ("ethernet_input: dest:%02x:%02x:%02x:%02x:%02x:%02x, src:%02x:%02x:%02x:%02x:%02x:%02x, type:%2hx\n", | ||
2174 | + (unsigned)ethhdr->dest.addr[0], (unsigned)ethhdr->dest.addr[1], (unsigned)ethhdr->dest.addr[2], | ||
2175 | + (unsigned)ethhdr->dest.addr[3], (unsigned)ethhdr->dest.addr[4], (unsigned)ethhdr->dest.addr[5], | ||
2176 | + (unsigned)ethhdr->src.addr[0], (unsigned)ethhdr->src.addr[1], (unsigned)ethhdr->src.addr[2], | ||
2177 | + (unsigned)ethhdr->src.addr[3], (unsigned)ethhdr->src.addr[4], (unsigned)ethhdr->src.addr[5], | ||
2178 | + (unsigned)htons(ethhdr->type))); | ||
2179 | + | ||
2180 | switch (htons(ethhdr->type)) { | ||
2181 | /* IP packet? */ | ||
2182 | case ETHTYPE_IP: | ||
2183 | @@ -1165,6 +1172,8 @@ ethernet_input(struct pbuf *p, struct ne | ||
2184 | #endif /* PPPOE_SUPPORT */ | ||
2185 | |||
2186 | default: | ||
2187 | + ETHARP_STATS_INC(etharp.proterr); | ||
2188 | + ETHARP_STATS_INC(etharp.drop); | ||
2189 | pbuf_free(p); | ||
2190 | p = NULL; | ||
2191 | break; | ||
2192 | Index: src/netif/loopif.c | ||
2193 | =================================================================== | ||
2194 | RCS file: /sources/lwip/lwip/src/netif/loopif.c,v | ||
2195 | retrieving revision 1.26 | ||
2196 | retrieving revision 1.27 | ||
2197 | diff -u -p -r1.26 -r1.27 | ||
2198 | --- a/src/netif/loopif.c 31 Aug 2007 10:14:09 -0000 1.26 | ||
2199 | +++ b/src/netif/loopif.c 12 Jun 2008 20:10:10 -0000 1.27 | ||
2200 | @@ -40,149 +40,8 @@ | ||
2201 | #if LWIP_HAVE_LOOPIF | ||
2202 | |||
2203 | #include "netif/loopif.h" | ||
2204 | -#include "lwip/pbuf.h" | ||
2205 | #include "lwip/snmp.h" | ||
2206 | |||
2207 | -#include <string.h> | ||
2208 | - | ||
2209 | -#if !LWIP_LOOPIF_MULTITHREADING | ||
2210 | - | ||
2211 | -#include "lwip/sys.h" | ||
2212 | -#include "lwip/mem.h" | ||
2213 | - | ||
2214 | -/* helper struct for the linked list of pbufs */ | ||
2215 | -struct loopif_private { | ||
2216 | - struct pbuf *first; | ||
2217 | - struct pbuf *last; | ||
2218 | -}; | ||
2219 | - | ||
2220 | -/** | ||
2221 | - * Call loopif_poll() in the main loop of your application. This is to prevent | ||
2222 | - * reentering non-reentrant functions like tcp_input(). Packets passed to | ||
2223 | - * loopif_output() are put on a list that is passed to netif->input() by | ||
2224 | - * loopif_poll(). | ||
2225 | - * | ||
2226 | - * @param netif the lwip network interface structure for this loopif | ||
2227 | - */ | ||
2228 | -void | ||
2229 | -loopif_poll(struct netif *netif) | ||
2230 | -{ | ||
2231 | - SYS_ARCH_DECL_PROTECT(lev); | ||
2232 | - struct pbuf *in, *in_end; | ||
2233 | - struct loopif_private *priv = (struct loopif_private*)netif->state; | ||
2234 | - | ||
2235 | - LWIP_ERROR("priv != NULL", (priv != NULL), return;); | ||
2236 | - | ||
2237 | - do { | ||
2238 | - /* Get a packet from the list. With SYS_LIGHTWEIGHT_PROT=1, this is protected */ | ||
2239 | - SYS_ARCH_PROTECT(lev); | ||
2240 | - in = priv->first; | ||
2241 | - if(in) { | ||
2242 | - in_end = in; | ||
2243 | - while(in_end->len != in_end->tot_len) { | ||
2244 | - LWIP_ASSERT("bogus pbuf: len != tot_len but next == NULL!", in_end->next != NULL); | ||
2245 | - in_end = in_end->next; | ||
2246 | - } | ||
2247 | - /* 'in_end' now points to the last pbuf from 'in' */ | ||
2248 | - if(in_end == priv->last) { | ||
2249 | - /* this was the last pbuf in the list */ | ||
2250 | - priv->first = priv->last = NULL; | ||
2251 | - } else { | ||
2252 | - /* pop the pbuf off the list */ | ||
2253 | - priv->first = in_end->next; | ||
2254 | - LWIP_ASSERT("should not be null since first != last!", priv->first != NULL); | ||
2255 | - } | ||
2256 | - } | ||
2257 | - SYS_ARCH_UNPROTECT(lev); | ||
2258 | - | ||
2259 | - if(in != NULL) { | ||
2260 | - if(in_end->next != NULL) { | ||
2261 | - /* De-queue the pbuf from its successors on the 'priv' list. */ | ||
2262 | - in_end->next = NULL; | ||
2263 | - } | ||
2264 | - if(netif->input(in, netif) != ERR_OK) { | ||
2265 | - pbuf_free(in); | ||
2266 | - } | ||
2267 | - /* Don't reference the packet any more! */ | ||
2268 | - in = NULL; | ||
2269 | - in_end = NULL; | ||
2270 | - } | ||
2271 | - /* go on while there is a packet on the list */ | ||
2272 | - } while(priv->first != NULL); | ||
2273 | -} | ||
2274 | -#endif /* LWIP_LOOPIF_MULTITHREADING */ | ||
2275 | - | ||
2276 | -/** | ||
2277 | - * Send an IP packet over the loopback interface. | ||
2278 | - * The pbuf is simply copied and handed back to netif->input. | ||
2279 | - * In multithreaded mode, this is done directly since netif->input must put | ||
2280 | - * the packet on a queue. | ||
2281 | - * In callback mode, the packet is put on an internal queue and is fed to | ||
2282 | - * netif->input by loopif_poll(). | ||
2283 | - * | ||
2284 | - * @param netif the lwip network interface structure for this loopif | ||
2285 | - * @param p the (IP) packet to 'send' | ||
2286 | - * @param ipaddr the ip address to send the packet to (not used for loopif) | ||
2287 | - * @return ERR_OK if the packet has been sent | ||
2288 | - * ERR_MEM if the pbuf used to copy the packet couldn't be allocated | ||
2289 | - */ | ||
2290 | -static err_t | ||
2291 | -loopif_output(struct netif *netif, struct pbuf *p, | ||
2292 | - struct ip_addr *ipaddr) | ||
2293 | -{ | ||
2294 | -#if !LWIP_LOOPIF_MULTITHREADING | ||
2295 | - SYS_ARCH_DECL_PROTECT(lev); | ||
2296 | - struct loopif_private *priv; | ||
2297 | - struct pbuf *last; | ||
2298 | -#endif /* LWIP_LOOPIF_MULTITHREADING */ | ||
2299 | - struct pbuf *r; | ||
2300 | - err_t err; | ||
2301 | - | ||
2302 | - LWIP_UNUSED_ARG(ipaddr); | ||
2303 | - | ||
2304 | - /* Allocate a new pbuf */ | ||
2305 | - r = pbuf_alloc(PBUF_RAW, p->tot_len, PBUF_RAM); | ||
2306 | - if (r == NULL) { | ||
2307 | - return ERR_MEM; | ||
2308 | - } | ||
2309 | - | ||
2310 | - /* Copy the whole pbuf queue p into the single pbuf r */ | ||
2311 | - if ((err = pbuf_copy(r, p)) != ERR_OK) { | ||
2312 | - pbuf_free(r); | ||
2313 | - r = NULL; | ||
2314 | - return err; | ||
2315 | - } | ||
2316 | - | ||
2317 | -#if LWIP_LOOPIF_MULTITHREADING | ||
2318 | - /* Multithreading environment, netif->input() is supposed to put the packet | ||
2319 | - into a mailbox, so we can safely call it here without risking to re-enter | ||
2320 | - functions that are not reentrant (TCP!!!) */ | ||
2321 | - if(netif->input(r, netif) != ERR_OK) { | ||
2322 | - pbuf_free(r); | ||
2323 | - r = NULL; | ||
2324 | - } | ||
2325 | -#else /* LWIP_LOOPIF_MULTITHREADING */ | ||
2326 | - /* Raw API without threads: put the packet on a linked list which gets emptied | ||
2327 | - through calling loopif_poll(). */ | ||
2328 | - priv = (struct loopif_private*)netif->state; | ||
2329 | - | ||
2330 | - /* let last point to the last pbuf in chain r */ | ||
2331 | - for (last = r; last->next != NULL; last = last->next); | ||
2332 | - SYS_ARCH_PROTECT(lev); | ||
2333 | - if(priv->first != NULL) { | ||
2334 | - LWIP_ASSERT("if first != NULL, last must also be != NULL", priv->last != NULL); | ||
2335 | - priv->last->next = r; | ||
2336 | - priv->last = last; | ||
2337 | - } else { | ||
2338 | - priv->first = r; | ||
2339 | - priv->last = last; | ||
2340 | - } | ||
2341 | - SYS_ARCH_UNPROTECT(lev); | ||
2342 | -#endif /* LWIP_LOOPIF_MULTITHREADING */ | ||
2343 | - | ||
2344 | - return ERR_OK; | ||
2345 | -} | ||
2346 | - | ||
2347 | /** | ||
2348 | * Initialize a lwip network interface structure for a loopback interface | ||
2349 | * | ||
2350 | @@ -193,16 +52,6 @@ loopif_output(struct netif *netif, struc | ||
2351 | err_t | ||
2352 | loopif_init(struct netif *netif) | ||
2353 | { | ||
2354 | -#if !LWIP_LOOPIF_MULTITHREADING | ||
2355 | - struct loopif_private *priv; | ||
2356 | - | ||
2357 | - priv = (struct loopif_private*)mem_malloc(sizeof(struct loopif_private)); | ||
2358 | - if(priv == NULL) | ||
2359 | - return ERR_MEM; | ||
2360 | - priv->first = priv->last = NULL; | ||
2361 | - netif->state = priv; | ||
2362 | -#endif /* LWIP_LOOPIF_MULTITHREADING */ | ||
2363 | - | ||
2364 | /* initialize the snmp variables and counters inside the struct netif | ||
2365 | * ifSpeed: no assumption can be made! | ||
2366 | */ | ||
2367 | @@ -210,7 +59,7 @@ loopif_init(struct netif *netif) | ||
2368 | |||
2369 | netif->name[0] = 'l'; | ||
2370 | netif->name[1] = 'o'; | ||
2371 | - netif->output = loopif_output; | ||
2372 | + netif->output = netif_loop_output; | ||
2373 | return ERR_OK; | ||
2374 | } | ||
2375 | |||
2376 | Index: src/netif/slipif.c | ||
2377 | =================================================================== | ||
2378 | RCS file: /sources/lwip/lwip/src/netif/slipif.c,v | ||
2379 | retrieving revision 1.29 | ||
2380 | retrieving revision 1.30 | ||
2381 | diff -u -p -r1.29 -r1.30 | ||
2382 | --- a/src/netif/slipif.c 30 Nov 2007 17:22:21 -0000 1.29 | ||
2383 | +++ b/src/netif/slipif.c 17 Jun 2008 20:14:05 -0000 1.30 | ||
2384 | @@ -44,6 +44,9 @@ | ||
2385 | |||
2386 | #include "netif/slipif.h" | ||
2387 | #include "lwip/opt.h" | ||
2388 | + | ||
2389 | +#if LWIP_HAVE_SLIPIF | ||
2390 | + | ||
2391 | #include "lwip/def.h" | ||
2392 | #include "lwip/pbuf.h" | ||
2393 | #include "lwip/sys.h" | ||
2394 | @@ -273,3 +276,4 @@ slipif_init(struct netif *netif) | ||
2395 | sys_thread_new(SLIPIF_THREAD_NAME, slipif_loop, netif, SLIPIF_THREAD_STACKSIZE, SLIPIF_THREAD_PRIO); | ||
2396 | return ERR_OK; | ||
2397 | } | ||
2398 | +#endif /* LWIP_HAVE_SLIPIF */ | ||
diff --git a/recipes-extended/xen/files/newlib-chk.patch b/recipes-extended/xen/files/newlib-chk.patch deleted file mode 100644 index a5d01495..00000000 --- a/recipes-extended/xen/files/newlib-chk.patch +++ /dev/null | |||
@@ -1,155 +0,0 @@ | |||
1 | --- a/newlib/libc/stdio/fprintf_chk.c 1969-12-31 19:00:00.000000000 -0500 | ||
2 | +++ b/newlib/libc/stdio/fprintf_chk.c 2009-02-26 19:02:53.000000000 -0500 | ||
3 | @@ -0,0 +1,21 @@ | ||
4 | +#include <stdarg.h> | ||
5 | +#include <stdio.h> | ||
6 | + | ||
7 | +/* | ||
8 | + * Stub implementation of __fprintf_chk adapted from glibc 2.7. This | ||
9 | + * doesn't actually implement any buffer overflow protection. It just makes | ||
10 | + * the linker happy :) | ||
11 | +*/ | ||
12 | +int | ||
13 | +__fprintf_chk (FILE *fp, int flag, const char *format, ...) | ||
14 | +{ | ||
15 | + va_list ap; | ||
16 | + int done; | ||
17 | + | ||
18 | + va_start (ap, format); | ||
19 | + done = vfprintf (fp, format, ap); | ||
20 | + va_end (ap); | ||
21 | + | ||
22 | + return done; | ||
23 | +} | ||
24 | + | ||
25 | --- a/newlib/libc/stdio/Makefile.am 2007-08-02 16:23:06.000000000 -0400 | ||
26 | +++ b/newlib/libc/stdio/Makefile.am 2009-02-26 18:14:53.000000000 -0500 | ||
27 | @@ -20,6 +20,7 @@ | ||
28 | flags.c \ | ||
29 | fopen.c \ | ||
30 | fprintf.c \ | ||
31 | + fprintf_chk.c \ | ||
32 | fputc.c \ | ||
33 | fputs.c \ | ||
34 | fread.c \ | ||
35 | @@ -65,6 +66,7 @@ | ||
36 | sniprintf.c \ | ||
37 | snprintf.c \ | ||
38 | sprintf.c \ | ||
39 | + sprintf_chk.c \ | ||
40 | sscanf.c \ | ||
41 | stdio.c \ | ||
42 | tmpfile.c \ | ||
43 | --- a/newlib/libc/stdio/Makefile.in 2007-12-19 17:36:38.000000000 -0500 | ||
44 | +++ b/newlib/libc/stdio/Makefile.in 2009-02-26 18:43:52.000000000 -0500 | ||
45 | @@ -63,7 +63,8 @@ | ||
46 | lib_a-fgets.$(OBJEXT) lib_a-fileno.$(OBJEXT) \ | ||
47 | lib_a-findfp.$(OBJEXT) lib_a-fiprintf.$(OBJEXT) \ | ||
48 | lib_a-flags.$(OBJEXT) lib_a-fopen.$(OBJEXT) \ | ||
49 | - lib_a-fprintf.$(OBJEXT) lib_a-fputc.$(OBJEXT) \ | ||
50 | + lib_a-fprintf.$(OBJEXT) lib_a-fprintf_chk.$(OBJEXT) \ | ||
51 | + lib_a-fputc.$(OBJEXT) \ | ||
52 | lib_a-fputs.$(OBJEXT) lib_a-fread.$(OBJEXT) \ | ||
53 | lib_a-freopen.$(OBJEXT) lib_a-fscanf.$(OBJEXT) \ | ||
54 | lib_a-fiscanf.$(OBJEXT) lib_a-fseek.$(OBJEXT) \ | ||
55 | @@ -86,6 +87,7 @@ | ||
56 | lib_a-setvbuf.$(OBJEXT) lib_a-siprintf.$(OBJEXT) \ | ||
57 | lib_a-siscanf.$(OBJEXT) lib_a-sniprintf.$(OBJEXT) \ | ||
58 | lib_a-snprintf.$(OBJEXT) lib_a-sprintf.$(OBJEXT) \ | ||
59 | + lib_a-sprintf_chk.$(OBJEXT) \ | ||
60 | lib_a-sscanf.$(OBJEXT) lib_a-stdio.$(OBJEXT) \ | ||
61 | lib_a-tmpfile.$(OBJEXT) lib_a-tmpnam.$(OBJEXT) \ | ||
62 | lib_a-ungetc.$(OBJEXT) lib_a-vdiprintf.$(OBJEXT) \ | ||
63 | @@ -122,15 +124,15 @@ | ||
64 | LTLIBRARIES = $(noinst_LTLIBRARIES) | ||
65 | am__objects_4 = clearerr.lo fclose.lo fdopen.lo feof.lo ferror.lo \ | ||
66 | fflush.lo fgetc.lo fgetpos.lo fgets.lo fileno.lo findfp.lo \ | ||
67 | - fiprintf.lo flags.lo fopen.lo fprintf.lo fputc.lo fputs.lo \ | ||
68 | - fread.lo freopen.lo fscanf.lo fiscanf.lo fseek.lo fsetpos.lo \ | ||
69 | + fiprintf.lo flags.lo fopen.lo fprintf.lo fprintf_chk.lo fputc.lo \ | ||
70 | + fputs.lo fread.lo freopen.lo fscanf.lo fiscanf.lo fseek.lo fsetpos.lo \ | ||
71 | ftell.lo fvwrite.lo fwalk.lo fwrite.lo getc.lo getchar.lo \ | ||
72 | getc_u.lo getchar_u.lo getdelim.lo getline.lo gets.lo \ | ||
73 | iprintf.lo iscanf.lo makebuf.lo perror.lo printf.lo putc.lo \ | ||
74 | putchar.lo putc_u.lo putchar_u.lo puts.lo refill.lo remove.lo \ | ||
75 | rename.lo rewind.lo rget.lo scanf.lo sccl.lo setbuf.lo \ | ||
76 | setbuffer.lo setlinebuf.lo setvbuf.lo siprintf.lo siscanf.lo \ | ||
77 | - sniprintf.lo snprintf.lo sprintf.lo sscanf.lo stdio.lo \ | ||
78 | + sniprintf.lo snprintf.lo sprintf.lo sprintf_chk.lo sscanf.lo stdio.lo \ | ||
79 | tmpfile.lo tmpnam.lo ungetc.lo vdiprintf.lo vdprintf.lo \ | ||
80 | viprintf.lo viscanf.lo vprintf.lo vscanf.lo vsiprintf.lo \ | ||
81 | vsiscanf.lo vsnprintf.lo vsniprintf.lo vsprintf.lo vsscanf.lo \ | ||
82 | @@ -344,6 +346,7 @@ | ||
83 | flags.c \ | ||
84 | fopen.c \ | ||
85 | fprintf.c \ | ||
86 | + fprintf_chk.c \ | ||
87 | fputc.c \ | ||
88 | fputs.c \ | ||
89 | fread.c \ | ||
90 | @@ -389,6 +392,7 @@ | ||
91 | sniprintf.c \ | ||
92 | snprintf.c \ | ||
93 | sprintf.c \ | ||
94 | + sprintf_chk.c \ | ||
95 | sscanf.c \ | ||
96 | stdio.c \ | ||
97 | tmpfile.c \ | ||
98 | @@ -508,6 +512,7 @@ | ||
99 | siprintf.def \ | ||
100 | siscanf.def \ | ||
101 | sprintf.def \ | ||
102 | + sprintf_chk.def \ | ||
103 | sscanf.def \ | ||
104 | tmpfile.def \ | ||
105 | tmpnam.def \ | ||
106 | @@ -678,6 +683,12 @@ | ||
107 | lib_a-fprintf.obj: fprintf.c | ||
108 | $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-fprintf.obj `if test -f 'fprintf.c'; then $(CYGPATH_W) 'fprintf.c'; else $(CYGPATH_W) '$(srcdir)/fprintf.c'; fi` | ||
109 | |||
110 | +lib_a-fprintf_chk.o: fprintf_chk.c | ||
111 | + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-fprintf_chk.o `test -f 'fprintf_chk.c' || echo '$(srcdir)/'`fprintf_chk.c | ||
112 | + | ||
113 | +lib_a-fprintf_chk.obj: fprintf_chk.c | ||
114 | + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-fprintf_chk.obj `if test -f 'fprintf_chk.c'; then $(CYGPATH_W) 'fprintf_chk.c'; else $(CYGPATH_W) '$(srcdir)/fprintf_chk.c'; fi` | ||
115 | + | ||
116 | lib_a-fputc.o: fputc.c | ||
117 | $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-fputc.o `test -f 'fputc.c' || echo '$(srcdir)/'`fputc.c | ||
118 | |||
119 | @@ -948,6 +959,12 @@ | ||
120 | lib_a-sprintf.obj: sprintf.c | ||
121 | $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-sprintf.obj `if test -f 'sprintf.c'; then $(CYGPATH_W) 'sprintf.c'; else $(CYGPATH_W) '$(srcdir)/sprintf.c'; fi` | ||
122 | |||
123 | +lib_a-sprintf_chk.o: sprintf_chk.c | ||
124 | + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-sprintf_chk.o `test -f 'sprintf_chk.c' || echo '$(srcdir)/'`sprintf_chk.c | ||
125 | + | ||
126 | +lib_a-sprintf_chk.obj: sprintf_chk.c | ||
127 | + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-sprintf_chk.obj `if test -f 'sprintf_chk.c'; then $(CYGPATH_W) 'sprintf_chk.c'; else $(CYGPATH_W) '$(srcdir)/sprintf_chk.c'; fi` | ||
128 | + | ||
129 | lib_a-sscanf.o: sscanf.c | ||
130 | $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-sscanf.o `test -f 'sscanf.c' || echo '$(srcdir)/'`sscanf.c | ||
131 | |||
132 | --- a/newlib/libc/stdio/sprintf_chk.c 1969-12-31 19:00:00.000000000 -0500 | ||
133 | +++ b/newlib/libc/stdio/sprintf_chk.c 2009-02-26 19:02:26.000000000 -0500 | ||
134 | @@ -0,0 +1,21 @@ | ||
135 | +#include <stdarg.h> | ||
136 | +#include <stdio.h> | ||
137 | + | ||
138 | +/* | ||
139 | + * Stub implementation of __sprintf_chk adapted from glibc 2.7. This | ||
140 | + * doesn't actually implement any buffer overflow protection. It just makes | ||
141 | + * the linker happy :) | ||
142 | +*/ | ||
143 | +int | ||
144 | +__sprintf_chk (char *s, int flags, size_t slen, const char *format, ...) | ||
145 | +{ | ||
146 | + va_list arg; | ||
147 | + int done; | ||
148 | + | ||
149 | + va_start (arg, format); | ||
150 | + done = vsprintf (s, format, arg); | ||
151 | + va_end (arg); | ||
152 | + | ||
153 | + return done; | ||
154 | +} | ||
155 | + | ||
diff --git a/recipes-extended/xen/files/newlib-stdint-size_max-fix-from-1.17.0.patch b/recipes-extended/xen/files/newlib-stdint-size_max-fix-from-1.17.0.patch deleted file mode 100644 index 3610d646..00000000 --- a/recipes-extended/xen/files/newlib-stdint-size_max-fix-from-1.17.0.patch +++ /dev/null | |||
@@ -1,16 +0,0 @@ | |||
1 | --- a/newlib/libc/include/stdint.h.orig 2006-08-17 00:39:43.000000000 +0300 | ||
2 | +++ b/newlib/libc/include/stdint.h 2009-08-25 17:33:23.000000000 +0300 | ||
3 | @@ -348,8 +348,11 @@ | ||
4 | #endif | ||
5 | |||
6 | /* This must match size_t in stddef.h, currently long unsigned int */ | ||
7 | -#define SIZE_MIN (-__STDINT_EXP(LONG_MAX) - 1L) | ||
8 | -#define SIZE_MAX __STDINT_EXP(LONG_MAX) | ||
9 | +#ifdef __SIZE_MAX__ | ||
10 | +#define SIZE_MAX __SIZE_MAX__ | ||
11 | +#else | ||
12 | +#define SIZE_MAX (__STDINT_EXP(LONG_MAX) * 2UL + 1) | ||
13 | +#endif | ||
14 | |||
15 | /* This must match sig_atomic_t in <signal.h> (currently int) */ | ||
16 | #define SIG_ATOMIC_MIN (-__STDINT_EXP(INT_MAX) - 1) | ||
diff --git a/recipes-extended/xen/files/newlib.patch b/recipes-extended/xen/files/newlib.patch deleted file mode 100644 index dbf409a2..00000000 --- a/recipes-extended/xen/files/newlib.patch +++ /dev/null | |||
@@ -1,727 +0,0 @@ | |||
1 | There is a mix between longs and long longs. | ||
2 | |||
3 | Index: newlib/libc/include/inttypes.h | ||
4 | =================================================================== | ||
5 | RCS file: /cvs/src/src/newlib/libc/include/inttypes.h,v | ||
6 | retrieving revision 1.3 | ||
7 | diff -u -p -r1.3 inttypes.h | ||
8 | --- a/newlib/libc/include/inttypes.h 16 Dec 2005 19:03:12 -0000 1.3 | ||
9 | +++ b/newlib/libc/include/inttypes.h 8 Nov 2007 16:32:44 -0000 | ||
10 | @@ -163,12 +163,12 @@ | ||
11 | |||
12 | |||
13 | /* 64-bit types */ | ||
14 | -#if __have_longlong64 | ||
15 | -#define __PRI64(x) __STRINGIFY(ll##x) | ||
16 | -#define __SCN64(x) __STRINGIFY(ll##x) | ||
17 | -#elif __have_long64 | ||
18 | +#if __have_long64 | ||
19 | #define __PRI64(x) __STRINGIFY(l##x) | ||
20 | #define __SCN64(x) __STRINGIFY(l##x) | ||
21 | +#elif __have_longlong64 | ||
22 | +#define __PRI64(x) __STRINGIFY(ll##x) | ||
23 | +#define __SCN64(x) __STRINGIFY(ll##x) | ||
24 | #else | ||
25 | #define __PRI64(x) __STRINGIFY(x) | ||
26 | #define __SCN64(x) __STRINGIFY(x) | ||
27 | @@ -217,12 +217,12 @@ | ||
28 | #endif | ||
29 | |||
30 | /* max-bit types */ | ||
31 | -#if __have_longlong64 | ||
32 | -#define __PRIMAX(x) __STRINGIFY(ll##x) | ||
33 | -#define __SCNMAX(x) __STRINGIFY(ll##x) | ||
34 | -#elif __have_long64 | ||
35 | +#if __have_long64 | ||
36 | #define __PRIMAX(x) __STRINGIFY(l##x) | ||
37 | #define __SCNMAX(x) __STRINGIFY(l##x) | ||
38 | +#elif __have_longlong64 | ||
39 | +#define __PRIMAX(x) __STRINGIFY(ll##x) | ||
40 | +#define __SCNMAX(x) __STRINGIFY(ll##x) | ||
41 | #else | ||
42 | #define __PRIMAX(x) __STRINGIFY(x) | ||
43 | #define __SCNMAX(x) __STRINGIFY(x) | ||
44 | @@ -242,12 +242,12 @@ | ||
45 | #define SCNxMAX __SCNMAX(x) | ||
46 | |||
47 | /* ptr types */ | ||
48 | -#if __have_longlong64 | ||
49 | -#define __PRIPTR(x) __STRINGIFY(ll##x) | ||
50 | -#define __SCNPTR(x) __STRINGIFY(ll##x) | ||
51 | -#elif __have_long64 | ||
52 | +#if __have_long64 | ||
53 | #define __PRIPTR(x) __STRINGIFY(l##x) | ||
54 | #define __SCNPTR(x) __STRINGIFY(l##x) | ||
55 | +#elif __have_longlong64 | ||
56 | +#define __PRIPTR(x) __STRINGIFY(ll##x) | ||
57 | +#define __SCNPTR(x) __STRINGIFY(ll##x) | ||
58 | #else | ||
59 | #define __PRIPTR(x) __STRINGIFY(x) | ||
60 | #define __SCNPTR(x) __STRINGIFY(x) | ||
61 | |||
62 | We don't want u?int32_t to be long as our code assume in a lot of places to be | ||
63 | int. | ||
64 | |||
65 | Index: newlib/libc/include/stdint.h | ||
66 | =================================================================== | ||
67 | RCS file: /cvs/src/src/newlib/libc/include/stdint.h,v | ||
68 | retrieving revision 1.10 | ||
69 | diff -u -p -r1.10 stdint.h | ||
70 | --- a/newlib/libc/include/stdint.h 16 Aug 2006 21:39:43 -0000 1.10 | ||
71 | +++ b/newlib/libc/include/stdint.h 12 Feb 2008 13:07:52 -0000 | ||
72 | @@ -38,7 +38,7 @@ extern "C" { | ||
73 | #if __STDINT_EXP(LONG_MAX) > 0x7fffffff | ||
74 | #define __have_long64 1 | ||
75 | #elif __STDINT_EXP(LONG_MAX) == 0x7fffffff && !defined(__SPU__) | ||
76 | -#define __have_long32 1 | ||
77 | +/* #define __have_long32 1 */ | ||
78 | #endif | ||
79 | |||
80 | #if __STDINT_EXP(SCHAR_MAX) == 0x7f | ||
81 | |||
82 | Define the basic ia64 jump buffer | ||
83 | |||
84 | Index: newlib/libc/include/sys/config.h | ||
85 | =================================================================== | ||
86 | RCS file: /cvs/src/src/newlib/libc/include/sys/config.h,v | ||
87 | retrieving revision 1.47 | ||
88 | diff -u -p -r1.47 config.h | ||
89 | --- a/newlib/libc/include/sys/config.h 15 Mar 2007 21:32:12 -0000 1.47 | ||
90 | +++ b/newlib/libc/include/sys/config.h 8 Nov 2007 16:32:44 -0000 | ||
91 | @@ -71,6 +71,10 @@ | ||
92 | #endif | ||
93 | #endif | ||
94 | |||
95 | +#ifndef __DYNAMIC_REENT__ | ||
96 | +#define __DYNAMIC_REENT__ | ||
97 | +#endif | ||
98 | + | ||
99 | #ifdef __mn10200__ | ||
100 | #define __SMALL_BITFIELDS | ||
101 | #endif | ||
102 | |||
103 | Dynamic pointer to our reentrancy zone | ||
104 | |||
105 | Index: newlib/libc/reent/getreent.c | ||
106 | =================================================================== | ||
107 | RCS file: /cvs/src/src/newlib/libc/reent/getreent.c,v | ||
108 | retrieving revision 1.2 | ||
109 | diff -u -p -r1.2 getreent.c | ||
110 | --- a/newlib/libc/reent/getreent.c 7 Sep 2007 00:45:55 -0000 1.2 | ||
111 | +++ b/newlib/libc/reent/getreent.c 8 Nov 2007 16:32:44 -0000 | ||
112 | @@ -3,12 +3,20 @@ | ||
113 | #include <_ansi.h> | ||
114 | #include <reent.h> | ||
115 | |||
116 | +#define weak_alias(name, aliasname) \ | ||
117 | + extern __typeof (name) aliasname __attribute__ ((weak, alias (#name))); | ||
118 | + | ||
119 | #ifdef __getreent | ||
120 | #undef __getreent | ||
121 | #endif | ||
122 | +#ifdef __libc_getreent | ||
123 | +#undef __libc_getreent | ||
124 | +#endif | ||
125 | |||
126 | struct _reent * | ||
127 | -_DEFUN_VOID(__getreent) | ||
128 | +__libc_getreent (void) | ||
129 | { | ||
130 | return _impure_ptr; | ||
131 | } | ||
132 | +weak_alias(__libc_getreent,__getreent) | ||
133 | + | ||
134 | |||
135 | We can't provide a red zone in mini-os. | ||
136 | |||
137 | Index: newlib/libc/machine/x86_64/memcpy.S | ||
138 | =================================================================== | ||
139 | RCS file: /cvs/src/src/newlib/libc/machine/x86_64/memcpy.S,v | ||
140 | retrieving revision 1.1 | ||
141 | diff -u -p -r1.1 memcpy.S | ||
142 | --- a/newlib/libc/machine/x86_64/memcpy.S 28 Aug 2007 21:56:49 -0000 1.1 | ||
143 | +++ b/newlib/libc/machine/x86_64/memcpy.S 8 Nov 2007 16:32:44 -0000 | ||
144 | @@ -30,10 +30,18 @@ quadword_aligned: | ||
145 | cmpq $256, rdx | ||
146 | jb quadword_copy | ||
147 | |||
148 | +#if 1 | ||
149 | + subq $32, rsp | ||
150 | + movq rax, 24 (rsp) | ||
151 | + movq r12, 16 (rsp) | ||
152 | + movq r13, 8 (rsp) | ||
153 | + movq r14, 0 (rsp) | ||
154 | +#else | ||
155 | movq rax, -8 (rsp) | ||
156 | movq r12, -16 (rsp) | ||
157 | movq r13, -24 (rsp) | ||
158 | movq r14, -32 (rsp) | ||
159 | +#endif | ||
160 | |||
161 | movq rdx, rcx /* Copy 128 bytes at a time with minimum cache polution */ | ||
162 | shrq $7, rcx | ||
163 | @@ -89,10 +97,18 @@ loop: | ||
164 | movq rdx, rcx | ||
165 | andq $127, rcx | ||
166 | rep movsb | ||
167 | +#if 1 | ||
168 | + movq 24 (rsp), rax | ||
169 | + movq 16 (rsp), r12 | ||
170 | + movq 8 (rsp), r13 | ||
171 | + movq 0 (rsp), r14 | ||
172 | + addq $32, rsp | ||
173 | +#else | ||
174 | movq -8 (rsp), rax | ||
175 | movq -16 (rsp), r12 | ||
176 | movq -24 (rsp), r13 | ||
177 | movq -32 (rsp), r14 | ||
178 | +#endif | ||
179 | ret | ||
180 | |||
181 | |||
182 | --- a/newlib/libc/machine/x86_64/x86_64mach.h.orig 2008-07-11 14:57:23.062269000 +0100 | ||
183 | +++ b/newlib/libc/machine/x86_64/x86_64mach.h 2008-07-11 14:58:01.262503000 +0100 | ||
184 | @@ -22,81 +22,81 @@ | ||
185 | |||
186 | #define REG(x) CONCAT1(__REG_PREFIX__, x) | ||
187 | |||
188 | -#define rax REG(rax) | ||
189 | -#define rbx REG(rbx) | ||
190 | -#define rcx REG(rcx) | ||
191 | -#define rdx REG(rdx) | ||
192 | -#define rsi REG(rsi) | ||
193 | -#define rdi REG(rdi) | ||
194 | -#define rbp REG(rbp) | ||
195 | -#define rsp REG(rsp) | ||
196 | - | ||
197 | -#define r8 REG(r8) | ||
198 | -#define r9 REG(r9) | ||
199 | -#define r10 REG(r10) | ||
200 | -#define r11 REG(r11) | ||
201 | -#define r12 REG(r12) | ||
202 | -#define r13 REG(r13) | ||
203 | -#define r14 REG(r14) | ||
204 | -#define r15 REG(r15) | ||
205 | - | ||
206 | -#define eax REG(eax) | ||
207 | -#define ebx REG(ebx) | ||
208 | -#define ecx REG(ecx) | ||
209 | -#define edx REG(edx) | ||
210 | -#define esi REG(esi) | ||
211 | -#define edi REG(edi) | ||
212 | -#define ebp REG(ebp) | ||
213 | -#define esp REG(esp) | ||
214 | - | ||
215 | -#define st0 REG(st) | ||
216 | -#define st1 REG(st(1)) | ||
217 | -#define st2 REG(st(2)) | ||
218 | -#define st3 REG(st(3)) | ||
219 | -#define st4 REG(st(4)) | ||
220 | -#define st5 REG(st(5)) | ||
221 | -#define st6 REG(st(6)) | ||
222 | -#define st7 REG(st(7)) | ||
223 | - | ||
224 | -#define ax REG(ax) | ||
225 | -#define bx REG(bx) | ||
226 | -#define cx REG(cx) | ||
227 | -#define dx REG(dx) | ||
228 | - | ||
229 | -#define ah REG(ah) | ||
230 | -#define bh REG(bh) | ||
231 | -#define ch REG(ch) | ||
232 | -#define dh REG(dh) | ||
233 | - | ||
234 | -#define al REG(al) | ||
235 | -#define bl REG(bl) | ||
236 | -#define cl REG(cl) | ||
237 | -#define dl REG(dl) | ||
238 | - | ||
239 | -#define sil REG(sil) | ||
240 | - | ||
241 | -#define mm1 REG(mm1) | ||
242 | -#define mm2 REG(mm2) | ||
243 | -#define mm3 REG(mm3) | ||
244 | -#define mm4 REG(mm4) | ||
245 | -#define mm5 REG(mm5) | ||
246 | -#define mm6 REG(mm6) | ||
247 | -#define mm7 REG(mm7) | ||
248 | - | ||
249 | -#define xmm0 REG(xmm0) | ||
250 | -#define xmm1 REG(xmm1) | ||
251 | -#define xmm2 REG(xmm2) | ||
252 | -#define xmm3 REG(xmm3) | ||
253 | -#define xmm4 REG(xmm4) | ||
254 | -#define xmm5 REG(xmm5) | ||
255 | -#define xmm6 REG(xmm6) | ||
256 | -#define xmm7 REG(xmm7) | ||
257 | - | ||
258 | -#define cr0 REG(cr0) | ||
259 | -#define cr1 REG(cr1) | ||
260 | -#define cr2 REG(cr2) | ||
261 | -#define cr3 REG(cr3) | ||
262 | -#define cr4 REG(cr4) | ||
263 | +#define rax %rax | ||
264 | +#define rbx %rbx | ||
265 | +#define rcx %rcx | ||
266 | +#define rdx %rdx | ||
267 | +#define rsi %rsi | ||
268 | +#define rdi %rdi | ||
269 | +#define rbp %rbp | ||
270 | +#define rsp %rsp | ||
271 | + | ||
272 | +#define r8 %r8 | ||
273 | +#define r9 %r9 | ||
274 | +#define r10 %r10 | ||
275 | +#define r11 %r11 | ||
276 | +#define r12 %r12 | ||
277 | +#define r13 %r13 | ||
278 | +#define r14 %r14 | ||
279 | +#define r15 %r15 | ||
280 | + | ||
281 | +#define eax %eax | ||
282 | +#define ebx %ebx | ||
283 | +#define ecx %ecx | ||
284 | +#define edx %edx | ||
285 | +#define esi %esi | ||
286 | +#define edi %edi | ||
287 | +#define ebp %ebp | ||
288 | +#define esp %esp | ||
289 | + | ||
290 | +#define st0 %st | ||
291 | +#define st1 %st(1) | ||
292 | +#define st2 %st(2) | ||
293 | +#define st3 %st(3) | ||
294 | +#define st4 %st(4) | ||
295 | +#define st5 %st(5) | ||
296 | +#define st6 %st(6) | ||
297 | +#define st7 %st(7) | ||
298 | + | ||
299 | +#define ax %ax | ||
300 | +#define bx %bx | ||
301 | +#define cx %cx | ||
302 | +#define dx %dx | ||
303 | + | ||
304 | +#define ah %ah | ||
305 | +#define bh %bh | ||
306 | +#define ch %ch | ||
307 | +#define dh %dh | ||
308 | + | ||
309 | +#define al %al | ||
310 | +#define bl %bl | ||
311 | +#define cl %cl | ||
312 | +#define dl %dl | ||
313 | + | ||
314 | +#define sil %sil | ||
315 | + | ||
316 | +#define mm1 %mm1 | ||
317 | +#define mm2 %mm2 | ||
318 | +#define mm3 %mm3 | ||
319 | +#define mm4 %mm4 | ||
320 | +#define mm5 %mm5 | ||
321 | +#define mm6 %mm6 | ||
322 | +#define mm7 %mm7 | ||
323 | + | ||
324 | +#define xmm0 %xmm0 | ||
325 | +#define xmm1 %xmm1 | ||
326 | +#define xmm2 %xmm2 | ||
327 | +#define xmm3 %xmm3 | ||
328 | +#define xmm4 %xmm4 | ||
329 | +#define xmm5 %xmm5 | ||
330 | +#define xmm6 %xmm6 | ||
331 | +#define xmm7 %xmm7 | ||
332 | + | ||
333 | +#define cr0 %cr0 | ||
334 | +#define cr1 %cr1 | ||
335 | +#define cr2 %cr2 | ||
336 | +#define cr3 %cr3 | ||
337 | +#define cr4 %cr4 | ||
338 | |||
339 | #ifdef _I386MACH_NEED_SOTYPE_FUNCTION | ||
340 | #define SOTYPE_FUNCTION(sym) .type SYM(sym),@function | ||
341 | --- a/newlib/libc/machine/x86_64/memcpy.S.orig 2008-07-11 15:12:27.494693000 +0100 | ||
342 | +++ b/newlib/libc/machine/x86_64/memcpy.S 2008-07-11 15:12:29.448706000 +0100 | ||
343 | @@ -60,14 +60,14 @@ | ||
344 | movq 48 (rsi), r13 | ||
345 | movq 56 (rsi), r14 | ||
346 | |||
347 | - movntiq rax, (rdi) | ||
348 | - movntiq r8 , 8 (rdi) | ||
349 | - movntiq r9 , 16 (rdi) | ||
350 | - movntiq r10, 24 (rdi) | ||
351 | - movntiq r11, 32 (rdi) | ||
352 | - movntiq r12, 40 (rdi) | ||
353 | - movntiq r13, 48 (rdi) | ||
354 | - movntiq r14, 56 (rdi) | ||
355 | + movnti rax, (rdi) | ||
356 | + movnti r8 , 8 (rdi) | ||
357 | + movnti r9 , 16 (rdi) | ||
358 | + movnti r10, 24 (rdi) | ||
359 | + movnti r11, 32 (rdi) | ||
360 | + movnti r12, 40 (rdi) | ||
361 | + movnti r13, 48 (rdi) | ||
362 | + movnti r14, 56 (rdi) | ||
363 | |||
364 | movq 64 (rsi), rax | ||
365 | movq 72 (rsi), r8 | ||
366 | @@ -78,14 +78,14 @@ | ||
367 | movq 112 (rsi), r13 | ||
368 | movq 120 (rsi), r14 | ||
369 | |||
370 | - movntiq rax, 64 (rdi) | ||
371 | - movntiq r8 , 72 (rdi) | ||
372 | - movntiq r9 , 80 (rdi) | ||
373 | - movntiq r10, 88 (rdi) | ||
374 | - movntiq r11, 96 (rdi) | ||
375 | - movntiq r12, 104 (rdi) | ||
376 | - movntiq r13, 112 (rdi) | ||
377 | - movntiq r14, 120 (rdi) | ||
378 | + movnti rax, 64 (rdi) | ||
379 | + movnti r8 , 72 (rdi) | ||
380 | + movnti r9 , 80 (rdi) | ||
381 | + movnti r10, 88 (rdi) | ||
382 | + movnti r11, 96 (rdi) | ||
383 | + movnti r12, 104 (rdi) | ||
384 | + movnti r13, 112 (rdi) | ||
385 | + movnti r14, 120 (rdi) | ||
386 | |||
387 | leaq 128 (rsi), rsi | ||
388 | leaq 128 (rdi), rdi | ||
389 | --- a/newlib/libc/machine/i386/i386mach.h 2000-08-28 18:50:06.000000000 +0100 | ||
390 | +++ b/newlib/libc/machine/i386/i386mach.h 2008-07-11 15:17:13.874409000 +0100 | ||
391 | @@ -27,46 +27,46 @@ | ||
392 | |||
393 | #define REG(x) CONCAT1(__REG_PREFIX__, x) | ||
394 | |||
395 | -#define eax REG(eax) | ||
396 | -#define ebx REG(ebx) | ||
397 | -#define ecx REG(ecx) | ||
398 | -#define edx REG(edx) | ||
399 | -#define esi REG(esi) | ||
400 | -#define edi REG(edi) | ||
401 | -#define ebp REG(ebp) | ||
402 | -#define esp REG(esp) | ||
403 | - | ||
404 | -#define st0 REG(st) | ||
405 | -#define st1 REG(st(1)) | ||
406 | -#define st2 REG(st(2)) | ||
407 | -#define st3 REG(st(3)) | ||
408 | -#define st4 REG(st(4)) | ||
409 | -#define st5 REG(st(5)) | ||
410 | -#define st6 REG(st(6)) | ||
411 | -#define st7 REG(st(7)) | ||
412 | - | ||
413 | -#define ax REG(ax) | ||
414 | -#define bx REG(bx) | ||
415 | -#define cx REG(cx) | ||
416 | -#define dx REG(dx) | ||
417 | - | ||
418 | -#define ah REG(ah) | ||
419 | -#define bh REG(bh) | ||
420 | -#define ch REG(ch) | ||
421 | -#define dh REG(dh) | ||
422 | - | ||
423 | -#define al REG(al) | ||
424 | -#define bl REG(bl) | ||
425 | -#define cl REG(cl) | ||
426 | -#define dl REG(dl) | ||
427 | - | ||
428 | -#define mm1 REG(mm1) | ||
429 | -#define mm2 REG(mm2) | ||
430 | -#define mm3 REG(mm3) | ||
431 | -#define mm4 REG(mm4) | ||
432 | -#define mm5 REG(mm5) | ||
433 | -#define mm6 REG(mm6) | ||
434 | -#define mm7 REG(mm7) | ||
435 | +#define eax %eax | ||
436 | +#define ebx %ebx | ||
437 | +#define ecx %ecx | ||
438 | +#define edx %edx | ||
439 | +#define esi %esi | ||
440 | +#define edi %edi | ||
441 | +#define ebp %ebp | ||
442 | +#define esp %esp | ||
443 | + | ||
444 | +#define st0 %st | ||
445 | +#define st1 %st(1) | ||
446 | +#define st2 %st(2) | ||
447 | +#define st3 %st(3) | ||
448 | +#define st4 %st(4) | ||
449 | +#define st5 %st(5) | ||
450 | +#define st6 %st(6) | ||
451 | +#define st7 %st(7) | ||
452 | + | ||
453 | +#define ax %ax | ||
454 | +#define bx %bx | ||
455 | +#define cx %cx | ||
456 | +#define dx %dx | ||
457 | + | ||
458 | +#define ah %ah | ||
459 | +#define bh %bh | ||
460 | +#define ch %ch | ||
461 | +#define dh %dh | ||
462 | + | ||
463 | +#define al %al | ||
464 | +#define bl %bl | ||
465 | +#define cl %cl | ||
466 | +#define dl %dl | ||
467 | + | ||
468 | +#define mm1 %mm1 | ||
469 | +#define mm2 %mm2 | ||
470 | +#define mm3 %mm3 | ||
471 | +#define mm4 %mm4 | ||
472 | +#define mm5 %mm5 | ||
473 | +#define mm6 %mm6 | ||
474 | +#define mm7 %mm7 | ||
475 | |||
476 | #ifdef _I386MACH_NEED_SOTYPE_FUNCTION | ||
477 | #define SOTYPE_FUNCTION(sym) .type SYM(sym),@function | ||
478 | --- a/newlib/libc/machine/x86_64/memset.S 2007-08-28 22:56:49.000000000 +0100 | ||
479 | +++ b/newlib/libc/machine/x86_64/memset.S 2008-07-11 15:16:59.098320000 +0100 | ||
480 | @@ -40,22 +40,22 @@ | ||
481 | |||
482 | .p2align 4 | ||
483 | loop: | ||
484 | - movntiq rax, (rdi) | ||
485 | - movntiq rax, 8 (rdi) | ||
486 | - movntiq rax, 16 (rdi) | ||
487 | - movntiq rax, 24 (rdi) | ||
488 | - movntiq rax, 32 (rdi) | ||
489 | - movntiq rax, 40 (rdi) | ||
490 | - movntiq rax, 48 (rdi) | ||
491 | - movntiq rax, 56 (rdi) | ||
492 | - movntiq rax, 64 (rdi) | ||
493 | - movntiq rax, 72 (rdi) | ||
494 | - movntiq rax, 80 (rdi) | ||
495 | - movntiq rax, 88 (rdi) | ||
496 | - movntiq rax, 96 (rdi) | ||
497 | - movntiq rax, 104 (rdi) | ||
498 | - movntiq rax, 112 (rdi) | ||
499 | - movntiq rax, 120 (rdi) | ||
500 | + movnti rax, (rdi) | ||
501 | + movnti rax, 8 (rdi) | ||
502 | + movnti rax, 16 (rdi) | ||
503 | + movnti rax, 24 (rdi) | ||
504 | + movnti rax, 32 (rdi) | ||
505 | + movnti rax, 40 (rdi) | ||
506 | + movnti rax, 48 (rdi) | ||
507 | + movnti rax, 56 (rdi) | ||
508 | + movnti rax, 64 (rdi) | ||
509 | + movnti rax, 72 (rdi) | ||
510 | + movnti rax, 80 (rdi) | ||
511 | + movnti rax, 88 (rdi) | ||
512 | + movnti rax, 96 (rdi) | ||
513 | + movnti rax, 104 (rdi) | ||
514 | + movnti rax, 112 (rdi) | ||
515 | + movnti rax, 120 (rdi) | ||
516 | |||
517 | leaq 128 (rdi), rdi | ||
518 | |||
519 | --- a/newlib/libm/machine/i386/i386mach.h.orig 2008-07-11 15:30:37.367227000 +0100 | ||
520 | +++ b/newlib/libm/machine/i386/i386mach.h 2008-07-11 15:30:55.232337000 +0100 | ||
521 | @@ -27,46 +27,46 @@ | ||
522 | |||
523 | #define REG(x) CONCAT1(__REG_PREFIX__, x) | ||
524 | |||
525 | -#define eax REG(eax) | ||
526 | -#define ebx REG(ebx) | ||
527 | -#define ecx REG(ecx) | ||
528 | -#define edx REG(edx) | ||
529 | -#define esi REG(esi) | ||
530 | -#define edi REG(edi) | ||
531 | -#define ebp REG(ebp) | ||
532 | -#define esp REG(esp) | ||
533 | - | ||
534 | -#define st0 REG(st) | ||
535 | -#define st1 REG(st(1)) | ||
536 | -#define st2 REG(st(2)) | ||
537 | -#define st3 REG(st(3)) | ||
538 | -#define st4 REG(st(4)) | ||
539 | -#define st5 REG(st(5)) | ||
540 | -#define st6 REG(st(6)) | ||
541 | -#define st7 REG(st(7)) | ||
542 | - | ||
543 | -#define ax REG(ax) | ||
544 | -#define bx REG(bx) | ||
545 | -#define cx REG(cx) | ||
546 | -#define dx REG(dx) | ||
547 | - | ||
548 | -#define ah REG(ah) | ||
549 | -#define bh REG(bh) | ||
550 | -#define ch REG(ch) | ||
551 | -#define dh REG(dh) | ||
552 | - | ||
553 | -#define al REG(al) | ||
554 | -#define bl REG(bl) | ||
555 | -#define cl REG(cl) | ||
556 | -#define dl REG(dl) | ||
557 | - | ||
558 | -#define mm1 REG(mm1) | ||
559 | -#define mm2 REG(mm2) | ||
560 | -#define mm3 REG(mm3) | ||
561 | -#define mm4 REG(mm4) | ||
562 | -#define mm5 REG(mm5) | ||
563 | -#define mm6 REG(mm6) | ||
564 | -#define mm7 REG(mm7) | ||
565 | +#define eax %eax | ||
566 | +#define ebx %ebx | ||
567 | +#define ecx %ecx | ||
568 | +#define edx %edx | ||
569 | +#define esi %esi | ||
570 | +#define edi %edi | ||
571 | +#define ebp %ebp | ||
572 | +#define esp %esp | ||
573 | + | ||
574 | +#define st0 %st | ||
575 | +#define st1 %st(1) | ||
576 | +#define st2 %st(2) | ||
577 | +#define st3 %st(3) | ||
578 | +#define st4 %st(4) | ||
579 | +#define st5 %st(5) | ||
580 | +#define st6 %st(6) | ||
581 | +#define st7 %st(7) | ||
582 | + | ||
583 | +#define ax %ax | ||
584 | +#define bx %bx | ||
585 | +#define cx %cx | ||
586 | +#define dx %dx | ||
587 | + | ||
588 | +#define ah %ah | ||
589 | +#define bh %bh | ||
590 | +#define ch %ch | ||
591 | +#define dh %dh | ||
592 | + | ||
593 | +#define al %al | ||
594 | +#define bl %bl | ||
595 | +#define cl %cl | ||
596 | +#define dl %dl | ||
597 | + | ||
598 | +#define mm1 %mm1 | ||
599 | +#define mm2 %mm2 | ||
600 | +#define mm3 %mm3 | ||
601 | +#define mm4 %mm4 | ||
602 | +#define mm5 %mm5 | ||
603 | +#define mm6 %mm6 | ||
604 | +#define mm7 %mm7 | ||
605 | |||
606 | #ifdef _I386MACH_NEED_SOTYPE_FUNCTION | ||
607 | #define SOTYPE_FUNCTION(sym) .type SYM(sym),@function | ||
608 | |||
609 | |||
610 | We want to have a 64bit offsets libc even on 32bit platforms. | ||
611 | |||
612 | --- ./newlib/configure.host.orig 2008-08-07 16:01:17.801946000 +0100 | ||
613 | +++ ./newlib/configure.host 2008-08-07 16:01:34.181064000 +0100 | ||
614 | @@ -317,6 +317,8 @@ | ||
615 | oext=lo | ||
616 | lpfx= | ||
617 | aext=la ;; | ||
618 | + i[34567]86-xen-elf) | ||
619 | + stdio64_dir=stdio64 ;; | ||
620 | *) ;; #shared library not supported for ${host} | ||
621 | esac | ||
622 | |||
623 | --- a/newlib/libc/include/sys/_types.h.orig 2008-08-07 15:22:44.925008000 +0100 | ||
624 | +++ b/newlib/libc/include/sys/_types.h 2008-08-07 15:22:50.824044000 +0100 | ||
625 | @@ -13,8 +13,12 @@ | ||
626 | #include <sys/lock.h> | ||
627 | |||
628 | #ifndef __off_t_defined | ||
629 | +#ifdef __MINIOS__ | ||
630 | +typedef long long _off_t; | ||
631 | +#else | ||
632 | typedef long _off_t; | ||
633 | #endif | ||
634 | +#endif | ||
635 | |||
636 | #if defined(__rtems__) | ||
637 | /* device numbers are 32-bit major and and 32-bit minor */ | ||
638 | --- ./newlib/libc/include/sys/config.h.orig 2008-08-07 14:43:25.915866000 +0100 | ||
639 | +++ ./newlib/libc/include/sys/config.h 2008-08-07 14:44:13.508154000 +0100 | ||
640 | @@ -69,6 +69,10 @@ | ||
641 | /* we use some glibc header files so turn on glibc large file feature */ | ||
642 | #define _LARGEFILE64_SOURCE 1 | ||
643 | #endif | ||
644 | +#ifdef __MINIOS__ | ||
645 | +#define __LARGE64_FILES 1 | ||
646 | +#define _LARGEFILE64_SOURCE 1 | ||
647 | +#endif | ||
648 | #endif | ||
649 | |||
650 | #ifndef __DYNAMIC_REENT__ | ||
651 | --- ./newlib/libc/include/sys/_default_fcntl.h.orig 2008-08-07 15:08:22.377836000 +0100 | ||
652 | +++ ./newlib/libc/include/sys/_default_fcntl.h 2008-08-07 15:08:31.651890000 +0100 | ||
653 | @@ -170,7 +170,11 @@ | ||
654 | /* Provide _<systemcall> prototypes for functions provided by some versions | ||
655 | of newlib. */ | ||
656 | #ifdef _COMPILING_NEWLIB | ||
657 | -extern int _open _PARAMS ((const char *, int, ...)); | ||
658 | +extern int _open _PARAMS ((const char *, int, ...)) | ||
659 | +#ifdef __MINIOS__ | ||
660 | + asm("open64") | ||
661 | +#endif | ||
662 | + ; | ||
663 | extern int _fcntl _PARAMS ((int, int, ...)); | ||
664 | #ifdef __LARGE64_FILES | ||
665 | extern int _open64 _PARAMS ((const char *, int, ...)); | ||
666 | --- ./newlib/libc/include/sys/unistd.h.orig 2008-08-07 15:09:36.449280000 +0100 | ||
667 | +++ ./newlib/libc/include/sys/unistd.h 2008-08-07 15:09:51.210370000 +0100 | ||
668 | @@ -101,7 +101,11 @@ | ||
669 | int _EXFUN(link, (const char *__path1, const char *__path2 )); | ||
670 | int _EXFUN(nice, (int __nice_value )); | ||
671 | #if !defined(__INSIDE_CYGWIN__) | ||
672 | -off_t _EXFUN(lseek, (int __fildes, off_t __offset, int __whence )); | ||
673 | +off_t _EXFUN(lseek, (int __fildes, off_t __offset, int __whence )) | ||
674 | +#ifdef __MINIOS__ | ||
675 | + asm("lseek64") | ||
676 | +#endif | ||
677 | + ; | ||
678 | #endif | ||
679 | #if defined(__SPU__) | ||
680 | #define F_ULOCK 0 | ||
681 | --- ./newlib/libc/include/sys/stat.h.orig 2008-08-07 16:08:50.495116000 +0100 | ||
682 | +++ ./newlib/libc/include/sys/stat.h 2008-08-07 16:10:21.799753000 +0100 | ||
683 | @@ -49,6 +49,9 @@ | ||
684 | long st_spare4[2]; | ||
685 | #endif | ||
686 | }; | ||
687 | +#ifdef __MINIOS__ | ||
688 | +#define stat64 stat | ||
689 | +#endif | ||
690 | #endif | ||
691 | |||
692 | #define _IFMT 0170000 /* type of file */ | ||
693 | @@ -132,7 +135,11 @@ | ||
694 | /* Provide prototypes for most of the _<systemcall> names that are | ||
695 | provided in newlib for some compilers. */ | ||
696 | #ifdef _COMPILING_NEWLIB | ||
697 | -int _EXFUN(_fstat,( int __fd, struct stat *__sbuf )); | ||
698 | +int _EXFUN(_fstat,( int __fd, struct stat *__sbuf )) | ||
699 | +#ifdef __MINIOS__ | ||
700 | + asm("fstat64") | ||
701 | +#endif | ||
702 | + ; | ||
703 | int _EXFUN(_stat,( const char *__path, struct stat *__sbuf )); | ||
704 | #ifdef __LARGE64_FILES | ||
705 | struct stat64; | ||
706 | --- ./newlib/libc/include/_syslist.h.orig 2008-08-07 16:24:19.122605000 +0100 | ||
707 | +++ ./newlib/libc/include/_syslist.h 2008-08-07 16:24:21.548628000 +0100 | ||
708 | @@ -14,6 +14,7 @@ | ||
709 | #define _kill kill | ||
710 | #define _link link | ||
711 | #define _lseek lseek | ||
712 | +#define _lseek64 lseek64 | ||
713 | #define _open open | ||
714 | #define _read read | ||
715 | #define _sbrk sbrk | ||
716 | --- a/newlib/libc/include/reent.h.orig 2008-08-07 16:28:49.846502000 +0100 | ||
717 | +++ b/newlib/libc/include/reent.h 2008-08-07 16:29:02.096586000 +0100 | ||
718 | @@ -87,6 +87,9 @@ | ||
719 | #if defined(__CYGWIN__) && defined(_COMPILING_NEWLIB) | ||
720 | #define stat64 __stat64 | ||
721 | #endif | ||
722 | +#if defined(__MINIOS__) | ||
723 | +#define stat64 stat | ||
724 | +#endif | ||
725 | |||
726 | struct stat64; | ||
727 | |||
diff --git a/recipes-extended/xen/files/polarssl.patch b/recipes-extended/xen/files/polarssl.patch deleted file mode 100644 index 95487308..00000000 --- a/recipes-extended/xen/files/polarssl.patch +++ /dev/null | |||
@@ -1,64 +0,0 @@ | |||
1 | diff -Naur polarssl-1.1.4/include/polarssl/config.h polarssl-x86_64/include/polarssl/config.h | ||
2 | --- a/include/polarssl/config.h 2011-12-22 05:06:27.000000000 -0500 | ||
3 | +++ b/include/polarssl/config.h 2012-10-30 17:18:07.567001000 -0400 | ||
4 | @@ -164,8 +164,8 @@ | ||
5 | * application. | ||
6 | * | ||
7 | * Uncomment this macro to prevent loading of default entropy functions. | ||
8 | -#define POLARSSL_NO_DEFAULT_ENTROPY_SOURCES | ||
9 | */ | ||
10 | +#define POLARSSL_NO_DEFAULT_ENTROPY_SOURCES | ||
11 | |||
12 | /** | ||
13 | * \def POLARSSL_NO_PLATFORM_ENTROPY | ||
14 | @@ -175,8 +175,8 @@ | ||
15 | * standards like the /dev/urandom or Windows CryptoAPI. | ||
16 | * | ||
17 | * Uncomment this macro to disable the built-in platform entropy functions. | ||
18 | -#define POLARSSL_NO_PLATFORM_ENTROPY | ||
19 | */ | ||
20 | +#define POLARSSL_NO_PLATFORM_ENTROPY | ||
21 | |||
22 | /** | ||
23 | * \def POLARSSL_PKCS1_V21 | ||
24 | @@ -426,8 +426,8 @@ | ||
25 | * Requires: POLARSSL_TIMING_C | ||
26 | * | ||
27 | * This module enables the HAVEGE random number generator. | ||
28 | - */ | ||
29 | #define POLARSSL_HAVEGE_C | ||
30 | + */ | ||
31 | |||
32 | /** | ||
33 | * \def POLARSSL_MD_C | ||
34 | @@ -490,7 +490,7 @@ | ||
35 | * | ||
36 | * This module provides TCP/IP networking routines. | ||
37 | */ | ||
38 | -#define POLARSSL_NET_C | ||
39 | +//#define POLARSSL_NET_C | ||
40 | |||
41 | /** | ||
42 | * \def POLARSSL_PADLOCK_C | ||
43 | @@ -644,8 +644,8 @@ | ||
44 | * Caller: library/havege.c | ||
45 | * | ||
46 | * This module is used by the HAVEGE random number generator. | ||
47 | - */ | ||
48 | #define POLARSSL_TIMING_C | ||
49 | + */ | ||
50 | |||
51 | /** | ||
52 | * \def POLARSSL_VERSION_C | ||
53 | diff -Naur polarssl-1.1.4/library/bignum.c polarssl-x86_64/library/bignum.c | ||
54 | --- a/library/bignum.c 2012-04-29 16:15:55.000000000 -0400 | ||
55 | +++ b/library/bignum.c 2012-10-30 17:21:52.135000999 -0400 | ||
56 | @@ -1101,7 +1101,7 @@ | ||
57 | Z.p[i - t - 1] = ~0; | ||
58 | else | ||
59 | { | ||
60 | -#if defined(POLARSSL_HAVE_LONGLONG) | ||
61 | +#if 0 //defined(POLARSSL_HAVE_LONGLONG) | ||
62 | t_udbl r; | ||
63 | |||
64 | r = (t_udbl) X.p[i] << biL; | ||
diff --git a/recipes-extended/xen/files/tpmemu-0.7.4.patch b/recipes-extended/xen/files/tpmemu-0.7.4.patch deleted file mode 100644 index 622b34f5..00000000 --- a/recipes-extended/xen/files/tpmemu-0.7.4.patch +++ /dev/null | |||
@@ -1,12 +0,0 @@ | |||
1 | diff -Naur tpm_emulator-x86_64-back/tpm/tpm_emulator_extern.c tpm_emulator-x86_64/tpm/tpm_emulator_extern.c | ||
2 | --- a/tpm/tpm_emulator_extern.c 2012-04-27 10:55:46.581963398 -0400 | ||
3 | +++ b/tpm/tpm_emulator_extern.c 2012-04-27 10:56:02.193034152 -0400 | ||
4 | @@ -249,7 +249,7 @@ | ||
5 | #else /* TPM_NO_EXTERN */ | ||
6 | |||
7 | int (*tpm_extern_init)(void) = NULL; | ||
8 | -int (*tpm_extern_release)(void) = NULL; | ||
9 | +void (*tpm_extern_release)(void) = NULL; | ||
10 | void* (*tpm_malloc)(size_t size) = NULL; | ||
11 | void (*tpm_free)(/*const*/ void *ptr) = NULL; | ||
12 | void (*tpm_log)(int priority, const char *fmt, ...) = NULL; | ||
diff --git a/recipes-extended/xen/files/vtpm-bufsize.patch b/recipes-extended/xen/files/vtpm-bufsize.patch deleted file mode 100644 index 9c9304cf..00000000 --- a/recipes-extended/xen/files/vtpm-bufsize.patch +++ /dev/null | |||
@@ -1,13 +0,0 @@ | |||
1 | diff --git a/config.h.in b/config.h.in | ||
2 | index d16a997..8088a2a 100644 | ||
3 | --- a/config.h.in | ||
4 | +++ b/config.h.in | ||
5 | @@ -27,7 +27,7 @@ | ||
6 | #define TPM_STORAGE_NAME "${TPM_STORAGE_NAME}" | ||
7 | #define TPM_DEVICE_NAME "${TPM_DEVICE_NAME}" | ||
8 | #define TPM_LOG_FILE "${TPM_LOG_FILE}" | ||
9 | -#define TPM_CMD_BUF_SIZE 4096 | ||
10 | +#define TPM_CMD_BUF_SIZE 4088 | ||
11 | |||
12 | #endif /* _CONFIG_H_ */ | ||
13 | |||
diff --git a/recipes-extended/xen/files/vtpm-cmake-Wextra.patch b/recipes-extended/xen/files/vtpm-cmake-Wextra.patch deleted file mode 100644 index 5fee4e9a..00000000 --- a/recipes-extended/xen/files/vtpm-cmake-Wextra.patch +++ /dev/null | |||
@@ -1,21 +0,0 @@ | |||
1 | --- | ||
2 | CMakeLists.txt | 3 ++- | ||
3 | 1 file changed, 2 insertions(+), 1 deletion(-) | ||
4 | |||
5 | Index: tpm_emulator-x86_64/CMakeLists.txt | ||
6 | =================================================================== | ||
7 | --- a/CMakeLists.txt | ||
8 | +++ b/CMakeLists.txt | ||
9 | @@ -40,10 +40,11 @@ set(TPM_STORAGE_NAME "/var/lib/tpm/tpm_e | ||
10 | set(TPM_DEVICE_NAME "/dev/tpm") | ||
11 | endif() | ||
12 | configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h) | ||
13 | -add_definitions(-Wall -Werror -Wno-unused-parameter -Wpointer-arith -Wcast-align -Wwrite-strings) | ||
14 | +add_definitions(-Wall -Werror) | ||
15 | if("${CMAKE_SYSTEM}" MATCHES "Linux") | ||
16 | add_definitions(-Wextra) | ||
17 | endif() | ||
18 | +add_definitions(-Wno-unused-parameter -Wpointer-arith -Wcast-align -Wwrite-strings) | ||
19 | if(USE_OPENSSL) | ||
20 | add_definitions(-DUSE_OPENSSL) | ||
21 | endif() | ||
diff --git a/recipes-extended/xen/files/vtpm-deepquote-anyloc.patch b/recipes-extended/xen/files/vtpm-deepquote-anyloc.patch deleted file mode 100644 index b1cbf66e..00000000 --- a/recipes-extended/xen/files/vtpm-deepquote-anyloc.patch +++ /dev/null | |||
@@ -1,127 +0,0 @@ | |||
1 | diff --git a/tpm/tpm_cmd_handler.c b/tpm/tpm_cmd_handler.c | ||
2 | index 69511d1..7545d51 100644 | ||
3 | --- a/tpm/tpm_cmd_handler.c | ||
4 | +++ b/tpm/tpm_cmd_handler.c | ||
5 | @@ -3347,12 +3347,13 @@ static TPM_RESULT execute_TPM_DeepQuote(TPM_REQUEST *req, TPM_RESPONSE *rsp) | ||
6 | { | ||
7 | TPM_NONCE nonce; | ||
8 | TPM_RESULT res; | ||
9 | - UINT32 sigSize; | ||
10 | - BYTE *sig; | ||
11 | + UINT32 quote_blob_size; | ||
12 | + BYTE *quote_blob; | ||
13 | BYTE *ptr; | ||
14 | UINT32 len; | ||
15 | TPM_PCR_SELECTION myPCR; | ||
16 | TPM_PCR_SELECTION ptPCR; | ||
17 | + UINT32 extraInfoFlags = 0; | ||
18 | |||
19 | tpm_compute_in_param_digest(req); | ||
20 | |||
21 | @@ -3361,17 +3362,19 @@ static TPM_RESULT execute_TPM_DeepQuote(TPM_REQUEST *req, TPM_RESPONSE *rsp) | ||
22 | if (tpm_unmarshal_TPM_NONCE(&ptr, &len, &nonce) | ||
23 | || tpm_unmarshal_TPM_PCR_SELECTION(&ptr, &len, &myPCR) | ||
24 | || tpm_unmarshal_TPM_PCR_SELECTION(&ptr, &len, &ptPCR) | ||
25 | + || tpm_unmarshal_TPM_DEEP_QUOTE_INFO(&ptr, &len, &extraInfoFlags) | ||
26 | || len != 0) return TPM_BAD_PARAMETER; | ||
27 | |||
28 | - res = TPM_DeepQuote(&nonce, &myPCR, &ptPCR, &req->auth1, &sigSize, &sig); | ||
29 | + res = TPM_DeepQuote(&nonce, &myPCR, &ptPCR, &req->auth1, extraInfoFlags, | ||
30 | + "e_blob_size, "e_blob); | ||
31 | if (res != TPM_SUCCESS) return res; | ||
32 | - rsp->paramSize = len = sigSize; | ||
33 | + rsp->paramSize = len = quote_blob_size; | ||
34 | rsp->param = ptr = tpm_malloc(len); | ||
35 | - if (ptr == NULL || tpm_marshal_BLOB(&ptr, &len, sig, sigSize)) { | ||
36 | + if (ptr == NULL || tpm_marshal_BLOB(&ptr, &len, quote_blob, quote_blob_size)) { | ||
37 | tpm_free(rsp->param); | ||
38 | res = TPM_FAIL; | ||
39 | } | ||
40 | - tpm_free(sig); | ||
41 | + tpm_free(quote_blob); | ||
42 | |||
43 | return res; | ||
44 | } | ||
45 | diff --git a/tpm/tpm_commands.h b/tpm/tpm_commands.h | ||
46 | index 328d1be..a56dd5f 100644 | ||
47 | --- a/tpm/tpm_commands.h | ||
48 | +++ b/tpm/tpm_commands.h | ||
49 | @@ -3077,6 +3077,7 @@ TPM_RESULT TPM_ParentSignEK( | ||
50 | * @myPCR: [in] PCR selection for the virtual TPM | ||
51 | * @ptPCR: [in] PCR selection for the hardware TPM | ||
52 | * @auth1: [in, out] Authorization protocol parameters | ||
53 | + * @extraInfoFlags [in] Flags for including, kernel hash, group info, etc | ||
54 | * @sigSize: [out] The length of the returned digital signature | ||
55 | * @sig: [out] The resulting digital signature and PCR values | ||
56 | * Returns: TPM_SUCCESS on success, a TPM error code otherwise. | ||
57 | @@ -3086,6 +3087,7 @@ TPM_RESULT TPM_DeepQuote( | ||
58 | TPM_PCR_SELECTION *myPCR, | ||
59 | TPM_PCR_SELECTION *ptPCR, | ||
60 | TPM_AUTH *auth1, | ||
61 | + UINT32 extraInfoFlags, | ||
62 | UINT32 *sigSize, | ||
63 | BYTE **sig | ||
64 | ); | ||
65 | diff --git a/tpm/tpm_credentials.c b/tpm/tpm_credentials.c | ||
66 | index c0d62e7..6586c22 100644 | ||
67 | --- a/tpm/tpm_credentials.c | ||
68 | +++ b/tpm/tpm_credentials.c | ||
69 | @@ -183,7 +183,8 @@ TPM_RESULT TPM_OwnerReadInternalPub(TPM_KEY_HANDLE keyHandle, TPM_AUTH *auth1, | ||
70 | |||
71 | int endorsementKeyFresh = 0; | ||
72 | |||
73 | -TPM_RESULT VTPM_GetParentQuote(TPM_DIGEST* data, TPM_PCR_SELECTION *sel, UINT32 *sigSize, BYTE **sig); | ||
74 | +TPM_RESULT VTPM_GetParentQuote(TPM_NONCE *data, TPM_PCR_SELECTION *sel, | ||
75 | + UINT32 extraInfoFlags, UINT32 *sigSize, BYTE **sig); | ||
76 | |||
77 | TPM_RESULT TPM_ParentSignEK(TPM_NONCE *externalData, TPM_PCR_SELECTION *sel, | ||
78 | TPM_AUTH *auth1, UINT32 *sigSize, BYTE **sig) | ||
79 | @@ -191,7 +192,7 @@ TPM_RESULT TPM_ParentSignEK(TPM_NONCE *externalData, TPM_PCR_SELECTION *sel, | ||
80 | TPM_PUBKEY pubKey; | ||
81 | TPM_RESULT res; | ||
82 | TPM_DIGEST hres; | ||
83 | - | ||
84 | + UINT32 extraInfoFlags = 0; | ||
85 | info("TPM_ParentSignEK()"); | ||
86 | |||
87 | res = tpm_verify_auth(auth1, tpmData.permanent.data.ownerAuth, TPM_KH_OWNER); | ||
88 | @@ -206,7 +207,7 @@ TPM_RESULT TPM_ParentSignEK(TPM_NONCE *externalData, TPM_PCR_SELECTION *sel, | ||
89 | res = TPM_FAIL; | ||
90 | |||
91 | if (res == TPM_SUCCESS) | ||
92 | - res = VTPM_GetParentQuote(&hres, sel, sigSize, sig); | ||
93 | + res = VTPM_GetParentQuote((TPM_NONCE*)&hres, sel, extraInfoFlags, sigSize, sig); | ||
94 | |||
95 | free_TPM_PUBKEY(pubKey); | ||
96 | return res; | ||
97 | @@ -218,7 +219,7 @@ static const BYTE dquot_hdr[] = { | ||
98 | |||
99 | TPM_RESULT TPM_DeepQuote(TPM_NONCE *externalData, TPM_PCR_SELECTION *myPCR, | ||
100 | TPM_PCR_SELECTION *ptPCR, TPM_AUTH *auth1, | ||
101 | - UINT32 *sigSize, BYTE **sig) | ||
102 | + UINT32 extraInfoFlags, UINT32 *quote_blob_size, BYTE **quote_blob) | ||
103 | { | ||
104 | TPM_RESULT res; | ||
105 | TPM_DIGEST hres; | ||
106 | @@ -253,7 +254,7 @@ TPM_RESULT TPM_DeepQuote(TPM_NONCE *externalData, TPM_PCR_SELECTION *myPCR, | ||
107 | |||
108 | tpm_free(buf); | ||
109 | |||
110 | - res = VTPM_GetParentQuote(&hres, ptPCR, sigSize, sig); | ||
111 | + res = VTPM_GetParentQuote((TPM_NONCE*)&hres, ptPCR, extraInfoFlags, quote_blob_size, quote_blob); | ||
112 | |||
113 | return res; | ||
114 | } | ||
115 | diff --git a/tpm/tpm_marshalling.h b/tpm/tpm_marshalling.h | ||
116 | index d510ebe..2e0c008 100644 | ||
117 | --- a/tpm/tpm_marshalling.h | ||
118 | +++ b/tpm/tpm_marshalling.h | ||
119 | @@ -268,6 +268,8 @@ static inline int tpm_unmarshal_BOOL(BYTE **ptr, UINT32 *length, BOOL *v) | ||
120 | #define tpm_unmarshal_TPM_REDIR_COMMAND tpm_unmarshal_UINT32 | ||
121 | #define tpm_marshal_DAAHANDLE tpm_marshal_UINT32 | ||
122 | #define tpm_unmarshal_DAAHANDLE tpm_unmarshal_UINT32 | ||
123 | +#define tpm_marshal_TPM_DEEP_QUOTE_INFO tpm_marshal_UINT32 | ||
124 | +#define tpm_unmarshal_TPM_DEEP_QUOTE_INFO tpm_unmarshal_UINT32 | ||
125 | |||
126 | int tpm_marshal_UINT32_ARRAY(BYTE **ptr, UINT32 *length, UINT32 *v, UINT32 n); | ||
127 | int tpm_unmarshal_UINT32_ARRAY(BYTE **ptr, UINT32 *length, UINT32 *v, UINT32 n); | ||
diff --git a/recipes-extended/xen/files/vtpm-deepquote.patch b/recipes-extended/xen/files/vtpm-deepquote.patch deleted file mode 100644 index 6344f387..00000000 --- a/recipes-extended/xen/files/vtpm-deepquote.patch +++ /dev/null | |||
@@ -1,187 +0,0 @@ | |||
1 | diff --git a/tpm/tpm_cmd_handler.c b/tpm/tpm_cmd_handler.c | ||
2 | index 0fabf98..69511d1 100644 | ||
3 | --- a/tpm/tpm_cmd_handler.c | ||
4 | +++ b/tpm/tpm_cmd_handler.c | ||
5 | @@ -3343,6 +3343,39 @@ static TPM_RESULT execute_TPM_ParentSignEK(TPM_REQUEST *req, TPM_RESPONSE *rsp) | ||
6 | return res; | ||
7 | } | ||
8 | |||
9 | +static TPM_RESULT execute_TPM_DeepQuote(TPM_REQUEST *req, TPM_RESPONSE *rsp) | ||
10 | +{ | ||
11 | + TPM_NONCE nonce; | ||
12 | + TPM_RESULT res; | ||
13 | + UINT32 sigSize; | ||
14 | + BYTE *sig; | ||
15 | + BYTE *ptr; | ||
16 | + UINT32 len; | ||
17 | + TPM_PCR_SELECTION myPCR; | ||
18 | + TPM_PCR_SELECTION ptPCR; | ||
19 | + | ||
20 | + tpm_compute_in_param_digest(req); | ||
21 | + | ||
22 | + ptr = req->param; | ||
23 | + len = req->paramSize; | ||
24 | + if (tpm_unmarshal_TPM_NONCE(&ptr, &len, &nonce) | ||
25 | + || tpm_unmarshal_TPM_PCR_SELECTION(&ptr, &len, &myPCR) | ||
26 | + || tpm_unmarshal_TPM_PCR_SELECTION(&ptr, &len, &ptPCR) | ||
27 | + || len != 0) return TPM_BAD_PARAMETER; | ||
28 | + | ||
29 | + res = TPM_DeepQuote(&nonce, &myPCR, &ptPCR, &req->auth1, &sigSize, &sig); | ||
30 | + if (res != TPM_SUCCESS) return res; | ||
31 | + rsp->paramSize = len = sigSize; | ||
32 | + rsp->param = ptr = tpm_malloc(len); | ||
33 | + if (ptr == NULL || tpm_marshal_BLOB(&ptr, &len, sig, sigSize)) { | ||
34 | + tpm_free(rsp->param); | ||
35 | + res = TPM_FAIL; | ||
36 | + } | ||
37 | + tpm_free(sig); | ||
38 | + | ||
39 | + return res; | ||
40 | +} | ||
41 | + | ||
42 | static void tpm_setup_rsp_auth(TPM_COMMAND_CODE ordinal, TPM_RESPONSE *rsp) | ||
43 | { | ||
44 | tpm_hmac_ctx_t hmac; | ||
45 | @@ -4098,6 +4131,11 @@ void tpm_execute_command(TPM_REQUEST *req, TPM_RESPONSE *rsp) | ||
46 | res = execute_TPM_ParentSignEK(req, rsp); | ||
47 | break; | ||
48 | |||
49 | + case TPM_ORD_DeepQuote: | ||
50 | + debug("[TPM_ORD_DeepQuote]"); | ||
51 | + res = execute_TPM_DeepQuote(req, rsp); | ||
52 | + break; | ||
53 | + | ||
54 | default: | ||
55 | #ifdef MTM_EMULATOR | ||
56 | res = mtm_execute_command(req, rsp); | ||
57 | diff --git a/tpm/tpm_commands.h b/tpm/tpm_commands.h | ||
58 | index 7fef934..328d1be 100644 | ||
59 | --- a/tpm/tpm_commands.h | ||
60 | +++ b/tpm/tpm_commands.h | ||
61 | @@ -3071,6 +3071,25 @@ TPM_RESULT TPM_ParentSignEK( | ||
62 | BYTE **sig | ||
63 | ); | ||
64 | |||
65 | +/** | ||
66 | + * TPM_DeepQuote - gets a hardware TPM quote of a vTPM's PCRs | ||
67 | + * @externalData: [in] AntiReplay nonce to prevent replay of messages | ||
68 | + * @myPCR: [in] PCR selection for the virtual TPM | ||
69 | + * @ptPCR: [in] PCR selection for the hardware TPM | ||
70 | + * @auth1: [in, out] Authorization protocol parameters | ||
71 | + * @sigSize: [out] The length of the returned digital signature | ||
72 | + * @sig: [out] The resulting digital signature and PCR values | ||
73 | + * Returns: TPM_SUCCESS on success, a TPM error code otherwise. | ||
74 | + */ | ||
75 | +TPM_RESULT TPM_DeepQuote( | ||
76 | + TPM_NONCE *externalData, | ||
77 | + TPM_PCR_SELECTION *myPCR, | ||
78 | + TPM_PCR_SELECTION *ptPCR, | ||
79 | + TPM_AUTH *auth1, | ||
80 | + UINT32 *sigSize, | ||
81 | + BYTE **sig | ||
82 | +); | ||
83 | + | ||
84 | /* | ||
85 | * Error handling | ||
86 | * [tpm_error.c] | ||
87 | diff --git a/tpm/tpm_credentials.c b/tpm/tpm_credentials.c | ||
88 | index 01f29e6..c0d62e7 100644 | ||
89 | --- a/tpm/tpm_credentials.c | ||
90 | +++ b/tpm/tpm_credentials.c | ||
91 | @@ -211,3 +211,49 @@ TPM_RESULT TPM_ParentSignEK(TPM_NONCE *externalData, TPM_PCR_SELECTION *sel, | ||
92 | free_TPM_PUBKEY(pubKey); | ||
93 | return res; | ||
94 | } | ||
95 | + | ||
96 | +static const BYTE dquot_hdr[] = { | ||
97 | + 0, 0, 0, 0, 'D', 'Q', 'U', 'T' | ||
98 | +}; | ||
99 | + | ||
100 | +TPM_RESULT TPM_DeepQuote(TPM_NONCE *externalData, TPM_PCR_SELECTION *myPCR, | ||
101 | + TPM_PCR_SELECTION *ptPCR, TPM_AUTH *auth1, | ||
102 | + UINT32 *sigSize, BYTE **sig) | ||
103 | +{ | ||
104 | + TPM_RESULT res; | ||
105 | + TPM_DIGEST hres; | ||
106 | + TPM_PCR_INFO_SHORT pcrData; | ||
107 | + tpm_sha1_ctx_t ctx; | ||
108 | + BYTE *buf, *ptr; | ||
109 | + UINT32 size, len; | ||
110 | + | ||
111 | + info("TPM_DeepQuote()"); | ||
112 | + | ||
113 | + res = tpm_verify_auth(auth1, tpmData.permanent.data.ownerAuth, TPM_KH_OWNER); | ||
114 | + if (res != TPM_SUCCESS) return res; | ||
115 | + | ||
116 | + res = tpm_compute_pcr_digest(myPCR, &pcrData.digestAtRelease, NULL); | ||
117 | + if (res != TPM_SUCCESS) return res; | ||
118 | + | ||
119 | + pcrData.pcrSelection.sizeOfSelect = myPCR->sizeOfSelect; | ||
120 | + memcpy(pcrData.pcrSelection.pcrSelect, myPCR->pcrSelect, myPCR->sizeOfSelect); | ||
121 | + pcrData.localityAtRelease = 1 << tpmData.stany.flags.localityModifier; | ||
122 | + | ||
123 | + size = len = sizeof_TPM_PCR_INFO_SHORT(pcrData); | ||
124 | + buf = ptr = tpm_malloc(size); | ||
125 | + if (buf == NULL) return TPM_NOSPACE; | ||
126 | + if (tpm_marshal_TPM_PCR_INFO_SHORT(&ptr, &len, &pcrData)) | ||
127 | + return TPM_FAIL; | ||
128 | + | ||
129 | + tpm_sha1_init(&ctx); | ||
130 | + tpm_sha1_update(&ctx, dquot_hdr, 8); | ||
131 | + tpm_sha1_update(&ctx, externalData->nonce, 20); | ||
132 | + tpm_sha1_update(&ctx, buf, size); | ||
133 | + tpm_sha1_final(&ctx, hres.digest); | ||
134 | + | ||
135 | + tpm_free(buf); | ||
136 | + | ||
137 | + res = VTPM_GetParentQuote(&hres, ptPCR, sigSize, sig); | ||
138 | + | ||
139 | + return res; | ||
140 | +} | ||
141 | diff --git a/tpm/tpm_structures.h b/tpm/tpm_structures.h | ||
142 | index b0f4625..dfb1894 100644 | ||
143 | --- a/tpm/tpm_structures.h | ||
144 | +++ b/tpm/tpm_structures.h | ||
145 | @@ -660,6 +660,42 @@ typedef struct tdTPM_CMK_MA_APPROVAL { | ||
146 | |||
147 | /* VTPM-only commands: */ | ||
148 | /* | ||
149 | + * Deep Quote - Create quote of PCRs | ||
150 | + * Input: | ||
151 | + * TPM_TAG tag TPM_TAG_RQU_AUTH1_COMMAND | ||
152 | + * UINT32 paramSize Total size of request | ||
153 | + * TPM_COMMAND_CODE ordinal TPM_ORD_DeepQuote | ||
154 | + * TPM_NONCE externData 20 bytes of external data | ||
155 | + * TPM_PCR_SELECTION vtSel PCR selection for virtual TPM | ||
156 | + * TPM_PCR_SELECTION ptSel PCR selection for physical TPM | ||
157 | + * --- | ||
158 | + * UINT32 authHandle Owner authorization session (OIAP) | ||
159 | + * TPM_NONCE nonceOdd Nonce for authHandle | ||
160 | + * BOOL continueAuth Continue flag for authHandle | ||
161 | + * TPM_AUTHDATA privAuth Authorization digest for command | ||
162 | + * | ||
163 | + * Output: | ||
164 | + * TPM_TAG tag TPM_TAG_RSP_AUTH1_COMMAND | ||
165 | + * UINT32 paramSize Total size of response | ||
166 | + * TPM_RESULT returnCode Return code of the operation | ||
167 | + * BYTE[] sig Signature provided by physical TPM | ||
168 | + * TPM_PCRVALUE[] pcrValue Values of hardware PCRs used in the quote | ||
169 | + * --- | ||
170 | + * TPM_NONCE nonceEven Nonce for authHandle | ||
171 | + * BOOL continueAuth Continue flag for authHandle | ||
172 | + * TPM_AUTHDATA resAuth Authorization digest for response | ||
173 | + * | ||
174 | + * The values of the virutal TPM's PCRs are not included in the response. | ||
175 | + * The signature is a standard TPM_Quote response from the physical TPM; its | ||
176 | + * externalData is the SHA1 hash of the following structure: | ||
177 | + * TPM_STRUCT_VER version MUST be 0.0.0.0 | ||
178 | + * BYTE[4] fixed MUST be the string "DQUT" | ||
179 | + * TPM_NONCE externData From input to the deep quote | ||
180 | + * TPM_PCR_INFO_SHORT pcrData Virtual TPM's PCRs | ||
181 | + */ | ||
182 | +#define TPM_ORD_DeepQuote (TPM_VENDOR_COMMAND | TPM_ORD_Quote) | ||
183 | + | ||
184 | +/* | ||
185 | * ParentSignEK - Proof of fresh provisioning and EK value | ||
186 | * | ||
187 | * Input: | ||
diff --git a/recipes-extended/xen/files/vtpm-implicit-fallthrough.patch b/recipes-extended/xen/files/vtpm-implicit-fallthrough.patch deleted file mode 100644 index e95d41fc..00000000 --- a/recipes-extended/xen/files/vtpm-implicit-fallthrough.patch +++ /dev/null | |||
@@ -1,10 +0,0 @@ | |||
1 | --- a/tpm/tpm_cmd_handler.c.orig 2017-04-27 13:37:14.408000000 +0200 | ||
2 | +++ b/tpm/tpm_cmd_handler.c 2017-04-27 13:39:53.585000000 +0200 | ||
3 | @@ -3397,6 +3397,7 @@ | ||
4 | sizeof(rsp->auth2->nonceOdd.nonce)); | ||
5 | tpm_hmac_update(&hmac, (BYTE*)&rsp->auth2->continueAuthSession, 1); | ||
6 | tpm_hmac_final(&hmac, rsp->auth2->auth); | ||
7 | + /* fall-thru */ | ||
8 | case TPM_TAG_RSP_AUTH1_COMMAND: | ||
9 | tpm_hmac_init(&hmac, rsp->auth1->secret, sizeof(rsp->auth1->secret)); | ||
10 | tpm_hmac_update(&hmac, rsp->auth1->digest, sizeof(rsp->auth1->digest)); | ||
diff --git a/recipes-extended/xen/files/vtpm-locality.patch b/recipes-extended/xen/files/vtpm-locality.patch deleted file mode 100644 index 8ab7dea6..00000000 --- a/recipes-extended/xen/files/vtpm-locality.patch +++ /dev/null | |||
@@ -1,50 +0,0 @@ | |||
1 | diff --git a/tpm/tpm_capability.c b/tpm/tpm_capability.c | ||
2 | index 60bbb90..f8f7f0f 100644 | ||
3 | --- a/tpm/tpm_capability.c | ||
4 | +++ b/tpm/tpm_capability.c | ||
5 | @@ -949,6 +949,8 @@ static TPM_RESULT set_vendor(UINT32 subCap, BYTE *setValue, | ||
6 | UINT32 setValueSize, BOOL ownerAuth, | ||
7 | BOOL deactivated, BOOL disabled) | ||
8 | { | ||
9 | + if (tpmData.stany.flags.localityModifier != 8) | ||
10 | + return TPM_BAD_PARAMETER; | ||
11 | /* set the capability area with the specified data, on failure | ||
12 | deactivate the TPM */ | ||
13 | switch (subCap) { | ||
14 | diff --git a/tpm/tpm_cmd_handler.c b/tpm/tpm_cmd_handler.c | ||
15 | index 288d1ce..9e1cfb4 100644 | ||
16 | --- a/tpm/tpm_cmd_handler.c | ||
17 | +++ b/tpm/tpm_cmd_handler.c | ||
18 | @@ -4132,7 +4132,7 @@ void tpm_emulator_shutdown() | ||
19 | tpm_extern_release(); | ||
20 | } | ||
21 | |||
22 | -int tpm_handle_command(const uint8_t *in, uint32_t in_size, uint8_t **out, uint32_t *out_size) | ||
23 | +int tpm_handle_command(const uint8_t *in, uint32_t in_size, uint8_t **out, uint32_t *out_size, int locality) | ||
24 | { | ||
25 | TPM_REQUEST req; | ||
26 | TPM_RESPONSE rsp; | ||
27 | @@ -4140,7 +4140,9 @@ int tpm_handle_command(const uint8_t *in, uint32_t in_size, uint8_t **out, uint3 | ||
28 | UINT32 len; | ||
29 | BOOL free_out; | ||
30 | |||
31 | - debug("tpm_handle_command()"); | ||
32 | + debug("tpm_handle_command(%d)", locality); | ||
33 | + if (locality != -1) | ||
34 | + tpmData.stany.flags.localityModifier = locality; | ||
35 | |||
36 | /* we need the whole packet at once, otherwise unmarshalling will fail */ | ||
37 | if (tpm_unmarshal_TPM_REQUEST((uint8_t**)&in, &in_size, &req) != 0) { | ||
38 | diff --git a/tpm/tpm_emulator.h b/tpm/tpm_emulator.h | ||
39 | index eed749e..4c228bd 100644 | ||
40 | --- a/tpm/tpm_emulator.h | ||
41 | +++ b/tpm/tpm_emulator.h | ||
42 | @@ -59,7 +59,7 @@ void tpm_emulator_shutdown(void); | ||
43 | * its usage. In case of an error, all internally allocated memory | ||
44 | * is released and the the state of out and out_size is unspecified. | ||
45 | */ | ||
46 | -int tpm_handle_command(const uint8_t *in, uint32_t in_size, uint8_t **out, uint32_t *out_size); | ||
47 | +int tpm_handle_command(const uint8_t *in, uint32_t in_size, uint8_t **out, uint32_t *out_size, int locality); | ||
48 | |||
49 | #endif /* _TPM_EMULATOR_H_ */ | ||
50 | |||
diff --git a/recipes-extended/xen/files/vtpm-parent-sign-ek.patch b/recipes-extended/xen/files/vtpm-parent-sign-ek.patch deleted file mode 100644 index 14e66eee..00000000 --- a/recipes-extended/xen/files/vtpm-parent-sign-ek.patch +++ /dev/null | |||
@@ -1,196 +0,0 @@ | |||
1 | diff --git a/tpm/tpm_cmd_handler.c b/tpm/tpm_cmd_handler.c | ||
2 | index 9e1cfb4..0fabf98 100644 | ||
3 | --- a/tpm/tpm_cmd_handler.c | ||
4 | +++ b/tpm/tpm_cmd_handler.c | ||
5 | @@ -3312,6 +3312,37 @@ static TPM_RESULT execute_TPM_OwnerReadPubek(TPM_REQUEST *req, TPM_RESPONSE *rsp | ||
6 | return res; | ||
7 | } | ||
8 | |||
9 | +static TPM_RESULT execute_TPM_ParentSignEK(TPM_REQUEST *req, TPM_RESPONSE *rsp) | ||
10 | +{ | ||
11 | + TPM_NONCE nonce; | ||
12 | + TPM_RESULT res; | ||
13 | + UINT32 sigSize; | ||
14 | + BYTE *sig; | ||
15 | + BYTE *ptr; | ||
16 | + UINT32 len; | ||
17 | + TPM_PCR_SELECTION targetPCR; | ||
18 | + | ||
19 | + tpm_compute_in_param_digest(req); | ||
20 | + | ||
21 | + ptr = req->param; | ||
22 | + len = req->paramSize; | ||
23 | + if (tpm_unmarshal_TPM_NONCE(&ptr, &len, &nonce) | ||
24 | + || tpm_unmarshal_TPM_PCR_SELECTION(&ptr, &len, &targetPCR) | ||
25 | + || len != 0) return TPM_BAD_PARAMETER; | ||
26 | + | ||
27 | + res = TPM_ParentSignEK(&nonce, &targetPCR, &req->auth1, &sigSize, &sig); | ||
28 | + if (res != TPM_SUCCESS) return res; | ||
29 | + rsp->paramSize = len = sigSize; | ||
30 | + rsp->param = ptr = tpm_malloc(len); | ||
31 | + if (ptr == NULL || tpm_marshal_BLOB(&ptr, &len, sig, sigSize)) { | ||
32 | + tpm_free(rsp->param); | ||
33 | + res = TPM_FAIL; | ||
34 | + } | ||
35 | + tpm_free(sig); | ||
36 | + | ||
37 | + return res; | ||
38 | +} | ||
39 | + | ||
40 | static void tpm_setup_rsp_auth(TPM_COMMAND_CODE ordinal, TPM_RESPONSE *rsp) | ||
41 | { | ||
42 | tpm_hmac_ctx_t hmac; | ||
43 | @@ -4062,6 +4093,11 @@ void tpm_execute_command(TPM_REQUEST *req, TPM_RESPONSE *rsp) | ||
44 | res = execute_TPM_OwnerReadPubek(req, rsp); | ||
45 | break; | ||
46 | |||
47 | + case TPM_ORD_ParentSignEK: | ||
48 | + debug("[TPM_ORD_ParentSignEK]"); | ||
49 | + res = execute_TPM_ParentSignEK(req, rsp); | ||
50 | + break; | ||
51 | + | ||
52 | default: | ||
53 | #ifdef MTM_EMULATOR | ||
54 | res = mtm_execute_command(req, rsp); | ||
55 | diff --git a/tpm/tpm_commands.h b/tpm/tpm_commands.h | ||
56 | index a7666f6..7fef934 100644 | ||
57 | --- a/tpm/tpm_commands.h | ||
58 | +++ b/tpm/tpm_commands.h | ||
59 | @@ -3054,6 +3054,23 @@ TPM_RESULT TPM_OwnerReadPubek( | ||
60 | TPM_PUBKEY *pubEndorsementKey | ||
61 | ); | ||
62 | |||
63 | +/** | ||
64 | + * TPM_ParentSignEK - gets a hardware TPM quote of a vTPM's EK | ||
65 | + * @externalData: [in] AntiReplay nonce to prevent replay of messages | ||
66 | + * @sel: [in] PCR selection for the hardware TPM's quote | ||
67 | + * @auth1: [in, out] Authorization protocol parameters | ||
68 | + * @sigSize: [out] The length of the returned digital signature | ||
69 | + * @sig: [out] The resulting digital signature and PCR values | ||
70 | + * Returns: TPM_SUCCESS on success, a TPM error code otherwise. | ||
71 | + */ | ||
72 | +TPM_RESULT TPM_ParentSignEK( | ||
73 | + TPM_NONCE *externalData, | ||
74 | + TPM_PCR_SELECTION *sel, | ||
75 | + TPM_AUTH *auth1, | ||
76 | + UINT32 *sigSize, | ||
77 | + BYTE **sig | ||
78 | +); | ||
79 | + | ||
80 | /* | ||
81 | * Error handling | ||
82 | * [tpm_error.c] | ||
83 | diff --git a/tpm/tpm_credentials.c b/tpm/tpm_credentials.c | ||
84 | index 9cd64af..01f29e6 100644 | ||
85 | --- a/tpm/tpm_credentials.c | ||
86 | +++ b/tpm/tpm_credentials.c | ||
87 | @@ -180,3 +180,34 @@ TPM_RESULT TPM_OwnerReadInternalPub(TPM_KEY_HANDLE keyHandle, TPM_AUTH *auth1, | ||
88 | return TPM_BAD_PARAMETER; | ||
89 | } | ||
90 | } | ||
91 | + | ||
92 | +int endorsementKeyFresh = 0; | ||
93 | + | ||
94 | +TPM_RESULT VTPM_GetParentQuote(TPM_DIGEST* data, TPM_PCR_SELECTION *sel, UINT32 *sigSize, BYTE **sig); | ||
95 | + | ||
96 | +TPM_RESULT TPM_ParentSignEK(TPM_NONCE *externalData, TPM_PCR_SELECTION *sel, | ||
97 | + TPM_AUTH *auth1, UINT32 *sigSize, BYTE **sig) | ||
98 | +{ | ||
99 | + TPM_PUBKEY pubKey; | ||
100 | + TPM_RESULT res; | ||
101 | + TPM_DIGEST hres; | ||
102 | + | ||
103 | + info("TPM_ParentSignEK()"); | ||
104 | + | ||
105 | + res = tpm_verify_auth(auth1, tpmData.permanent.data.ownerAuth, TPM_KH_OWNER); | ||
106 | + if (res != TPM_SUCCESS) return res; | ||
107 | + | ||
108 | + if (!endorsementKeyFresh) return TPM_DISABLED_CMD; | ||
109 | + | ||
110 | + res = tpm_get_pubek(&pubKey); | ||
111 | + if (res != TPM_SUCCESS) return res; | ||
112 | + | ||
113 | + if (tpm_compute_pubkey_checksum(externalData, &pubKey, &hres)) | ||
114 | + res = TPM_FAIL; | ||
115 | + | ||
116 | + if (res == TPM_SUCCESS) | ||
117 | + res = VTPM_GetParentQuote(&hres, sel, sigSize, sig); | ||
118 | + | ||
119 | + free_TPM_PUBKEY(pubKey); | ||
120 | + return res; | ||
121 | +} | ||
122 | diff --git a/tpm/tpm_data.c b/tpm/tpm_data.c | ||
123 | index 50c9697..6a0c499 100644 | ||
124 | --- a/tpm/tpm_data.c | ||
125 | +++ b/tpm/tpm_data.c | ||
126 | @@ -76,6 +76,8 @@ static void init_timeouts(void) | ||
127 | tpmData.permanent.data.cmd_durations[2] = 1000; | ||
128 | } | ||
129 | |||
130 | +extern int endorsementKeyFresh; | ||
131 | + | ||
132 | void tpm_init_data(void) | ||
133 | { | ||
134 | /* endorsement key */ | ||
135 | @@ -157,6 +159,7 @@ void tpm_init_data(void) | ||
136 | if (tpmConf & TPM_CONF_GENERATE_EK) { | ||
137 | /* generate a new endorsement key */ | ||
138 | tpm_rsa_generate_key(&tpmData.permanent.data.endorsementKey, 2048); | ||
139 | + endorsementKeyFresh = 1; | ||
140 | } else { | ||
141 | /* setup endorsement key */ | ||
142 | tpm_rsa_import_key(&tpmData.permanent.data.endorsementKey, | ||
143 | diff --git a/tpm/tpm_structures.h b/tpm/tpm_structures.h | ||
144 | index f746c05..b0f4625 100644 | ||
145 | --- a/tpm/tpm_structures.h | ||
146 | +++ b/tpm/tpm_structures.h | ||
147 | @@ -658,6 +658,49 @@ typedef struct tdTPM_CMK_MA_APPROVAL { | ||
148 | #define TPM_ORD_TickStampBlob 242 | ||
149 | #define TPM_ORD_MAX 256 | ||
150 | |||
151 | +/* VTPM-only commands: */ | ||
152 | +/* | ||
153 | + * ParentSignEK - Proof of fresh provisioning and EK value | ||
154 | + * | ||
155 | + * Input: | ||
156 | + * TPM_TAG tag TPM_TAG_RQU_AUTH1_COMMAND | ||
157 | + * UINT32 paramSize Total size of request | ||
158 | + * TPM_COMMAND_CODE ordinal TPM_ORD_ParentSignEK | ||
159 | + * TPM_NONCE externData 20 bytes of external data | ||
160 | + * TPM_PCR_SELECTION ptSel PCR selection for physical TPM | ||
161 | + * --- | ||
162 | + * UINT32 authHandle Owner authorization session (OIAP) | ||
163 | + * TPM_NONCE nonceOdd Nonce for authHandle | ||
164 | + * BOOL continueAuth Continue flag for authHandle | ||
165 | + * TPM_AUTHDATA privAuth Authorization digest for command | ||
166 | + * | ||
167 | + * Output: | ||
168 | + * TPM_TAG tag TPM_TAG_RSP_AUTH1_COMMAND | ||
169 | + * UINT32 paramSize Total size of response | ||
170 | + * TPM_RESULT returnCode Return code of the operation | ||
171 | + * BYTE[] sig Signature provided by physical TPM | ||
172 | + * TPM_PCRVALUE[] pcrValue Values of hardware PCRs used in the quote | ||
173 | + * --- | ||
174 | + * TPM_NONCE nonceEven Nonce for authHandle | ||
175 | + * BOOL continueAuth Continue flag for authHandle | ||
176 | + * TPM_AUTHDATA resAuth Authorization digest for response | ||
177 | + * | ||
178 | + * This command is only valid on the first boot of a vTPM; on any subsequent | ||
179 | + * boot, the command returns TPM_DISABLED_CMD. It is intended to be used to | ||
180 | + * provide evidence of proper platform configuration to the verifier/CA which is | ||
181 | + * responsible for the creation of the vTPM's endorsement credential, which will | ||
182 | + * be used on subsequent boots to certify AIKs via the usual Privacy CA protocol. | ||
183 | + * | ||
184 | + * The values of the virtual TPM's PCRs are not included in the response. | ||
185 | + * The signature is a standard TPM_Quote response from the physical TPM; its | ||
186 | + * externalData is the SHA1 hash of the following structure: | ||
187 | + * TPM_PUBKEY pubEK The vTPM's public EK | ||
188 | + * TPM_NONCE externData From input to the deep quote | ||
189 | + * | ||
190 | + * This structure was chosen to match the return of TPM_ReadPubek | ||
191 | + */ | ||
192 | +#define TPM_ORD_ParentSignEK (TPM_VENDOR_COMMAND | TPM_ORD_ReadPubek) | ||
193 | + | ||
194 | /* | ||
195 | * TCS Ordinals ([TPM_Part2], Section 17.1) | ||
196 | * | ||
diff --git a/recipes-extended/xen/files/vtpm_TPM_ChangeAuthAsymFinish.patch b/recipes-extended/xen/files/vtpm_TPM_ChangeAuthAsymFinish.patch deleted file mode 100644 index aefca284..00000000 --- a/recipes-extended/xen/files/vtpm_TPM_ChangeAuthAsymFinish.patch +++ /dev/null | |||
@@ -1,28 +0,0 @@ | |||
1 | Patch derived from below Xen changeset. | ||
2 | Signed-off-by: Christopher Clark <christopher.clark6@baesystems.com> | ||
3 | |||
4 | commit 22bf5be3237cb482a2ffd772ffd20ce37285eebf | ||
5 | Author: Olaf Hering <olaf@aepfle.de> | ||
6 | Date: Mon Jun 18 14:55:36 2018 +0200 | ||
7 | |||
8 | stubdom/vtpm: fix memcmp in TPM_ChangeAuthAsymFinish | ||
9 | |||
10 | gcc8 spotted this error: | ||
11 | error: 'memcmp' reading 20 bytes from a region of size 8 [-Werror=stringop-overflow=] | ||
12 | |||
13 | Signed-off-by: Olaf Hering <olaf@aepfle.de> | ||
14 | Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org> | ||
15 | |||
16 | diff --git a/tpm/tpm_deprecated.c b/tpm/tpm_deprecated.c | ||
17 | index c362b56..4c49f54 100644 | ||
18 | --- a/tpm/tpm_deprecated.c | ||
19 | +++ b/tpm/tpm_deprecated.c | ||
20 | @@ -434,7 +434,7 @@ TPM_RESULT TPM_ChangeAuthAsymFinish(TPM_KEY_HANDLE parentHandle, | ||
21 | tpm_hmac_final(&hmac_ctx, b1.digest); | ||
22 | /* 6. The TPM SHALL compare b1 with newAuthLink. The TPM SHALL | ||
23 | indicate a failure if the values do not match. */ | ||
24 | - if (memcmp(&b1, &newAuthLink, sizeof(TPM_HMAC))) { | ||
25 | + if (memcmp(&b1, newAuthLink, sizeof(TPM_HMAC))) { | ||
26 | debug("TPM_ChangeAuthAsymFinish(): newAuthLink value does not match."); | ||
27 | return TPM_FAIL; | ||
28 | } | ||
diff --git a/recipes-extended/xen/lwip.inc b/recipes-extended/xen/lwip.inc deleted file mode 100644 index e0836332..00000000 --- a/recipes-extended/xen/lwip.inc +++ /dev/null | |||
@@ -1,24 +0,0 @@ | |||
1 | # Copyright (C) 2018 kebodiker <kurt.bodiker@braintrust-us.com> | ||
2 | # Released under the MIT license (see COPYING.MIT for the terms) | ||
3 | |||
4 | require stubdom.inc | ||
5 | |||
6 | # clear this out to break dependency circle | ||
7 | DEPENDS = "" | ||
8 | |||
9 | # Nothing to configure or compile | ||
10 | # For stubdoms, lwip is basically a source package with a couple of patches applied. | ||
11 | do_configure[noexec] = "1" | ||
12 | do_compile[noexec] = "1" | ||
13 | |||
14 | # needed because this directory isn't typically part of a sysroot | ||
15 | SYSROOT_DIRS += "${prefix}/lwip" | ||
16 | |||
17 | FILES_${PN} = "\ | ||
18 | ${prefix} \ | ||
19 | " | ||
20 | |||
21 | do_install() { | ||
22 | install -d ${D}${prefix}/lwip | ||
23 | cp -r -t ${D}${prefix}/lwip ${S}/src/* | ||
24 | } | ||
diff --git a/recipes-extended/xen/lwip_1.3.0.bb b/recipes-extended/xen/lwip_1.3.0.bb deleted file mode 100644 index b7d8e95d..00000000 --- a/recipes-extended/xen/lwip_1.3.0.bb +++ /dev/null | |||
@@ -1,19 +0,0 @@ | |||
1 | # Copyright (C) 2018 kebodiker <kurt.bodiker@braintrust-us.com> | ||
2 | # Released under the MIT license (see COPYING.MIT for the terms) | ||
3 | |||
4 | DESCRIPTION = "LWIP" | ||
5 | HOMEPAGE = "https://savannah.nongnu.org/projects/lwip" | ||
6 | LICENSE = "BSD" | ||
7 | LIC_FILES_CHKSUM = "file://COPYING;md5=59a383b05013356e0c9899b06dc5da3f" | ||
8 | |||
9 | SRCREV_lwip = "bcb4afa886408bf0a1dde9c2a4a00323c8b07eb1" | ||
10 | SRC_URI = "\ | ||
11 | git://git.savannah.gnu.org/lwip.git;protocol=git;nobranch=1;destsuffix=lwip;name=lwip \ | ||
12 | file://lwip.patch-cvs \ | ||
13 | file://lwip.dhcp_create_request-hwaddr_len.patch \ | ||
14 | " | ||
15 | |||
16 | S="${WORKDIR}/${PN}" | ||
17 | B="${S}" | ||
18 | |||
19 | require lwip.inc | ||
diff --git a/recipes-extended/xen/mini-os.inc b/recipes-extended/xen/mini-os.inc deleted file mode 100644 index 61c27041..00000000 --- a/recipes-extended/xen/mini-os.inc +++ /dev/null | |||
@@ -1,28 +0,0 @@ | |||
1 | # Copyright (C) 2018 kebodiker <kurt.bodiker@braintrust-us.com> | ||
2 | # Released under the MIT license (see COPYING.MIT for the terms) | ||
3 | |||
4 | require stubdom.inc | ||
5 | |||
6 | # clear this out to break dependency circle | ||
7 | DEPENDS = "" | ||
8 | |||
9 | do_configure() { | ||
10 | ${MAKE} -C ${WORKDIR}/mini-os links | ||
11 | } | ||
12 | |||
13 | # Nothing to configure or compile | ||
14 | do_compile[noexec] = "1" | ||
15 | |||
16 | # needed because this directory isn't typically part of a sysroot | ||
17 | SYSROOT_DIRS += "${prefix}/mini-os" | ||
18 | RDEPENDS_${PN}-dev = "perl" | ||
19 | |||
20 | FILES_${PN}-dev = "\ | ||
21 | ${prefix} \ | ||
22 | " | ||
23 | |||
24 | do_install() { | ||
25 | install -d ${D}${prefix}/mini-os | ||
26 | cp -r -t ${D}${prefix}/mini-os ${S}/* | ||
27 | rm -rf ${D}${prefix}/mini-os/scripts | ||
28 | } | ||
diff --git a/recipes-extended/xen/mini-os_4.11.0.bb b/recipes-extended/xen/mini-os_4.11.0.bb deleted file mode 100644 index 85a06a79..00000000 --- a/recipes-extended/xen/mini-os_4.11.0.bb +++ /dev/null | |||
@@ -1,17 +0,0 @@ | |||
1 | # Copyright (C) 2017 Kurt Bodiker <kurt.bodiker@braintrust-us.com> | ||
2 | # Released under the MIT license (see COPYING.MIT for the terms) | ||
3 | |||
4 | DESCRIPTION = "Mini-OS is a tiny OS kernel distributed with the Xen Project" | ||
5 | HOMEPAGE = "https://wiki.xenproject.org/wiki/Mini-OS" | ||
6 | LICENSE = "GPLv2" | ||
7 | LIC_FILES_CHKSUM = "file://COPYING;md5=8a437231894440a8f7629caa372243d0" | ||
8 | |||
9 | # git commit hash for: xen-RELEASE-4.11.0 | ||
10 | SRCREV_minios = "0b4b7897e08b967a09bed2028a79fabff82342dd" | ||
11 | SRC_URI = "\ | ||
12 | git://xenbits.xen.org/mini-os.git;protocol=git;nobranch=1;destsuffix=mini-os;name=minios \ | ||
13 | " | ||
14 | S="${WORKDIR}/mini-os" | ||
15 | B="${S}" | ||
16 | |||
17 | require mini-os.inc | ||
diff --git a/recipes-extended/xen/newlib.inc b/recipes-extended/xen/newlib.inc deleted file mode 100644 index 1fdbd0aa..00000000 --- a/recipes-extended/xen/newlib.inc +++ /dev/null | |||
@@ -1,64 +0,0 @@ | |||
1 | # Copyright (C) 2017 Kurt Bodiker <kurt.bodiker@braintrust-us.com> | ||
2 | # Released under the MIT license (see COPYING.MIT for the terms) | ||
3 | |||
4 | require stubdom.inc | ||
5 | |||
6 | CPPFLAGS_INCLUDE_DIR = "-isystem `${HOST_PREFIX}gcc -print-file-name=include`" | ||
7 | STUBDOM_CFLAGS += "-D_I386MACH_ALLOW_HW_INTERRUPTS" | ||
8 | |||
9 | export ac_cv_path_CC_FOR_TARGET="${HOST_PREFIX}gcc --sysroot=${RECIPE_SYSROOT} ${STUBDOM_CPPFLAGS} ${STUBDOM_CFLAGS}" | ||
10 | export CC_FOR_TARGET="${HOST_PREFIX}gcc --sysroot=${RECIPE_SYSROOT} ${STUBDOM_CPPFLAGS} ${STUBDOM_CFLAGS}" | ||
11 | |||
12 | export ac_cv_path_CXX_FOR_TARGET="${HOST_PREFIX}g++ --sysroot=${RECIPE_SYSROOT}" | ||
13 | export CXX_FOR_TARGET="${HOST_PREFIX}g++ --sysroot=${RECIPE_SYSROOT}" | ||
14 | |||
15 | export ac_cv_path_CPP_FOR_TARGET="${HOST_PREFIX}gcc -E --sysroot=${RECIPE_SYSROOT}" | ||
16 | export CPP_FOR_TARGET="${HOST_PREFIX}gcc -E --sysroot=${RECIPE_SYSROOT}" | ||
17 | |||
18 | export ac_cv_path_LD_FOR_TARGET="${HOST_PREFIX}ld --sysroot=${RECIPE_SYSROOT}" | ||
19 | export LD_FOR_TARGET="${HOST_PREFIX}ld --sysroot=${RECIPE_SYSROOT}" | ||
20 | |||
21 | export ac_cv_path_AS_FOR_TARGET="${HOST_PREFIX}as" | ||
22 | export AS_FOR_TARGET="${HOST_PREFIX}as" | ||
23 | |||
24 | export ac_cv_path_AR_FOR_TARGET="${HOST_PREFIX}ar" | ||
25 | export AR_FOR_TARGET="${HOST_PREFIX}ar" | ||
26 | |||
27 | export ac_cv_path_NM_FOR_TARGET="${HOST_PREFIX}nm" | ||
28 | export NM_FOR_TARGET="${HOST_PREFIX}nm" | ||
29 | |||
30 | export ac_cv_path_RANLIB_FOR_TARGET="${HOST_PREFIX}ranlib" | ||
31 | export RANLIB_FOR_TARGET="${HOST_PREFIX}ranlib" | ||
32 | |||
33 | export ac_cv_path_OBJDUMP_FOR_TARGET="${HOST_PREFIX}objdump" | ||
34 | export OBJDUMP_FOR_TARGET="${HOST_PREFIX}objdump" | ||
35 | |||
36 | export ac_cv_path_OBJCOPY_FOR_TARGET="${HOST_PREFIX}objcopy" | ||
37 | export OBJCOPY_FOR_TARGET="${HOST_PREFIX}objcopy" | ||
38 | |||
39 | export ac_cv_path_STRIP_FOR_TARGET="${HOST_PREFIX}strip" | ||
40 | export STRIP_FOR_TARGET="${HOST_PREFIX}strip" | ||
41 | |||
42 | export ac_cv_path_STRINGS_FOR_TARGET="${HOST_PREFIX}strings" | ||
43 | export STRINGS_FOR_TARGET="${HOST_PREFIX}strings" | ||
44 | |||
45 | export ac_cv_path_READELF_FOR_TARGET="${HOST_PREFIX}readelf" | ||
46 | export READELF_FOR_TARGET="${HOST_PREFIX}readelf" | ||
47 | |||
48 | do_configure() { | ||
49 | ${S}/configure --verbose --prefix=${prefix} --target=${GNU_TARGET_ARCH}-xen-elf --enable-newlib-io-long-long --disable-multilib | ||
50 | find ${S} -type f | xargs perl -i.bak -pe 's/\b_(tzname|daylight|timezone)\b/$1/g' | ||
51 | } | ||
52 | |||
53 | do_compile() { | ||
54 | ${MAKE} | ||
55 | } | ||
56 | |||
57 | do_install() { | ||
58 | ${MAKE} DESTDIR=${D} install | ||
59 | rm -rf ${D}/cross-root-${GNU_TARGET_ARCH}/share | ||
60 | rm -rf ${D}/cross-root-${GNU_TARGET_ARCH}/info | ||
61 | install -m 644 `${HOST_PREFIX}gcc -print-file-name=include`/stdarg.h -t ${D}/${includedir} | ||
62 | install -m 644 `${HOST_PREFIX}gcc -print-file-name=include`/stddef.h -t ${D}/${includedir} | ||
63 | install -m 644 `${HOST_PREFIX}gcc -print-file-name=include`/stdbool.h -t ${D}/${includedir} | ||
64 | } | ||
diff --git a/recipes-extended/xen/newlib_1.16.0.bb b/recipes-extended/xen/newlib_1.16.0.bb deleted file mode 100644 index 60672bea..00000000 --- a/recipes-extended/xen/newlib_1.16.0.bb +++ /dev/null | |||
@@ -1,21 +0,0 @@ | |||
1 | # Copyright (C) 2017 Kurt Bodiker <kurt.bodiker@braintrust-us.com> | ||
2 | # Released under the MIT license (see COPYING.MIT for the terms) | ||
3 | |||
4 | DESCRIPTION = "Newlib is a C library intended for use on embedded systems." | ||
5 | HOMEPAGE = "http://sourceware.org/newlib" | ||
6 | LICENSE = "GPLv2 & LGPLv3 & GPLv3 & LGPLv2" | ||
7 | LIC_FILES_CHKSUM = "file://COPYING.NEWLIB;md5=950f50b290e8fcf7a2d3fff61775de9b" | ||
8 | |||
9 | # this is the hash of version tag 1_16_0 | ||
10 | SRCREV_newlib = "07b4b67a88f386ce4716a14e0ff2c2bce992b985" | ||
11 | SRC_URI = "\ | ||
12 | git://sourceware.org/git/newlib-cygwin.git;protocol=git;nobranch=1;destsuffix=newlib;name=newlib \ | ||
13 | file://newlib.patch \ | ||
14 | file://newlib-chk.patch \ | ||
15 | file://newlib-stdint-size_max-fix-from-1.17.0.patch \ | ||
16 | " | ||
17 | |||
18 | S="${WORKDIR}/newlib" | ||
19 | B="${WORKDIR}/build" | ||
20 | |||
21 | require newlib.inc | ||
diff --git a/recipes-extended/xen/polarssl.inc b/recipes-extended/xen/polarssl.inc deleted file mode 100644 index eae95f40..00000000 --- a/recipes-extended/xen/polarssl.inc +++ /dev/null | |||
@@ -1,27 +0,0 @@ | |||
1 | # Copyright (C) 2017 Kurt Bodiker <kurt.bodiker@braintrust-us.com> | ||
2 | # Released under the MIT license (see COPYING.MIT for the terms) | ||
3 | |||
4 | require stubdom.inc | ||
5 | |||
6 | DEPENDS += "\ | ||
7 | newlib \ | ||
8 | " | ||
9 | STUBDOM_CFLAGS += "\ | ||
10 | -Wno-memset-elt-size \ | ||
11 | -Wno-implicit-fallthrough \ | ||
12 | " | ||
13 | |||
14 | # nothing to configure | ||
15 | do_configure[noexec] = "1" | ||
16 | |||
17 | do_compile() { | ||
18 | ${MAKE} CC="${HOST_PREFIX}gcc --sysroot=${RECIPE_SYSROOT} ${STUBDOM_CPPFLAGS} ${STUBDOM_CFLAGS}" | ||
19 | } | ||
20 | |||
21 | do_install() { | ||
22 | install -d ${D}${includedir} | ||
23 | cp -r -t ${D}${includedir} ${S}/include/polarssl | ||
24 | |||
25 | install -d ${D}/${libdir} | ||
26 | install -m 644 -t ${D}/${libdir} ${S}/library/libpolarssl.a | ||
27 | } | ||
diff --git a/recipes-extended/xen/polarssl_1.1.4.bb b/recipes-extended/xen/polarssl_1.1.4.bb deleted file mode 100644 index 80ea45a7..00000000 --- a/recipes-extended/xen/polarssl_1.1.4.bb +++ /dev/null | |||
@@ -1,19 +0,0 @@ | |||
1 | # Copyright (C) 2017 Kurt Bodiker <kurt.bodiker@braintrust-us.com> | ||
2 | # Released under the MIT license (see COPYING.MIT for the terms) | ||
3 | |||
4 | DESCRIPTION = "PolarSSL (now 'mbed TLS') is an open source, portable, easy to use, readable and flexible SSL library." | ||
5 | HOMEPAGE = "https://tls.mbed.org" | ||
6 | LICENSE = "GPLv2" | ||
7 | LIC_FILES_CHKSUM = "file://LICENSE;md5=751419260aa954499f7abaabaa882bbe" | ||
8 | |||
9 | # git hash for release tag polarssl-1.1.4 | ||
10 | SRCREV_polarssl = "d36da11125a9c85c572a4fdf63e0a25e76d7bb18" | ||
11 | SRC_URI = "\ | ||
12 | git://github.com/ARMmbed/mbedtls.git;protocol=https;nobranch=1;destsuffix=polarssl;name=polarssl \ | ||
13 | file://polarssl.patch; \ | ||
14 | " | ||
15 | |||
16 | S="${WORKDIR}/${PN}" | ||
17 | B="${S}/library" | ||
18 | |||
19 | require polarssl.inc | ||
diff --git a/recipes-extended/xen/stubdom-gmp.inc b/recipes-extended/xen/stubdom-gmp.inc deleted file mode 100644 index ef6473d4..00000000 --- a/recipes-extended/xen/stubdom-gmp.inc +++ /dev/null | |||
@@ -1,37 +0,0 @@ | |||
1 | # Copyright (C) 2017 Kurt Bodiker <kurt.bodiker@braintrust-us.com> | ||
2 | # Released under the MIT license (see COPYING.MIT for the terms) | ||
3 | |||
4 | require stubdom.inc | ||
5 | |||
6 | DEPENDS += "\ | ||
7 | newlib \ | ||
8 | " | ||
9 | |||
10 | do_configure() { | ||
11 | # need to modify prefix here during configure otherwise OE-level variables | ||
12 | # (prefix, libdir, includedir, etc...) defined in stubdom.inc get messed up | ||
13 | CPPFLAGS="-isystem ${RECIPE_SYSROOT}/cross-root-${GNU_TARGET_ARCH}/${GNU_TARGET_ARCH}-xen-elf/include ${STUBDOM_CPPFLAGS}" \ | ||
14 | CFLAGS="${STUBDOM_CFLAGS}" \ | ||
15 | CC="${HOST_PREFIX}gcc --sysroot=${RECIPE_SYSROOT}" \ | ||
16 | ${S}/configure \ | ||
17 | --disable-shared \ | ||
18 | --enable-static \ | ||
19 | --disable-fft \ | ||
20 | --without-readline \ | ||
21 | --with-gnu-ld \ | ||
22 | --prefix=${prefix}/${GNU_TARGET_ARCH}-xen-elf \ | ||
23 | --libdir=${libdir} \ | ||
24 | --build=`${HOST_PREFIX}gcc -dumpmachine` \ | ||
25 | --host=${GNU_TARGET_ARCH}-xen-elf | ||
26 | |||
27 | sed -i 's/#define HAVE_OBSTACK_VPRINTF 1/\/\/#define HAVE_OBSTACK_VPRINTF 1/' ${S}/config.h | ||
28 | } | ||
29 | |||
30 | do_compile() { | ||
31 | ${MAKE} | ||
32 | } | ||
33 | |||
34 | do_install() { | ||
35 | ${MAKE} DESTDIR=${D} install | ||
36 | rm -rf ${D}${prefix}/${GNU_TARGET_ARCH}-xen-elf/share | ||
37 | } | ||
diff --git a/recipes-extended/xen/stubdom-gmp_4.3.2.bb b/recipes-extended/xen/stubdom-gmp_4.3.2.bb deleted file mode 100644 index d9a2adbd..00000000 --- a/recipes-extended/xen/stubdom-gmp_4.3.2.bb +++ /dev/null | |||
@@ -1,20 +0,0 @@ | |||
1 | # Copyright (C) 2017 Kurt Bodiker <kurt.bodiker@braintrust-us.com> | ||
2 | # Released under the MIT license (see COPYING.MIT for the terms) | ||
3 | |||
4 | DESCRIPTION = "GMP library for Xen vTPM's." | ||
5 | HOMEPAGE = "http://gmp" | ||
6 | LICENSE = "GPLv3" | ||
7 | LIC_FILES_CHKSUM = "file://COPYING;md5=d32239bcb673463ab874e80d47fae504 \ | ||
8 | file://COPYING.LIB;md5=6a6a8e020838b23406c81b19c1d46df6 \ | ||
9 | " | ||
10 | |||
11 | SRC_URI = "\ | ||
12 | https://gmplib.org/download/gmp/archive/gmp-${PV}.tar.bz2 \ | ||
13 | " | ||
14 | SRC_URI[md5sum] = "dd60683d7057917e34630b4a787932e8" | ||
15 | SRC_URI[sha256sum] = "936162c0312886c21581002b79932829aa048cfaf9937c6265aeaa14f1cd1775" | ||
16 | |||
17 | S="${WORKDIR}/gmp-${PV}" | ||
18 | B="${S}" | ||
19 | |||
20 | require stubdom-gmp.inc | ||
diff --git a/recipes-extended/xen/stubdom.inc b/recipes-extended/xen/stubdom.inc deleted file mode 100644 index bfc67527..00000000 --- a/recipes-extended/xen/stubdom.inc +++ /dev/null | |||
@@ -1,152 +0,0 @@ | |||
1 | # Copyright (C) 2017 Kurt Bodiker <kurt.bodiker@braintrust-us.com> | ||
2 | # Released under the MIT license (see COPYING.MIT for the terms) | ||
3 | |||
4 | COMPATIBLE_HOST = '(x86_64.*).*-linux' | ||
5 | |||
6 | require xen-arch.inc | ||
7 | |||
8 | # many of the xen stubdom related recipes build and package static instead of shared libraries | ||
9 | EXCLUDE_FROM_SHLIBS = "1" | ||
10 | |||
11 | # base set of dependencies to be used for xen stubdom recipes | ||
12 | DEPENDS += "\ | ||
13 | lwip \ | ||
14 | mini-os \ | ||
15 | " | ||
16 | |||
17 | # unset EVERYTHING from the OE environment. | ||
18 | # Weird things happen when these are exported into the environment. | ||
19 | unset CFLAGS | ||
20 | unset BUILD_CFLAGS | ||
21 | unset TARGET_CFLAGS | ||
22 | unset CFLAGS_FOR_BUILD | ||
23 | |||
24 | unset CPPFLAGS | ||
25 | unset BUILD_CPPFLAGS | ||
26 | unset TARGET_CPPFLAGS | ||
27 | unset CPPFLAGS_FOR_BUILD | ||
28 | |||
29 | unset LDFLAGS | ||
30 | unset BUILD_LDFLAGS | ||
31 | unset TARGET_LDFLAGS | ||
32 | unset LDFLAGS_FOR_BUILD | ||
33 | |||
34 | unset CXXFLAGS | ||
35 | unset TARGET_CXXFLAGS | ||
36 | unset BUILD_CXXFLAGS | ||
37 | unset CXXFLAGS_FOR_BUILD | ||
38 | |||
39 | unset BUILD_CC | ||
40 | unset BUILD_CPP | ||
41 | unset BUILD_CXX | ||
42 | unset BUILD_LD | ||
43 | unset BUILD_AR | ||
44 | unset BUILD_AS | ||
45 | unset BUILD_CCLD | ||
46 | unset BUILD_FC | ||
47 | unset BUILD_RANLIB | ||
48 | unset BUILD_NM | ||
49 | unset BUILD_STRIP | ||
50 | unset BUILD_READELF | ||
51 | unset BUILD_OBJCOPY | ||
52 | unset BUILD_OBJDUMP | ||
53 | unset CC | ||
54 | unset CPP | ||
55 | unset CXX | ||
56 | unset LD | ||
57 | unset AR | ||
58 | unset AS | ||
59 | unset NM | ||
60 | unset RANLIB | ||
61 | unset STRIP | ||
62 | unset STRINGS | ||
63 | unset READELF | ||
64 | unset OBJCOPY | ||
65 | unset OBJDUMP | ||
66 | unset READELF | ||
67 | unset CCLD | ||
68 | unset FC | ||
69 | |||
70 | # Provide support to build both 32-bit and 64-bit stubdoms | ||
71 | python () { | ||
72 | gnu_dict = { | ||
73 | 'x86_32': 'i686', | ||
74 | 'x86_64': 'x86_64', | ||
75 | } | ||
76 | |||
77 | if d.expand('${XEN_TARGET_ARCH}') == 'x86_32': | ||
78 | d.setVar("GNU_TARGET_ARCH",gnu_dict[d.expand('${XEN_TARGET_ARCH}')]) | ||
79 | d.setVar("PACKAGE_ARCH","core2-32") | ||
80 | elif d.expand('${XEN_TARGET_ARCH}') == 'x86_64': | ||
81 | d.setVar("GNU_TARGET_ARCH",gnu_dict[d.expand('${XEN_TARGET_ARCH}')]) | ||
82 | } | ||
83 | |||
84 | export GNU_TARGET_ARCH | ||
85 | export XEN_TARGET_ARCH="${@map_xen_arch(d.getVar('TARGET_ARCH'), d)}" | ||
86 | export XEN_COMPILE_ARCH="${@map_xen_arch(d.getVar('BUILD_ARCH'), d)}" | ||
87 | |||
88 | LWIP_SRCDIR = "${RECIPE_SYSROOT}/cross-root-${GNU_TARGET_ARCH}/lwip" | ||
89 | MINIOS_SRCDIR = "${RECIPE_SYSROOT}/cross-root-${GNU_TARGET_ARCH}/mini-os" | ||
90 | |||
91 | # Base set of CPPFLAGS, CFLAGS needed for each component used to build MiniOS-based stubdoms | ||
92 | # LDFLAGS are only used when building stubdoms, so only used in stubdom recipes | ||
93 | # Generic name given because each library uses DEF_, BUILD_, TARGET_, and xxxFLAGS differently | ||
94 | CPPFLAGS_INCLUDE_DIR = "-isystem ${RECIPE_SYSROOT}/cross-root-${GNU_TARGET_ARCH}/${GNU_TARGET_ARCH}-xen-elf/include" | ||
95 | |||
96 | STUBDOM_CPPFLAGS += "\ | ||
97 | -isystem ${MINIOS_SRCDIR}/include \ | ||
98 | -D__MINIOS__ \ | ||
99 | -DHAVE_LIBC \ | ||
100 | -isystem ${MINIOS_SRCDIR}/include/posix \ | ||
101 | -isystem ${MINIOS_SRCDIR}/include/xen \ | ||
102 | -isystem ${MINIOS_SRCDIR}/include/x86 \ | ||
103 | -isystem ${MINIOS_SRCDIR}/include/x86/${XEN_TARGET_ARCH} \ | ||
104 | -U __linux__ \ | ||
105 | -U __FreeBSD__ \ | ||
106 | -U __sun__ \ | ||
107 | -nostdinc \ | ||
108 | ${CPPFLAGS_INCLUDE_DIR} \ | ||
109 | -isystem ${LWIP_SRCDIR}/include \ | ||
110 | -isystem ${LWIP_SRCDIR}/include/ipv4 \ | ||
111 | " | ||
112 | |||
113 | STUBDOM_CFLAGS += "\ | ||
114 | -mno-red-zone \ | ||
115 | -O1 \ | ||
116 | -fno-omit-frame-pointer \ | ||
117 | -m64 \ | ||
118 | -fno-reorder-blocks \ | ||
119 | -fno-asynchronous-unwind-tables \ | ||
120 | -DBUILD_ID \ | ||
121 | -fno-strict-aliasing \ | ||
122 | -std=gnu99 \ | ||
123 | -Wall \ | ||
124 | -Wstrict-prototypes \ | ||
125 | -Wdeclaration-after-statement \ | ||
126 | -Wno-unused-but-set-variable \ | ||
127 | -Wno-unused-local-typedefs \ | ||
128 | -fno-stack-protector \ | ||
129 | -fno-exceptions \ | ||
130 | " | ||
131 | |||
132 | STUBDOM_LDFLAGS = "\ | ||
133 | -nostdlib \ | ||
134 | -L${RECIPE_SYSROOT}/cross-root-${GNU_TARGET_ARCH}/${GNU_TARGET_ARCH}-xen-elf/lib \ | ||
135 | " | ||
136 | |||
137 | # Need to redefine these for stubdom-related builds. It all starts because of | ||
138 | # the prefix used in newlib and then continues because we don't want to | ||
139 | # cross-contaminate stubdom-related recipes with headers and libraries found in | ||
140 | # the OE-defined locations | ||
141 | export prefix="/cross-root-${GNU_TARGET_ARCH}" | ||
142 | export includedir="${prefix}/${GNU_TARGET_ARCH}-xen-elf/include" | ||
143 | export libdir="${prefix}/${GNU_TARGET_ARCH}-xen-elf/lib" | ||
144 | export libexecdir="${libdir}" | ||
145 | export STAGING_INCDIR | ||
146 | export STAGING_LIBDIR | ||
147 | |||
148 | # Typically defined in Xen and Minios .mk files that aren't sourced/read, | ||
149 | # defined to trigger some values and paths in Makefiles | ||
150 | export debug="y" | ||
151 | export stubdom="y" | ||
152 | export XEN_OS="MiniOS" | ||
diff --git a/recipes-extended/xen/tpm-emulator.inc b/recipes-extended/xen/tpm-emulator.inc deleted file mode 100644 index f58a2763..00000000 --- a/recipes-extended/xen/tpm-emulator.inc +++ /dev/null | |||
@@ -1,37 +0,0 @@ | |||
1 | # Copyright (C) 2017 Kurt Bodiker <kurt.bodiker@braintrust-us.com> | ||
2 | # Released under the MIT license (see COPYING.MIT for the terms) | ||
3 | |||
4 | require stubdom.inc | ||
5 | |||
6 | DEPENDS += "\ | ||
7 | cmake-native \ | ||
8 | newlib \ | ||
9 | stubdom-gmp \ | ||
10 | " | ||
11 | |||
12 | # nothing to configure | ||
13 | do_configure[noexec] = "1" | ||
14 | |||
15 | export CMAKE_C_FLAGS = "\ | ||
16 | -std=c99 \ | ||
17 | -DTPM_NO_EXTERN \ | ||
18 | ${STUBDOM_CPPFLAGS} \ | ||
19 | ${STUBDOM_CFLAGS} \ | ||
20 | -Wno-declaration-after-statement \ | ||
21 | -Wno-implicit-fallthrough \ | ||
22 | " | ||
23 | |||
24 | do_compile() { | ||
25 | CC="${HOST_PREFIX}gcc --sysroot=${RECIPE_SYSROOT}" cmake .. -DCMAKE_C_FLAGS:STRING="${CMAKE_C_FLAGS}" | ||
26 | ${MAKE} VERBOSE=1 tpm_crypto tpm | ||
27 | } | ||
28 | |||
29 | do_install() { | ||
30 | install -d ${D}/${libdir} | ||
31 | install -m 644 -t ${D}/${libdir} ${B}/crypto/libtpm_crypto.a | ||
32 | install -m 644 -t ${D}/${libdir} ${B}/tpm/libtpm.a | ||
33 | |||
34 | install -D -m 644 -t ${D}/${includedir}/tpm-emulator/build ${S}/build/config.h | ||
35 | install -D -m 644 -t ${D}/${includedir}/tpm-emulator/crypto ${S}/crypto/*.h | ||
36 | install -D -m 644 -t ${D}/${includedir}/tpm-emulator/tpm ${S}/tpm/*.h | ||
37 | } | ||
diff --git a/recipes-extended/xen/tpm-emulator_0.7.4.bb b/recipes-extended/xen/tpm-emulator_0.7.4.bb deleted file mode 100644 index 96a40905..00000000 --- a/recipes-extended/xen/tpm-emulator_0.7.4.bb +++ /dev/null | |||
@@ -1,27 +0,0 @@ | |||
1 | # Copyright (C) 2017 Kurt Bodiker <kurt.bodiker@braintrust-us.com> | ||
2 | # Released under the MIT license (see COPYING.MIT for the terms) | ||
3 | |||
4 | DESCRIPTION = "TPM Emulator" | ||
5 | HOMEPAGE = "http://xenbits.xen.org/xen-extfiles" | ||
6 | LICENSE = "GPLv2" | ||
7 | LIC_FILES_CHKSUM = "file://README;md5=eeabd77cf8fd8a8bc42983884cb09863" | ||
8 | |||
9 | SRC_URI = "\ | ||
10 | http://xenbits.xen.org/xen-extfiles/tpm_emulator-${PV}.tar.gz;name=tpm-emulator \ | ||
11 | file://tpmemu-0.7.4.patch \ | ||
12 | file://vtpm-bufsize.patch \ | ||
13 | file://vtpm-locality.patch \ | ||
14 | file://vtpm-parent-sign-ek.patch \ | ||
15 | file://vtpm-deepquote.patch \ | ||
16 | file://vtpm-deepquote-anyloc.patch \ | ||
17 | file://vtpm-cmake-Wextra.patch \ | ||
18 | file://vtpm-implicit-fallthrough.patch \ | ||
19 | file://vtpm_TPM_ChangeAuthAsymFinish.patch \ | ||
20 | " | ||
21 | SRC_URI[tpm-emulator.md5sum] = "e26becb8a6a2b6695f6b3e8097593db8" | ||
22 | SRC_URI[tpm-emulator.sha256sum] = "4e48ea0d83dd9441cc1af04ab18cd6c961b9fa54d5cbf2c2feee038988dea459" | ||
23 | |||
24 | S="${WORKDIR}/tpm_emulator-${PV}" | ||
25 | B="${S}/build" | ||
26 | |||
27 | require tpm-emulator.inc | ||
diff --git a/recipes-extended/xen/xen-vtpm.inc b/recipes-extended/xen/xen-vtpm.inc deleted file mode 100644 index a94c7503..00000000 --- a/recipes-extended/xen/xen-vtpm.inc +++ /dev/null | |||
@@ -1,111 +0,0 @@ | |||
1 | # Copyright (C) 2017 Kurt Bodiker <kurt.bodiker@braintrust-us.com> | ||
2 | # Released under the MIT license (see COPYING.MIT for the terms) | ||
3 | |||
4 | require stubdom.inc | ||
5 | |||
6 | DEPENDS = "\ | ||
7 | newlib \ | ||
8 | lwip \ | ||
9 | mini-os \ | ||
10 | polarssl \ | ||
11 | stubdom-gmp \ | ||
12 | tpm-emulator \ | ||
13 | " | ||
14 | # These were unset by stubdom.inc to allow us to scope them per recipe | ||
15 | export CC="${HOST_PREFIX}gcc --sysroot=${RECIPE_SYSROOT}" | ||
16 | export CCLD="${HOST_PREFIX}gcc --sysroot=${RECIPE_SYSROOT}" | ||
17 | export CXX="${HOST_PREFIX}g++ --sysroot=${RECIPE_SYSROOT}" | ||
18 | export CPP="${HOST_PREFIX}gcc -E --sysroot=${RECIPE_SYSROOT}" | ||
19 | export LD="${HOST_PREFIX}ld --sysroot=${RECIPE_SYSROOT}" | ||
20 | export LD_LTO="${HOST_PREFIX}ld --sysroot=${RECIPE_SYSROOT}" | ||
21 | export AS="${HOST_PREFIX}as" | ||
22 | export AR="${HOST_PREFIX}ar" | ||
23 | export NM="${HOST_PREFIX}nm" | ||
24 | export RANLIB="${HOST_PREFIX}ranlib" | ||
25 | export OBJDUMP="${HOST_PREFIX}objdump" | ||
26 | export OBJCOPY="${HOST_PREFIX}objcopy" | ||
27 | export STRIP="${HOST_PREFIX}strip" | ||
28 | export STRINGS="${HOST_PREFIX}strings" | ||
29 | export READELF="${HOST_PREFIX}readelf" | ||
30 | |||
31 | |||
32 | # Required for some of the config stuff | ||
33 | export STUBDOM_TARGETS="vtpm vtpmmgr" | ||
34 | |||
35 | VTPM_CPPFLAGS = "\ | ||
36 | -I${RECIPE_SYSROOT}/cross-root-${GNU_TARGET_ARCH}/${GNU_TARGET_ARCH}-xen-elf/include/tpm-emulator/build \ | ||
37 | -I${RECIPE_SYSROOT}/cross-root-${GNU_TARGET_ARCH}/${GNU_TARGET_ARCH}-xen-elf/include/tpm-emulator/crypto \ | ||
38 | -I${RECIPE_SYSROOT}/cross-root-${GNU_TARGET_ARCH}/${GNU_TARGET_ARCH}-xen-elf/include/tpm-emulator/tpm \ | ||
39 | -I${RECIPE_SYSROOT}/cross-root-${GNU_TARGET_ARCH}/${GNU_TARGET_ARCH}-xen-elf/include/tpm-emulator \ | ||
40 | " | ||
41 | |||
42 | # The includes from this Xen directory are not in the MiniOS repo, although they probably should be. | ||
43 | STUBDOM_CPPFLAGS += "-isystem ${B}/include/" | ||
44 | |||
45 | do_configure() { | ||
46 | |||
47 | # GCC 7 fails linking header defined inlines if not declared 'static' or 'extern' | ||
48 | # This appears to be fixed in Xen 4.10.0+, so let's look at version of Xen source | ||
49 | # to determine if we need to modify inline declarations. | ||
50 | # | ||
51 | # 'echo -e' to enable interpretation of backslashes | ||
52 | # 'sort -V' to natural sort version numbers | ||
53 | # 'head -n1' to capture the first line of output from sort command | ||
54 | |||
55 | if [ "${PV}" = "$(echo "${PV};4.9.999" | sed 's/;/\n/' | sort -V | head -n1)" ]; then | ||
56 | sed -i "s/^inline/static inline/g" ${B}/vtpmmgr/*.h | ||
57 | fi | ||
58 | |||
59 | for i in AR AS NM RANLIB OBJDUMP OBJCOPY STRIP STRINGS READELF CXX LD LD_LTO CC CPP; do | ||
60 | sed -i "s/^\($i\s\s*\).*=/\1?=/" ${MINIOS_SRCDIR}/Config.mk | ||
61 | done | ||
62 | |||
63 | # replicate the TARGETS_MINIOS target in xen/stubdom/Makefile | ||
64 | for i in ${STUBDOM_TARGETS}; do | ||
65 | [ -d ${B}/mini-os-${XEN_TARGET_ARCH}-$i ] || | ||
66 | for j in $(cd ${MINIOS_SRCDIR} ; find . -type d) ; do \ | ||
67 | mkdir -p ${B}/mini-os-${XEN_TARGET_ARCH}-$i/$j; \ | ||
68 | done | ||
69 | done | ||
70 | } | ||
71 | |||
72 | do_compile() { | ||
73 | ${MAKE} MINIOS_CONFIG="${B}/vtpm/minios.cfg" CONFIG_FILE="${B}/vtpm-minios-config.mk" DESTDIR= -C ${MINIOS_SRCDIR} config | ||
74 | CPPFLAGS="`cat ${B}/vtpm-minios-config.mk` ${STUBDOM_CPPFLAGS} ${VTPM_CPPFLAGS}" CFLAGS="${STUBDOM_CFLAGS}" ${MAKE} -C ${B}/vtpm | ||
75 | DEF_CPPFLAGS="${STUBDOM_CPPFLAGS}" \ | ||
76 | DEF_CFLAGS="${STUBDOM_CFLAGS}" \ | ||
77 | DEF_LDFLAGS="${STUBDOM_LDFLAGS}" \ | ||
78 | MINIOS_CONFIG="${B}/vtpm/minios.cfg" \ | ||
79 | ${MAKE} -C ${MINIOS_SRCDIR} \ | ||
80 | OBJ_DIR=${B}/mini-os-${XEN_TARGET_ARCH}-vtpm \ | ||
81 | APP_OBJS="${B}/vtpm/vtpm.a" \ | ||
82 | APP_LDLIBS="-ltpm -ltpm_crypto -lgmp -lpolarssl" | ||
83 | |||
84 | ${MAKE} MINIOS_CONFIG="${B}/vtpmmgr/minios.cfg" CONFIG_FILE="${B}/vtpmmgr-minios-config.mk" DESTDIR= -C ${MINIOS_SRCDIR} config | ||
85 | CPPFLAGS="`cat ${B}/vtpmmgr-minios-config.mk` ${STUBDOM_CPPFLAGS}" CFLAGS="${STUBDOM_CFLAGS}" ${MAKE} -C ${B}/vtpmmgr | ||
86 | DEF_CPPFLAGS="${STUBDOM_CPPFLAGS}" \ | ||
87 | DEF_CFLAGS="${STUBDOM_CFLAGS}" \ | ||
88 | DEF_LDFLAGS="${STUBDOM_LDFLAGS}" \ | ||
89 | MINIOS_CONFIG="${B}/vtpmmgr/minios.cfg" \ | ||
90 | ${MAKE} -C ${MINIOS_SRCDIR} \ | ||
91 | OBJ_DIR=${B}/mini-os-${XEN_TARGET_ARCH}-vtpmmgr \ | ||
92 | APP_OBJS="${B}/vtpmmgr/vtpmmgr.a" \ | ||
93 | APP_LDLIBS="-lm -lpolarssl" | ||
94 | } | ||
95 | |||
96 | PACKAGES = "\ | ||
97 | ${PN}-vtpm-stubdom \ | ||
98 | ${PN}-vtpmmgr-stubdom \ | ||
99 | " | ||
100 | FILES_${PN}-vtpm-stubdom="\ | ||
101 | ${libdir}/xen/boot/vtpm-stubdom.gz \ | ||
102 | " | ||
103 | |||
104 | FILES_${PN}-vtpmmgr-stubdom="\ | ||
105 | ${libdir}/xen/boot/vtpmmgr-stubdom.gz \ | ||
106 | " | ||
107 | |||
108 | do_install() { | ||
109 | install -m 644 -D ${B}/mini-os-${XEN_TARGET_ARCH}-vtpm/mini-os.gz ${D}${libdir}/xen/boot/vtpm-stubdom.gz | ||
110 | install -m 644 -D ${B}/mini-os-${XEN_TARGET_ARCH}-vtpmmgr/mini-os.gz ${D}${libdir}/xen/boot/vtpmmgr-stubdom.gz | ||
111 | } | ||
diff --git a/recipes-extended/xen/xen-vtpm_4.11.0.bb b/recipes-extended/xen/xen-vtpm_4.11.0.bb deleted file mode 100644 index 088e985b..00000000 --- a/recipes-extended/xen/xen-vtpm_4.11.0.bb +++ /dev/null | |||
@@ -1,21 +0,0 @@ | |||
1 | # Copyright (C) 2017 Kurt Bodiker <kurt.bodiker@braintrust-us.com> | ||
2 | # Released under the MIT license (see COPYING.MIT for the terms) | ||
3 | |||
4 | DESCRIPTION = "MiniOS-based vTPMs for Xen" | ||
5 | HOMEPAGE = "https://www.xenproject.org" | ||
6 | LICENSE = "GPLv2 & BSD-3-Clause" | ||
7 | LIC_FILES_CHKSUM = "file://COPYING;md5=b1ceb1b03a49b202ee6f41ffd1ed0155 \ | ||
8 | file://vtpm/COPYING;md5=75a98062ab0322ded060d9026a1bda61 \ | ||
9 | " | ||
10 | |||
11 | # git commit hash for Xen's RELEASE-4.11.0 tag | ||
12 | SRCREV_xen = "1eb6544a567e3e5133fafe0c4ef3545c5138d0e4" | ||
13 | SRC_URI = "\ | ||
14 | git://xenbits.xen.org/xen.git;protocol=git;nobranch=1;name=xen;subpath=stubdom \ | ||
15 | git://xenbits.xen.org/xen.git;protocol=git;nobranch=1;name=xen;destsuffix=stubdom/include;subpath=tools/xenstore/include \ | ||
16 | " | ||
17 | |||
18 | S="${WORKDIR}/stubdom" | ||
19 | B="${S}" | ||
20 | |||
21 | require xen-vtpm.inc | ||