-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
!tls: move tls handling to libphoenix
JIRA: RTOS-921
- Loading branch information
Showing
30 changed files
with
622 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* | ||
* Phoenix-RTOS | ||
* | ||
* libphoenix | ||
* | ||
* tls (armv7a) | ||
* | ||
* Copyright 2024 Phoenix Systems | ||
* Author: Hubert Badocha | ||
* | ||
* This file is part of Phoenix-RTOS. | ||
* | ||
* %LICENSE% | ||
*/ | ||
|
||
|
||
#include <sys/tls.h> | ||
|
||
|
||
struct tls_tcb *__tls_getTcb(void) | ||
{ | ||
void *tcb; | ||
/* clang-format off */ | ||
__asm__ volatile("mrc p15, 0, %0, cr13, cr0, 3" : "=r"(tcb)); | ||
/* clang-format on */ | ||
return tcb; | ||
} | ||
|
||
|
||
void *__tls_tcbPtrToTlsPtr(struct tls_tcb *tcb) | ||
{ | ||
return (void *)tcb; | ||
} | ||
|
||
|
||
void __tls_archInit(void) | ||
{ | ||
/* Nothing to do. */ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* | ||
* Phoenix-RTOS | ||
* | ||
* libphoenix | ||
* | ||
* tls (armv8r) | ||
* | ||
* Copyright 2024 Phoenix Systems | ||
* Author: Hubert Badocha | ||
* | ||
* This file is part of Phoenix-RTOS. | ||
* | ||
* %LICENSE% | ||
*/ | ||
|
||
|
||
#include <sys/tls.h> | ||
|
||
|
||
struct tls_tcb *__tls_getTcb(void) | ||
{ | ||
void *tcb; | ||
/* clang-format off */ | ||
__asm__ volatile("mrc p15, 0, %0, cr13, cr0, 3" : "=r"(tcb)); | ||
/* clang-format on */ | ||
return tcb; | ||
} | ||
|
||
|
||
void *__tls_tcbPtrToTlsPtr(struct tls_tcb *tcb) | ||
{ | ||
return (void *)tcb; | ||
} | ||
|
||
|
||
void __tls_archInit(void) | ||
{ | ||
/* Nothing to do. */ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* | ||
* Phoenix-RTOS | ||
* | ||
* libphoenix | ||
* | ||
* tls (ia32) | ||
* | ||
* Copyright 2024 Phoenix Systems | ||
* Author: Hubert Badocha | ||
* | ||
* This file is part of Phoenix-RTOS. | ||
* | ||
* %LICENSE% | ||
*/ | ||
|
||
|
||
#include <sys/tls.h> | ||
|
||
|
||
struct tls_tcb *__tls_getTcb(void) | ||
{ | ||
struct tls_tcb *tcb; | ||
/* clang-format off */ | ||
__asm__ volatile("movl %%gs:0, %0" : "=r"(tcb)); | ||
/* clang-format on */ | ||
return tcb; | ||
} | ||
|
||
|
||
void *__tls_tcbPtrToTlsPtr(struct tls_tcb *tcb) | ||
{ | ||
return (void *)tcb; | ||
} | ||
|
||
|
||
void __tls_archInit(void) | ||
{ | ||
/* Nothing to do. */ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
* Phoenix-RTOS | ||
* | ||
* libphoenix | ||
* | ||
* tls (riscv64) | ||
* | ||
* Copyright 2024 Phoenix Systems | ||
* Author: Hubert Badocha | ||
* | ||
* This file is part of Phoenix-RTOS. | ||
* | ||
* %LICENSE% | ||
*/ | ||
|
||
|
||
#include <sys/tls.h> | ||
|
||
|
||
/* As per RISC-V ABI: | ||
* RISC-V uses Variant I as described by the ELF TLS specification, with tp containing the address one past the end of the TCB */ | ||
struct tls_tcb *__tls_getTcb(void) | ||
{ | ||
void *tcb; | ||
/* clang-format off */ | ||
__asm__ volatile("addi %[tcb], tp, %[offset]" | ||
: [tcb] "=r"(tcb) | ||
: [offset] "n"(-sizeof(struct tls_tcb))); | ||
/* clang-format on */ | ||
return tcb; | ||
} | ||
|
||
|
||
void *__tls_tcbPtrToTlsPtr(struct tls_tcb *tcb) | ||
{ | ||
return (void *)(tcb + 1); | ||
} | ||
|
||
|
||
void __tls_archInit(void) | ||
{ | ||
/* Nothing to do. */ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* | ||
* Phoenix-RTOS | ||
* | ||
* libphoenix | ||
* | ||
* tls (sparc) | ||
* | ||
* Copyright 2024 Phoenix Systems | ||
* Author: Hubert Badocha | ||
* | ||
* This file is part of Phoenix-RTOS. | ||
* | ||
* %LICENSE% | ||
*/ | ||
|
||
|
||
#include <sys/tls.h> | ||
|
||
|
||
struct tls_tcb *__tls_getTcb(void) | ||
{ | ||
register struct tls_tcb *tcb asm("g7"); | ||
|
||
return tcb; | ||
} | ||
|
||
|
||
void *__tls_tcbPtrToTlsPtr(struct tls_tcb *tcb) | ||
{ | ||
return (void *)tcb; | ||
} | ||
|
||
|
||
void __tls_archInit(void) { | ||
/* Nothing to do. */ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.