aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSadaf Ebrahimi <sadafebrahimi@google.com>2023-07-05 18:31:26 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2023-07-05 18:31:26 +0000
commiteb3a388512a87207158c1c5eff6eaf49713e801c (patch)
tree4448719f8536d1b4d9eacea29898ff943a55d72c
parent32efd47eadda7fd3e0f2d58b5d4951ccb0a500a8 (diff)
parent61719849ac5ebb5d1be619cfc67eba85ed77772c (diff)
downloadxz-embedded-eb3a388512a87207158c1c5eff6eaf49713e801c.tar.gz
Upgrade xz-embedded to d89ad8130128d71c773f5e50e356562a506f843e am: 9ecffe1d16 am: 1ad65adab5 am: e472aa9e0f am: 61719849ac
Original change: https://android-review.googlesource.com/c/platform/external/xz-embedded/+/2646463 Change-Id: I49be2faf0f1156593a0f72269d61a1531bd9425d Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-rw-r--r--METADATA12
-rw-r--r--README7
-rw-r--r--README.version2
-rw-r--r--linux/lib/xz/Kconfig29
-rw-r--r--linux/lib/xz/xz_dec_bcj.c50
-rw-r--r--linux/lib/xz/xz_private.h3
-rw-r--r--userspace/Makefile4
-rw-r--r--userspace/xz_config.h5
8 files changed, 86 insertions, 26 deletions
diff --git a/METADATA b/METADATA
index 72800f8..46bfe82 100644
--- a/METADATA
+++ b/METADATA
@@ -1,3 +1,7 @@
+# This project was upgraded with external_updater.
+# Usage: tools/external_updater/updater.sh update xz-embedded
+# For more info, check https://cs.android.com/android/platform/superproject/+/master:tools/external_updater/README.md
+
name: "xz-embedded"
description: "XZ Embedded"
third_party {
@@ -5,11 +9,11 @@ third_party {
type: GIT
value: "https://git.tukaani.org/xz-embedded.git"
}
- version: "3f438e15109229bb14ab45f285f4bff5412a9542"
+ version: "d89ad8130128d71c773f5e50e356562a506f843e"
license_type: UNENCUMBERED
last_upgrade_date {
- year: 2021
- month: 10
- day: 11
+ year: 2023
+ month: 6
+ day: 30
}
}
diff --git a/README b/README
index c8ca09c..32c4625 100644
--- a/README
+++ b/README
@@ -35,9 +35,10 @@ Compiling the Linux kernel module
make -C /path/to/kernel/source \
KCPPFLAGS=-I"$(pwd)/../../include" M="$(pwd)" \
CONFIG_XZ_DEC=m CONFIG_XZ_DEC_TEST=m CONFIG_XZ_DEC_BCJ=y \
- CONFIG_XZ_DEC_X86=y CONFIG_XZ_DEC_POWERPC=y \
- CONFIG_XZ_DEC_IA64=y CONFIG_XZ_DEC_ARM=y \
- CONFIG_XZ_DEC_ARMTHUMB=y CONFIG_XZ_DEC_SPARC=y
+ CONFIG_XZ_DEC_X86=y CONFIG_XZ_DEC_ARM=y \
+ CONFIG_XZ_DEC_ARMTHUMB=y CONFIG_XZ_DEC_ARM64=y \
+ CONFIG_XZ_DEC_POWERPC=y CONFIG_XZ_DEC_IA64=y \
+ CONFIG_XZ_DEC_SPARC=y
If you want only one or a few of the BCJ filters, omit the appropriate
variables. CONFIG_XZ_DEC_BCJ=y is always required to build the support
diff --git a/README.version b/README.version
deleted file mode 100644
index a9aaf07..0000000
--- a/README.version
+++ /dev/null
@@ -1,2 +0,0 @@
-URL: https://git.tukaani.org/?p=xz-embedded.git
-Version: 79b68de5657beecfad575578a7181cf6fca869cb
diff --git a/linux/lib/xz/Kconfig b/linux/lib/xz/Kconfig
index 3e58caf..c993dda 100644
--- a/linux/lib/xz/Kconfig
+++ b/linux/lib/xz/Kconfig
@@ -9,33 +9,38 @@ config XZ_DEC
if XZ_DEC
config XZ_DEC_X86
- bool "x86 BCJ filter decoder"
- default y if X86
+ bool "x86 BCJ filter decoder" if EXPERT
+ default y
select XZ_DEC_BCJ
config XZ_DEC_POWERPC
- bool "PowerPC BCJ filter decoder"
- default y if PPC
+ bool "PowerPC BCJ filter decoder" if EXPERT
+ default y
select XZ_DEC_BCJ
config XZ_DEC_IA64
- bool "IA-64 BCJ filter decoder"
- default y if IA64
+ bool "IA-64 BCJ filter decoder" if EXPERT
+ default y
select XZ_DEC_BCJ
config XZ_DEC_ARM
- bool "ARM BCJ filter decoder"
- default y if ARM
+ bool "ARM BCJ filter decoder" if EXPERT
+ default y
select XZ_DEC_BCJ
config XZ_DEC_ARMTHUMB
- bool "ARM-Thumb BCJ filter decoder"
- default y if (ARM && ARM_THUMB)
+ bool "ARM-Thumb BCJ filter decoder" if EXPERT
+ default y
+ select XZ_DEC_BCJ
+
+config XZ_DEC_ARM64
+ bool "ARM64 BCJ filter decoder" if EXPERT
+ default y
select XZ_DEC_BCJ
config XZ_DEC_SPARC
- bool "SPARC BCJ filter decoder"
- default y if SPARC
+ bool "SPARC BCJ filter decoder" if EXPERT
+ default y
select XZ_DEC_BCJ
config XZ_DEC_MICROLZMA
diff --git a/linux/lib/xz/xz_dec_bcj.c b/linux/lib/xz/xz_dec_bcj.c
index ef449e9..56c02e9 100644
--- a/linux/lib/xz/xz_dec_bcj.c
+++ b/linux/lib/xz/xz_dec_bcj.c
@@ -24,7 +24,8 @@ struct xz_dec_bcj {
BCJ_IA64 = 6, /* Big or little endian */
BCJ_ARM = 7, /* Little endian only */
BCJ_ARMTHUMB = 8, /* Little endian only */
- BCJ_SPARC = 9 /* Big or little endian */
+ BCJ_SPARC = 9, /* Big or little endian */
+ BCJ_ARM64 = 10 /* AArch64 */
} type;
/*
@@ -334,6 +335,45 @@ static size_t bcj_sparc(struct xz_dec_bcj *s, uint8_t *buf, size_t size)
}
#endif
+#ifdef XZ_DEC_ARM64
+static size_t bcj_arm64(struct xz_dec_bcj *s, uint8_t *buf, size_t size)
+{
+ size_t i;
+ uint32_t instr;
+ uint32_t addr;
+
+ for (i = 0; i + 4 <= size; i += 4) {
+ instr = get_unaligned_le32(buf + i);
+
+ if ((instr >> 26) == 0x25) {
+ /* BL instruction */
+ addr = instr - ((s->pos + (uint32_t)i) >> 2);
+ instr = 0x94000000 | (addr & 0x03FFFFFF);
+ put_unaligned_le32(instr, buf + i);
+
+ } else if ((instr & 0x9F000000) == 0x90000000) {
+ /* ADRP instruction */
+ addr = ((instr >> 29) & 3) | ((instr >> 3) & 0x1FFFFC);
+
+ /* Only convert values in the range +/-512 MiB. */
+ if ((addr + 0x020000) & 0x1C0000)
+ continue;
+
+ addr -= (s->pos + (uint32_t)i) >> 12;
+
+ instr &= 0x9000001F;
+ instr |= (addr & 3) << 29;
+ instr |= (addr & 0x03FFFC) << 3;
+ instr |= (0U - (addr & 0x020000)) & 0xE00000;
+
+ put_unaligned_le32(instr, buf + i);
+ }
+ }
+
+ return i;
+}
+#endif
+
/*
* Apply the selected BCJ filter. Update *pos and s->pos to match the amount
* of data that got filtered.
@@ -381,6 +421,11 @@ static void bcj_apply(struct xz_dec_bcj *s,
filtered = bcj_sparc(s, buf, size);
break;
#endif
+#ifdef XZ_DEC_ARM64
+ case BCJ_ARM64:
+ filtered = bcj_arm64(s, buf, size);
+ break;
+#endif
default:
/* Never reached but silence compiler warnings. */
filtered = 0;
@@ -554,6 +599,9 @@ XZ_EXTERN enum xz_ret xz_dec_bcj_reset(struct xz_dec_bcj *s, uint8_t id)
#ifdef XZ_DEC_SPARC
case BCJ_SPARC:
#endif
+#ifdef XZ_DEC_ARM64
+ case BCJ_ARM64:
+#endif
break;
default:
diff --git a/linux/lib/xz/xz_private.h b/linux/lib/xz/xz_private.h
index d9fd49b..e3bba7b 100644
--- a/linux/lib/xz/xz_private.h
+++ b/linux/lib/xz/xz_private.h
@@ -37,6 +37,9 @@
# ifdef CONFIG_XZ_DEC_SPARC
# define XZ_DEC_SPARC
# endif
+# ifdef CONFIG_XZ_DEC_ARM64
+# define XZ_DEC_ARM64
+# endif
# ifdef CONFIG_XZ_DEC_MICROLZMA
# define XZ_DEC_MICROLZMA
# endif
diff --git a/userspace/Makefile b/userspace/Makefile
index 1acacf0..b48d30c 100644
--- a/userspace/Makefile
+++ b/userspace/Makefile
@@ -11,8 +11,8 @@
# the code is also C99/C11 compatible. With clang you may wish to omit
# either -std=gnu89 or -pedantic as having both gives quite a few warnings.
CC = gcc -std=gnu89
-BCJ_CPPFLAGS = -DXZ_DEC_X86 -DXZ_DEC_POWERPC -DXZ_DEC_IA64 \
- -DXZ_DEC_ARM -DXZ_DEC_ARMTHUMB -DXZ_DEC_SPARC
+BCJ_CPPFLAGS = -DXZ_DEC_X86 -DXZ_DEC_ARM -DXZ_DEC_ARMTHUMB -DXZ_DEC_ARM64 \
+ -DXZ_DEC_POWERPC -DXZ_DEC_IA64 -DXZ_DEC_SPARC
CPPFLAGS = -DXZ_USE_CRC64 -DXZ_DEC_ANY_CHECK -DXZ_DEC_CONCATENATED
CFLAGS = -ggdb3 -O2 -pedantic -Wall -Wextra -Wno-long-long
RM = rm -f
diff --git a/userspace/xz_config.h b/userspace/xz_config.h
index ee590d7..ac1b6c3 100644
--- a/userspace/xz_config.h
+++ b/userspace/xz_config.h
@@ -18,10 +18,11 @@
/* Uncomment as needed to enable BCJ filter decoders. */
/* #define XZ_DEC_X86 */
-/* #define XZ_DEC_POWERPC */
-/* #define XZ_DEC_IA64 */
/* #define XZ_DEC_ARM */
/* #define XZ_DEC_ARMTHUMB */
+/* #define XZ_DEC_ARM64 */
+/* #define XZ_DEC_POWERPC */
+/* #define XZ_DEC_IA64 */
/* #define XZ_DEC_SPARC */
/*