Make ipl_t and ipl_cookie_t 8-bit values. kmutex is now down to 12 bytes

(from 20) on ARM.

Approved by Matt Thomas.
This commit is contained in:
thorpej 2007-03-09 06:45:19 +00:00
parent 02530653ff
commit d1d10b58ab
8 changed files with 28 additions and 23 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: intr.h,v 1.10 2007/02/16 02:53:43 ad Exp $ */
/* $NetBSD: intr.h,v 1.11 2007/03/09 06:45:19 thorpej Exp $ */
/*-
* Copyright (c) 1998, 2000 Ben Harris
* All rights reserved.
@ -86,7 +86,7 @@ extern int raisespl(int);
extern void lowerspl(int);
extern int hardsplx(int);
typedef int ipl_t;
typedef uint8_t ipl_t;
typedef struct {
ipl_t _ipl;
} ipl_cookie_t;

View File

@ -1,4 +1,4 @@
/* $NetBSD: intr.c,v 1.20 2007/02/20 04:14:23 matt Exp $ */
/* $NetBSD: intr.c,v 1.21 2007/03/09 06:45:19 thorpej Exp $ */
/*
* Copyright (c) 1994-1998 Mark Brinicombe.
@ -36,7 +36,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.20 2007/02/20 04:14:23 matt Exp $");
__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.21 2007/03/09 06:45:19 thorpej Exp $");
#include "opt_irqstats.h"
@ -204,12 +204,17 @@ static const int ipl_to_spl_map[] = {
};
int
ipl_to_spl(int ipl)
ipl_to_spl(ipl_t ipl)
{
int spl;
KASSERT(ipl < __arraycount(ipl_to_spl_map));
KASSERT(ipl_to_spl_map[ipl]);
return ipl_to_spl_map[ipl] - 1;
spl = ipl_to_spl_map[ipl] - 1;
KASSERT(spl < 0x100);
return spl;
}
#ifdef DIAGNOSTIC

View File

@ -1,4 +1,4 @@
/* $NetBSD: footbridge_intr.h,v 1.9 2006/12/21 15:55:22 yamt Exp $ */
/* $NetBSD: footbridge_intr.h,v 1.10 2007/03/09 06:45:20 thorpej Exp $ */
/*
* Copyright (c) 2001, 2002 Wasabi Systems, Inc.
@ -176,7 +176,7 @@ void _setsoftintr(int);
#define spl0() (void)_spllower(IPL_NONE)
#define spllowersoftclock() (void)_spllower(IPL_SOFTCLOCK)
typedef int ipl_t;
typedef uint8_t ipl_t;
typedef struct {
ipl_t _ipl;
} ipl_cookie_t;

View File

@ -1,4 +1,4 @@
/* $NetBSD: psl.h,v 1.9 2007/02/18 07:48:20 matt Exp $ */
/* $NetBSD: psl.h,v 1.10 2007/03/09 06:45:20 thorpej Exp $ */
/*
* Copyright (c) 1995 Mark Brinicombe.
@ -104,9 +104,9 @@ extern int current_spl_level;
extern u_int spl_masks[_SPL_LEVELS + 1];
typedef int ipl_t;
typedef uint8_t ipl_t;
typedef struct {
int _spl;
uint8_t _spl;
} ipl_cookie_t;
int ipl_to_spl(ipl_t);
@ -115,7 +115,7 @@ static inline ipl_cookie_t
makeiplcookie(ipl_t ipl)
{
return (ipl_cookie_t){._spl = ipl_to_spl(ipl)};
return (ipl_cookie_t){._spl = (uint8_t)ipl_to_spl(ipl)};
}
static inline int

View File

@ -1,4 +1,4 @@
/* $NetBSD: mutex.h,v 1.2 2007/03/09 05:40:08 thorpej Exp $ */
/* $NetBSD: mutex.h,v 1.3 2007/03/09 06:45:20 thorpej Exp $ */
/*-
* Copyright (c) 2002, 2007 The NetBSD Foundation, Inc.
@ -84,7 +84,7 @@
struct kmutex {
uintptr_t mtx_pad1;
uint32_t mtx_pad2[4];
uint32_t mtx_pad2[2];
};
#else /* __MUTEX_PRIVATE */
@ -93,9 +93,9 @@ struct kmutex {
volatile uintptr_t mtx_owner; /* 0-3 */
__cpu_simple_lock_t mtx_interlock; /* 4 */
__cpu_simple_lock_t mtx_lock; /* 5 */
uint8_t mtx_pad[2]; /* 6-7 XXX */
ipl_cookie_t mtx_ipl; /* 8-11 */
uint32_t mtx_id; /* 16-19 */
ipl_cookie_t mtx_ipl; /* 6 */
uint8_t mtx_pad; /* 7 */
uint32_t mtx_id; /* 8-11 */
};
#if 0

View File

@ -1,4 +1,4 @@
/* $NetBSD: intr.h,v 1.16 2007/02/16 02:53:45 ad Exp $ */
/* $NetBSD: intr.h,v 1.17 2007/03/09 06:45:20 thorpej Exp $ */
/*
* Copyright (c) 2001, 2003 Wasabi Systems, Inc.
@ -150,7 +150,7 @@ void _setsoftintr(int);
#define splsoft() _splraise(IPL_SOFT)
typedef int ipl_t;
typedef uint8_t ipl_t;
typedef struct {
ipl_t _ipl;
} ipl_cookie_t;

View File

@ -1,4 +1,4 @@
/* $NetBSD: intr.h,v 1.6 2007/02/16 02:53:47 ad Exp $ */
/* $NetBSD: intr.h,v 1.7 2007/03/09 06:45:20 thorpej Exp $ */
/*
* Copyright (c) 2001, 2003 Wasabi Systems, Inc.
@ -136,7 +136,7 @@ void _setsoftintr(int);
#define splsoft() _splraise(IPL_SOFT)
typedef int ipl_t;
typedef uint8_t ipl_t;
typedef struct {
ipl_t _ipl;
} ipl_cookie_t;

View File

@ -1,4 +1,4 @@
/* $NetBSD: intr.h,v 1.3 2007/02/16 02:53:52 ad Exp $ */
/* $NetBSD: intr.h,v 1.4 2007/03/09 06:45:20 thorpej Exp $ */
/*
* Copyright (c) 2001, 2003 Wasabi Systems, Inc.
@ -150,7 +150,7 @@ void _setsoftintr(int);
#define splsoft() _splraise(IPL_SOFT)
typedef int ipl_t;
typedef uint8_t ipl_t;
typedef struct {
ipl_t _ipl;
} ipl_cookie_t;