[syslinux:lwip] pxe: use core for atomic modification of certain volatiles

syslinux-bot for H. Peter Anvin hpa at zytor.com
Tue May 29 21:12:03 PDT 2012


Commit-ID:  79312306de0150ef64213ef9fbc5aa8580544f03
Gitweb:     http://www.syslinux.org/commit/79312306de0150ef64213ef9fbc5aa8580544f03
Author:     H. Peter Anvin <hpa at zytor.com>
AuthorDate: Tue, 29 May 2012 21:08:20 -0700
Committer:  H. Peter Anvin <hpa at zytor.com>
CommitDate: Tue, 29 May 2012 21:08:20 -0700

pxe: use core for atomic modification of certain volatiles

pxe_need_poll and pxe_irq_count can be accessed from an interrupt
handler, so make sure that we modify them in a way that is locally
atomic.

Signed-off-by: H. Peter Anvin <hpa at zytor.com>

---
 core/fs/pxe/isr.c            |    2 +-
 core/lwip/src/netif/undiif.c |    4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/core/fs/pxe/isr.c b/core/fs/pxe/isr.c
index 69cfe9f..069fefd 100644
--- a/core/fs/pxe/isr.c
+++ b/core/fs/pxe/isr.c
@@ -252,7 +252,7 @@ void pxe_start_isr(void)
 			       pxe_poll_thread, NULL);
 
     if (!irq ||	!(pxe_undi_iface.ServiceFlags & PXE_UNDI_IFACE_FLAG_IRQ))
-	pxe_need_poll |= 1;
+	asm volatile("orb $1,%0" : "+m" (pxe_need_poll));
 }
 
 int reset_pxe(void)
diff --git a/core/lwip/src/netif/undiif.c b/core/lwip/src/netif/undiif.c
index b82b6f3..2c7e4ac 100644
--- a/core/lwip/src/netif/undiif.c
+++ b/core/lwip/src/netif/undiif.c
@@ -313,8 +313,8 @@ undi_transmit(struct netif *netif, struct pbuf *pbuf,
 	  first_xmit = now;
       } else if (now - first_xmit > 3000) {
 	  /* 3 seconds after first transmit, and no interrupts */
-	  pxe_need_poll |= 1;
-	  pxe_irq_count++;	/* We don't need to do this again... */
+	  asm volatile("orb $1,%0" : "+m" (pxe_need_poll));
+	  asm volatile("incl %0" : "+m" (pxe_irq_count));
       }
   }
 


More information about the Syslinux-commits mailing list