Commit graph

29 commits

Author SHA1 Message Date
Pengfei Zhu
de3d7cf49f
kernel/thread: Change owner_process to std::weak_ptr (#5325)
* kernel/thread: Change owner_process to std::weak_ptr

Previously this leaked almost all kernel objects. In short, Threads own Processes which own HandleTables which own maps of Objects which include Threads.

Changing this to weak_ptr at least got the camera interfaces to destruct properly. Did not really check the other objects though, and I think there are probably more leaks.

* hle/kernel: Lock certain objects while deserializing

When deserializing other kernel objects, these objects (`MemoryRegion`s and `VMManager`s) can possibly get modified. To avoid inconsistent state caused by destructor side-effects, we may as well simply lock them until loading is fully completed.

* Fix silly typo

Somehow this didn't break?!
2020-11-15 12:59:45 +01:00
Hamish Milne
92640fc29c Code review actions (plus hopefully fix the linux CI) 2020-03-31 17:54:28 +01:00
Hamish Milne
96432589bd Use shared_ptr for PageTable 2020-02-13 17:42:04 +08:00
Hamish Milne
65d96bf6c1 Changed u8* to MemoryRef 2020-02-13 17:42:00 +08:00
Hamish Milne
7b846ffa98 clang-format fixes 2020-02-13 17:39:15 +08:00
Hamish Milne
4f95575d41 Serialize some more kernel objects 2020-02-13 17:38:18 +08:00
Hamish Milne
f79c9668a3 Added shader state; WIP kernel objects 2020-02-13 17:38:10 +08:00
Hamish Milne
6940c99ed6 Added boost serialization 2020-02-13 17:27:50 +08:00
Weiyi Wang
643b7d4dcb Memory: move memory setup into MemorySystem 2018-12-10 22:01:09 -05:00
Weiyi Wang
b6ab4e466b VMManager: remove all backing block related functions
The shared_ptr<vector> type backing memory is unused now, and is not expected to be used in the future
2018-11-16 00:16:13 -05:00
Weiyi Wang
7f9873d7ec VMManager: change MapMemoryBlockToBase to use raw backing memory
And let ServerSession.MappedBufferContext hold the mapped memory
2018-11-16 00:16:13 -05:00
Weiyi Wang
2067946f59
Kernel: reimplement memory management on physical FCRAM (#4392)
* Kernel: reimplement memory management on physical FCRAM

* Kernel/Process: Unmap does not care the source memory permission

What game usually does is after mapping the memory, they reprotect the source memory as no permission to avoid modification there

* Kernel/SharedMemory: zero initialize new-allocated memory

* Process/Thread: zero new TLS entry

* Kernel: fix a bug where code segments memory usage are accumulated twice

It is added to both misc and heap (done inside HeapAlloc), which results a doubled number reported by svcGetProcessInfo. While we are on it, we just merge the three number misc, heap and linear heap usage together, as there is no where they are distinguished.

Question: is TLS page also added to this number?

* Kernel/SharedMemory: add more object info on mapping error

* Process: lower log level; SharedMemory: store phys offset

* VMManager: add helper function to retrieve backing block list for a range
2018-11-06 15:00:47 -05:00
Weiyi Wang
7d8f115185 Prefix all size_t with std::
done automatically by executing regex replace `([^:0-9a-zA-Z_])size_t([^0-9a-zA-Z_])` -> `$1std::size_t$2`
2018-09-06 16:03:28 -04:00
B3n30
33b0b5163f
Merge pull request #3136 from Subv/mem_aliasing1
Kernel/Memory: Added a function to change the memory state of an address range
2018-01-24 10:17:25 +01:00
Subv
a7a5c5aa0d Kernel/IPC: Partially implement MappedBuffer translation.
Right now only MappedBuffers that only span a single page and are not aligned are implemented.

MappedBuffers are unmapped during the reply part of ReplyAndReceive. Only unmapping of ReadOnly buffers is currently implemented.
2018-01-23 08:27:00 -05:00
Subv
928202f744 Kernel/VMManager: Added a function to map a block of memory into the first available address after a given base. 2018-01-23 08:24:15 -05:00
Subv
e4f35f70ac Memory: Added a function to change the memory state of an address range.
This will be useful when implementing memory aliasing operations.
2018-01-23 08:19:47 -05:00
Subv
6d2734a074 Kernel/Memory: Give each Process its own page table.
The loader is in charge of setting the newly created process's page table as the main one during the loading process.
2017-09-10 15:13:41 -05:00
Yuri Kunde Schlesner
2cdb40d709 Kernel: Centralize error definitions in errors.h 2017-05-24 21:06:00 -07:00
Emmanuel Gil Peyrot
ebdae19fd2 Remove empty newlines in #include blocks.
This makes clang-format useful on those.

Also add a bunch of forgotten transitive includes, which otherwise
prevented compilation.
2016-09-21 11:15:47 +09:00
Emmanuel Gil Peyrot
dc8479928c Sources: Run clang-format on everything. 2016-09-18 09:38:01 +09:00
MerryMage
2b93313348 Memory: Implement MMIO 2016-01-30 18:41:04 +00:00
Yuri Kunde Schlesner
cdeeecf080 Kernel: Properly implement ControlMemory FREE and COMMIT 2015-08-16 01:03:45 -03:00
Yuri Kunde Schlesner
306408d174 VMManager: Introduce names for used ResultCodes 2015-08-16 01:03:44 -03:00
Yuri Kunde Schlesner
b9a9ad9742 VMManager: Make LogLayout log level configurable as a parameter 2015-08-16 01:03:43 -03:00
Yuri Kunde Schlesner
785407d06f VMManager: Change block offsets to size_t 2015-08-16 01:03:43 -03:00
Yuri Kunde Schlesner
5c5cf2f8e0 Core: Properly configure address space when loading a binary
The code now properly configures the process image to match the loaded
binary segments (code, rodata, data) instead of just blindly allocating
a large chunk of dummy memory.
2015-07-11 23:54:42 -03:00
Emmanuel Gil Peyrot
aea15f5c73 Core: Cleanup core includes. 2015-06-28 00:36:54 +01:00
Yuri Kunde Schlesner
0a60aa75c2 Kernel: Add VMManager to manage process address spaces
This enables more dynamic management of the process address space,
compared to just directly configuring the page table for major areas.

This will serve as the foundation upon which the rest of the Kernel
memory management functions will be built.
2015-05-27 03:24:12 -03:00