sharp-shl22: new device (SHARP SHL22) (!1011)
This commit is contained in:
parent
64ba17490b
commit
b8b2308aa4
13 changed files with 4547 additions and 0 deletions
33
device/device-sharp-shl22/APKBUILD
Normal file
33
device/device-sharp-shl22/APKBUILD
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
# Contributor: TAKIZAWA Fumiya <takizawa.fumiya34@gmail.com>
|
||||||
|
# Reference: <https://postmarketos.org/devicepkg>
|
||||||
|
pkgname="device-sharp-shl22"
|
||||||
|
pkgdesc="SHARP SHL22"
|
||||||
|
pkgver=0.1
|
||||||
|
pkgrel=0
|
||||||
|
url="https://postmarketos.org"
|
||||||
|
license="MIT"
|
||||||
|
arch="armv7"
|
||||||
|
options="!check !archcheck"
|
||||||
|
depends="postmarketos-base linux-sharp-shl22 mesa-dri-swrast mkbootimg msm-fb-refresher"
|
||||||
|
makedepends="devicepkg-dev"
|
||||||
|
source="
|
||||||
|
deviceinfo
|
||||||
|
initfs-hook.sh
|
||||||
|
"
|
||||||
|
|
||||||
|
build() {
|
||||||
|
devicepkg_build $startdir $pkgname
|
||||||
|
}
|
||||||
|
|
||||||
|
package() {
|
||||||
|
devicepkg_package $startdir $pkgname
|
||||||
|
|
||||||
|
# Disable v4l (video4linux), because without the camera firmware
|
||||||
|
# blobs this makes dev hang with the kernel this device uses (#1033)
|
||||||
|
mkdir -p "$pkgdir"/etc/udev/rules.d
|
||||||
|
ln -s /dev/null "$pkgdir"/etc/udev/rules.d/60-persistent-v4l.rules
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sha512sums="6af7cc576c4cc32b8027d33144a30cef475d86a4123fb1821e536d4cd40c8ef2a172cb01c073de8667edb8dae8d3fc12327d11879b0ebb2d368393888f27ec22 deviceinfo
|
||||||
|
c983fc8281167bed1de5eec3651d82ed0dea612a4267acc8edf34ac8b1f857a57d5d63c555a373749eef3119cbfc9f4d25a080c0291d5af847642b5f60fcb211 initfs-hook.sh"
|
35
device/device-sharp-shl22/deviceinfo
Normal file
35
device/device-sharp-shl22/deviceinfo
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
# Reference: <https://postmarketos.org/deviceinfo>
|
||||||
|
# Please use double quotes only. You can source this file in shell scripts.
|
||||||
|
|
||||||
|
deviceinfo_format_version="0"
|
||||||
|
deviceinfo_name="SHARP SHL22"
|
||||||
|
deviceinfo_manufacturer="SHARP"
|
||||||
|
deviceinfo_codename="sharp-shl22"
|
||||||
|
deviceinfo_date=""
|
||||||
|
deviceinfo_dtb=""
|
||||||
|
deviceinfo_modules_initfs=""
|
||||||
|
deviceinfo_arch="armv7"
|
||||||
|
|
||||||
|
# Device related
|
||||||
|
deviceinfo_keyboard="false"
|
||||||
|
deviceinfo_external_storage="true"
|
||||||
|
deviceinfo_screen_width="720"
|
||||||
|
deviceinfo_screen_height="1280"
|
||||||
|
deviceinfo_dev_touchscreen="/dev/input/event5"
|
||||||
|
deviceinfo_dev_touchscreen_calibration=""
|
||||||
|
deviceinfo_dev_keyboard=""
|
||||||
|
|
||||||
|
# Bootloader related
|
||||||
|
deviceinfo_flash_method="none"
|
||||||
|
|
||||||
|
deviceinfo_kernel_cmdline="androidboot.hardware=qcom user_debug=31 msm_rtb.filter=0x3F ehci-hcd.park=3 loglevel=8 maxcpus=2 vmalloc=320M"
|
||||||
|
deviceinfo_generate_bootimg="true"
|
||||||
|
deviceinfo_bootimg_qcdt="false"
|
||||||
|
deviceinfo_bootimg_dtb_second="false"
|
||||||
|
deviceinfo_flash_offset_base="0x80200000"
|
||||||
|
deviceinfo_flash_offset_kernel="0x00008000"
|
||||||
|
deviceinfo_flash_offset_ramdisk="0x02000000"
|
||||||
|
deviceinfo_flash_offset_second="0x00f00000"
|
||||||
|
deviceinfo_flash_offset_tags="0x00000100"
|
||||||
|
deviceinfo_flash_pagesize="2048"
|
||||||
|
|
3
device/device-sharp-shl22/initfs-hook.sh
Normal file
3
device/device-sharp-shl22/initfs-hook.sh
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
echo 1 > /sys/class/android_usb/android0/unlocked
|
91
device/linux-sharp-shl22/03-fix-video-argb-setting.patch
Normal file
91
device/linux-sharp-shl22/03-fix-video-argb-setting.patch
Normal file
|
@ -0,0 +1,91 @@
|
||||||
|
From 79f928baf4e7b0fa8f36276b2f877da2d46a50d0 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
|
||||||
|
Date: Mon, 11 Dec 2017 11:00:24 -0200
|
||||||
|
Subject: [PATCH] fix video argb setting
|
||||||
|
|
||||||
|
---
|
||||||
|
drivers/video/msm/msm_fb.c | 34 +++++++++++++++++-----------------
|
||||||
|
1 file changed, 17 insertions(+), 17 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/drivers/video/msm/msm_fb.c b/drivers/video/msm/msm_fb.c
|
||||||
|
index 251a5cbb753d..dcd9262a88f4 100644
|
||||||
|
--- a/drivers/video/msm/msm_fb.c
|
||||||
|
+++ b/drivers/video/msm/msm_fb.c
|
||||||
|
@@ -1342,16 +1342,16 @@ static int msm_fb_register(struct msm_fb_data_type *mfd)
|
||||||
|
fix->xpanstep = 1;
|
||||||
|
fix->ypanstep = 1;
|
||||||
|
var->vmode = FB_VMODE_NONINTERLACED;
|
||||||
|
- var->blue.offset = 0;
|
||||||
|
- var->green.offset = 8;
|
||||||
|
- var->red.offset = 16;
|
||||||
|
+ var->blue.offset = 24;
|
||||||
|
+ var->green.offset = 16;
|
||||||
|
+ var->red.offset = 8;
|
||||||
|
var->blue.length = 8;
|
||||||
|
var->green.length = 8;
|
||||||
|
var->red.length = 8;
|
||||||
|
var->blue.msb_right = 0;
|
||||||
|
var->green.msb_right = 0;
|
||||||
|
var->red.msb_right = 0;
|
||||||
|
- var->transp.offset = 24;
|
||||||
|
+ var->transp.offset = 0;
|
||||||
|
var->transp.length = 8;
|
||||||
|
bpp = 4;
|
||||||
|
break;
|
||||||
|
@@ -1361,16 +1361,16 @@ static int msm_fb_register(struct msm_fb_data_type *mfd)
|
||||||
|
fix->xpanstep = 1;
|
||||||
|
fix->ypanstep = 1;
|
||||||
|
var->vmode = FB_VMODE_NONINTERLACED;
|
||||||
|
- var->blue.offset = 8;
|
||||||
|
- var->green.offset = 16;
|
||||||
|
- var->red.offset = 24;
|
||||||
|
+ var->blue.offset = 16;
|
||||||
|
+ var->green.offset = 8;
|
||||||
|
+ var->red.offset = 0;
|
||||||
|
var->blue.length = 8;
|
||||||
|
var->green.length = 8;
|
||||||
|
var->red.length = 8;
|
||||||
|
var->blue.msb_right = 0;
|
||||||
|
var->green.msb_right = 0;
|
||||||
|
var->red.msb_right = 0;
|
||||||
|
- var->transp.offset = 0;
|
||||||
|
+ var->transp.offset = 24;
|
||||||
|
var->transp.length = 8;
|
||||||
|
bpp = 4;
|
||||||
|
break;
|
||||||
|
@@ -2260,15 +2260,15 @@ static int msm_fb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
|
||||||
|
/* Figure out if the user meant RGBA or ARGB
|
||||||
|
and verify the position of the RGB components */
|
||||||
|
|
||||||
|
- if (var->transp.offset == 24) {
|
||||||
|
- if ((var->blue.offset != 0) ||
|
||||||
|
- (var->green.offset != 8) ||
|
||||||
|
- (var->red.offset != 16))
|
||||||
|
- return -EINVAL;
|
||||||
|
- } else if (var->transp.offset == 0) {
|
||||||
|
- if ((var->blue.offset != 8) ||
|
||||||
|
+ if (var->transp.offset == 0) {
|
||||||
|
+ if ((var->blue.offset != 24) ||
|
||||||
|
(var->green.offset != 16) ||
|
||||||
|
- (var->red.offset != 24))
|
||||||
|
+ (var->red.offset != 8))
|
||||||
|
+ return -EINVAL;
|
||||||
|
+ } else if (var->transp.offset == 24) {
|
||||||
|
+ if ((var->blue.offset != 16) ||
|
||||||
|
+ (var->green.offset != 8) ||
|
||||||
|
+ (var->red.offset != 0))
|
||||||
|
return -EINVAL;
|
||||||
|
} else
|
||||||
|
return -EINVAL;
|
||||||
|
@@ -2365,7 +2365,7 @@ static int msm_fb_set_par(struct fb_info *info)
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 32:
|
||||||
|
- if (var->transp.offset == 24)
|
||||||
|
+ if (var->transp.offset == 0)
|
||||||
|
mfd->fb_imgType = MDP_ARGB_8888;
|
||||||
|
else
|
||||||
|
mfd->fb_imgType = MDP_RGBA_8888;
|
||||||
|
--
|
||||||
|
2.14.1
|
||||||
|
|
59
device/linux-sharp-shl22/APKBUILD
Normal file
59
device/linux-sharp-shl22/APKBUILD
Normal file
|
@ -0,0 +1,59 @@
|
||||||
|
# Contributor: TAKIZAWA Fumiya <takizawa.fumiya34@gmail.com>
|
||||||
|
# Reference: <https://postmarketos.org/vendorkernel>
|
||||||
|
# Kernel config based on: arch/arm/configs/deckard_as96_defconfig
|
||||||
|
|
||||||
|
pkgname="linux-sharp-shl22"
|
||||||
|
pkgver=3.4.0
|
||||||
|
pkgrel=0
|
||||||
|
pkgdesc="SHARP SHL22 kernel fork"
|
||||||
|
arch="armv7"
|
||||||
|
_carch="arm"
|
||||||
|
_flavor="sharp-shl22"
|
||||||
|
url="https://kernel.org"
|
||||||
|
license="GPL-2.0-only"
|
||||||
|
options="!strip !check !tracedeps"
|
||||||
|
makedepends="perl sed installkernel bash gmp-dev bc linux-headers elfutils-dev devicepkg-dev"
|
||||||
|
|
||||||
|
# Source
|
||||||
|
_repository="android_kernel_sharp_deckard_as96"
|
||||||
|
_commit="4e1878619e0cba19070b336f68afcb742eb8b52a"
|
||||||
|
_config="config-$_flavor.$arch"
|
||||||
|
source="
|
||||||
|
$pkgname-$_commit.tar.gz::https://github.com/letterarrow/$_repository/archive/$_commit.tar.gz
|
||||||
|
$_config
|
||||||
|
gcc7-give-up-on-ilog2-const-optimizations.patch
|
||||||
|
gcc8-fix-put-user.patch
|
||||||
|
kernel-use-the-gnu89-standard-explicitly.patch
|
||||||
|
fix_dependency_of_WEXT_CORE.patch
|
||||||
|
fix_get_time_ns_error.patch
|
||||||
|
fix_memset-related_crashes_caused_by_recent_GCC_4.7.2_optimizations.patch
|
||||||
|
fix_the_memset_fix.patch
|
||||||
|
03-fix-video-argb-setting.patch
|
||||||
|
"
|
||||||
|
builddir="$srcdir/$_repository-$_commit"
|
||||||
|
|
||||||
|
prepare() {
|
||||||
|
default_prepare
|
||||||
|
downstreamkernel_prepare "$srcdir" "$builddir" "$_config" "$_carch"
|
||||||
|
}
|
||||||
|
|
||||||
|
build() {
|
||||||
|
unset LDFLAGS
|
||||||
|
make ARCH="$_carch" CC="${CC:-gcc}" \
|
||||||
|
KBUILD_BUILD_VERSION="$((pkgrel + 1 ))-postmarketOS"
|
||||||
|
}
|
||||||
|
|
||||||
|
package() {
|
||||||
|
downstreamkernel_package "$builddir" "$pkgdir" "$_carch" "$_flavor"
|
||||||
|
}
|
||||||
|
|
||||||
|
sha512sums="dfcf2d809229f55bf1a15f06e006620a546345ff5ce84d36e4411fd6906e086b08ff06056c4777c8e1a3d134445ffb77b1871999c4a4eb7170ffd20025a87117 linux-sharp-shl22-4e1878619e0cba19070b336f68afcb742eb8b52a.tar.gz
|
||||||
|
682cefb82f0be63606baa77eac7738c307a35c215f5478d9b6fe38521a9ee9e1ffe8b80e2e089f2e7c68c2583f634f894c155cf2ea41d04fc54f9213c966ee5b config-sharp-shl22.armv7
|
||||||
|
77eba606a71eafb36c32e9c5fe5e77f5e4746caac292440d9fb720763d766074a964db1c12bc76fe583c5d1a5c864219c59941f5e53adad182dbc70bf2bc14a7 gcc7-give-up-on-ilog2-const-optimizations.patch
|
||||||
|
197d40a214ada87fcb2dfc0ae4911704b9a93354b75179cd6b4aadbb627a37ec262cf516921c84a8b1806809b70a7b440cdc8310a4a55fca5d2c0baa988e3967 gcc8-fix-put-user.patch
|
||||||
|
ad0182a483791fc88e058838bc331b2f04a75ba291e763767babdb815efadfc3b4fda97e69e2e3f00a426cabea088e35297a92bd287592597d1e309be68ee92c kernel-use-the-gnu89-standard-explicitly.patch
|
||||||
|
40f3d782ec73e4324e5b0e96d661e4fb911a50cd4218d5993154decd1c102b51c6978dd5ac6e69402cea2e481fe0597ed39b0ecc55202bab3e83427869786034 fix_dependency_of_WEXT_CORE.patch
|
||||||
|
df7a38951ef860d7d271fce436935a6fafa3e86fb2c6f43d9d3b1122351424fd9e22e6319129a5d56e8e2b415032af0005fcac1eefde4bbb9ee5905444bac467 fix_get_time_ns_error.patch
|
||||||
|
eee0d4d84ddfe0516463c100a5fdaeb69fd916fe4c89ed6ac8708a93d2d187b6f4b78beb99e4e2cfd4ea17e376872d10215034bada934a040b4ba6fe59052908 fix_memset-related_crashes_caused_by_recent_GCC_4.7.2_optimizations.patch
|
||||||
|
ad77b68cb99d035a7cbebf61cc3d24e1da4c30c7d57682f7315b24bb01c32875cd92a22483957c7cd3c6f3ea1b270e669a988b48ed2e391bdb743420ee12375f fix_the_memset_fix.patch
|
||||||
|
e3083c260ed9c4fc0d83f43106700b6173876dbfae072f6e6696ac6785a4dc17771fbcb3e21601e04ed29a11bf0f7a2a09ad549375e0c34cea245c7f2e2bcbbd 03-fix-video-argb-setting.patch"
|
3929
device/linux-sharp-shl22/config-sharp-shl22.armv7
Normal file
3929
device/linux-sharp-shl22/config-sharp-shl22.armv7
Normal file
File diff suppressed because it is too large
Load diff
13
device/linux-sharp-shl22/fix_dependency_of_WEXT_CORE.patch
Normal file
13
device/linux-sharp-shl22/fix_dependency_of_WEXT_CORE.patch
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
diff --git a/net/wireless/Kconfig b/net/wireless/Kconfig
|
||||||
|
index 8db24da2..bce9db53 100644
|
||||||
|
--- a/net/wireless/Kconfig
|
||||||
|
+++ b/net/wireless/Kconfig
|
||||||
|
@@ -3,7 +3,7 @@ config WIRELESS_EXT
|
||||||
|
|
||||||
|
config WEXT_CORE
|
||||||
|
def_bool y
|
||||||
|
- depends on CFG80211_WEXT || WIRELESS_EXT
|
||||||
|
+ depends on CFG80211_WEXT || WIRELESS_EXT || SHWLAN_CFG80211
|
||||||
|
|
||||||
|
config WEXT_PROC
|
||||||
|
def_bool y
|
25
device/linux-sharp-shl22/fix_get_time_ns_error.patch
Normal file
25
device/linux-sharp-shl22/fix_get_time_ns_error.patch
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
diff --git a/drivers/sharp/shmds/mpu9150/inv_gyro.h b/drivers/sharp/shmds/mpu9150/inv_gyro.h
|
||||||
|
index 1d920c27..99686f81 100755
|
||||||
|
--- a/drivers/sharp/shmds/mpu9150/inv_gyro.h
|
||||||
|
+++ b/drivers/sharp/shmds/mpu9150/inv_gyro.h
|
||||||
|
@@ -705,7 +705,6 @@ int create_device_attributes(struct device *dev,
|
||||||
|
void remove_device_attributes(struct device *dev,
|
||||||
|
struct device_attribute **attrs);
|
||||||
|
int set_3050_bypass(struct inv_gyro_state_s *st, int enable);
|
||||||
|
-inline s64 get_time_ns(void);
|
||||||
|
int inv_mpu3050_create_sysfs(struct inv_gyro_state_s *st);
|
||||||
|
int inv_mpu3050_remove_sysfs(struct inv_gyro_state_s *st);
|
||||||
|
int inv_get_accl_bias(struct inv_gyro_state_s *st, int *accl_bias_regular);
|
||||||
|
diff --git a/drivers/sharp/shmds/mpu9150/inv_mpu3050.c b/drivers/sharp/shmds/mpu9150/inv_mpu3050.c
|
||||||
|
index fade48de..c9e044e4 100755
|
||||||
|
--- a/drivers/sharp/shmds/mpu9150/inv_mpu3050.c
|
||||||
|
+++ b/drivers/sharp/shmds/mpu9150/inv_mpu3050.c
|
||||||
|
@@ -43,6 +43,8 @@
|
||||||
|
#define MPU3050_ONE_MPU_TIME (20)
|
||||||
|
#define MPU3050_BOGUS_ADDR (0x7F)
|
||||||
|
|
||||||
|
+extern s64 get_time_ns(void);
|
||||||
|
+
|
||||||
|
int set_3050_bypass(struct inv_gyro_state_s *st, int enable)
|
||||||
|
{
|
||||||
|
struct inv_reg_map_s *reg;
|
|
@ -0,0 +1,264 @@
|
||||||
|
From e6fffec6636ffa3062891bae69a3895bbb73b148 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Ivan Djelic <ivan.djelic@parrot.com>
|
||||||
|
Date: Wed, 6 Mar 2013 20:09:27 +0100
|
||||||
|
Subject: ARM: 7668/1: fix memset-related crashes caused by recent GCC (4.7.2)
|
||||||
|
optimizations
|
||||||
|
MIME-Version: 1.0
|
||||||
|
Content-Type: text/plain; charset=UTF-8
|
||||||
|
Content-Transfer-Encoding: 8bit
|
||||||
|
|
||||||
|
commit 455bd4c430b0c0a361f38e8658a0d6cb469942b5 upstream.
|
||||||
|
|
||||||
|
Recent GCC versions (e.g. GCC-4.7.2) perform optimizations based on
|
||||||
|
assumptions about the implementation of memset and similar functions.
|
||||||
|
The current ARM optimized memset code does not return the value of
|
||||||
|
its first argument, as is usually expected from standard implementations.
|
||||||
|
|
||||||
|
For instance in the following function:
|
||||||
|
|
||||||
|
void debug_mutex_lock_common(struct mutex *lock, struct mutex_waiter *waiter)
|
||||||
|
{
|
||||||
|
memset(waiter, MUTEX_DEBUG_INIT, sizeof(*waiter));
|
||||||
|
waiter->magic = waiter;
|
||||||
|
INIT_LIST_HEAD(&waiter->list);
|
||||||
|
}
|
||||||
|
|
||||||
|
compiled as:
|
||||||
|
|
||||||
|
800554d0 <debug_mutex_lock_common>:
|
||||||
|
800554d0: e92d4008 push {r3, lr}
|
||||||
|
800554d4: e1a00001 mov r0, r1
|
||||||
|
800554d8: e3a02010 mov r2, #16 ; 0x10
|
||||||
|
800554dc: e3a01011 mov r1, #17 ; 0x11
|
||||||
|
800554e0: eb04426e bl 80165ea0 <memset>
|
||||||
|
800554e4: e1a03000 mov r3, r0
|
||||||
|
800554e8: e583000c str r0, [r3, #12]
|
||||||
|
800554ec: e5830000 str r0, [r3]
|
||||||
|
800554f0: e5830004 str r0, [r3, #4]
|
||||||
|
800554f4: e8bd8008 pop {r3, pc}
|
||||||
|
|
||||||
|
GCC assumes memset returns the value of pointer 'waiter' in register r0; causing
|
||||||
|
register/memory corruptions.
|
||||||
|
|
||||||
|
This patch fixes the return value of the assembly version of memset.
|
||||||
|
It adds a 'mov' instruction and merges an additional load+store into
|
||||||
|
existing load/store instructions.
|
||||||
|
For ease of review, here is a breakdown of the patch into 4 simple steps:
|
||||||
|
|
||||||
|
Step 1
|
||||||
|
======
|
||||||
|
Perform the following substitutions:
|
||||||
|
ip -> r8, then
|
||||||
|
r0 -> ip,
|
||||||
|
and insert 'mov ip, r0' as the first statement of the function.
|
||||||
|
At this point, we have a memset() implementation returning the proper result,
|
||||||
|
but corrupting r8 on some paths (the ones that were using ip).
|
||||||
|
|
||||||
|
Step 2
|
||||||
|
======
|
||||||
|
Make sure r8 is saved and restored when (! CALGN(1)+0) == 1:
|
||||||
|
|
||||||
|
save r8:
|
||||||
|
- str lr, [sp, #-4]!
|
||||||
|
+ stmfd sp!, {r8, lr}
|
||||||
|
|
||||||
|
and restore r8 on both exit paths:
|
||||||
|
- ldmeqfd sp!, {pc} @ Now <64 bytes to go.
|
||||||
|
+ ldmeqfd sp!, {r8, pc} @ Now <64 bytes to go.
|
||||||
|
(...)
|
||||||
|
tst r2, #16
|
||||||
|
stmneia ip!, {r1, r3, r8, lr}
|
||||||
|
- ldr lr, [sp], #4
|
||||||
|
+ ldmfd sp!, {r8, lr}
|
||||||
|
|
||||||
|
Step 3
|
||||||
|
======
|
||||||
|
Make sure r8 is saved and restored when (! CALGN(1)+0) == 0:
|
||||||
|
|
||||||
|
save r8:
|
||||||
|
- stmfd sp!, {r4-r7, lr}
|
||||||
|
+ stmfd sp!, {r4-r8, lr}
|
||||||
|
|
||||||
|
and restore r8 on both exit paths:
|
||||||
|
bgt 3b
|
||||||
|
- ldmeqfd sp!, {r4-r7, pc}
|
||||||
|
+ ldmeqfd sp!, {r4-r8, pc}
|
||||||
|
(...)
|
||||||
|
tst r2, #16
|
||||||
|
stmneia ip!, {r4-r7}
|
||||||
|
- ldmfd sp!, {r4-r7, lr}
|
||||||
|
+ ldmfd sp!, {r4-r8, lr}
|
||||||
|
|
||||||
|
Step 4
|
||||||
|
======
|
||||||
|
Rewrite register list "r4-r7, r8" as "r4-r8".
|
||||||
|
|
||||||
|
Signed-off-by: Ivan Djelic <ivan.djelic@parrot.com>
|
||||||
|
Reviewed-by: Nicolas Pitre <nico@linaro.org>
|
||||||
|
Signed-off-by: Dirk Behme <dirk.behme@gmail.com>
|
||||||
|
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
|
||||||
|
Cc: Eric Bénard <eric@eukrea.com>
|
||||||
|
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
||||||
|
---
|
||||||
|
arch/arm/lib/memset.S | 85 ++++++++++++++++++++++++++-------------------------
|
||||||
|
1 file changed, 44 insertions(+), 41 deletions(-)
|
||||||
|
|
||||||
|
(limited to 'arch/arm/lib/memset.S')
|
||||||
|
|
||||||
|
diff --git a/arch/arm/lib/memset.S b/arch/arm/lib/memset.S
|
||||||
|
index 650d5923..d912e73 100644
|
||||||
|
--- a/arch/arm/lib/memset.S
|
||||||
|
+++ b/arch/arm/lib/memset.S
|
||||||
|
@@ -19,9 +19,9 @@
|
||||||
|
1: subs r2, r2, #4 @ 1 do we have enough
|
||||||
|
blt 5f @ 1 bytes to align with?
|
||||||
|
cmp r3, #2 @ 1
|
||||||
|
- strltb r1, [r0], #1 @ 1
|
||||||
|
- strleb r1, [r0], #1 @ 1
|
||||||
|
- strb r1, [r0], #1 @ 1
|
||||||
|
+ strltb r1, [ip], #1 @ 1
|
||||||
|
+ strleb r1, [ip], #1 @ 1
|
||||||
|
+ strb r1, [ip], #1 @ 1
|
||||||
|
add r2, r2, r3 @ 1 (r2 = r2 - (4 - r3))
|
||||||
|
/*
|
||||||
|
* The pointer is now aligned and the length is adjusted. Try doing the
|
||||||
|
@@ -29,10 +29,14 @@
|
||||||
|
*/
|
||||||
|
|
||||||
|
ENTRY(memset)
|
||||||
|
- ands r3, r0, #3 @ 1 unaligned?
|
||||||
|
+/*
|
||||||
|
+ * Preserve the contents of r0 for the return value.
|
||||||
|
+ */
|
||||||
|
+ mov ip, r0
|
||||||
|
+ ands r3, ip, #3 @ 1 unaligned?
|
||||||
|
bne 1b @ 1
|
||||||
|
/*
|
||||||
|
- * we know that the pointer in r0 is aligned to a word boundary.
|
||||||
|
+ * we know that the pointer in ip is aligned to a word boundary.
|
||||||
|
*/
|
||||||
|
orr r1, r1, r1, lsl #8
|
||||||
|
orr r1, r1, r1, lsl #16
|
||||||
|
@@ -43,29 +47,28 @@ ENTRY(memset)
|
||||||
|
#if ! CALGN(1)+0
|
||||||
|
|
||||||
|
/*
|
||||||
|
- * We need an extra register for this loop - save the return address and
|
||||||
|
- * use the LR
|
||||||
|
+ * We need 2 extra registers for this loop - use r8 and the LR
|
||||||
|
*/
|
||||||
|
- str lr, [sp, #-4]!
|
||||||
|
- mov ip, r1
|
||||||
|
+ stmfd sp!, {r8, lr}
|
||||||
|
+ mov r8, r1
|
||||||
|
mov lr, r1
|
||||||
|
|
||||||
|
2: subs r2, r2, #64
|
||||||
|
- stmgeia r0!, {r1, r3, ip, lr} @ 64 bytes at a time.
|
||||||
|
- stmgeia r0!, {r1, r3, ip, lr}
|
||||||
|
- stmgeia r0!, {r1, r3, ip, lr}
|
||||||
|
- stmgeia r0!, {r1, r3, ip, lr}
|
||||||
|
+ stmgeia ip!, {r1, r3, r8, lr} @ 64 bytes at a time.
|
||||||
|
+ stmgeia ip!, {r1, r3, r8, lr}
|
||||||
|
+ stmgeia ip!, {r1, r3, r8, lr}
|
||||||
|
+ stmgeia ip!, {r1, r3, r8, lr}
|
||||||
|
bgt 2b
|
||||||
|
- ldmeqfd sp!, {pc} @ Now <64 bytes to go.
|
||||||
|
+ ldmeqfd sp!, {r8, pc} @ Now <64 bytes to go.
|
||||||
|
/*
|
||||||
|
* No need to correct the count; we're only testing bits from now on
|
||||||
|
*/
|
||||||
|
tst r2, #32
|
||||||
|
- stmneia r0!, {r1, r3, ip, lr}
|
||||||
|
- stmneia r0!, {r1, r3, ip, lr}
|
||||||
|
+ stmneia ip!, {r1, r3, r8, lr}
|
||||||
|
+ stmneia ip!, {r1, r3, r8, lr}
|
||||||
|
tst r2, #16
|
||||||
|
- stmneia r0!, {r1, r3, ip, lr}
|
||||||
|
- ldr lr, [sp], #4
|
||||||
|
+ stmneia ip!, {r1, r3, r8, lr}
|
||||||
|
+ ldmfd sp!, {r8, lr}
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
@@ -74,54 +77,54 @@ ENTRY(memset)
|
||||||
|
* whole cache lines at once.
|
||||||
|
*/
|
||||||
|
|
||||||
|
- stmfd sp!, {r4-r7, lr}
|
||||||
|
+ stmfd sp!, {r4-r8, lr}
|
||||||
|
mov r4, r1
|
||||||
|
mov r5, r1
|
||||||
|
mov r6, r1
|
||||||
|
mov r7, r1
|
||||||
|
- mov ip, r1
|
||||||
|
+ mov r8, r1
|
||||||
|
mov lr, r1
|
||||||
|
|
||||||
|
cmp r2, #96
|
||||||
|
- tstgt r0, #31
|
||||||
|
+ tstgt ip, #31
|
||||||
|
ble 3f
|
||||||
|
|
||||||
|
- and ip, r0, #31
|
||||||
|
- rsb ip, ip, #32
|
||||||
|
- sub r2, r2, ip
|
||||||
|
- movs ip, ip, lsl #(32 - 4)
|
||||||
|
- stmcsia r0!, {r4, r5, r6, r7}
|
||||||
|
- stmmiia r0!, {r4, r5}
|
||||||
|
- tst ip, #(1 << 30)
|
||||||
|
- mov ip, r1
|
||||||
|
- strne r1, [r0], #4
|
||||||
|
+ and r8, ip, #31
|
||||||
|
+ rsb r8, r8, #32
|
||||||
|
+ sub r2, r2, r8
|
||||||
|
+ movs r8, r8, lsl #(32 - 4)
|
||||||
|
+ stmcsia ip!, {r4, r5, r6, r7}
|
||||||
|
+ stmmiia ip!, {r4, r5}
|
||||||
|
+ tst r8, #(1 << 30)
|
||||||
|
+ mov r8, r1
|
||||||
|
+ strne r1, [ip], #4
|
||||||
|
|
||||||
|
3: subs r2, r2, #64
|
||||||
|
- stmgeia r0!, {r1, r3-r7, ip, lr}
|
||||||
|
- stmgeia r0!, {r1, r3-r7, ip, lr}
|
||||||
|
+ stmgeia ip!, {r1, r3-r8, lr}
|
||||||
|
+ stmgeia ip!, {r1, r3-r8, lr}
|
||||||
|
bgt 3b
|
||||||
|
- ldmeqfd sp!, {r4-r7, pc}
|
||||||
|
+ ldmeqfd sp!, {r4-r8, pc}
|
||||||
|
|
||||||
|
tst r2, #32
|
||||||
|
- stmneia r0!, {r1, r3-r7, ip, lr}
|
||||||
|
+ stmneia ip!, {r1, r3-r8, lr}
|
||||||
|
tst r2, #16
|
||||||
|
- stmneia r0!, {r4-r7}
|
||||||
|
- ldmfd sp!, {r4-r7, lr}
|
||||||
|
+ stmneia ip!, {r4-r7}
|
||||||
|
+ ldmfd sp!, {r4-r8, lr}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
4: tst r2, #8
|
||||||
|
- stmneia r0!, {r1, r3}
|
||||||
|
+ stmneia ip!, {r1, r3}
|
||||||
|
tst r2, #4
|
||||||
|
- strne r1, [r0], #4
|
||||||
|
+ strne r1, [ip], #4
|
||||||
|
/*
|
||||||
|
* When we get here, we've got less than 4 bytes to zero. We
|
||||||
|
* may have an unaligned pointer as well.
|
||||||
|
*/
|
||||||
|
5: tst r2, #2
|
||||||
|
- strneb r1, [r0], #1
|
||||||
|
- strneb r1, [r0], #1
|
||||||
|
+ strneb r1, [ip], #1
|
||||||
|
+ strneb r1, [ip], #1
|
||||||
|
tst r2, #1
|
||||||
|
- strneb r1, [r0], #1
|
||||||
|
+ strneb r1, [ip], #1
|
||||||
|
mov pc, lr
|
||||||
|
ENDPROC(memset)
|
||||||
|
--
|
||||||
|
cgit v1.1
|
||||||
|
|
92
device/linux-sharp-shl22/fix_the_memset_fix.patch
Normal file
92
device/linux-sharp-shl22/fix_the_memset_fix.patch
Normal file
|
@ -0,0 +1,92 @@
|
||||||
|
From d1814ea12da067fda7bac933e06ef205163617f6 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Nicolas Pitre <nicolas.pitre@linaro.org>
|
||||||
|
Date: Tue, 12 Mar 2013 13:00:42 +0100
|
||||||
|
Subject: ARM: 7670/1: fix the memset fix
|
||||||
|
MIME-Version: 1.0
|
||||||
|
Content-Type: text/plain; charset=UTF-8
|
||||||
|
Content-Transfer-Encoding: 8bit
|
||||||
|
|
||||||
|
commit 418df63adac56841ef6b0f1fcf435bc64d4ed177 upstream.
|
||||||
|
|
||||||
|
Commit 455bd4c430b0 ("ARM: 7668/1: fix memset-related crashes caused by
|
||||||
|
recent GCC (4.7.2) optimizations") attempted to fix a compliance issue
|
||||||
|
with the memset return value. However the memset itself became broken
|
||||||
|
by that patch for misaligned pointers.
|
||||||
|
|
||||||
|
This fixes the above by branching over the entry code from the
|
||||||
|
misaligned fixup code to avoid reloading the original pointer.
|
||||||
|
|
||||||
|
Also, because the function entry alignment is wrong in the Thumb mode
|
||||||
|
compilation, that fixup code is moved to the end.
|
||||||
|
|
||||||
|
While at it, the entry instructions are slightly reworked to help dual
|
||||||
|
issue pipelines.
|
||||||
|
|
||||||
|
Signed-off-by: Nicolas Pitre <nico@linaro.org>
|
||||||
|
Tested-by: Alexander Holler <holler@ahsoftware.de>
|
||||||
|
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
|
||||||
|
Cc: Eric Bénard <eric@eukrea.com>
|
||||||
|
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
||||||
|
---
|
||||||
|
arch/arm/lib/memset.S | 33 +++++++++++++--------------------
|
||||||
|
1 file changed, 13 insertions(+), 20 deletions(-)
|
||||||
|
|
||||||
|
(limited to 'arch/arm/lib/memset.S')
|
||||||
|
|
||||||
|
diff --git a/arch/arm/lib/memset.S b/arch/arm/lib/memset.S
|
||||||
|
index d912e73..94b0650 100644
|
||||||
|
--- a/arch/arm/lib/memset.S
|
||||||
|
+++ b/arch/arm/lib/memset.S
|
||||||
|
@@ -14,31 +14,15 @@
|
||||||
|
|
||||||
|
.text
|
||||||
|
.align 5
|
||||||
|
- .word 0
|
||||||
|
-
|
||||||
|
-1: subs r2, r2, #4 @ 1 do we have enough
|
||||||
|
- blt 5f @ 1 bytes to align with?
|
||||||
|
- cmp r3, #2 @ 1
|
||||||
|
- strltb r1, [ip], #1 @ 1
|
||||||
|
- strleb r1, [ip], #1 @ 1
|
||||||
|
- strb r1, [ip], #1 @ 1
|
||||||
|
- add r2, r2, r3 @ 1 (r2 = r2 - (4 - r3))
|
||||||
|
-/*
|
||||||
|
- * The pointer is now aligned and the length is adjusted. Try doing the
|
||||||
|
- * memset again.
|
||||||
|
- */
|
||||||
|
|
||||||
|
ENTRY(memset)
|
||||||
|
-/*
|
||||||
|
- * Preserve the contents of r0 for the return value.
|
||||||
|
- */
|
||||||
|
- mov ip, r0
|
||||||
|
- ands r3, ip, #3 @ 1 unaligned?
|
||||||
|
- bne 1b @ 1
|
||||||
|
+ ands r3, r0, #3 @ 1 unaligned?
|
||||||
|
+ mov ip, r0 @ preserve r0 as return value
|
||||||
|
+ bne 6f @ 1
|
||||||
|
/*
|
||||||
|
* we know that the pointer in ip is aligned to a word boundary.
|
||||||
|
*/
|
||||||
|
- orr r1, r1, r1, lsl #8
|
||||||
|
+1: orr r1, r1, r1, lsl #8
|
||||||
|
orr r1, r1, r1, lsl #16
|
||||||
|
mov r3, r1
|
||||||
|
cmp r2, #16
|
||||||
|
@@ -127,4 +111,13 @@ ENTRY(memset)
|
||||||
|
tst r2, #1
|
||||||
|
strneb r1, [ip], #1
|
||||||
|
mov pc, lr
|
||||||
|
+
|
||||||
|
+6: subs r2, r2, #4 @ 1 do we have enough
|
||||||
|
+ blt 5b @ 1 bytes to align with?
|
||||||
|
+ cmp r3, #2 @ 1
|
||||||
|
+ strltb r1, [ip], #1 @ 1
|
||||||
|
+ strleb r1, [ip], #1 @ 1
|
||||||
|
+ strb r1, [ip], #1 @ 1
|
||||||
|
+ add r2, r2, r3 @ 1 (r2 = r2 - (4 - r3))
|
||||||
|
+ b 1b
|
||||||
|
ENDPROC(memset)
|
||||||
|
--
|
||||||
|
cgit v1.1
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
../../.shared-patches/linux/gcc7-give-up-on-ilog2-const-optimizations.patch
|
1
device/linux-sharp-shl22/gcc8-fix-put-user.patch
Symbolic link
1
device/linux-sharp-shl22/gcc8-fix-put-user.patch
Symbolic link
|
@ -0,0 +1 @@
|
||||||
|
../../.shared-patches/linux/gcc8-fix-put-user.patch
|
|
@ -0,0 +1 @@
|
||||||
|
../../.shared-patches/linux/kernel-use-the-gnu89-standard-explicitly.patch
|
Loading…
Reference in a new issue