Nekotekina
63104af8e9
vm_native: detect overcommit support on FreeBSD and other OS
...
Used in sparse memory initialization code.
2021-08-30 14:42:16 +03:00
Jan Beich
3a6399aaaa
vm_native: add workaround for FreeBSD 12
...
rpcs3/util/vm_native.cpp:302:16: error: no member named 'memfd_create' in the global namespace
m_file = ::memfd_create_("2M", c_mfd_huge_2mb);
~~^
rpcs3/util/vm_native.cpp:34:23: note: expanded from macro 'memfd_create_'
#define memfd_create_ memfd_create
^
rpcs3/util/vm_native.cpp:308:15: error: no member named 'memfd_create' in the global namespace
m_file = ::memfd_create_("", 0);
~~^
rpcs3/util/vm_native.cpp:34:23: note: expanded from macro 'memfd_create_'
#define memfd_create_ memfd_create
^
2021-07-29 20:48:10 +03:00
Jan Beich
de6f3b5653
vm_native: enable memfd_create on FreeBSD
2021-07-29 20:48:10 +03:00
Nekotekina
6f874be41b
vm_native: bypass rpcs3_vm creation if overcommit is enabled (Linux)
...
Unfortunately, different systems need different approach here.
2021-06-12 19:12:59 +03:00
Nekotekina
dfbd63df94
vm_native.cpp: change rpcs3_vm name/location priority (Win32)
...
Prefer temp directory, rename to rpcs3_vm_sparse.tmp
Try to remove archive attribute (doesn't work well).
2021-06-11 19:15:21 +03:00
Nekotekina
7311c161f6
vm_native: fix Linux/Posix sparse file check
...
Fix fast path condition (xnor is not ==, facepalm).
Increase probe size.
Should fix #10334
Closes #10335
Co-authored-by: Jan Beich <jbeich@FreeBSD.org>
2021-05-25 09:55:43 +03:00
Nekotekina
5db38c0127
vm_native: improve sparse file check (Linux/BSD)
...
Use lseek(FIND_DATA) to check for sparse file support.
2021-05-24 18:21:52 +03:00
Nekotekina
191cb92300
vm_native: improve sparse file implementation (Win32)
...
Fix sparse attribute set/check, improve logic.
Implement actual check of file data.
Ask to restart RPCS3 first time (Win7 bug).
2021-05-24 18:21:52 +03:00
Nekotekina
160b131de3
types.hpp: implement smin, smax, amin, amax
...
Rewritten the following global utility constants:
`umax` returns max number, restricted to unsigned.
`smax` returns max signed number, restricted to integrals.
`smin` returns min signed number, restricted to signed.
`amin` returns smin or zero, less restricted.
`amax` returns smax or umax, less restricted.
Fix operators == and <=> for synthesized rel-ops.
2021-05-22 12:10:57 +03:00
Nekotekina
613777afde
vm_native: try to workaround another bug (Win32)
...
Resize sparse file gradually.
2021-05-22 08:16:54 +03:00
Nekotekina
16620f6835
vm_native: sparse file fixup (Win32)
...
Clear file if it occupies blocks.
Makes it more fool-proof and fixes possible bug.
2021-05-19 22:41:16 +03:00
Nekotekina
6e497ae372
vm: disable sparse files on win7
2021-05-18 13:31:46 +03:00
Nekotekina
2a26bc6668
Fix page mapping rights to file mapping
2021-05-13 13:49:24 +03:00
Nekotekina
126141cdce
vm_native: improve sparse file handling
...
Don't specify O_TRUNC every time.
Add portable support test (Linux/Unix).
Use PAGE_WRITECOPY (Windows).
2021-05-13 10:23:33 +03:00
Nekotekina
0bd64a0e72
Don't fatal on sparse file initialization failure
...
Also try two different locations (Win32).
2021-05-10 00:39:28 +03:00
Nekotekina
1b0b2fe21e
vm: add "hook" memory (32G)
...
Implement overcommit emulation for shm.
2021-05-04 18:02:52 +03:00
Nekotekina
e327d47169
vm_native: add cow flag to map functions
...
CoW is copy-on-write mapping type.
2021-05-04 09:53:19 +03:00
Nekotekina
7a9561b966
vm_native: document some unmap_critical behaviour (posix)
2021-04-18 13:13:15 +03:00
Nekotekina
c061991c43
vm_native: supply only one madvise flag at a time
2021-04-18 13:13:15 +03:00
David Carlier
266c4209c4
VM: FreeBSD c_madv_no_dump/dump constants support.
2021-04-17 20:47:36 +03:00
Megamouse
a16d8ba3ea
More random changes
2021-04-11 14:01:51 +03:00
Nekotekina
ad1027455a
Fix minor inconsistency in utils::memory_reset (Linux)
2021-02-22 13:00:01 +03:00
Nekotekina
8e6e57de86
Enable -Wunused-function warning
2021-02-15 14:39:53 +03:00
Nekotekina
caa83d20f7
vm_native.cpp: implement shm::try_map
...
Treats addr as a hint, emulating windows behaviour.
2021-01-25 16:55:19 +03:00
kd-11
ead180aa60
win32: Be a bit more optimistic with allocated ranges; we get contiguous ranges more often than not
2021-01-24 14:24:55 +03:00
Nekotekina
0ac68def49
vm_native.cpp: minor compilation fix
2021-01-17 15:14:11 +03:00
Nekotekina
4ed76a15ff
Use different approach in shm::unmap_critical (Linux)
...
For now, set protection to PROT_NONE.
Attempt to address #9609
2021-01-15 20:11:09 +03:00
Nekotekina
b5837d1271
Memory: use MADV_DONTDUMP if available (Linux)
...
Also refactor other madvise() usage
2021-01-15 19:54:41 +03:00
Nekotekina
ea916fd7e1
Memory: fix critical bug in shm::unmap_critical (Linux)
...
It was leaving holes in reserved areas.
Windows is unaffected.
2021-01-14 18:04:29 +03:00
Eladash
923fcc3b3d
utils::shm: Hotfix after #9578
2021-01-12 23:57:36 +03:00
Eladash
c50b9bc4b4
utils::shm: Make map_self() atomic ( #9578 )
2021-01-12 19:53:18 +03:00
Nekotekina
db8e6fe7a7
Enable -Wunused-variable
2021-01-12 14:34:14 +03:00
Nekotekina
e3dec420a2
vm_native.cpp: conditionally define c_madv_free
2020-12-27 12:19:50 +03:00
Nekotekina
1e32311a65
Use MAP_NORESERVE when available in mmap (Linux)
...
Used in: memory_reserve, memory_decommit (vm_native.cpp)
2020-12-27 10:20:42 +03:00
Nekotekina
eec11bfba9
Move align helpers to util/asm.hpp
...
Also add some files:
GLTextureCache.cpp
VKTextureCache.cpp
2020-12-18 18:07:42 +03:00
Nekotekina
fb29933d3d
Add usz alias for std::size_t
2020-12-18 12:23:53 +03:00
Nekotekina
e055d16b2c
Replace verify() with ensure() with auto src location.
...
Expression ensure(x) returns x.
Using comma operator removed.
2020-12-09 15:43:38 +03:00
Nekotekina
2b674d4d8c
utils::shm: allow 2M hugepages on demand
2020-11-25 10:41:17 +03:00
Nekotekina
487b572aa6
Linux: remove assertions on MADV_HUGEPAGE
...
It's a hint and is allowed to fail.
2020-11-25 10:41:17 +03:00
Nekotekina
ab248e170c
vm_native.cpp: add MADV_HUGEPAGE
...
It enables Transparend Huge Pages for some regions on Linux.
Although it can't be actively useful, it seems to do something.
Maybe it's even harmful for recompilers.
2020-11-24 12:31:11 +03:00
Nekotekina
d1ee7c651f
Make memory locking optional (mlock, VirtualLock).
...
Fix desired locking operation (to fix "sudo" memory).
It was discovered that some systems have outdated configuration.
With too tight limit, it's almost impossible to lock anything in memory.
2020-11-10 06:05:37 +03:00
Nekotekina
dcbe8ef5f4
Import VirtualAlloc2 if available (Win10+)
...
Import MapViewOfFile3 as well.
Unused, this crap is tricky.
2020-11-10 03:04:38 +03:00
Nekotekina
e98eb4659e
Implement utils::memory_lock
2020-11-09 22:57:36 +03:00
Nekotekina
d1988d384c
vm: remove unnecessary memset() on stop
2020-11-09 22:57:36 +03:00
Nekotekina
b05d12df0e
Hotfix for shm->map_self()
...
Make sure mmap returns 64K-aligned results, as on Windows.
2020-11-08 22:15:59 +03:00
Nekotekina
1c99a2e7fb
vm: add map_self() method to utils::shm
...
Add complementary unmap_self() method.
Move VirtualMemory to util/vm.hpp
Minor associated include cleanup.
Move asm.h to util/asm.hpp
2020-11-08 16:43:15 +03:00