Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F102641652
D42262.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D42262.diff
View Options
diff --git a/sys/arm/arm/cpufunc.c b/sys/arm/arm/cpufunc.c
--- a/sys/arm/arm/cpufunc.c
+++ b/sys/arm/arm/cpufunc.c
@@ -61,8 +61,8 @@
/* PRIMARY CACHE VARIABLES */
-int arm_dcache_align;
-int arm_dcache_align_mask;
+unsigned int arm_dcache_align;
+unsigned int arm_dcache_align_mask;
#ifdef CPU_MV_PJ4B
static void pj4bv7_setup(void);
@@ -170,7 +170,7 @@
: : "r" (sel));
__asm __volatile("mrc p15, 1, %0, c0, c0, 0"
: "=r" (csize));
- arm_dcache_align = 1 <<
+ arm_dcache_align = 1U <<
(CPUV7_CT_xSIZE_LEN(csize) + 4);
}
if (type == CACHE_ICACHE || type == CACHE_SEP_CACHE) {
diff --git a/sys/vm/uma.h b/sys/vm/uma.h
--- a/sys/vm/uma.h
+++ b/sys/vm/uma.h
@@ -475,7 +475,7 @@
* Returns:
* Nothing
*/
-void uma_set_cache_align_mask(int mask);
+void uma_set_cache_align_mask(unsigned int mask);
#include <vm/uma_align_mask.h>
diff --git a/sys/vm/uma_align_mask.h b/sys/vm/uma_align_mask.h
--- a/sys/vm/uma_align_mask.h
+++ b/sys/vm/uma_align_mask.h
@@ -31,6 +31,6 @@
#ifndef _VM_UMA_ALIGN_MASK_H_
#define _VM_UMA_ALIGN_MASK_H_
-int uma_get_cache_align_mask(void) __pure;
+unsigned int uma_get_cache_align_mask(void) __pure;
#endif /* !_VM_UMA_ALIGN_MASK_H_ */
diff --git a/sys/vm/uma_core.c b/sys/vm/uma_core.c
--- a/sys/vm/uma_core.c
+++ b/sys/vm/uma_core.c
@@ -150,7 +150,7 @@
static uma_zone_t hashzone;
/* The boot-time adjusted value for cache line alignment. */
-static int uma_cache_align_mask = 64 - 1;
+static unsigned int uma_cache_align_mask = 64 - 1;
static MALLOC_DEFINE(M_UMAHASH, "UMAHash", "UMA Hash Buckets");
static MALLOC_DEFINE(M_UMA, "UMA", "UMA Misc");
@@ -3252,15 +3252,20 @@
/* Public functions */
/* See uma.h */
void
-uma_set_cache_align_mask(int mask)
+uma_set_cache_align_mask(unsigned int mask)
{
- if (mask >= 0)
- uma_cache_align_mask = mask;
+ /*
+ * Make sure the stored align mask doesn't have its highest bit set,
+ * which would cause implementation-defined behavior when passing it as
+ * the 'align' argument of uma_zcreate(). Such very large alignments do
+ * not make sense anyway.
+ */
+ uma_cache_align_mask = mask & ~(1U << 31);
}
/* Returns the alignment mask to use to request cache alignment. */
-int
+unsigned int
uma_get_cache_align_mask(void)
{
return (uma_cache_align_mask);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Nov 16, 5:42 AM (21 h, 1 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
14653887
Default Alt Text
D42262.diff (2 KB)
Attached To
Mode
D42262: uma: Make the cache alignment mask unsigned
Attached
Detach File
Event Timeline
Log In to Comment