Commit Graph

30 Commits

Author SHA1 Message Date
fincs
3a5d0dae35 Linker script refactoring, see details:
- Added separate relro "segment" (introduced by [17.0.0+])
- Reordered sections to better reflect official layout
- Fixed handling of TLS segment alignment
2023-10-21 00:18:04 +02:00
Michael Scire
d90afaacde thread: set arguments/fields before CreateThread 2021-07-20 18:13:10 +02:00
fincs
076657fd31
Allow user override of dynamic memory allocation functions throughout libnx 2021-01-22 18:37:46 +01:00
fincs
d53150f855
thread: Allow user override of automatic stack memory allocation 2021-01-17 17:48:08 +01:00
fincs
970d982e57
Add diagAbortWithResult, see details:
- This is a (weak/overridable) function meant to be called when the
  program encounters an unrecoverable error, but it's not fatal enough
  to bring down the entire system with it.
- The default implementation uses svcBreak, passing the result code
  in the user buffer.
- Replaced all usages of fatalThrow with diagAbortWithResult throughout
  the entire library.
2020-10-29 13:40:35 +01:00
fincs
a05a44fca8
virtmem: Major rewrite to support ASLR, see details:
- Added virtmemLock/Unlock, needed for atomic find-and-map operations
- Added virtmemFindAslr, which looks for a random free area in AslrRegion
  - virtmemReserve still exists for legacy callers who rely on sequential
    allocation in order to avoid race conditions from concurrent uses
- Added virtmemFindStack, which searches within StackRegion instead
  - Removed virtmemReserveStack/FreeStack
- Changed shmem/thread/tmem/codememory-jit to use the new virtmem API
  - Legacy jit still uses virtmemReserve
2020-10-27 12:27:32 +01:00
SciresM
4746827513
thread: add threadGetSelf(), add main thread to thread list. (#392) 2020-04-07 01:47:06 +02:00
Michael Scire
5d57c70a3e fix calls to svcSetThreadActivity 2020-03-29 18:42:19 +02:00
fincs
4ab2384449
fatal: Rename functions/types to match official names more closely 2019-10-24 23:25:07 +02:00
SciresM
415adf5b93 threads: support using existing mem as stack (#336) 2019-10-19 04:25:23 +02:00
fincs
21de119c68
Run TLS destructor after clearing TLS value, as per standard 2019-08-04 21:03:04 +02:00
fincs
1c832bebd6 Avoid overwriting TLS[0x100] and TLS[0x102] as per 8.0.0 2019-04-20 19:19:34 +02:00
fincs
626b07fac8 Implement TLS slot support (with destructors) 2019-03-29 18:40:26 +01:00
plutooo
376add30a4 wait: Introduce wait for raw handles too 2018-12-17 16:06:23 +01:00
fincs
ede79862fb Add threadGetCurHandle 2018-10-27 17:34:44 +02:00
Michael Scire
e942b9cc25 virtmem: Fix stack region mapping on 1.0.0 2018-10-22 22:34:11 +02:00
TuxSH
3ecd841ec2 Update svcGetDebugThreadContext, add svcSetDebugThreadContext, implement threadDumpContext 2018-09-18 01:13:55 +02:00
plutoo
6fa8370bfb This looks better 2018-01-22 20:11:55 +01:00
TuxSH
5abc4873d8 Include only what is really necessary...
add pragma once in every header, etc.
2018-01-22 18:42:57 +01:00
plutoo
e54bbc54ea Fix codestyle for results 2018-01-21 18:40:23 +01:00
plutoo
8ae150d110 NRO loading bringup 2018-01-20 00:13:38 +01:00
plutoo
d8061f67bd Introduce svcWaitForSynchronizationSingle to clean up code 2018-01-13 00:27:47 +01:00
plutoo
916dfb56f0 More threading functionality 2018-01-01 23:32:44 +01:00
plutoo
5cad71213b Cache version values, fix guard paging of threads on 2.0.0+ 2018-01-01 22:28:12 +01:00
yellows8
9703ddbf3e Fixed the stack_sz used for stack_top in threadCreate(). t->stack_sz is uninitialized at the time stack_top is set, hence this was causing memory corruption in some cases. 2017-11-25 12:54:42 -05:00
plutoo
69ce83479a Mutex bringup 2017-11-17 16:15:28 +01:00
fincs
5e0b10db70 Page-align stack size in threadCreate 2017-11-14 01:14:36 +01:00
fincs
e836ee7bb9 Implement TLS/newlib reent support (untested) 2017-11-14 00:31:47 +01:00
plutoo
99bd9c76aa Attempt to introduce newlib heap implementation 2017-10-09 21:24:11 +02:00
plutoo
85538c9fb3 Introducing thread.. 2017-10-08 18:39:33 +02:00