From a2432a9b39b470aace2210f9cc4fb790df9c8702 Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Sun, 23 Nov 2008 20:42:36 +0000 Subject: 2008-11-23 Samuel Thibault * 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. --- ChangeLog | 7 +++++++ i386/i386/proc_reg.h | 12 ++++++------ 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3688782..868bd10 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2008-11-23 Samuel Thibault + + * 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. + 2008-11-17 Thomas Schwinge * Makefile.am (install_sh, INSTALL): Point to `build-aux/install-sh'. 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__; \ }) -- cgit v1.2.3