Commit graph

166 commits

Author SHA1 Message Date
Fernando Sahmkow
6a3eca65ea MemoryManager: Fix errors popping out. 2022-10-06 21:00:53 +02:00
Kyle Kienapfel
ea00332a67 code: dodge PAGE_SIZE #define
Some header files, specifically for OSX and Musl libc define PAGE_SIZE to be a number
This is great except in yuzu we're using PAGE_SIZE as a variable

Specific example
`static constexpr u64 PAGE_SIZE = u64(1) << PAGE_BITS;`

PAGE_SIZE PAGE_BITS PAGE_MASK are all similar variables.
Simply deleted the underscores, and then added YUZU_ prefix

Might be worth noting that there are multiple uses in different classes/namespaces
This list may not be exhaustive

Core::Memory   12 bits (4096)
QueryCacheBase 12 bits
ShaderCache    14 bits (16384)
TextureCache   20 bits (1048576, or 1MB)

Fixes #8779
2022-08-19 16:08:40 -07:00
Andrea Pappacoda
6a2efdda2f chore: make yuzu REUSE compliant
[REUSE] is a specification that aims at making file copyright
information consistent, so that it can be both human and machine
readable. It basically requires that all files have a header containing
copyright and licensing information. When this isn't possible, like
when dealing with binary assets, generated files or embedded third-party
dependencies, it is permitted to insert copyright information in the
`.reuse/dep5` file.

Oh, and it also requires that all the licenses used in the project are
present in the `LICENSES` folder, that's why the diff is so huge.
This can be done automatically with `reuse download --all`.

The `reuse` tool also contains a handy subcommand that analyzes the
project and tells whether or not the project is (still) compliant,
`reuse lint`.

Following REUSE has a few advantages over the current approach:

- Copyright information is easy to access for users / downstream
- Files like `dist/license.md` do not need to exist anymore, as
  `.reuse/dep5` is used instead
- `reuse lint` makes it easy to ensure that copyright information of
  files like binary assets / images is always accurate and up to date

To add copyright information of files that didn't have it I looked up
who committed what and when, for each file. As yuzu contributors do not
have to sign a CLA or similar I couldn't assume that copyright ownership
was of the "yuzu Emulator Project", so I used the name and/or email of
the commit author instead.

[REUSE]: https://reuse.software

Follow-up to b2eb103829
2022-07-27 12:53:49 +02:00
Kelebek1
be1f5f1d9f Project Andio 2022-07-22 01:11:32 +01:00
Liam
8d2abc710c core/debugger: memory breakpoint support 2022-06-16 13:18:07 -04:00
Liam
2ee161a0bf core/debugger: Implement new GDB stub debugger 2022-06-01 00:01:25 -04:00
bunnei
b149526098 Revert "Memory GPU <-> CPU: reduce infighting in the texture cache by adding CPU Cached memory." 2022-03-26 12:38:30 -07:00
Fernando Sahmkow
6e2cfc4310 Memory: Don't protect reads on Normal accuracy. 2022-03-25 04:24:25 +01:00
bunnei
b928936457 core: device_memory: Use memory size reported by KSystemControl.
- That way, we can consolidate the memory layout to one place.
2022-02-21 13:07:19 -08:00
Andrew Strelsky
5a02e7aabf prevent access violation from iob in Memory::IsValidVirtualAddress 2021-09-29 19:26:44 -04:00
yzct12345
b61be44dbc memory: Address lioncash's review 2021-08-07 03:03:21 +00:00
yzct12345
a21f46127b memory: Dedup Read and Write and fix logging bugs 2021-08-07 01:32:06 +00:00
yzct12345
7a421e7e33 memory: Clean up CopyBlock too 2021-08-05 21:09:08 +00:00
yzct12345
fa26e226de memory: Address lioncash's review 2021-08-05 20:29:43 +00:00
yzct12345
cbe093e865 memory: Clean up code 2021-08-05 20:11:14 +00:00
FernandoS27
3147b9e34c General: Add settings for fastmem and disabling adress space check. 2021-06-11 17:27:17 +02:00
Markus Wick
99f6d60a99 core: Make use of fastmem 2021-06-11 17:27:06 +02:00
Markus Wick
870505def8 core/memory: Check our memory fallbacks for out-of-bound behavior.
This makes it by far harder to crash yuzu.

Also implement the 48bit masking of AARCH64 while touching this code.
2021-05-29 09:28:26 +02:00
bunnei
227f9e5ab2 hle: kernel: Use host memory allocations for KSlabMemory.
- There are some issues with the current workaround, we will just use host memory until we have a complete kernel memory implementation.
2021-05-20 21:41:52 -07:00
bunnei
ad048de3d6 hle: kernel: Rename Process to KProcess. 2021-05-05 16:40:52 -07:00
bunnei
4aebdea6cf core: memory: Add a work-around to allocate and access kernel memory regions by vaddr. 2021-05-05 16:40:50 -07:00
bunnei
5dbcaa2970 hle: kernel: Migrate PageHeap/PageTable to KPageHeap/KPageTable. 2021-02-18 16:16:25 -08:00
MerryMage
e3490b55c1 memory: Remove MemoryHook 2021-01-01 11:34:38 +00:00
ReinUsesLisp
8bfa4d6dbf core/memory: Read and write page table atomically
Squash attributes into the pointer's integer, making them an uintptr_t
pair containing 2 bits at the bottom and then the pointer. These bits
are currently unused thanks to alignment requirements.

Configure Dynarmic to mask out these bits on pointer reads.

While we are at it, remove some unused attributes carried over from
Citra.

Read/Write and other hot functions use a two step unpacking process that
is less readable to stop MSVC from emitting an extra AND instruction in
the hot path:

 mov         rdi,rcx
 shr         rdx,0Ch
 mov         r8,qword ptr [rax+8]
 mov         rax,qword ptr [r8+rdx*8]
 mov         rdx,rax
-and         al,3
 and         rdx,0FFFFFFFFFFFFFFFCh
 je          Core::Memory::Memory::Impl::Read<unsigned char>
 mov         rax,qword ptr [vaddr]
 movzx       eax,byte ptr [rdx+rax]
2020-12-29 21:54:49 -03:00
bunnei
eb609b73a7 core: memory: Ensure thread safe access when pages are rasterizer cached (#5206)
* core: memory: Ensure thread safe access when pages are rasterizer cached.
2020-12-24 21:51:49 -08:00
Lioncash
024c10b697 memory: Resolve -Wdocumentation warning for Write()
Write() doesn't return anything, so the @returns tag shouldn't be
present.
2020-12-08 12:44:58 -05:00
bunnei
deb3536936 Revert "core: Fix clang build" 2020-10-20 19:07:39 -07:00
Lioncash
18636013c9 core: Fix clang build
Recent changes to the build system that made more warnings be flagged as
errors caused building via clang to break.

Fixes #4795
2020-10-17 19:50:39 -04:00
Lioncash
16de0a6a96 core/CMakeLists: Make some warnings errors
Makes our error coverage a little more consistent across the board by
applying it to Linux side of things as well. This also makes it more
consistent with the warning settings in other libraries in the project.

This also updates httplib to 0.7.9, as there are several warning
cleanups made that allow us to enable several warnings as errors.
2020-10-13 13:16:49 -04:00
Lioncash
3abd28c35a memory: Resolve a -Wdocumentation warning
memory doesn't exist as a parameter any more.
2020-09-23 13:39:27 -04:00
Lioncash
32ce1467e5 common/atomic_ops: Don't cast away volatile from pointers
Preserves the volatility of the pointers being casted.
2020-07-28 04:36:53 -04:00
MerryMage
f0019f2176 memory: Set page-table pointers before setting attribute = Memory 2020-07-05 12:54:19 +01:00
Fernando Sahmkow
cc2f7dcd08 General: Initial Setup for Single Core. 2020-06-27 11:35:42 -04:00
Fernando Sahmkow
5eac520ae3 ARM/Memory: Correct Exclusive Monitor and Implement Exclusive Memory Writes. 2020-06-27 11:35:37 -04:00
Fernando Sahmkow
7ee76003ad General: Recover Prometheus project from harddrive failure
This commit: Implements CPU Interrupts, Replaces Cycle Timing for Host 
Timing, Reworks the Kernel's Scheduler, Introduce Idle State and 
Suspended State, Recreates the bootmanager, Initializes Multicore 
system.
2020-06-27 11:35:06 -04:00
bunnei
8a67b3058e core: memory: Fix memory access on page boundaries.
- Fixes Super Smash Bros. Ultimate.
2020-04-17 00:59:34 -04:00
bunnei
43321c1a69 core: memory: Updates for new VMM. 2020-04-17 00:59:34 -04:00
bunnei
5b9e69e7fe core: memory: Move to Core::Memory namespace.
- helpful to disambiguate Kernel::Memory namespace.
2020-04-17 00:59:28 -04:00
Fernando Sahmkow
3728c7160f Buffer Cache: Use vAddr instead of physical memory. 2020-04-06 09:23:06 -04:00
Fernando Sahmkow
5cc292ac3c GPU: Setup Flush/Invalidate to use VAddr instead of CacheAddr 2020-04-06 09:21:46 -04:00
Markus Wick
4042bd107b core/memory: Create a special MapMemoryRegion for physical memory.
This allows us to create a fastmem arena within the memory.cpp helpers.
2020-01-18 08:38:47 +01:00
Markus Wick
f74d95547e core/memory + arm/dynarmic: Use a global offset within our arm page table.
This saves us two x64 instructions per load/store instruction.

TODO: Clean up our memory code. We can use this optimization here as well.
2020-01-01 12:24:54 +01:00
Lioncash
50906bcf42 core/memory; Migrate over SetCurrentPageTable() to the Memory class
Now that literally every other API function is converted over to the
Memory class, we can just move the file-local page table into the Memory
implementation class, finally getting rid of global state within the
memory code.
2019-11-26 21:55:39 -05:00
Lioncash
d03fbad80f core/memory: Migrate over GetPointerFromVMA() to the Memory class
Now that everything else is migrated over, this is essentially just code
relocation and conversion of a global accessor to the class member
variable.

All that remains is to migrate over the page table.
2019-11-26 21:55:39 -05:00
Lioncash
b5f69f4cc9 core/memory: Migrate over Write{8, 16, 32, 64, Block} to the Memory class
The Write functions are used slightly less than the Read functions,
which make these a bit nicer to move over.

The only adjustments we really need to make here are to Dynarmic's
exclusive monitor instance. We need to keep a reference to the currently
active memory instance to perform exclusive read/write operations.
2019-11-26 21:55:39 -05:00
Lioncash
cc3d6fdf73 core/memory: Migrate over Read{8, 16, 32, 64, Block} to the Memory class
With all of the trivial parts of the memory interface moved over, we can
get right into moving over the bits that are used.

Note that this does require the use of GetInstance from the global
system instance to be used within hle_ipc.cpp and the gdbstub. This is
fine for the time being, as they both already rely on the global system
instance in other functions. These will be removed in a change directed
at both of these respectively.

For now, it's sufficient, as it still accomplishes the goal of
de-globalizing the memory code.
2019-11-26 21:55:39 -05:00
Lioncash
9e3cbf71fc core/memory: Migrate over ZeroBlock() and CopyBlock() to the Memory class
These currently aren't used anywhere in the codebase, so these are very
trivial to move over to the Memory class.
2019-11-26 21:55:38 -05:00
Lioncash
ad85ba53dd core/memory: Migrate over RasterizerMarkRegionCached() to the Memory class
This is only used within the accelerated rasterizer in two places, so
this is also a very trivial migration.
2019-11-26 21:55:38 -05:00
Lioncash
8d306269d0 core/memory: Migrate over ReadCString() to the Memory class
This only had one usage spot, so this is fairly straightforward to
convert over.
2019-11-26 21:55:38 -05:00
Lioncash
7110e6a128 core/memory: Migrate over GetPointer()
With all of the interfaces ready for migration, it's trivial to migrate
over GetPointer().
2019-11-26 21:55:38 -05:00