From 2e5061e40af88070984e3769eafb5a06022375fd Mon Sep 17 00:00:00 2001 From: Heiko Carstens Date: Wed, 30 Apr 2008 13:38:45 +0200 Subject: [S390] Convert machine feature detection code to C. From: Heiko Carstens From: Carsten Otte This lets us use defines for the magic bits in machine flags instead of using plain numbers all over the place. In addition on newer machines features/facilities are indicated by the result of the stfl instruction. So we use these bits instead of trying to execute new instructions and check wether we get an exception or not. Also the mvpg instruction is always available when in zArch mode, whereas the idte instruction is only available in zArch mode. This results in some minor optimizations. Signed-off-by: Heiko Carstens Signed-off-by: Carsten Otte Signed-off-by: Martin Schwidefsky --- include/asm-s390/system.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'include/asm-s390/system.h') diff --git a/include/asm-s390/system.h b/include/asm-s390/system.h index 79bdbf4b33a7..c819ae25a842 100644 --- a/include/asm-s390/system.h +++ b/include/asm-s390/system.h @@ -432,6 +432,14 @@ static inline unsigned int stfl(void) return S390_lowcore.stfl_fac_list; } +static inline unsigned short stap(void) +{ + unsigned short cpu_address; + + asm volatile("stap %0" : "=m" (cpu_address)); + return cpu_address; +} + extern void (*_machine_restart)(char *command); extern void (*_machine_halt)(void); extern void (*_machine_power_off)(void); -- cgit v1.2.3