diff options
Diffstat (limited to 'system')
-rw-r--r-- | system/adelie-base/APKBUILD | 6 | ||||
-rw-r--r-- | system/easy-kernel-power8-64k/APKBUILD | 66 | ||||
-rw-r--r-- | system/easy-kernel-power8/APKBUILD | 62 | ||||
-rw-r--r-- | system/easy-kernel-power8/config-ppc64 | 2 | ||||
-rw-r--r-- | system/easy-kernel/APKBUILD | 44 | ||||
-rw-r--r-- | system/easy-kernel/config-aarch64 | 65 | ||||
-rw-r--r-- | system/libucontext/0001-Reorder-registers-in-other-assembler-files.patch | 45 | ||||
-rw-r--r-- | system/libucontext/APKBUILD | 8 | ||||
-rw-r--r-- | system/libucontext/ppc64-assembly.patch | 331 | ||||
-rw-r--r-- | system/libucontext/ppc64-stack-layout.patch | 105 |
10 files changed, 565 insertions, 169 deletions
diff --git a/system/adelie-base/APKBUILD b/system/adelie-base/APKBUILD index 4cda8968f..4954aa8f8 100644 --- a/system/adelie-base/APKBUILD +++ b/system/adelie-base/APKBUILD @@ -2,7 +2,7 @@ # Maintainer: A. Wilcox <awilfox@adelielinux.org> pkgname=adelie-base pkgver=0.9.1 -pkgrel=2 +pkgrel=3 pkgdesc="The Adélie Linux Base System" url="https://www.adelielinux.org/" arch="noarch" @@ -71,8 +71,8 @@ doc() { posix() { # We pull in vim for /usr/bin/ex, until apk has an alternatives system - depends="adelie-base at bc cflow ed fcron heirloom-devtools - heirloom-pax mailx mawk vim" + depends="adelie-base at bc cflow cxref ed fcron heirloom-devtools + heirloom-pax mailx mawk uucp vim" pkgdesc="$pkgdesc - Additional POSIX tools" mkdir -p "$subpkgdir" return 0 diff --git a/system/easy-kernel-power8-64k/APKBUILD b/system/easy-kernel-power8-64k/APKBUILD index 1b75a06f4..4ccc016fe 100644 --- a/system/easy-kernel-power8-64k/APKBUILD +++ b/system/easy-kernel-power8-64k/APKBUILD @@ -1,42 +1,50 @@ # Contributor: A. Wilcox <awilfox@adelielinux.org> # Maintainer: Adelie Platform Group <adelie-devel@lists.adelielinux.org> -_pkgname=easy-kernel-power8-64k +# KEEP THIS IN SYNC with the other easy-kernel packages. +_kflavour=-power8-64k +_pkgname=easy-kernel$_kflavour pkgver=4.14.88 pkgrel=13 pkgname=$_pkgname-$pkgver-mc$pkgrel -_kflavour=power8-64k pkgdesc="The Linux kernel, packaged for POWER8 and POWER9 computers (with 64K page size)" url="https://kernel.org/" arch="ppc64" options="!check !dbg !strip !tracedeps" license="GPL-2.0-only" depends="" -makedepends="bc gzip lzop openssl-dev xz" +makedepends="bc gzip kmod lzop openssl-dev xz" install="" -provides="easy-kernel-power8-64k=$pkgver-r$pkgrel" -subpackages="$_pkgname-modules-$pkgver-mc$pkgrel:modules" -source="https://cdn.kernel.org/pub/linux/kernel/v4.x/linux-4.14.tar.xz - https://distfiles.adelielinux.org/source/linux-4.14-mc$pkgrel.patch.xz +provides="easy-kernel$_kflavour=$pkgver-r$pkgrel" +subpackages="$_pkgname-modules-$pkgver-mc$pkgrel:modules + $_pkgname-src-$pkgver-mc$pkgrel:src + " +_pkgmajver=${pkgver%%.*} +_pkgminver=${pkgver%.*} +source="https://cdn.kernel.org/pub/linux/kernel/v${_pkgmajver}.x/linux-${_pkgminver}.tar.xz + https://distfiles.adelielinux.org/source/linux-${_pkgminver}-mc$pkgrel.patch.xz ast-endianness.patch config-ppc64 futex-cmpxchg.patch " -builddir="$srcdir/linux-4.14" +builddir="$srcdir/linux-${_pkgminver}" prepare() { - default_prepare cd "$srcdir" - cat linux-4.14-mc$pkgrel.patch.xz | unxz -> linux-4.14-mc$pkgrel.patch - cd "$builddir" - patch -Np1 <../linux-4.14-mc$pkgrel.patch + cat linux-${_pkgminver}-mc$pkgrel.patch.xz | unxz -> linux-${_pkgminver}-mc$pkgrel.patch + patch -Np1 -d "$builddir" <linux-${_pkgminver}-mc$pkgrel.patch + default_prepare cd "$srcdir" - cp config-$CARCH linux-4.14/.config - cp -pr linux-4.14 linux-src + cp config-$CARCH linux-${_pkgminver}/.config + cp -pr linux-${_pkgminver} linux-src } build() { cd "$builddir" make LDFLAGS="" + + cd "$srcdir/linux-src" + make LDFLAGS="" modules_prepare clean + cp "$builddir/Module.symvers" . } package() { @@ -48,32 +56,38 @@ package() { if [ -f "$pkgdir"/boot/vmlinuz ]; then mv "$pkgdir"/boot/vmlinuz \ - "$pkgdir"/boot/vmlinuz-$pkgver-mc$pkgrel-easy-$_kflavour + "$pkgdir"/boot/vmlinuz-$pkgver-mc$pkgrel-easy$_kflavour fi if [ -f "$pkgdir"/boot/vmlinux ]; then mv "$pkgdir"/boot/vmlinux \ - "$pkgdir"/boot/vmlinux-$pkgver-mc$pkgrel-easy-$_kflavour + "$pkgdir"/boot/vmlinux-$pkgver-mc$pkgrel-easy$_kflavour fi - # This allows coexistence of both kernel flavours on media. - mv "$pkgdir"/boot/System.map "$pkgdir"/boot/System.map-$_kflavour + mv "$pkgdir"/boot/System.map "$pkgdir"/boot/System.map-$pkgver-mc$pkgrel-easy$_kflavour install -D "$builddir"/include/config/kernel.release \ - "$pkgdir"/usr/share/kernel/easy-$pkgver-mc$pkgrel-$_kflavour/kernel.release + "$pkgdir"/usr/share/kernel/easy-$pkgver-mc$pkgrel$_kflavour/kernel.release } modules() { pkgdesc="Modules / device drivers for easy-kernel" - provides="easy-kernel-power8-64k-modules=$pkgver-r$pkgrel" + provides="easy-kernel$_kflavour-modules=$pkgver-r$pkgrel" autodeps=0 # modules should not depend on src just for symlink mkdir -p "$subpkgdir"/lib mv "$pkgdir"/lib/modules "$subpkgdir"/lib/ - rm "$subpkgdir"/lib/modules/$pkgver-mc$pkgrel-easy-$_kflavour/build - rm "$subpkgdir"/lib/modules/$pkgver-mc$pkgrel-easy-$_kflavour/source - ln -s "../../../usr/src/linux-$pkgver-mc$pkgrel-p8" \ - "$subpkgdir"/lib/modules/$pkgver-mc$pkgrel-easy-$_kflavour/build - ln -s "../../../usr/src/linux-$pkgver-mc$pkgrel-p8" \ - "$subpkgdir"/lib/modules/$pkgver-mc$pkgrel-easy-$_kflavour/source + rm "$subpkgdir"/lib/modules/$pkgver-mc$pkgrel-easy$_kflavour/build + rm "$subpkgdir"/lib/modules/$pkgver-mc$pkgrel-easy$_kflavour/source + ln -s "../../../usr/src/linux-$pkgver-mc$pkgrel$_kflavour" \ + "$subpkgdir"/lib/modules/$pkgver-mc$pkgrel-easy$_kflavour/build + ln -s "../../../usr/src/linux-$pkgver-mc$pkgrel$_kflavour" \ + "$subpkgdir"/lib/modules/$pkgver-mc$pkgrel-easy$_kflavour/source +} + +src() { + pkgdesc="Kernel source code used to build the kernel" + provides="easy-kernel$_kflavour-src=$pkgver-r$pkgrel" + mkdir -p "$subpkgdir"/usr/src + mv "$srcdir"/linux-src "$subpkgdir"/usr/src/linux-$pkgver-mc$pkgrel$_kflavour } sha512sums="77e43a02d766c3d73b7e25c4aafb2e931d6b16e870510c22cef0cdb05c3acb7952b8908ebad12b10ef982c6efbe286364b1544586e715cf38390e483927904d8 linux-4.14.tar.xz diff --git a/system/easy-kernel-power8/APKBUILD b/system/easy-kernel-power8/APKBUILD index 477e7ea04..34f8faddd 100644 --- a/system/easy-kernel-power8/APKBUILD +++ b/system/easy-kernel-power8/APKBUILD @@ -1,6 +1,8 @@ # Contributor: A. Wilcox <awilfox@adelielinux.org> # Maintainer: Adelie Platform Group <adelie-devel@lists.adelielinux.org> -_pkgname=easy-kernel-power8 +# KEEP THIS IN SYNC with the other easy-kernel packages. +_kflavour=-power8 +_pkgname=easy-kernel$_kflavour pkgver=4.14.88 pkgrel=13 pkgname=$_pkgname-$pkgver-mc$pkgrel @@ -12,31 +14,37 @@ license="GPL-2.0-only" depends="" makedepends="bc gzip kmod lzop openssl-dev xz" install="" -provides="easy-kernel-power8=$pkgver-r$pkgrel" +provides="easy-kernel$_kflavour=$pkgver-r$pkgrel" subpackages="$_pkgname-modules-$pkgver-mc$pkgrel:modules - $_pkgname-src-$pkgver-mc$pkgrel:src" -source="https://cdn.kernel.org/pub/linux/kernel/v4.x/linux-4.14.tar.xz - https://distfiles.adelielinux.org/source/linux-4.14-mc$pkgrel.patch.xz + $_pkgname-src-$pkgver-mc$pkgrel:src + " +_pkgmajver=${pkgver%%.*} +_pkgminver=${pkgver%.*} +source="https://cdn.kernel.org/pub/linux/kernel/v${_pkgmajver}.x/linux-${_pkgminver}.tar.xz + https://distfiles.adelielinux.org/source/linux-${_pkgminver}-mc$pkgrel.patch.xz ast-endianness.patch config-ppc64 futex-cmpxchg.patch " -builddir="$srcdir/linux-4.14" +builddir="$srcdir/linux-${_pkgminver}" prepare() { - default_prepare cd "$srcdir" - cat linux-4.14-mc$pkgrel.patch.xz | unxz -> linux-4.14-mc$pkgrel.patch - cd "$builddir" - patch -Np1 <../linux-4.14-mc$pkgrel.patch + cat linux-${_pkgminver}-mc$pkgrel.patch.xz | unxz -> linux-${_pkgminver}-mc$pkgrel.patch + patch -Np1 -d "$builddir" <linux-${_pkgminver}-mc$pkgrel.patch + default_prepare cd "$srcdir" - cp config-$CARCH linux-4.14/.config - cp -pr linux-4.14 linux-src + cp config-$CARCH linux-${_pkgminver}/.config + cp -pr linux-${_pkgminver} linux-src } build() { cd "$builddir" make LDFLAGS="" + + cd "$srcdir/linux-src" + make LDFLAGS="" modules_prepare clean + cp "$builddir/Module.symvers" . } package() { @@ -48,42 +56,42 @@ package() { if [ -f "$pkgdir"/boot/vmlinuz ]; then mv "$pkgdir"/boot/vmlinuz \ - "$pkgdir"/boot/vmlinuz-$pkgver-mc$pkgrel-easy-p8 + "$pkgdir"/boot/vmlinuz-$pkgver-mc$pkgrel-easy$_kflavour fi if [ -f "$pkgdir"/boot/vmlinux ]; then mv "$pkgdir"/boot/vmlinux \ - "$pkgdir"/boot/vmlinux-$pkgver-mc$pkgrel-easy-p8 + "$pkgdir"/boot/vmlinux-$pkgver-mc$pkgrel-easy$_kflavour fi - # This allows coexistence of both kernel flavours on media. - mv "$pkgdir"/boot/System.map "$pkgdir"/boot/System.map-p8 + mv "$pkgdir"/boot/System.map "$pkgdir"/boot/System.map-$pkgver-mc$pkgrel-easy$_kflavour install -D "$builddir"/include/config/kernel.release \ - "$pkgdir"/usr/share/kernel/easy-$pkgver-mc$pkgrel-p8/kernel.release + "$pkgdir"/usr/share/kernel/easy-$pkgver-mc$pkgrel$_kflavour/kernel.release } modules() { pkgdesc="Modules / device drivers for easy-kernel" - provides="easy-kernel-power8-modules=$pkgver-r$pkgrel" + provides="easy-kernel$_kflavour-modules=$pkgver-r$pkgrel" autodeps=0 # modules should not depend on src just for symlink mkdir -p "$subpkgdir"/lib mv "$pkgdir"/lib/modules "$subpkgdir"/lib/ - rm "$subpkgdir"/lib/modules/$pkgver-mc$pkgrel-easy-p8/build - rm "$subpkgdir"/lib/modules/$pkgver-mc$pkgrel-easy-p8/source - ln -s "../../../usr/src/linux-$pkgver-mc$pkgrel-p8" \ - "$subpkgdir"/lib/modules/$pkgver-mc$pkgrel-easy-p8/build - ln -s "../../../usr/src/linux-$pkgver-mc$pkgrel-p8" \ - "$subpkgdir"/lib/modules/$pkgver-mc$pkgrel-easy-p8/source + rm "$subpkgdir"/lib/modules/$pkgver-mc$pkgrel-easy$_kflavour/build + rm "$subpkgdir"/lib/modules/$pkgver-mc$pkgrel-easy$_kflavour/source + ln -s "../../../usr/src/linux-$pkgver-mc$pkgrel$_kflavour" \ + "$subpkgdir"/lib/modules/$pkgver-mc$pkgrel-easy$_kflavour/build + ln -s "../../../usr/src/linux-$pkgver-mc$pkgrel$_kflavour" \ + "$subpkgdir"/lib/modules/$pkgver-mc$pkgrel-easy$_kflavour/source } src() { pkgdesc="Kernel source code used to build the kernel" - provides="easy-kernel-power8-src=$pkgver-r$pkgrel" + provides="easy-kernel$_kflavour-src=$pkgver-r$pkgrel" mkdir -p "$subpkgdir"/usr/src - mv "$srcdir"/linux-src "$subpkgdir"/usr/src/linux-$pkgver-mc$pkgrel-p8 + mv "$srcdir"/linux-src "$subpkgdir"/usr/src/linux-$pkgver-mc$pkgrel$_kflavour } + sha512sums="77e43a02d766c3d73b7e25c4aafb2e931d6b16e870510c22cef0cdb05c3acb7952b8908ebad12b10ef982c6efbe286364b1544586e715cf38390e483927904d8 linux-4.14.tar.xz bfe606f208894cc572fb98f323e26956c69b4f75febd4a9b500514cbb2aa70bddb2aba05b3f16a5fe52535236b215335f73974324065f80643265f17f281faa6 linux-4.14-mc13.patch.xz e41d9111219342ad13367902242444ecdd847a93575c3f9709d6c6a075bc650f4a15be9db1a8798435fc0a0b56d41705829bfe0d2c2d88f8d1c28931e27ef5be ast-endianness.patch -7eaa8840cbcb78afcc95a2e57a0fe92d6016f0ee6b5e1530e647ddb2799dae709ff57ac86bdfdefd32be1f3b1aec789cdc6b49f81c3186291672a8945bc474dd config-ppc64 +70c09aaa7e75ef04389d69768874bc243f351a63f481b191d5708f74f1ceccf32dbbc286415aff4eaf44040a0fd75e90487a50f0c53a32f6d1c0dc779cb56fec config-ppc64 64486a4f53046a69f727cecd8c39400b50c2d2b15e3b5ca8c18b8249d25990f3a872ec064800ba3d190f9d25b4518899b9ea3675920f487108102856d6beb51e futex-cmpxchg.patch" diff --git a/system/easy-kernel-power8/config-ppc64 b/system/easy-kernel-power8/config-ppc64 index 62fb8f381..ad91c8957 100644 --- a/system/easy-kernel-power8/config-ppc64 +++ b/system/easy-kernel-power8/config-ppc64 @@ -86,7 +86,7 @@ CONFIG_SCHED_MUQSS=y CONFIG_INIT_ENV_ARG_LIMIT=32 CONFIG_CROSS_COMPILE="" # CONFIG_COMPILE_TEST is not set -CONFIG_LOCALVERSION="-easy-p8" +CONFIG_LOCALVERSION="-easy-power8" CONFIG_LOCALVERSION_AUTO=y CONFIG_HAVE_KERNEL_GZIP=y CONFIG_HAVE_KERNEL_XZ=y diff --git a/system/easy-kernel/APKBUILD b/system/easy-kernel/APKBUILD index 2a3903b73..294644b01 100644 --- a/system/easy-kernel/APKBUILD +++ b/system/easy-kernel/APKBUILD @@ -1,6 +1,8 @@ # Contributor: A. Wilcox <awilfox@adelielinux.org> # Maintainer: Adelie Platform Group <adelie-devel@lists.adelielinux.org> -_pkgname=easy-kernel +# KEEP THIS IN SYNC with the other easy-kernel packages. +_kflavour="" +_pkgname=easy-kernel$_kflavour pkgver=4.14.88 pkgrel=13 pkgname=$_pkgname-$pkgver-mc$pkgrel @@ -12,9 +14,10 @@ license="GPL-2.0-only" depends="" makedepends="bc gzip kmod lzop openssl-dev xz" install="" -provides="easy-kernel=$pkgver-r$pkgrel" +provides="easy-kernel$_kflavour=$pkgver-r$pkgrel" subpackages="$_pkgname-modules-$pkgver-mc$pkgrel:modules - $_pkgname-src-$pkgver-mc$pkgrel:src linux-headers:headers" + $_pkgname-src-$pkgver-mc$pkgrel:src + linux-headers:headers" _pkgmajver=${pkgver%%.*} _pkgminver=${pkgver%.*} source="https://cdn.kernel.org/pub/linux/kernel/v${_pkgmajver}.x/linux-${_pkgminver}.tar.xz @@ -65,29 +68,38 @@ package() { if [ -f "$pkgdir"/boot/vmlinuz ]; then mv "$pkgdir"/boot/vmlinuz \ - "$pkgdir"/boot/vmlinuz-$pkgver-mc$pkgrel-easy + "$pkgdir"/boot/vmlinuz-$pkgver-mc$pkgrel-easy$_kflavour fi if [ -f "$pkgdir"/boot/vmlinux ]; then mv "$pkgdir"/boot/vmlinux \ - "$pkgdir"/boot/vmlinux-$pkgver-mc$pkgrel-easy + "$pkgdir"/boot/vmlinux-$pkgver-mc$pkgrel-easy$_kflavour fi + if [ -f "$pkgdir"/boot/System.map ]; then + mv "$pkgdir"/boot/System.map \ + "$pkgdir"/boot/System.map-$pkgver-mc$pkgrel-easy$_kflavour + fi + + case $CARCH in + aarch64|arm*) make INSTALL_PATH="$pkgdir"/boot dtbs_install ;; + esac + install -D "$builddir"/include/config/kernel.release \ - "$pkgdir"/usr/share/kernel/easy-$pkgver-mc$pkgrel/kernel.release + "$pkgdir"/usr/share/kernel/easy-$pkgver-mc$pkgrel$_kflavour/kernel.release } modules() { pkgdesc="Modules / device drivers for easy-kernel" - provides="easy-kernel-modules=$pkgver-r$pkgrel" + provides="easy-kernel$_kflavour-modules=$pkgver-r$pkgrel" autodeps=0 # modules should not depend on src just for symlink mkdir -p "$subpkgdir"/lib mv "$pkgdir"/lib/modules "$subpkgdir"/lib/ - rm "$subpkgdir"/lib/modules/$pkgver-mc$pkgrel-easy/build - rm "$subpkgdir"/lib/modules/$pkgver-mc$pkgrel-easy/source - ln -s "../../../usr/src/linux-$pkgver-mc$pkgrel" \ - "$subpkgdir"/lib/modules/$pkgver-mc$pkgrel-easy/build - ln -s "../../../usr/src/linux-$pkgver-mc$pkgrel" \ - "$subpkgdir"/lib/modules/$pkgver-mc$pkgrel-easy/source + rm "$subpkgdir"/lib/modules/$pkgver-mc$pkgrel-easy$_kflavour/build + rm "$subpkgdir"/lib/modules/$pkgver-mc$pkgrel-easy$_kflavour/source + ln -s "../../../usr/src/linux-$pkgver-mc$pkgrel$_kflavour" \ + "$subpkgdir"/lib/modules/$pkgver-mc$pkgrel-easy$_kflavour/build + ln -s "../../../usr/src/linux-$pkgver-mc$pkgrel$_kflavour" \ + "$subpkgdir"/lib/modules/$pkgver-mc$pkgrel-easy$_kflavour/source } headers() { @@ -113,9 +125,9 @@ headers() { src() { pkgdesc="Kernel source code used to build the kernel" - provides="easy-kernel-src=$pkgver-r$pkgrel" + provides="easy-kernel$_kflavour-src=$pkgver-r$pkgrel" mkdir -p "$subpkgdir"/usr/src - mv "$srcdir"/linux-src "$subpkgdir"/usr/src/linux-$pkgver-mc$pkgrel + mv "$srcdir"/linux-src "$subpkgdir"/usr/src/linux-$pkgver-mc$pkgrel$_kflavour } sha512sums="77e43a02d766c3d73b7e25c4aafb2e931d6b16e870510c22cef0cdb05c3acb7952b8908ebad12b10ef982c6efbe286364b1544586e715cf38390e483927904d8 linux-4.14.tar.xz @@ -126,7 +138,7 @@ cfa1c2b523875967c42bfd8fcfeeb80b1c4c9887c4399b4767f0ac0525769a9e8c5cddaec831e1ad 1112f6c3fcfd7fdc0ef4d5e85df5d3adea430a9c7b4c2b34508a215f7ba14c863ccd7a5e17f13ed46c518bafec30cfb3ced70c465137c14ef5fc998b6cbcca1f config-ppc 1c5b4365da04a85ac994f123847cc69df0eda772e88b12914cd1e16ea9be62de2a46106f0f0b736f0e7bee746017d49f5671d1277793b5d383258f3d40b562f6 config-x86_64 69c737ecb6968ca567dfb52335a8a89e147c0b01f92b1e5239bd6d806c10cd7d4225f3cc8a703249020669d3e785df0c1350afda158b0e6c8e70b4805532f07e config-pmmx -231c346e601c1d032a03d6cb19ed3d6e0f538f84d6c9980e3f47236ba9dc3f076ea23f91d68813b7d5c9eea40200f69cef31697f89f514112c09c5762ab2c48a config-aarch64 +c7573068450aff89101ef5aec683f4fee34476f072f9f7debcdc7398c646194b63e3d2fb63742631cdbff0d77d9fabf8d151cc260d80297d00b57c800c60ef6c config-aarch64 64486a4f53046a69f727cecd8c39400b50c2d2b15e3b5ca8c18b8249d25990f3a872ec064800ba3d190f9d25b4518899b9ea3675920f487108102856d6beb51e futex-cmpxchg.patch fdd94b9de7b374f1812dec0f9971c05f5e52177ca4a16c8071daa620c18265b38f656f528e7045a24f30af01f05e53e54546fb0a9e93773cf191866e87de505d kernel.h af093e91e8c8371629948e2e574f8764078564bc027ba5b2f87886f8827d9a63ba7a43717552fe7e3cc9212b2fd55b8633b12900c3d8cdc6c035d52b389c39e5 uapi-ether.patch" diff --git a/system/easy-kernel/config-aarch64 b/system/easy-kernel/config-aarch64 index 69fbd943c..3d9def137 100644 --- a/system/easy-kernel/config-aarch64 +++ b/system/easy-kernel/config-aarch64 @@ -170,7 +170,6 @@ CONFIG_KALLSYMS_ALL=y # CONFIG_KALLSYMS_ABSOLUTE_PERCPU is not set CONFIG_KALLSYMS_BASE_RELATIVE=y CONFIG_PRINTK=y -CONFIG_PRINTK_NMI=y CONFIG_BUG=y CONFIG_ELF_CORE=y CONFIG_BASE_FULL=y @@ -217,7 +216,6 @@ CONFIG_JUMP_LABEL=y CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y CONFIG_HAVE_KPROBES=y CONFIG_HAVE_KRETPROBES=y -CONFIG_HAVE_NMI=y CONFIG_HAVE_ARCH_TRACEHOOK=y CONFIG_HAVE_DMA_CONTIGUOUS=y CONFIG_GENERIC_SMP_IDLE_THREAD=y @@ -232,7 +230,6 @@ CONFIG_HAVE_PERF_REGS=y CONFIG_HAVE_PERF_USER_STACK_DUMP=y CONFIG_HAVE_ARCH_JUMP_LABEL=y CONFIG_HAVE_RCU_TABLE_FREE=y -CONFIG_ARCH_HAVE_NMI_SAFE_CMPXCHG=y CONFIG_HAVE_ALIGNED_STRUCT_PAGE=y CONFIG_HAVE_CMPXCHG_LOCAL=y CONFIG_HAVE_CMPXCHG_DOUBLE=y @@ -623,9 +620,7 @@ CONFIG_ARM64_MODULE_CMODEL_LARGE=y # CONFIG_ARM64_ACPI_PARKING_PROTOCOL is not set CONFIG_CMDLINE="" # CONFIG_CMDLINE_FORCE is not set -CONFIG_EFI_STUB=y -CONFIG_EFI=y -CONFIG_DMI=y +# CONFIG_EFI is not set # # Userspace binary formats @@ -2405,7 +2400,7 @@ CONFIG_I2C_ALGOBIT=y # # I2C system bus drivers (mostly embedded / system-on-chip) # -CONFIG_I2C_BCM2835=m +CONFIG_I2C_BCM2835=y CONFIG_I2C_BCM_IPROC=y CONFIG_I2C_BRCMSTB=y # CONFIG_I2C_CADENCE is not set @@ -2474,8 +2469,8 @@ CONFIG_SPI_MASTER=y # CONFIG_SPI_ALTERA is not set # CONFIG_SPI_ARMADA_3700 is not set # CONFIG_SPI_AXI_SPI_ENGINE is not set -CONFIG_SPI_BCM2835=m -CONFIG_SPI_BCM2835AUX=m +CONFIG_SPI_BCM2835=y +CONFIG_SPI_BCM2835AUX=y CONFIG_SPI_BCM_QSPI=y # CONFIG_SPI_BITBANG is not set # CONFIG_SPI_CADENCE is not set @@ -2930,7 +2925,7 @@ CONFIG_MTK_THERMAL=y # # Broadcom thermal drivers # -# CONFIG_BCM2835_THERMAL is not set +CONFIG_BCM2835_THERMAL=m CONFIG_BCM_NS_THERMAL=y # @@ -3410,8 +3405,10 @@ CONFIG_DRM_VM=y CONFIG_DRM_I2C_CH7006=m CONFIG_DRM_I2C_SIL164=m # CONFIG_DRM_I2C_NXP_TDA998X is not set -# CONFIG_DRM_HDLCD is not set -# CONFIG_DRM_MALI_DISPLAY is not set +CONFIG_DRM_ARM=y +CONFIG_DRM_HDLCD=m +# CONFIG_DRM_HDLCD_SHOW_UNDERRUN is not set +CONFIG_DRM_MALI_DISPLAY=m # CONFIG_DRM_RADEON is not set # CONFIG_DRM_AMDGPU is not set @@ -3569,7 +3566,6 @@ CONFIG_FB_ARMCLCD=y # CONFIG_FB_CYBER2000 is not set # CONFIG_FB_ASILIANT is not set # CONFIG_FB_IMSTT is not set -# CONFIG_FB_EFI is not set # CONFIG_FB_OPENCORES is not set # CONFIG_FB_S1D13XXX is not set # CONFIG_FB_NVIDIA is not set @@ -3594,7 +3590,7 @@ CONFIG_FB_ARMCLCD=y # CONFIG_FB_SH_MOBILE_LCDC is not set # CONFIG_FB_S3C is not set # CONFIG_FB_SMSCUFX is not set -# CONFIG_FB_UDL is not set +CONFIG_FB_UDL=m # CONFIG_FB_IBM_GXT4500 is not set # CONFIG_FB_XILINX is not set # CONFIG_FB_VIRTUAL is not set @@ -3605,7 +3601,7 @@ CONFIG_XEN_FBDEV_FRONTEND=y # CONFIG_FB_AUO_K190X is not set # CONFIG_FB_SIMPLE is not set # CONFIG_FB_SH_MOBILE_MERAM is not set -# CONFIG_FB_SSD1307 is not set +CONFIG_FB_SSD1307=m # CONFIG_FB_SM712 is not set CONFIG_BACKLIGHT_LCD_SUPPORT=y CONFIG_LCD_CLASS_DEVICE=m @@ -3815,10 +3811,10 @@ CONFIG_SND_SOC_RCAR=m # # Allwinner SoC Audio support # -# CONFIG_SND_SUN4I_CODEC is not set -# CONFIG_SND_SUN8I_CODEC_ANALOG is not set -# CONFIG_SND_SUN4I_I2S is not set -# CONFIG_SND_SUN4I_SPDIF is not set +CONFIG_SND_SUN4I_CODEC=m +CONFIG_SND_SUN8I_CODEC_ANALOG=m +CONFIG_SND_SUN4I_I2S=m +CONFIG_SND_SUN4I_SPDIF=m # CONFIG_SND_SOC_TEGRA is not set # CONFIG_SND_SOC_XTFPGA_I2S is not set # CONFIG_ZX_SPDIF is not set @@ -4378,7 +4374,6 @@ CONFIG_EDAC_SUPPORT=y CONFIG_EDAC=y CONFIG_EDAC_LEGACY_SYSFS=y # CONFIG_EDAC_DEBUG is not set -# CONFIG_EDAC_GHES is not set # CONFIG_EDAC_LAYERSCAPE is not set # CONFIG_EDAC_THUNDERX is not set # CONFIG_EDAC_XGENE is not set @@ -4469,7 +4464,6 @@ CONFIG_RTC_DRV_DS3232_HWMON=y # CONFIG_RTC_DRV_DS1685_FAMILY is not set # CONFIG_RTC_DRV_DS1742 is not set # CONFIG_RTC_DRV_DS2404 is not set -CONFIG_RTC_DRV_EFI=y # CONFIG_RTC_DRV_STK17TA8 is not set # CONFIG_RTC_DRV_M48T86 is not set # CONFIG_RTC_DRV_M48T35 is not set @@ -4516,7 +4510,7 @@ CONFIG_DMA_OF=y # CONFIG_ALTERA_MSGDMA is not set # CONFIG_AMBA_PL08X is not set CONFIG_BCM_SBA_RAID=m -CONFIG_DMA_BCM2835=m +CONFIG_DMA_BCM2835=y # CONFIG_DMA_SUN6I is not set # CONFIG_FSL_EDMA is not set # CONFIG_INTEL_IDMA64 is not set @@ -4600,7 +4594,6 @@ CONFIG_XEN_GRANT_DEV_ALLOC=y CONFIG_SWIOTLB_XEN=y # CONFIG_XEN_PVCALLS_BACKEND is not set CONFIG_XEN_PRIVCMD=y -CONFIG_XEN_EFI=y CONFIG_XEN_AUTO_XLATE=y CONFIG_STAGING=y # CONFIG_IRDA is not set @@ -5460,27 +5453,12 @@ CONFIG_ARM_PSCI_FW=y CONFIG_ARM_SCPI_PROTOCOL=y CONFIG_ARM_SCPI_POWER_DOMAIN=y # CONFIG_FIRMWARE_MEMMAP is not set -CONFIG_DMIID=y -# CONFIG_DMI_SYSFS is not set CONFIG_RASPBERRYPI_FIRMWARE=y # CONFIG_FW_CFG_SYSFS is not set CONFIG_QCOM_SCM=y CONFIG_QCOM_SCM_64=y CONFIG_HAVE_ARM_SMCCC=y # CONFIG_GOOGLE_FIRMWARE is not set - -# -# EFI (Extensible Firmware Interface) Support -# -# CONFIG_EFI_VARS is not set -CONFIG_EFI_ESRT=y -CONFIG_EFI_PARAMS_FROM_FDT=y -CONFIG_EFI_RUNTIME_WRAPPERS=y -CONFIG_EFI_ARMSTUB=y -CONFIG_EFI_CAPSULE_LOADER=y -# CONFIG_EFI_TEST is not set -# CONFIG_RESET_ATTACK_MITIGATION is not set -CONFIG_UEFI_CPER=y # CONFIG_EFI_DEV_PATH_PARSER is not set CONFIG_MESON_SM=y @@ -5513,15 +5491,7 @@ CONFIG_ACPI_TABLE_UPGRADE=y CONFIG_ACPI_CONTAINER=y CONFIG_ACPI_HED=y # CONFIG_ACPI_CUSTOM_METHOD is not set -# CONFIG_ACPI_BGRT is not set CONFIG_ACPI_REDUCED_HARDWARE_ONLY=y -CONFIG_HAVE_ACPI_APEI=y -CONFIG_ACPI_APEI=y -CONFIG_ACPI_APEI_GHES=y -CONFIG_ACPI_APEI_PCIEAER=y -CONFIG_ACPI_APEI_SEA=y -# CONFIG_ACPI_APEI_EINJ is not set -# CONFIG_ACPI_APEI_ERST_DEBUG is not set # CONFIG_PMIC_OPREGION is not set # CONFIG_ACPI_CONFIGFS is not set CONFIG_ACPI_IORT=y @@ -5623,7 +5593,6 @@ CONFIG_HUGETLBFS=y CONFIG_HUGETLB_PAGE=y CONFIG_ARCH_HAS_GIGANTIC_PAGE=y CONFIG_CONFIGFS_FS=y -CONFIG_EFIVAR_FS=y CONFIG_MISC_FILESYSTEMS=y # CONFIG_ORANGEFS_FS is not set # CONFIG_ADFS_FS is not set @@ -5945,7 +5914,6 @@ CONFIG_ARCH_HAS_DEVMEM_IS_ALLOWED=y # CONFIG_ARM64_RANDOMIZE_TEXT_OFFSET is not set # CONFIG_DEBUG_WX is not set # CONFIG_DEBUG_ALIGN_RODATA is not set -# CONFIG_DEBUG_EFI is not set # CONFIG_ARM64_RELOC_TEST is not set # CONFIG_CORESIGHT is not set @@ -6241,7 +6209,6 @@ CONFIG_CLZ_TAB=y CONFIG_MPILIB=y CONFIG_LIBFDT=y CONFIG_OID_REGISTRY=y -CONFIG_UCS2_STRING=y CONFIG_FONT_SUPPORT=y # CONFIG_FONTS is not set CONFIG_FONT_8x8=y diff --git a/system/libucontext/0001-Reorder-registers-in-other-assembler-files.patch b/system/libucontext/0001-Reorder-registers-in-other-assembler-files.patch deleted file mode 100644 index b6fe600c9..000000000 --- a/system/libucontext/0001-Reorder-registers-in-other-assembler-files.patch +++ /dev/null @@ -1,45 +0,0 @@ -From 42c84cbe58c3c9089cc2a46a425210f20b47bcc9 Mon Sep 17 00:00:00 2001 -From: "A. Wilcox" <AWilcox@Wilcox-Tech.com> -Date: Thu, 19 Jul 2018 17:17:26 -0500 -Subject: [PATCH] Reorder registers in other assembler files - -This fixes the previous commit which changed the register order in -swapcontext only, which caused setcontext to subtly corrupt the stack. ---- - arch/x86_64/getcontext.S | 4 ++-- - arch/x86_64/setcontext.S | 4 ++-- - 2 files changed, 4 insertions(+), 4 deletions(-) - -diff --git a/arch/x86_64/getcontext.S b/arch/x86_64/getcontext.S -index 7e56a1a..24cc1d3 100644 ---- a/arch/x86_64/getcontext.S -+++ b/arch/x86_64/getcontext.S -@@ -22,8 +22,8 @@ __getcontext: - movq %r14, 88(%rdi) - movq %r15, 96(%rdi) - movq %rdi, 104(%rdi) -- movq %rbp, 112(%rdi) -- movq %rsi, 120(%rdi) -+ movq %rsi, 112(%rdi) -+ movq %rbp, 120(%rdi) - movq %rbx, 128(%rdi) - movq %rdx, 136(%rdi) - movq $1, 144(%rdi) /* $1 is %rax */ -diff --git a/arch/x86_64/setcontext.S b/arch/x86_64/setcontext.S -index 607d40c..aba3775 100644 ---- a/arch/x86_64/setcontext.S -+++ b/arch/x86_64/setcontext.S -@@ -21,8 +21,8 @@ __setcontext: - movq 80(%rdi), %r13 - movq 88(%rdi), %r14 - movq 96(%rdi), %r15 -- movq 112(%rdi), %rbp -- movq 120(%rdi), %rsi -+ movq 112(%rdi), %rsi -+ movq 120(%rdi), %rbp - movq 128(%rdi), %rbx - movq 136(%rdi), %rdx - movq 144(%rdi), %rax --- -2.15.0 - diff --git a/system/libucontext/APKBUILD b/system/libucontext/APKBUILD index 2adee39f2..f6b020858 100644 --- a/system/libucontext/APKBUILD +++ b/system/libucontext/APKBUILD @@ -1,7 +1,7 @@ # Maintainer: William Pitcock <nenolod@dereferenced.org> pkgname=libucontext pkgver=0.1.3 -pkgrel=0 +pkgrel=1 pkgdesc="ucontext function implementations" url="https://git.dereferenced.org/kaniini/libucontext/" arch="all" @@ -9,6 +9,8 @@ license="ISC" depends="" subpackages="$pkgname-dev" source="https://distfiles.dereferenced.org/libucontext/libucontext-$pkgver.tar.xz + ppc64-assembly.patch + ppc64-stack-layout.patch " case "$CTARGET_ARCH" in @@ -33,4 +35,6 @@ package() { make ARCH="$LIBUCONTEXT_ARCH" DESTDIR="$pkgdir" install } -sha512sums="9e0694c09f159de714b655f6a4201a05c8d1871ee7376bb6bf824206b45475cfbd8269ca1caa75b9c322624d9f77d3fc3f938228a4bdd267a5ddceb57ca5c1ab libucontext-0.1.3.tar.xz" +sha512sums="9e0694c09f159de714b655f6a4201a05c8d1871ee7376bb6bf824206b45475cfbd8269ca1caa75b9c322624d9f77d3fc3f938228a4bdd267a5ddceb57ca5c1ab libucontext-0.1.3.tar.xz +dbb7599fe5cc1e470d944bf741c393c13e684d6c27bd794ec380a05ba1ba045597b102903a1ac9bf586a508941440373c2d29fad1d7372ee8c72ffb7f0e11f75 ppc64-assembly.patch +d6219487a5aa456726a01a5a6a39c3a7f29bc24a66f2fc77ff7f852e1b45ffe64854ad92cafad3cc03d3b52bd77dce786ef125e3e88ddb0398833a560afb5211 ppc64-stack-layout.patch" diff --git a/system/libucontext/ppc64-assembly.patch b/system/libucontext/ppc64-assembly.patch new file mode 100644 index 000000000..66fb3104d --- /dev/null +++ b/system/libucontext/ppc64-assembly.patch @@ -0,0 +1,331 @@ +From 7b864e86e3e8e64fe69363137384ee9b858fe78d Mon Sep 17 00:00:00 2001 +From: Bobby Bingham <koorogi@koorogi.info> +Date: Sat, 23 Feb 2019 17:12:37 -0600 +Subject: [PATCH 2/3] ppc64: rewrite get/set/swapcontext in assembly + +If getcontext makes any function call, which it does to call syscall, then +it must spill its return address to the stack. After it returns to its +caller, that return address can be clobbered. When setcontext is called +to resume this saved context, the correct return address is not available. +--- + Makefile | 10 ++------- + arch/ppc64/getcontext.S | 25 +++++++++++++++++++++ + arch/ppc64/getcontext.c | 45 ------------------------------------- + arch/ppc64/retfromsyscall.c | 24 ++++++++++++++++++++ + arch/ppc64/setcontext.S | 26 +++++++++++++++++++++ + arch/ppc64/setcontext.c | 45 ------------------------------------- + arch/ppc64/swapcontext.S | 28 +++++++++++++++++++++++ + arch/ppc64/swapcontext.c | 45 ------------------------------------- + 8 files changed, 105 insertions(+), 143 deletions(-) + create mode 100644 arch/ppc64/getcontext.S + delete mode 100644 arch/ppc64/getcontext.c + create mode 100644 arch/ppc64/retfromsyscall.c + create mode 100644 arch/ppc64/setcontext.S + delete mode 100644 arch/ppc64/setcontext.c + create mode 100644 arch/ppc64/swapcontext.S + delete mode 100644 arch/ppc64/swapcontext.c + +diff --git a/Makefile b/Makefile +index 51365a3..d6ff1b0 100644 +--- a/Makefile ++++ b/Makefile +@@ -2,14 +2,8 @@ ARCH := $(shell uname -m) + + CFLAGS = -ggdb3 -O2 -Wall -Iarch/${ARCH} + +-LIBUCONTEXT_C_SRC = \ +- arch/${ARCH}/makecontext.c +- +-LIBUCONTEXT_S_SRC = \ +- arch/${ARCH}/getcontext.S \ +- arch/${ARCH}/setcontext.S \ +- arch/${ARCH}/swapcontext.S \ +- arch/${ARCH}/startcontext.S ++LIBUCONTEXT_C_SRC = $(wildcard arch/${ARCH}/*.c) ++LIBUCONTEXT_S_SRC = $(wildcard arch/${ARCH}/*.S) + + LIBUCONTEXT_OBJ = ${LIBUCONTEXT_C_SRC:.c=.o} ${LIBUCONTEXT_S_SRC:.S=.o} + LIBUCONTEXT_SOVERSION = 0 +diff --git a/arch/ppc64/getcontext.S b/arch/ppc64/getcontext.S +new file mode 100644 +index 0000000..935edd2 +--- /dev/null ++++ b/arch/ppc64/getcontext.S +@@ -0,0 +1,25 @@ ++/* ++ * Copyright (c) 2019 Bobby Bingham <koorogi@koorogi.info> ++ * ++ * Permission to use, copy, modify, and/or distribute this software for any ++ * purpose with or without fee is hereby granted, provided that the above ++ * copyright notice and this permission notice appear in all copies. ++ * ++ * This software is provided 'as is' and without any warranty, express or ++ * implied. In no event shall the authors be liable for any damages arising ++ * from the use of this software. ++ */ ++ ++.global __getcontext ++.hidden __swapcontext ++__getcontext: ++ addis 2, 12, .TOC.-__getcontext@ha ++ addi 2, 12, .TOC.-__getcontext@l ++ ++ .localentry __getcontext,.-__getcontext ++ ++ li 4, 0 ++ b __swapcontext ++ ++.weak getcontext ++getcontext = __getcontext +diff --git a/arch/ppc64/getcontext.c b/arch/ppc64/getcontext.c +deleted file mode 100644 +index 5da9dfb..0000000 +--- a/arch/ppc64/getcontext.c ++++ /dev/null +@@ -1,45 +0,0 @@ +-/* +- * Copyright (c) 2018 William Pitcock <nenolod@dereferenced.org> +- * +- * Permission to use, copy, modify, and/or distribute this software for any +- * purpose with or without fee is hereby granted, provided that the above +- * copyright notice and this permission notice appear in all copies. +- * +- * This software is provided 'as is' and without any warranty, express or +- * implied. In no event shall the authors be liable for any damages arising +- * from the use of this software. +- */ +- +-#define _GNU_SOURCE +-#include <stddef.h> +-#include <stdarg.h> +-#include <signal.h> +-#include <string.h> +-#include <stdint.h> +-#include <errno.h> +-#include <unistd.h> +-#include <sys/syscall.h> +- +- +-int +-__getcontext(ucontext_t *ucp) +-{ +-#ifdef SYS_swapcontext +- int r; +- +- r = syscall(SYS_swapcontext, ucp, NULL, sizeof(ucontext_t)); +- if (r < 0) +- { +- errno = -r; +- return -1; +- } +- +- return 0; +-#else +- errno = ENOSYS; +- return -1; +-#endif +-} +- +- +-extern __typeof(__getcontext) getcontext __attribute__((weak, __alias__("__getcontext"))); +diff --git a/arch/ppc64/retfromsyscall.c b/arch/ppc64/retfromsyscall.c +new file mode 100644 +index 0000000..22c5134 +--- /dev/null ++++ b/arch/ppc64/retfromsyscall.c +@@ -0,0 +1,24 @@ ++/* ++ * Copyright (c) 2019 Bobby Bingham <koorogi@koorogi.info> ++ * ++ * Permission to use, copy, modify, and/or distribute this software for any ++ * purpose with or without fee is hereby granted, provided that the above ++ * copyright notice and this permission notice appear in all copies. ++ * ++ * This software is provided 'as is' and without any warranty, express or ++ * implied. In no event shall the authors be liable for any damages arising ++ * from the use of this software. ++ */ ++ ++#include <errno.h> ++ ++__attribute__ ((visibility ("hidden"))) ++int __retfromsyscall(long retval) ++{ ++ if (retval < 0) { ++ errno = -retval; ++ return -1; ++ } ++ return 0; ++} ++ +diff --git a/arch/ppc64/setcontext.S b/arch/ppc64/setcontext.S +new file mode 100644 +index 0000000..5a0cde3 +--- /dev/null ++++ b/arch/ppc64/setcontext.S +@@ -0,0 +1,26 @@ ++/* ++ * Copyright (c) 2019 Bobby Bingham <koorogi@koorogi.info> ++ * ++ * Permission to use, copy, modify, and/or distribute this software for any ++ * purpose with or without fee is hereby granted, provided that the above ++ * copyright notice and this permission notice appear in all copies. ++ * ++ * This software is provided 'as is' and without any warranty, express or ++ * implied. In no event shall the authors be liable for any damages arising ++ * from the use of this software. ++ */ ++ ++.global __setcontext ++.hidden __swapcontext ++__setcontext: ++ addis 2, 12, .TOC.-__setcontext@ha ++ addi 2, 12, .TOC.-__setcontext@l ++ ++ .localentry __setcontext,.-__setcontext ++ ++ mr 4, 3 ++ li 3, 0 ++ b __swapcontext ++ ++.weak setcontext ++setcontext = __setcontext +diff --git a/arch/ppc64/setcontext.c b/arch/ppc64/setcontext.c +deleted file mode 100644 +index 59c65b4..0000000 +--- a/arch/ppc64/setcontext.c ++++ /dev/null +@@ -1,45 +0,0 @@ +-/* +- * Copyright (c) 2018 William Pitcock <nenolod@dereferenced.org> +- * +- * Permission to use, copy, modify, and/or distribute this software for any +- * purpose with or without fee is hereby granted, provided that the above +- * copyright notice and this permission notice appear in all copies. +- * +- * This software is provided 'as is' and without any warranty, express or +- * implied. In no event shall the authors be liable for any damages arising +- * from the use of this software. +- */ +- +-#define _GNU_SOURCE +-#include <stddef.h> +-#include <stdarg.h> +-#include <signal.h> +-#include <string.h> +-#include <stdint.h> +-#include <errno.h> +-#include <unistd.h> +-#include <sys/syscall.h> +- +- +-int +-__setcontext(const ucontext_t *ucp) +-{ +-#ifdef SYS_swapcontext +- int r; +- +- r = syscall(SYS_swapcontext, NULL, (void *) ucp, sizeof(ucontext_t)); +- if (r < 0) +- { +- errno = -r; +- return -1; +- } +- +- return r; +-#else +- errno = ENOSYS; +- return -1; +-#endif +-} +- +- +-extern __typeof(__setcontext) setcontext __attribute__((weak, __alias__("__setcontext"))); +diff --git a/arch/ppc64/swapcontext.S b/arch/ppc64/swapcontext.S +new file mode 100644 +index 0000000..982537a +--- /dev/null ++++ b/arch/ppc64/swapcontext.S +@@ -0,0 +1,28 @@ ++/* ++ * Copyright (c) 2019 Bobby Bingham <koorogi@koorogi.info> ++ * ++ * Permission to use, copy, modify, and/or distribute this software for any ++ * purpose with or without fee is hereby granted, provided that the above ++ * copyright notice and this permission notice appear in all copies. ++ * ++ * This software is provided 'as is' and without any warranty, express or ++ * implied. In no event shall the authors be liable for any damages arising ++ * from the use of this software. ++ */ ++ ++.global __swapcontext ++__swapcontext: ++ addis 2, 12, .TOC.-__swapcontext@ha ++ addi 2, 12, .TOC.-__swapcontext@l ++ ++ .localentry __swapcontext,.-__swapcontext ++ ++ li 0, 249 # SYS_swapcontext ++ li 5, 1696 # sizeof(ucontext_t) ++ sc ++ ++.hidden __retfromsyscall ++ b __retfromsyscall ++ ++.weak swapcontext ++swapcontext = __swapcontext +diff --git a/arch/ppc64/swapcontext.c b/arch/ppc64/swapcontext.c +deleted file mode 100644 +index af14bc2..0000000 +--- a/arch/ppc64/swapcontext.c ++++ /dev/null +@@ -1,45 +0,0 @@ +-/* +- * Copyright (c) 2018 William Pitcock <nenolod@dereferenced.org> +- * +- * Permission to use, copy, modify, and/or distribute this software for any +- * purpose with or without fee is hereby granted, provided that the above +- * copyright notice and this permission notice appear in all copies. +- * +- * This software is provided 'as is' and without any warranty, express or +- * implied. In no event shall the authors be liable for any damages arising +- * from the use of this software. +- */ +- +-#define _GNU_SOURCE +-#include <stddef.h> +-#include <stdarg.h> +-#include <signal.h> +-#include <string.h> +-#include <stdint.h> +-#include <errno.h> +-#include <unistd.h> +-#include <sys/syscall.h> +- +- +-int +-__swapcontext(ucontext_t *oucp, const ucontext_t *ucp) +-{ +-#ifdef SYS_swapcontext +- int r; +- +- r = syscall(SYS_swapcontext, oucp, ucp, sizeof(ucontext_t)); +- if (r < 0) +- { +- errno = -r; +- return -1; +- } +- +- return r; +-#else +- errno = ENOSYS; +- return -1; +-#endif +-} +- +- +-extern __typeof(__swapcontext) swapcontext __attribute__((weak, __alias__("__swapcontext"))); +-- +2.19.2 + diff --git a/system/libucontext/ppc64-stack-layout.patch b/system/libucontext/ppc64-stack-layout.patch new file mode 100644 index 000000000..d030b61af --- /dev/null +++ b/system/libucontext/ppc64-stack-layout.patch @@ -0,0 +1,105 @@ +From a17b01bc9df4004a1852ba272d452b0f46f5927c Mon Sep 17 00:00:00 2001 +From: Bobby Bingham <koorogi@koorogi.info> +Date: Tue, 19 Feb 2019 06:27:28 +0000 +Subject: [PATCH 3/3] ppc64: fix stack frame layout + +--- + arch/ppc64/makecontext.c | 48 +++++++++++++++++----------------------- + 1 file changed, 20 insertions(+), 28 deletions(-) + +diff --git a/arch/ppc64/makecontext.c b/arch/ppc64/makecontext.c +index 9d6b998..6d9841c 100644 +--- a/arch/ppc64/makecontext.c ++++ b/arch/ppc64/makecontext.c +@@ -1,5 +1,6 @@ + /* + * Copyright (c) 2018 William Pitcock <nenolod@dereferenced.org> ++ * Copyright (c) 2019 Bobby Bingham <koorogi@koorogi.info> + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above +@@ -11,32 +12,39 @@ + */ + + #define _GNU_SOURCE +-#include <stddef.h> + #include <stdarg.h> + #include <signal.h> +-#include <string.h> + #include <stdint.h> + +- + #include "defs.h" + + + extern void __start_context(void); + + ++#define SAVEARG(i,val) \ ++ do { \ ++ *(i < 8 ? &ucp->uc_mcontext.gp_regs[3+i] : argp) = val; \ ++ argp++; \ ++ } while (0) ++ + void + __makecontext(ucontext_t *ucp, void (*func)(void), int argc, ...) + { + greg_t *sp, *argp; + va_list va; +- int i; +- unsigned int uc_link, stack_args; ++ unsigned int stack_args; ++ ++ /* We pass uc_link as an argument, so in total we have argc+1 args */ ++ stack_args = argc + 1; + +- stack_args = argc > 8 ? argc - 8 : 0; +- uc_link = stack_args + 1; ++ /* We can pass 8 args before needing the stack. If any arg is passed ++ * on the stack, then stack space must be reserved for all args, even ++ * though the first 8 don't need to be stored there */ ++ if (stack_args <= 8) stack_args = 0; + + sp = (greg_t *) ((uintptr_t) ucp->uc_stack.ss_sp + ucp->uc_stack.ss_size); +- sp -= (uc_link + 1); ++ sp -= stack_args + 4; + sp = (greg_t *) (((uintptr_t) sp & -16L)); + + ucp->uc_mcontext.gp_regs[REG_NIP] = (uintptr_t) func; +@@ -45,29 +53,13 @@ __makecontext(ucontext_t *ucp, void (*func)(void), int argc, ...) + ucp->uc_mcontext.gp_regs[REG_ENTRY] = (uintptr_t) func; + ucp->uc_mcontext.gp_regs[REG_R31] = (uintptr_t) ucp->uc_link; + +- sp[0] = (uintptr_t) &__start_context; +- sp[uc_link] = (uintptr_t) ucp->uc_link; +- argp = &sp[2]; ++ sp[0] = 0; ++ argp = &sp[4]; + + va_start(va, argc); + +- for (i = 0; i < argc; i++) +- switch (i) +- { +- case 0: +- case 1: +- case 2: +- case 3: +- case 4: +- case 5: +- case 6: +- case 7: +- ucp->uc_mcontext.gp_regs[i + 3] = va_arg (va, greg_t); +- break; +- default: +- *argp++ = va_arg (va, greg_t); +- break; +- } ++ for (int i = 0; i < argc; i++) SAVEARG(i, va_arg(va, greg_t)); ++ SAVEARG(argc, (uintptr_t) ucp->uc_link); + + va_end(va); + } +-- +2.19.2 + |