Changeset View
Changeset View
Standalone View
Standalone View
source/lib/sysdep/arch/x86_x64/cache.cpp
/* Copyright (C) 2018 Wildfire Games. | /* Copyright (C) 2020 Wildfire Games. | ||||
* | * | ||||
* Permission is hereby granted, free of charge, to any person obtaining | * Permission is hereby granted, free of charge, to any person obtaining | ||||
* a copy of this software and associated documentation files (the | * a copy of this software and associated documentation files (the | ||||
* "Software"), to deal in the Software without restriction, including | * "Software"), to deal in the Software without restriction, including | ||||
* without limitation the rights to use, copy, modify, merge, publish, | * without limitation the rights to use, copy, modify, merge, publish, | ||||
* distribute, sublicense, and/or sell copies of the Software, and to | * distribute, sublicense, and/or sell copies of the Software, and to | ||||
* permit persons to whom the Software is furnished to do so, subject to | * permit persons to whom the Software is furnished to do so, subject to | ||||
* the following conditions: | * the following conditions: | ||||
▲ Show 20 Lines • Show All 74 Lines • ▼ Show 20 Lines | static x86_x64::Cache L1Cache(u32 reg, x86_x64::Cache::Type type) | ||||
} | } | ||||
return cache; | return cache; | ||||
} | } | ||||
// applies to L2, L3 and TLB2 | // applies to L2, L3 and TLB2 | ||||
static const size_t associativityTable[16] = | static const size_t associativityTable[16] = | ||||
{ | { | ||||
0, 1, 2, 0, 4, 0, 8, 0, | 0, 1, 2, 0, 4, 0, 8, 0, | ||||
// TODO: The second '16' does not obey to the specifications and is only a workaround. For a correct implementation please look here: https://community.amd.com/thread/244207 | 16, 0, 32, 48, 64, 96, 128, x86_x64::Cache::fullyAssociative | ||||
16, 16, 32, 48, 64, 96, 128, x86_x64::Cache::fullyAssociative | |||||
}; | }; | ||||
static x86_x64::Cache L2Cache(u32 reg, x86_x64::Cache::Type type) | static x86_x64::Cache L2Cache(u32 reg, x86_x64::Cache::Type type) | ||||
{ | { | ||||
x86_x64::Cache cache; | x86_x64::Cache cache; | ||||
cache.Initialize(2, type); | cache.Initialize(2, type); | ||||
const size_t lineSize = bits(reg, 0, 7); | const size_t lineSize = bits(reg, 0, 7); | ||||
▲ Show 20 Lines • Show All 560 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator