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. --- i386/i386/proc_reg.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'i386') 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