Commit Graph

53 Commits

Author SHA1 Message Date
59df319f48 kernel: Improve accuracy of KResourceLimit emulation (#7221)
* core: Refactor resource limits

* svc: Implement SetResourceLimitLimitValues

* Also correct existing name and add missing error codes
2023-12-04 13:31:06 +02:00
cf9bb90ae3 code: Use std::span where appropriate (#6658)
* code: Use std::span when possible

* code: Prefix memcpy and memcmp with std::
2023-07-07 01:52:40 +03:00
7edc86a9bc code: Remove outdated comment style (#6640) 2023-06-25 15:22:41 +05:30
1032b60d9b Bump kernel version for 3DSX (#5446) 2020-10-01 09:54:42 +08:00
623b0621ab Port various minor changes from yuzu PRs (#4725)
* common/thread: Remove unused functions

Many of these functions are carried over from Dolphin (where they aren't
used anymore). Given these have no use (and we really shouldn't be
screwing around with OS-specific thread scheduler handling from the
emulator, these can be removed.

The function for setting the thread name is left, however, since it can
have debugging utility usages.

* input_common/sdl: Use a type alias to shorten declaration of GetPollers

Just makes the definitions a little bit more tidy.

* input_common/sdl: Correct return values within implementations of GetPollers()

In both cases, we weren't actually returning anything, which is
undefined behavior.

* yuzu/debugger/graphics_surface: Fill in missing surface format listings

Fills in the missing surface types that were marked as unknown. The
order corresponds with the TextureFormat enum within
video_core/texture.h.

We also don't need to all of these strings as translatable (only the
first string, as it's an English word).

* yuzu/debugger/graphics_surface: Clean up connection overload deduction

We can utilize qOverload with the signal connections to make the
function deducing a little less ugly.

* yuzu/debugger/graphics_surface: Tidy up SaveSurface

- Use QStringLiteral where applicable.

- Use const where applicable

- Remove unnecessary precondition check (we already assert the pixbuf
  being non null)

* yuzu/debugger/graphics_surface: Display error messages for file I/O errors

* core: Add missing override specifiers where applicable

Applies the override specifier where applicable. In the case of
destructors that are  defaulted in their definition, they can
simply be removed.

This also removes the unnecessary inclusions being done in audin_u and
audrec_u, given their close proximity.

* kernel/thread: Make parameter of GetWaitObjectIndex() const qualified

The pointed to member is never actually modified, so it can be made
const.

* kernel/thread: Avoid sign conversion within GetCommandBufferAddress()

Previously this was performing a u64 + int sign conversion. When dealing
with addresses, we should generally be keeping the arithmetic in the
same signedness type.

This also gets rid of the static lifetime of the constant, as there's no
need to make a trivial type like this potentially live for the entire
duration of the program.

* kernel/codeset: Make CodeSet's memory data member a regular std::vector

The use of a shared_ptr is an implementation detail of the VMManager
itself when mapping memory. Because of that, we shouldn't require all
users of the CodeSet to have to allocate the shared_ptr ahead of time.
It's intended that CodeSet simply pass in the required direct data, and
that the memory manager takes care of it from that point on.

This means we just do the shared pointer allocation in a single place,
when loading modules, as opposed to in each loader.

* kernel/wait_object: Make ShouldWait() take thread members by pointer-to-const

Given this is intended as a querying function, it doesn't make sense to
allow the implementer to modify the state of the given thread.
2019-05-01 14:28:49 +02:00
05058863b5 cleanup includes 2019-03-26 10:50:41 -04:00
5f11c5f733 Kernel: replace boost::intrusive_ptr with std::shared_ptr 2019-03-24 14:32:11 -04:00
2a411bb501 Kernel: wrap resource limit state into kernel state; pass ref to resource limit 2018-10-18 21:41:36 -04:00
9565091fc2 kernel: pass ref in Process 2018-10-18 21:41:36 -04:00
213b259cf1 kernel: pass ref in CodeSet 2018-10-18 21:41:36 -04:00
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
37e78de206 kernel/process: Use accessors instead of class members for referencing segment array
Using member variables for referencing the segments array increases the
size of the class in memory for little benefit. The same behavior can be
achieved through the use of accessors that just return the relevant
segment.
2018-08-23 18:08:03 +02:00
661f7bbcfd core: Make converting constructors explicit where applicable
Avoids unwanted implicit conversions. Thankfully, given the large amount
of cleanup in past PRs, only this tiny amount is left over to cover.
2018-07-30 08:21:13 +08:00
0eab948728 reformat all files with clang-format 2018-06-29 16:56:12 +03:00
7c5a76e58b log: replace all NGLOG with LOG 2018-06-29 14:18:07 +03:00
fbfc1103fd core/loader: Migrate logging macros
Replace logging to use NGLOG instead of LOG.
2018-03-29 00:08:26 +08:00
f61141e86a Update the entire application to use the new clang format style 2018-03-09 10:54:43 -07:00
7f48aa8d25 Loaders: Don't automatically set the current process every time we load an application.
The loaders will now just create a Kernel::Process, construct it and return it to the caller, which is responsible for setting it as the current process and configuring the global page table.
2017-09-26 18:17:47 -05:00
c02bbb7030 memory: Add GetCurrentPageTable/SetCurrentPageTable
Don't expose Memory::current_page_table as a global.
2017-09-24 22:42:42 +01:00
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
6577bbc3c5 Remove ability to load symbol maps
This was now mostly unused except by thread creation, which used a
symbol of the entrypoint, if available, to name the thread.
2017-05-07 15:33:07 -07:00
84fbbe2629 Use negative priorities to avoid special-casing the self-include 2016-09-21 00:15:56 -07:00
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
dc8479928c Sources: Run clang-format on everything. 2016-09-18 09:38:01 +09:00
a89e32b157 elf: Don't cast away const 2016-01-25 02:36:57 -05:00
62c2a262b2 Loader: Fix variable type and remove unused variable 2015-07-13 21:10:13 -03:00
2d7299a86f Loader: Remove unnecessary pointer indirection to IOFile 2015-07-13 20:00:56 -03:00
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
45c4781544 CitraQt: Cleanup includes. 2015-06-28 00:36:54 +01:00
d3634d4bf4 Core/ResourceLimits: Implemented the basic structure of ResourceLimits.
Implemented svcs GetResourceLimit, GetResourceLimitCurrentValues and GetResourceLimitLimitValues.

Note that the resource limits do not currently keep track of used objects, since we have no way to distinguish between an object created by the application, and an object created by some HLE module once we're inside Kernel::T::Create.
2015-05-14 22:50:13 -05:00
7ada357b2d Memmap: Re-organize memory function in two files
memory.cpp/h contains definitions related to acessing memory and
configuring the address space
mem_map.cpp/h contains higher-level definitions related to configuring
the address space accoording to the kernel and allocating memory.
2015-05-15 00:04:38 -03:00
1c0b87edc2 Memory: Re-organize and rename memory area address constants 2015-05-09 01:29:52 -03:00
3cb19c9589 Process: Rename StaticAddressMapping => AddressMapping 2015-05-08 22:12:10 -03:00
2af30d465f Process: Support parsing of exheader kernel caps 2015-05-08 22:11:44 -03:00
6d60acf0f1 Kernel: Introduce skeleton Process class to hold process data 2015-05-08 22:11:02 -03:00
e1fbac3ca1 Common: Remove common.h 2015-05-07 15:45:22 -03:00
5ebf35db96 Silence a few warnings. 2015-01-30 19:20:34 +00:00
df0d66c7cf Loader: Clean up the ELF AppLoader. 2015-01-15 22:23:08 +01:00
82ec17db7d Loader: Guess filetype from the magic, or fallback to the extension. 2015-01-15 22:23:08 +01:00
04622a859c Loader: Don’t assume the file hasn’t been read before. 2015-01-15 22:23:07 +01:00
b5237e885d Loader: Keep a reference to the file and pass it to the correct AppLoader, instead of loading it multiple times. 2015-01-15 21:21:26 +00:00
85030c6e6b Loader: Never forget to change is_loaded. 2015-01-15 21:21:26 +00:00
43e699d849 Loader: Don’t duplicate the docstring into the cpp file. 2015-01-15 21:21:26 +00:00
bf23f94571 elf: Make DidRelocate const 2015-01-02 20:32:16 -05:00
ebfd831ccb License change 2014-12-20 21:20:24 -08:00
0600e2d8b5 Convert old logging calls to new logging macros 2014-12-13 02:08:02 -02:00
f5d38649c7 Remove trailing spaces in every file but the ones imported from SkyEye, AOSP or generated 2014-11-19 09:03:07 +00:00
6b7b36a874 Common: Rename the File namespace to FileUtil, to match the filename and prevent collisions. 2014-09-17 14:35:45 +00:00
cedc28dcc6 ELF: Refactored LoadInto(..) to use memcpy, removed unnecessary code. 2014-06-24 19:30:07 -04:00
62b444cd17 Loader: Refactored use of const. 2014-06-24 19:30:06 -04:00