<feed xmlns='http://www.w3.org/2005/Atom'>
<title>yuzu/src/core/hle/kernel/k_scheduler.cpp, branch main</title>
<subtitle>Nintendo Switch emulator</subtitle>
<link rel='alternate' type='text/html' href='https://git.dog6.net/yuzu/'/>
<entry>
<title>core: refactor emulated cpu core activation</title>
<updated>2023-12-04T15:37:16+00:00</updated>
<author>
<name>Liam</name>
<email>byteslice@airmail.cc</email>
</author>
<published>2023-11-28T19:30:39+00:00</published>
<link rel='alternate' type='text/html' href='https://git.dog6.net/yuzu/commit/?id=45c87c7e6e841c11def43e5ab25160006dab6d77'/>
<id>45c87c7e6e841c11def43e5ab25160006dab6d77</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>kernel: update KProcess</title>
<updated>2023-10-22T00:03:41+00:00</updated>
<author>
<name>Liam</name>
<email>byteslice@airmail.cc</email>
</author>
<published>2023-10-21T20:47:43+00:00</published>
<link rel='alternate' type='text/html' href='https://git.dog6.net/yuzu/commit/?id=8c59543ee32c8bff575bab7ec1e70f76f8eda437'/>
<id>8c59543ee32c8bff575bab7ec1e70f76f8eda437</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Fixes and workarounds to make UBSan happier on macOS</title>
<updated>2023-07-15T19:00:28+00:00</updated>
<author>
<name>comex</name>
<email>comexk@gmail.com</email>
</author>
<published>2023-07-01T22:00:39+00:00</published>
<link rel='alternate' type='text/html' href='https://git.dog6.net/yuzu/commit/?id=d7c532d8894ce806c9af13b8dd3eec975642b348'/>
<id>d7c532d8894ce806c9af13b8dd3eec975642b348</id>
<content type='text'>
There are still some other issues not addressed here, but it's a start.

Workarounds for false-positive reports:

- `RasterizerAccelerated`: Put a gigantic array behind a `unique_ptr`,
  because UBSan has a [hardcoded limit](https://stackoverflow.com/questions/64531383/c-runtime-error-using-fsanitize-undefined-object-has-a-possibly-invalid-vp)
  of how big it thinks objects can be, specifically when dealing with
  offset-to-top values used with multiple inheritance.  Hopefully this
  doesn't have a performance impact.

- `QueryCacheBase::QueryCacheBase`: Avoid an operation that UBSan thinks
  is UB even though it at least arguably isn't.  See the link in the
  comment for more information.

Fixes for correct reports:

- `PageTable`, `Memory`: Use `uintptr_t` values instead of pointers to
  avoid UB from pointer overflow (when pointer arithmetic wraps around
  the address space).

- `KScheduler::Reload`: `thread-&gt;GetOwnerProcess()` can be `nullptr`;
  avoid calling methods on it in this case.  (The existing code returns
  a garbage reference to a field, which is then passed into
  `LoadWatchpointArray`, and apparently it's never used, so it's
  harmless in practice but still triggers UBSan.)

- `KAutoObject::Close`: This function calls `this-&gt;Destroy()`, which
  overwrites the beginning of the object with junk (specifically a free
  list pointer).  Then it calls `this-&gt;UnregisterWithKernel()`.  UBSan
  complains about a type mismatch because the vtable has been
  overwritten, and I believe this is indeed UB.  `UnregisterWithKernel`
  also loads `m_kernel` from the 'freed' object, which seems to be
  technically safe (the overwriting doesn't extend as far as that
  field), but seems dubious.  Switch to a `static` method and load
  `m_kernel` in advance.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
There are still some other issues not addressed here, but it's a start.

Workarounds for false-positive reports:

- `RasterizerAccelerated`: Put a gigantic array behind a `unique_ptr`,
  because UBSan has a [hardcoded limit](https://stackoverflow.com/questions/64531383/c-runtime-error-using-fsanitize-undefined-object-has-a-possibly-invalid-vp)
  of how big it thinks objects can be, specifically when dealing with
  offset-to-top values used with multiple inheritance.  Hopefully this
  doesn't have a performance impact.

- `QueryCacheBase::QueryCacheBase`: Avoid an operation that UBSan thinks
  is UB even though it at least arguably isn't.  See the link in the
  comment for more information.

Fixes for correct reports:

- `PageTable`, `Memory`: Use `uintptr_t` values instead of pointers to
  avoid UB from pointer overflow (when pointer arithmetic wraps around
  the address space).

- `KScheduler::Reload`: `thread-&gt;GetOwnerProcess()` can be `nullptr`;
  avoid calling methods on it in this case.  (The existing code returns
  a garbage reference to a field, which is then passed into
  `LoadWatchpointArray`, and apparently it's never used, so it's
  harmless in practice but still triggers UBSan.)

- `KAutoObject::Close`: This function calls `this-&gt;Destroy()`, which
  overwrites the beginning of the object with junk (specifically a free
  list pointer).  Then it calls `this-&gt;UnregisterWithKernel()`.  UBSan
  complains about a type mismatch because the vtable has been
  overwritten, and I believe this is indeed UB.  `UnregisterWithKernel`
  also loads `m_kernel` from the 'freed' object, which seems to be
  technically safe (the overwriting doesn't extend as far as that
  field), but seems dubious.  Switch to a `static` method and load
  `m_kernel` in advance.
</pre>
</div>
</content>
</entry>
<entry>
<title>core_timing: Use CNTPCT as the guest CPU tick</title>
<updated>2023-06-08T01:44:42+00:00</updated>
<author>
<name>Morph</name>
<email>39850852+Morph1984@users.noreply.github.com</email>
</author>
<published>2023-04-23T04:01:08+00:00</published>
<link rel='alternate' type='text/html' href='https://git.dog6.net/yuzu/commit/?id=8e56a84566036cfff0aa5c3d80ae1b051d2bd0bf'/>
<id>8e56a84566036cfff0aa5c3d80ae1b051d2bd0bf</id>
<content type='text'>
Previously, we were mixing the raw CPU frequency and CNTFRQ.
The raw CPU frequency (1020 MHz) should've never been used as CNTPCT (whose frequency is CNTFRQ) is the only counter available.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Previously, we were mixing the raw CPU frequency and CNTFRQ.
The raw CPU frequency (1020 MHz) should've never been used as CNTPCT (whose frequency is CNTFRQ) is the only counter available.
</pre>
</div>
</content>
</entry>
<entry>
<title>kernel: use KTypedAddress for addresses</title>
<updated>2023-03-22T13:35:16+00:00</updated>
<author>
<name>Liam</name>
<email>byteslice@airmail.cc</email>
</author>
<published>2023-03-18T01:26:04+00:00</published>
<link rel='alternate' type='text/html' href='https://git.dog6.net/yuzu/commit/?id=fb49ec19c1fb6030fcc960077e82c998290d0ab8'/>
<id>fb49ec19c1fb6030fcc960077e82c998290d0ab8</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>kernel: convert KThread to new style</title>
<updated>2023-03-13T02:09:09+00:00</updated>
<author>
<name>Liam</name>
<email>byteslice@airmail.cc</email>
</author>
<published>2023-03-07T21:11:50+00:00</published>
<link rel='alternate' type='text/html' href='https://git.dog6.net/yuzu/commit/?id=6bfb4c8f713323bb39b7e38a779c35583fc61bcc'/>
<id>6bfb4c8f713323bb39b7e38a779c35583fc61bcc</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>kernel: prefer std::addressof</title>
<updated>2023-03-13T02:09:09+00:00</updated>
<author>
<name>Liam</name>
<email>byteslice@airmail.cc</email>
</author>
<published>2023-03-07T17:01:07+00:00</published>
<link rel='alternate' type='text/html' href='https://git.dog6.net/yuzu/commit/?id=ac6cbb7134d71134e4beae91361a78fa68202c22'/>
<id>ac6cbb7134d71134e4beae91361a78fa68202c22</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>kernel: remove kernel_</title>
<updated>2023-03-13T02:09:09+00:00</updated>
<author>
<name>Liam</name>
<email>byteslice@airmail.cc</email>
</author>
<published>2023-03-07T15:49:41+00:00</published>
<link rel='alternate' type='text/html' href='https://git.dog6.net/yuzu/commit/?id=c0b9e93b77cca0e5fbd455efc5dec10199ef8184'/>
<id>c0b9e93b77cca0e5fbd455efc5dec10199ef8184</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>kernel: use GetCurrentProcess</title>
<updated>2023-02-13T16:05:14+00:00</updated>
<author>
<name>Liam</name>
<email>byteslice@airmail.cc</email>
</author>
<published>2023-02-13T15:44:41+00:00</published>
<link rel='alternate' type='text/html' href='https://git.dog6.net/yuzu/commit/?id=4363ca304afb0b615481c7d49e863a2c429cc5c6'/>
<id>4363ca304afb0b615481c7d49e863a2c429cc5c6</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Ensure correctness of atomic store ordering</title>
<updated>2022-11-09T13:09:50+00:00</updated>
<author>
<name>Liam</name>
<email>byteslice@airmail.cc</email>
</author>
<published>2022-11-09T03:26:14+00:00</published>
<link rel='alternate' type='text/html' href='https://git.dog6.net/yuzu/commit/?id=71c0e20f95861a3766c04bc92afe677205848407'/>
<id>71c0e20f95861a3766c04bc92afe677205848407</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
</feed>
