summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@linux.intel.com>2010-06-15 16:49:41 -0700
committerH. Peter Anvin <hpa@linux.intel.com>2010-06-15 16:49:41 -0700
commit5ddf3aedfe591ffdf3a5b8bcc1f9523c96925418 (patch)
treeb5879f90ff6652938c78d116b1fc9564496b8bf9
parent66f58cb7dc6818aa45974231b90424281311658f (diff)
downloadsyslinux-5ddf3aedfe591ffdf3a5b8bcc1f9523c96925418.tar.gz
dos: fix get_64_sl() and set_64_sl()
We must make sure we actually use the modified pointer returned from set_fs(), otherwise bad things happen... Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
-rw-r--r--libinstaller/syslxmod.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/libinstaller/syslxmod.c b/libinstaller/syslxmod.c
index bc75ecf0..b96e127a 100644
--- a/libinstaller/syslxmod.c
+++ b/libinstaller/syslxmod.c
@@ -188,9 +188,8 @@ static __noinline uint32_t get_32_sl(const uint32_t * p)
static __noinline uint64_t get_64_sl(const uint64_t * p)
{
uint32_t v0, v1;
- const uint32_t *pp = (const uint32_t *)p;
+ const uint32_t *pp = (const uint32_t *)set_fs(p);
- p = set_fs(p);
asm volatile("movl %%fs:%1,%0" : "=r" (v0) : "m" (pp[0]));
asm volatile("movl %%fs:%1,%0" : "=r" (v1) : "m" (pp[1]));
return v0 + ((uint64_t)v1 << 32);
@@ -219,9 +218,7 @@ static __noinline void set_32_sl(uint32_t * p, uint32_t v)
static __noinline void set_64_sl(uint64_t * p, uint64_t v)
{
- uint32_t *pp = (uint32_t *)p;
-
- p = set_fs(p);
+ uint32_t *pp = (uint32_t *)set_fs(p);
asm volatile("movl %1,%%fs:%0" : "=m" (pp[0]) : "ri"((uint32_t)v));
asm volatile("movl %1,%%fs:%0" : "=m" (pp[1]) : "ri"((uint32_t)(v >> 32)));
}