summaryrefslogtreecommitdiff
path: root/i386
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2008-11-23 20:42:36 +0000
committerThomas Schwinge <tschwinge@gnu.org>2009-06-18 00:27:21 +0200
commita2432a9b39b470aace2210f9cc4fb790df9c8702 (patch)
tree586a53100e93bbadbf58aeef982199bb00916559 /i386
parent526c44d37472ead7edd3356a70733fe9e01db643 (diff)
2008-11-23 Samuel Thibault <samuel.thibault@ens-lyon.org>
* i386/i386/proc_reg.h (get_cr0, get_cr2, get_cr3, get_cr4, get_tr, get_ldt): Add volatile qualifier to asm statement to prevent gcc from optimizing it away since there seems to be no way to clobber these properly in the set_* macros.
Diffstat (limited to 'i386')
-rw-r--r--i386/i386/proc_reg.h12
1 files changed, 6 insertions, 6 deletions
diff --git a/i386/i386/proc_reg.h b/i386/i386/proc_reg.h
index 448b645..7ccc2aa 100644
--- a/i386/i386/proc_reg.h
+++ b/i386/i386/proc_reg.h
@@ -102,7 +102,7 @@ set_eflags(unsigned eflags)
#define get_cr0() \
({ \
register unsigned int _temp__; \
- asm("mov %%cr0, %0" : "=r" (_temp__)); \
+ asm volatile("mov %%cr0, %0" : "=r" (_temp__)); \
_temp__; \
})
@@ -115,14 +115,14 @@ set_eflags(unsigned eflags)
#define get_cr2() \
({ \
register unsigned int _temp__; \
- asm("mov %%cr2, %0" : "=r" (_temp__)); \
+ asm volatile("mov %%cr2, %0" : "=r" (_temp__)); \
_temp__; \
})
#define get_cr3() \
({ \
register unsigned int _temp__; \
- asm("mov %%cr3, %0" : "=r" (_temp__)); \
+ asm volatile("mov %%cr3, %0" : "=r" (_temp__)); \
_temp__; \
})
@@ -137,7 +137,7 @@ set_eflags(unsigned eflags)
#define get_cr4() \
({ \
register unsigned int _temp__; \
- asm("mov %%cr4, %0" : "=r" (_temp__)); \
+ asm volatile("mov %%cr4, %0" : "=r" (_temp__)); \
_temp__; \
})
@@ -157,7 +157,7 @@ set_eflags(unsigned eflags)
#define get_tr() \
({ \
unsigned short _seg__; \
- asm("str %0" : "=rm" (_seg__) ); \
+ asm volatile("str %0" : "=rm" (_seg__) ); \
_seg__; \
})
@@ -167,7 +167,7 @@ set_eflags(unsigned eflags)
#define get_ldt() \
({ \
unsigned short _seg__; \
- asm("sldt %0" : "=rm" (_seg__) ); \
+ asm volatile("sldt %0" : "=rm" (_seg__) ); \
_seg__; \
})