summaryrefslogtreecommitdiff
path: root/src/pmm.c
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2010-03-20 18:17:19 -0400
committerKevin O'Connor <kevin@koconnor.net>2010-03-20 18:17:19 -0400
commitd7eb27efa3f9265dca8357cfa05d9e0560fd4534 (patch)
treee47ab5db226465cf2a87276d161f861e626ccef5 /src/pmm.c
parent7415270ed16175e443ac1b10205ccabbc964a309 (diff)
downloadqemu-seabios-d7eb27efa3f9265dca8357cfa05d9e0560fd4534.tar.gz
Don't move EBDA while an optionrom is running (CONFIG_THREAD_OPTIONROMS).
Moving the ebda while an optionrom is running could confuse it. So, avoid doing that.
Diffstat (limited to 'src/pmm.c')
-rw-r--r--src/pmm.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/pmm.c b/src/pmm.c
index 0461e41..1b90f21 100644
--- a/src/pmm.c
+++ b/src/pmm.c
@@ -74,12 +74,18 @@ relocate_ebda(u32 newebda, u32 oldebda, u8 ebda_size)
static void
zonelow_expand(u32 size, u32 align)
{
- u32 oldpos = GET_PMMVAR(ZoneLow.cur);
- u32 newpos = ALIGN_DOWN(oldpos - size, align);
- u32 bottom = GET_PMMVAR(ZoneLow.bottom);
- if (newpos >= bottom && newpos <= oldpos)
- // Space already present.
- return;
+ u32 oldpos, newpos, bottom;
+ for (;;) {
+ oldpos = GET_PMMVAR(ZoneLow.cur);
+ newpos = ALIGN_DOWN(oldpos - size, align);
+ bottom = GET_PMMVAR(ZoneLow.bottom);
+ if (newpos >= bottom && newpos <= oldpos)
+ // Space already present.
+ return;
+ // Make sure to not move ebda while an optionrom is running.
+ if (likely(!wait_preempt()))
+ break;
+ }
u16 ebda_seg = get_ebda_seg();
u32 ebda_pos = (u32)MAKE_FLATPTR(ebda_seg, 0);
u8 ebda_size = GET_EBDA2(ebda_seg, size);