[syslinux:lwip] pxe: put a semaphore around PXE calls
syslinux-bot for H. Peter Anvin
hpa at zytor.com
Fri Apr 22 20:06:23 PDT 2011
Commit-ID: 53ecbda7a9977735494c72748f54c164d5367e99
Gitweb: http://syslinux.zytor.com/commit/53ecbda7a9977735494c72748f54c164d5367e99
Author: H. Peter Anvin <hpa at zytor.com>
AuthorDate: Fri, 22 Apr 2011 19:35:36 -0700
Committer: H. Peter Anvin <hpa at zytor.com>
CommitDate: Fri, 22 Apr 2011 19:35:36 -0700
pxe: put a semaphore around PXE calls
Make sure we can't accidentally invoke the PXE stack from multiple
threads (except for the ISR, which presumably has to allow for
reentrancy, since the spec implies the ISR can be invoked from inside
the PXE stack strategy routine.)
Signed-off-by: H. Peter Anvin <hpa at zytor.com>
---
core/fs/pxe/pxe.c | 8 +++++++-
1 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/core/fs/pxe/pxe.c b/core/fs/pxe/pxe.c
index b9a7a04..b4ff1f7 100644
--- a/core/fs/pxe/pxe.c
+++ b/core/fs/pxe/pxe.c
@@ -6,6 +6,7 @@
#include <minmax.h>
#include <sys/cpu.h>
#include "pxe.h"
+#include "thread.h"
#include <lwip/api.h>
#include <lwip/dns.h>
#include <lwip/tcpip.h>
@@ -222,11 +223,14 @@ const char *parse_dotquad(const char *ip_str, uint32_t *res)
*/
int pxe_call(int opcode, void *data)
{
+ static DECLARE_INIT_SEMAPHORE(pxe_sem, 1);
extern void pxenv(void);
com32sys_t regs;
+ sem_down(&pxe_sem, 0);
+
#if 0
- printf("pxe_call op %04x data %p\n", opcode, data);
+ dprintf("pxe_call op %04x data %p\n", opcode, data);
#endif
memset(®s, 0, sizeof regs);
@@ -235,6 +239,8 @@ int pxe_call(int opcode, void *data)
regs.edi.w[0] = OFFS(data);
call16(pxenv, ®s, ®s);
+ sem_up(&pxe_sem);
+
return regs.eflags.l & EFLAGS_CF; /* CF SET if fail */
}
More information about the Syslinux-commits
mailing list