From d9b262b49d1e5cb6f6b0580fc052bbdbb3f1b022 Mon Sep 17 00:00:00 2001 From: ad Date: Thu, 22 May 2008 13:55:51 +0000 Subject: [PATCH] Mark x86_curlwp() with __attribute__ ((const)), so gcc can CSE it and know that it does not clobber global data. --- sys/arch/amd64/include/cpu.h | 4 ++-- sys/arch/i386/include/cpu.h | 4 ++-- sys/arch/x86/include/cpu.h | 8 ++++++-- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/sys/arch/amd64/include/cpu.h b/sys/arch/amd64/include/cpu.h index 7a6ef580b9d1..83025f4a7983 100644 --- a/sys/arch/amd64/include/cpu.h +++ b/sys/arch/amd64/include/cpu.h @@ -1,4 +1,4 @@ -/* $NetBSD: cpu.h,v 1.56 2008/05/11 16:57:43 ad Exp $ */ +/* $NetBSD: cpu.h,v 1.57 2008/05/22 13:55:51 ad Exp $ */ /*- * Copyright (c) 1990 The Regents of the University of California. @@ -57,7 +57,7 @@ x86_curcpu(void) return ci; } -__inline static lwp_t * __unused +__inline static lwp_t * __unused __attribute__ ((const)) x86_curlwp(void) { lwp_t *l; diff --git a/sys/arch/i386/include/cpu.h b/sys/arch/i386/include/cpu.h index 1a7833f0381f..32f3e6717702 100644 --- a/sys/arch/i386/include/cpu.h +++ b/sys/arch/i386/include/cpu.h @@ -1,4 +1,4 @@ -/* $NetBSD: cpu.h,v 1.174 2008/05/11 16:57:43 ad Exp $ */ +/* $NetBSD: cpu.h,v 1.175 2008/05/22 13:55:51 ad Exp $ */ /*- * Copyright (c) 1990 The Regents of the University of California. @@ -57,7 +57,7 @@ x86_curcpu(void) return ci; } -__inline static lwp_t * __unused +__inline static lwp_t * __attribute__ ((const)) x86_curlwp(void) { lwp_t *l; diff --git a/sys/arch/x86/include/cpu.h b/sys/arch/x86/include/cpu.h index 20792384f10d..a7990dd664ff 100644 --- a/sys/arch/x86/include/cpu.h +++ b/sys/arch/x86/include/cpu.h @@ -1,4 +1,4 @@ -/* $NetBSD: cpu.h,v 1.4 2008/05/12 14:41:07 ad Exp $ */ +/* $NetBSD: cpu.h,v 1.5 2008/05/22 13:55:51 ad Exp $ */ /*- * Copyright (c) 1990 The Regents of the University of California. @@ -238,8 +238,12 @@ extern struct cpu_info *cpu_info_list; #if !defined(__GNUC__) || defined(_LKM) /* For non-GCC and modules */ struct cpu_info *x86_curcpu(void); -lwp_t *x86_curlwp(void); void cpu_set_curpri(int); +# ifdef __GNUC__ +lwp_t *x86_curlwp(void) __attribute__ ((const)); +# else +lwp_t *x86_curlwp(void); +# endif #endif #define cpu_number() (cpu_index(curcpu()))