Skip to content

Commit a9afda3

Browse files
i#7909 unknown cache: Add 48KB cache size enum (#7921)
Adds support for a 48KB cache size by adding an enum value. We don't have a mock hardware query set up so it's not simple to add a test, unfortunately. Fixes #7909
1 parent c00adbd commit a9afda3

2 files changed

Lines changed: 17 additions & 14 deletions

File tree

core/arch/proc_api.h

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* **********************************************************
2-
* Copyright (c) 2010-2025 Google, Inc. All rights reserved.
2+
* Copyright (c) 2010-2026 Google, Inc. All rights reserved.
33
* Copyright (c) 2002-2010 VMware, Inc. All rights reserved.
44
* **********************************************************/
55

@@ -439,16 +439,17 @@ typedef enum {
439439
* proc_get_cache_size_str().
440440
*/
441441
typedef enum {
442-
CACHE_SIZE_8_KB, /**< L1 or L2 cache size of 8 KB. */
443-
CACHE_SIZE_16_KB, /**< L1 or L2 cache size of 16 KB. */
444-
CACHE_SIZE_32_KB, /**< L1 or L2 cache size of 32 KB. */
445-
CACHE_SIZE_64_KB, /**< L1 or L2 cache size of 64 KB. */
446-
CACHE_SIZE_128_KB, /**< L1 or L2 cache size of 128 KB. */
447-
CACHE_SIZE_256_KB, /**< L1 or L2 cache size of 256 KB. */
448-
CACHE_SIZE_512_KB, /**< L1 or L2 cache size of 512 KB. */
449-
CACHE_SIZE_1_MB, /**< L1 or L2 cache size of 1 MB. */
450-
CACHE_SIZE_2_MB, /**< L1 or L2 cache size of 2 MB. */
451-
CACHE_SIZE_UNKNOWN /**< Unknown L1 or L2 cache size. */
442+
CACHE_SIZE_8_KB, /**< L1 or L2 cache size of 8 KB. */
443+
CACHE_SIZE_16_KB, /**< L1 or L2 cache size of 16 KB. */
444+
CACHE_SIZE_32_KB, /**< L1 or L2 cache size of 32 KB. */
445+
CACHE_SIZE_64_KB, /**< L1 or L2 cache size of 64 KB. */
446+
CACHE_SIZE_128_KB, /**< L1 or L2 cache size of 128 KB. */
447+
CACHE_SIZE_256_KB, /**< L1 or L2 cache size of 256 KB. */
448+
CACHE_SIZE_512_KB, /**< L1 or L2 cache size of 512 KB. */
449+
CACHE_SIZE_1_MB, /**< L1 or L2 cache size of 1 MB. */
450+
CACHE_SIZE_2_MB, /**< L1 or L2 cache size of 2 MB. */
451+
CACHE_SIZE_UNKNOWN, /**< Unknown L1 or L2 cache size. */
452+
CACHE_SIZE_48_KB, /**< L1 or L2 cache size of 48 KB. */
452453
} cache_size_t;
453454

454455
DR_API

core/arch/proc_shared.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ proc_set_cache_size(uint val, uint *dst)
103103
case 8: *dst = CACHE_SIZE_8_KB; break;
104104
case 16: *dst = CACHE_SIZE_16_KB; break;
105105
case 32: *dst = CACHE_SIZE_32_KB; break;
106+
case 48: *dst = CACHE_SIZE_48_KB; break;
106107
case 64: *dst = CACHE_SIZE_64_KB; break;
107108
case 128: *dst = CACHE_SIZE_128_KB; break;
108109
case 256: *dst = CACHE_SIZE_256_KB; break;
@@ -255,9 +256,10 @@ proc_get_L2_cache_size(void)
255256
const char *
256257
proc_get_cache_size_str(cache_size_t size)
257258
{
258-
static const char *strings[] = { "8 KB", "16 KB", "32 KB", "64 KB", "128 KB",
259-
"256 KB", "512 KB", "1 MB", "2 MB", "unknown" };
260-
CLIENT_ASSERT(size <= CACHE_SIZE_UNKNOWN, "proc_get_cache_size_str: invalid size");
259+
static const char *strings[] = { "8 KB", "16 KB", "32 KB", "64 KB",
260+
"128 KB", "256 KB", "512 KB", "1 MB",
261+
"2 MB", "unknown", "48 KB" };
262+
CLIENT_ASSERT(size <= CACHE_SIZE_48_KB, "proc_get_cache_size_str: invalid size");
261263
return strings[size];
262264
}
263265

0 commit comments

Comments
 (0)