mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-25 18:58:56 +00:00
LibELF: Add helpers for setting the thread pointer register
This commit is contained in:
parent
216089c7a1
commit
cb48f31d79
Notes:
sideshowbarker
2024-07-17 03:03:44 +09:00
Author: https://github.com/spholz
Commit: cb48f31d79
Pull-request: https://github.com/SerenityOS/serenity/pull/24005
Reviewed-by: https://github.com/ADKaster ✅
6 changed files with 67 additions and 2 deletions
|
@ -10,7 +10,7 @@ file(GLOB LIBC_SOURCES2 "../Libraries/LibC/*/*.cpp")
|
||||||
set(ARCH_FOLDER "${SERENITY_ARCH}")
|
set(ARCH_FOLDER "${SERENITY_ARCH}")
|
||||||
|
|
||||||
file(GLOB LIBC_SOURCES3 "../Libraries/LibC/arch/${ARCH_FOLDER}/*.S")
|
file(GLOB LIBC_SOURCES3 "../Libraries/LibC/arch/${ARCH_FOLDER}/*.S")
|
||||||
set(ELF_SOURCES ${ELF_SOURCES} "../Libraries/LibELF/Arch/${ARCH_FOLDER}/entry.S" "../Libraries/LibELF/Arch/${ARCH_FOLDER}/plt_trampoline.S")
|
set(ELF_SOURCES ${ELF_SOURCES} "../Libraries/LibELF/Arch/${ARCH_FOLDER}/entry.S" "../Libraries/LibELF/Arch/${ARCH_FOLDER}/plt_trampoline.S" "../Libraries/LibELF/Arch/${ARCH_FOLDER}/tls.cpp")
|
||||||
set(LIBC_SOURCES3 ${LIBC_SOURCES3} "../Libraries/LibC/arch/${ARCH_FOLDER}/fenv.cpp")
|
set(LIBC_SOURCES3 ${LIBC_SOURCES3} "../Libraries/LibC/arch/${ARCH_FOLDER}/fenv.cpp")
|
||||||
if ("${SERENITY_ARCH}" STREQUAL "x86_64")
|
if ("${SERENITY_ARCH}" STREQUAL "x86_64")
|
||||||
set(LIBC_SOURCES3 ${LIBC_SOURCES3} "../Libraries/LibC/arch/x86_64/memset.cpp")
|
set(LIBC_SOURCES3 ${LIBC_SOURCES3} "../Libraries/LibC/arch/x86_64/memset.cpp")
|
||||||
|
|
|
@ -97,7 +97,7 @@ foreach(RELATIVE_HEADER_PATH IN LISTS LIBC_HEADERS)
|
||||||
)
|
)
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
file(GLOB ELF_SOURCES CONFIGURE_DEPENDS "../LibELF/*.cpp")
|
file(GLOB ELF_SOURCES CONFIGURE_DEPENDS "../LibELF/*.cpp" "../LibELF/Arch/${SERENITY_ARCH}/*.cpp")
|
||||||
|
|
||||||
if ("${SERENITY_ARCH}" STREQUAL "aarch64")
|
if ("${SERENITY_ARCH}" STREQUAL "aarch64")
|
||||||
set(LIBC_SOURCES ${LIBC_SOURCES} "arch/aarch64/fenv.cpp")
|
set(LIBC_SOURCES ${LIBC_SOURCES} "arch/aarch64/fenv.cpp")
|
||||||
|
|
16
Userland/Libraries/LibELF/Arch/aarch64/tls.cpp
Normal file
16
Userland/Libraries/LibELF/Arch/aarch64/tls.cpp
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2024, Sönke Holz <sholz8530@gmail.com>
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <LibELF/Arch/tls.h>
|
||||||
|
|
||||||
|
namespace ELF {
|
||||||
|
|
||||||
|
void set_thread_pointer_register(FlatPtr value)
|
||||||
|
{
|
||||||
|
asm volatile("msr tpidr_el0, %0" ::"r"(value));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
16
Userland/Libraries/LibELF/Arch/riscv64/tls.cpp
Normal file
16
Userland/Libraries/LibELF/Arch/riscv64/tls.cpp
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2024, Sönke Holz <sholz8530@gmail.com>
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <LibELF/Arch/tls.h>
|
||||||
|
|
||||||
|
namespace ELF {
|
||||||
|
|
||||||
|
void set_thread_pointer_register(FlatPtr value)
|
||||||
|
{
|
||||||
|
asm volatile("mv tp, %0" ::"r"(value));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
15
Userland/Libraries/LibELF/Arch/tls.h
Normal file
15
Userland/Libraries/LibELF/Arch/tls.h
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2024, Sönke Holz <sholz8530@gmail.com>
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <AK/Types.h>
|
||||||
|
|
||||||
|
namespace ELF {
|
||||||
|
|
||||||
|
void set_thread_pointer_register(FlatPtr);
|
||||||
|
|
||||||
|
}
|
18
Userland/Libraries/LibELF/Arch/x86_64/tls.cpp
Normal file
18
Userland/Libraries/LibELF/Arch/x86_64/tls.cpp
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2024, Sönke Holz <sholz8530@gmail.com>
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <AK/Assertions.h>
|
||||||
|
#include <LibELF/Arch/tls.h>
|
||||||
|
#include <sys/archctl.h>
|
||||||
|
|
||||||
|
namespace ELF {
|
||||||
|
|
||||||
|
void set_thread_pointer_register(FlatPtr)
|
||||||
|
{
|
||||||
|
TODO();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue