-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Acked-by: Thomas Huth <thuth@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
- Loading branch information
Showing
8 changed files
with
155 additions
and
3 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,11 @@ | ||
include $(BUILD_DIR)/tests/tcg/s390x-linux-user/config-target.mak | ||
|
||
SUBDIR = $(SRC_PATH)/linux-user/s390x | ||
VPATH += $(SUBDIR) | ||
|
||
all: $(SUBDIR)/vdso.so | ||
|
||
$(SUBDIR)/vdso.so: vdso.S vdso.ld vdso-asmoffset.h | ||
$(CC) -o $@ -nostdlib -shared -Wl,-h,linux-vdso64.so.1 \ | ||
-Wl,--build-id=sha1 -Wl,--hash-style=both \ | ||
-Wl,-T,$(SUBDIR)/vdso.ld $< |
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,2 @@ | ||
/* Minimum stack frame size */ | ||
#define STACK_FRAME_OVERHEAD 160 |
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,61 @@ | ||
/* | ||
* s390x linux replacement vdso. | ||
* | ||
* Copyright 2023 Linaro, Ltd. | ||
* | ||
* SPDX-License-Identifier: GPL-2.0-or-later | ||
*/ | ||
|
||
#include <asm/unistd.h> | ||
#include "vdso-asmoffset.h" | ||
|
||
.macro endf name | ||
.globl \name | ||
.type \name, @function | ||
.size \name, . - \name | ||
.endm | ||
|
||
.macro raw_syscall n | ||
.ifne \n < 0x100 | ||
svc \n | ||
.else | ||
lghi %r1, \n | ||
svc 0 | ||
.endif | ||
.endm | ||
|
||
.macro vdso_syscall name, nr | ||
\name: | ||
.cfi_startproc | ||
aghi %r15, -(STACK_FRAME_OVERHEAD + 16) | ||
.cfi_adjust_cfa_offset STACK_FRAME_OVERHEAD + 16 | ||
stg %r14, STACK_FRAME_OVERHEAD(%r15) | ||
.cfi_rel_offset %r14, STACK_FRAME_OVERHEAD | ||
raw_syscall \nr | ||
lg %r14, STACK_FRAME_OVERHEAD(%r15) | ||
aghi %r15, STACK_FRAME_OVERHEAD + 16 | ||
.cfi_restore %r14 | ||
.cfi_adjust_cfa_offset -(STACK_FRAME_OVERHEAD + 16) | ||
br %r14 | ||
.cfi_endproc | ||
endf \name | ||
.endm | ||
|
||
vdso_syscall __kernel_gettimeofday, __NR_gettimeofday | ||
vdso_syscall __kernel_clock_gettime, __NR_clock_gettime | ||
vdso_syscall __kernel_clock_getres, __NR_clock_getres | ||
vdso_syscall __kernel_getcpu, __NR_getcpu | ||
|
||
/* | ||
* TODO unwind info, though we're ok without it. | ||
* The kernel supplies bogus empty unwind info, and it is likely ignored | ||
* by all users. Without it we get the fallback signal frame handling. | ||
*/ | ||
|
||
__kernel_sigreturn: | ||
raw_syscall __NR_sigreturn | ||
endf __kernel_sigreturn | ||
|
||
__kernel_rt_sigreturn: | ||
raw_syscall __NR_rt_sigreturn | ||
endf __kernel_rt_sigreturn |
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,72 @@ | ||
/* | ||
* Linker script for linux s390x replacement vdso. | ||
* | ||
* Copyright 2023 Linaro, Ltd. | ||
* | ||
* SPDX-License-Identifier: GPL-2.0-or-later | ||
*/ | ||
|
||
VERSION { | ||
LINUX_2.6.29 { | ||
global: | ||
__kernel_gettimeofday; | ||
__kernel_clock_gettime; | ||
__kernel_clock_getres; | ||
__kernel_getcpu; | ||
__kernel_rt_sigreturn; | ||
__kernel_sigreturn; | ||
/* | ||
* QEMU handles syscall restart internally, so we don't | ||
* need the __kernel_restart_syscall entry point. | ||
*/ | ||
local: *; | ||
}; | ||
} | ||
|
||
|
||
PHDRS { | ||
phdr PT_PHDR FLAGS(4) PHDRS; | ||
load PT_LOAD FLAGS(7) FILEHDR PHDRS; /* FLAGS=RWX */ | ||
dynamic PT_DYNAMIC FLAGS(4); | ||
eh_frame_hdr PT_GNU_EH_FRAME; | ||
note PT_NOTE FLAGS(4); | ||
} | ||
|
||
SECTIONS { | ||
. = SIZEOF_HEADERS; | ||
|
||
/* | ||
* The following, including the FILEHDRS and PHDRS, are modified | ||
* when we relocate the binary. We want them to be initially | ||
* writable for the relocation; we'll force them read-only after. | ||
*/ | ||
.note : { *(.note*) } :load :note | ||
.dynamic : { *(.dynamic) } :load :dynamic | ||
.dynsym : { *(.dynsym) } :load | ||
/* | ||
* There ought not be any real read-write data. | ||
* But since we manipulated the segment layout, | ||
* we have to put these sections somewhere. | ||
*/ | ||
.data : { | ||
*(.data*) | ||
*(.sdata*) | ||
*(.got.plt) *(.got) | ||
*(.gnu.linkonce.d.*) | ||
*(.bss*) | ||
*(.dynbss*) | ||
*(.gnu.linkonce.b.*) | ||
} | ||
|
||
.rodata : { *(.rodata*) } | ||
.hash : { *(.hash) } | ||
.gnu.hash : { *(.gnu.hash) } | ||
.dynstr : { *(.dynstr) } | ||
.gnu.version : { *(.gnu.version) } | ||
.gnu.version_d : { *(.gnu.version_d) } | ||
.gnu.version_r : { *(.gnu.version_r) } | ||
.eh_frame_hdr : { *(.eh_frame_hdr) } :load :eh_frame_hdr | ||
.eh_frame : { *(.eh_frame) } :load | ||
|
||
.text : { *(.text*) } :load | ||
} |
Binary file not shown.