community/openjdk8-loongarch: new aport

https://github.com/loongson/jdk8u
Loongarch port of OpenJDK 8

Only enabled for arch=loongarch64
This commit is contained in:
Celeste 2024-09-12 03:37:04 +00:00
parent 84b4a331ea
commit 82181afd55
16 changed files with 1108 additions and 0 deletions

View File

@ -0,0 +1,294 @@
# Maintainer: Celeste <cielesti@protonmail.com>
pkgname=openjdk8-loongarch
pkgver=8.422.05
pkgrel=0
_majorver=${pkgver%%.*}
_pkgver=${pkgver#*.}
_pkgver=${_majorver}u${_pkgver/\./-b}-ls-ga
pkgdesc="Loongarch port of OpenJDK $_majorver"
url="https://github.com/loongson/jdk${_majorver}u"
arch="loongarch64"
license="GPL-2.0-only WITH Classpath-exception-2.0"
options="sover-namecheck"
makedepends_build="
openjdk$_majorver-bootstrap
autoconf
bash
gawk
grep
make
sed
zip
zlib-dev
"
makedepends_host="
alsa-lib-dev
cups-dev
elfutils-dev
fontconfig-dev
freetype-dev
giflib-dev
lcms2-dev
libffi-dev
libjpeg-turbo-dev
libx11-dev
libxext-dev
libxrandr-dev
libxrender-dev
libxt-dev
libxtst-dev
linux-headers
zlib-dev
"
subpackages="
$pkgname-demos
$pkgname-doc
$pkgname-jre
$pkgname-jre-lib:jrelib:noarch
$pkgname-jre-base:jrebase
$pkgname-jdk
"
source="jdk-$_pkgver.tar.gz::https://github.com/loongson/jdk${_majorver}u/archive/refs/tags/jdk$_pkgver.tar.gz
icedtea-hotspot-lfs64.patch
icedtea-hotspot-musl.patch
icedtea-hotspot-noagent-musl.patch
icedtea-int-conversion.patch
icedtea-issue13032.patch
icedtea-jdk-disable-vfork.patch
icedtea-jdk-execinfo.patch
icedtea-jdk-fix-ipv6-init.patch
icedtea-jdk-fix-libjvm-load.patch
icedtea-jdk-implicit.patch
icedtea-jdk-includes.patch
icedtea-jdk-musl.patch
icedtea-pointer-types.patch
loongarch-fpu_control.patch
Example.java
"
builddir="$srcdir/jdk${_majorver}u-jdk$_pkgver"
case "$CARCH" in
loongarch64)
_jarch="$CARCH"
_jvm_variants=server
provides="openjdk$_majorver-bootstrap openjdk$_majorver"
replaces="openjdk$_majorver"
provider_priority=$((_majorver + 1))
;;
esac
_java_home="/usr/lib/jvm/java-1.8-openjdk"
_jrelib="$_java_home/jre/lib/$_jarch"
# Exclude xawt from ldpath to avoid duplicate provides for libmawt.so
# (also in headless). in future this should be a virtual provides.
ldpath="$_jrelib:$_jrelib/native_threads:$_jrelib/headless:$_jrelib/server:$_jrelib/jli"
sonameprefix="$pkgname:"
# enable running the JTReg tests in check?
# see comment in that function for explanation
_run_jtreg=${_run_jtreg:-0}
if [ $_run_jtreg -ne 0 ]; then
makedepends="$makedepends java-jtreg"
checkdepends="$checkdepends font-freefont xvfb-run"
fi
prepare() {
default_prepare
# update autoconf files to detect alpine
update_config_guess
update_config_sub
case "$CARCH" in
loongarch64)
;;
*)
error "Please use community/openjdk8"
return 1
;;
esac
}
build() {
if [ $_run_jtreg -ne 0 ]; then
_with_jtreg="--with-jtreg=/usr/share/java/jtreg"
else
_with_jtreg="--with-jtreg=no"
fi
if [ -n "$USE_CCACHE" ]; then
# workaround ccache being disallowed
export PATH="/usr/bin:/bin:/sbin:/usr/sbin"
local ccache="--enable-ccache"
fi
# we want to build hotspot with better optimisations; it's set to this
# (prepended) anyway, and it's huge
export CFLAGS="$CFLAGS -O3"
export CXXFLAGS="$CXXFLAGS -O3"
# CFLAGS, CXXFLAGS and LDFLAGS are ignored as shown by a warning
# in the output of ./configure unless used like such:
# --with-extra-cflags="$CFLAGS"
# --with-extra-cxxflags="$CXXFLAGS"
# --with-extra-ldflags="$LDFLAGS"
# See also paragraph "Configure Control Variables" from "common/doc/building.md"
# shellcheck disable=2097 disable=2098
CFLAGS='' CXXFLAGS='' LDFLAGS='' \
bash ./configure \
--openjdk-target=$CHOST \
--prefix="$_java_home" \
--sysconfdir=/etc \
--mandir=/usr/share/man \
--infodir=/usr/share/info \
--localstatedir=/var \
--with-extra-cflags="$CFLAGS" \
--with-extra-cxxflags="$CXXFLAGS" \
--with-extra-ldflags="$LDFLAGS" \
--with-zlib=system \
--with-giflib=system \
--with-jobs=${JOBS:-4} \
--with-native-debug-symbols=none \
$ccache \
$_with_jtreg \
--with-milestone="fcs" \
--with-jvm-variants=$_jvm_variants \
--with-debug-level=release \
--with-vendor-name="Alpine" \
--with-vendor-url="https://alpinelinux.org/" \
--with-vendor-bug-url="https://gitlab.alpinelinux.org/alpine/aports/issues" \
--with-vendor-vm-bug-url="https://gitlab.alpinelinux.org/alpine/aports/issues"
MAKEFLAGS='' make JOBS="${JOBS:-4}" images
}
check() {
cd build/linux-*-$_jvm_variants-release/images/j2sdk-image
./bin/java -version
./bin/javac "$srcdir"/Example.java -d "$builddir"
./bin/java -classpath "$builddir" Example
}
package() {
depends="$pkgname-jdk=$pkgver-r$pkgrel"
mkdir -p "$pkgdir"/$_java_home
cd build/linux-*-$_jvm_variants-release/images/
cp -a j2sdk-image/* "$pkgdir"/$_java_home/
rm -v "$pkgdir"/$_java_home/src.zip
# symlink to shared java cacerts store
rm -v "$pkgdir"/$_java_home/jre/lib/security/cacerts
ln -sv /etc/ssl/certs/java/cacerts \
"$pkgdir"/$_java_home/jre/lib/security/cacerts
}
jrelib() {
pkgdesc="$pkgdesc Java Runtime (class libraries)"
depends="java-cacerts"
provides="openjdk$_majorver-jre-lib"
replaces="openjdk$_majorver-jre-lib"
amove \
$_java_home/jre/lib/images \
$_java_home/jre/lib/\*.jar \
$_java_home/jre/lib/security \
$_java_home/jre/lib/ext/\*.jar \
$_java_home/jre/lib/cmm \
$_java_home/jre/ASSEMBLY_EXCEPTION \
$_java_home/jre/THIRD_PARTY_README \
$_java_home/jre/LICENSE
}
jre() {
pkgdesc="$pkgdesc Java Runtime"
depends="font-dejavu"
provides="java-jre openjdk$_majorver-jre"
replaces="openjdk$_majorver-jre"
amove \
$_java_home/jre/bin/policytool \
$_java_home/bin/appletviewer \
$_java_home/bin/policytool \
$_java_home/jre/lib/$_jarch/libawt_xawt.so \
$_java_home/jre/lib/$_jarch/libfontmanager.so \
$_java_home/jre/lib/$_jarch/libjawt.so \
$_java_home/jre/lib/$_jarch/libjsoundalsa.so \
$_java_home/jre/lib/$_jarch/libsplashscreen.so
}
jrebase() {
pkgdesc="$pkgdesc Java Runtime (no GUI support)"
depends="$pkgname-jre-lib=$pkgver-r$pkgrel java-common"
provides="java-jre-headless openjdk$_majorver-jre-base"
replaces="openjdk$_majorver-jre-base"
amove \
$_java_home/bin/java \
$_java_home/bin/orbd \
$_java_home/bin/rmid \
$_java_home/bin/servertool \
$_java_home/bin/unpack200 \
$_java_home/bin/keytool \
$_java_home/bin/pack200 \
$_java_home/bin/rmiregistry \
$_java_home/bin/tnameserv \
$_java_home/lib/$_jarch/jli
# Rest of the jre subdir (which were not taken by -jre subpkg).
amove $_java_home/jre
ln -s java-1.8-openjdk "$subpkgdir"/usr/lib/jvm/java-8-openjdk
}
doc() {
default_doc
amove $_java_home/man
}
demos() {
pkgdesc="$pkgdesc Java Demos and Samples"
depends="$pkgname-jdk=$pkgver-r$pkgrel"
provides="openjdk$_majorver-demos"
replaces="openjdk$_majorver-demos"
amove \
$_java_home/demo \
$_java_home/sample
}
jdk() {
pkgdesc="$pkgdesc (JDK) ($_jvm_variants variant)"
depends="$pkgname-jre=$pkgver-r$pkgrel"
provides="java-jdk openjdk$_majorver-jdk"
replaces="openjdk$_majorver-jdk"
amove \
$_java_home/bin \
$_java_home/lib \
$_java_home/include
}
sha512sums="
bb12ea5d8c12b728095b0353857bcc782b343874299195b39dcf183124b245b279bf82736267ecdaf82c383b37b9bbb99159c668e9122c6472874db1d9d5cb39 jdk-8u422-b05-ls-ga.tar.gz
6717172162cfc638de0e7a9ef80fd512f215a094d3dd6ca472c735445e612a804c4e97ced32a9618385130c054b6d333670ab2bd644f4f11daf150f93cd077d1 icedtea-hotspot-lfs64.patch
28709285390a997adbd56ebda42ef718fbc08daf572b8568f484436d255514f9d25f033e3333dff8aa352fc9846057ac5bb42fa955d3e5e44eddc96dc273c07c icedtea-hotspot-musl.patch
19459dbb922f5a71cd15b53199481498626a783c24f91d2544d55b7dddd2cdb34a64bbf0226b99548612dd1743af01b3f9ff32c30abbbc90ce727ca2dbbbd1f9 icedtea-hotspot-noagent-musl.patch
4fcad23d533d6a1fd5526223cb76330aebbbbab3766c43a5b6d5d8cc9c729381d153cced81aae2666798c82e90e10e193db33207b357e01fb5ebd0b686263394 icedtea-int-conversion.patch
e1bca07aa1a25258ee9c8e9870f8d475db788bab1a354c5458196012aaf20fba8b3968b646d18792ab7135e9b75cbebafc53fda176166bc6ddfd13e4a43b1c8d icedtea-issue13032.patch
c70fee8f1a10c155494ab9c6e55e979d8a3e23f12358ffe9de2029ae15feff361957f1aa43af43c90ecf00523f92e3333b40311a8d0c132ebd456486cb85ed8a icedtea-jdk-disable-vfork.patch
f6365cfafafa008bd6c1bf0ccec01a63f8a39bd1a8bc87baa492a27234d47793ba02d455e5667a873ef50148df3baaf6a8421e2da0b15faac675867da714dd5f icedtea-jdk-execinfo.patch
48533f87fc2cf29d26b259be0df51087d2fe5b252e72d00c6ea2f4add7b0fb113141718c116279c5905e03f64a1118082e719393786811367cf4d472b5d36774 icedtea-jdk-fix-ipv6-init.patch
b135991c76b0db8fa7c363e0903624668e11eda7b54a943035c214aa4d7fc8c3e8110ed200edcec82792f3c9393150a9bd628625ddf7f3e55720ff163fbbb471 icedtea-jdk-fix-libjvm-load.patch
21a16599d7e0aaf2997db59ada5af63e25484949ca965a34536ee44b950a132a6b5ca0b4922a6919d840a84ba0bb8413d87d2b97ea2c65c00e8766cc470c267d icedtea-jdk-implicit.patch
de246b2f23a9aa1054e327bdf4ab34136d9480b34f7646f9823bddd9bc252131c0b05d790778fc5df3816e2386bdee5178a37a2ec7f30919e137a775dfd6fbb4 icedtea-jdk-includes.patch
3b01de971f64f082d3e289cf337e635ef001381e8ca427a77baa9c52c7ba423889f57665779ca5b3c8bcefb8feacbea31dfaac580c969a4f061439069ee34aae icedtea-jdk-musl.patch
4380e167a1600d980b5aa53941cdaf3a83c742169d174af39efb81b544d6961d0e77e9cd37eb7b7afd14e205d0039f47f2b1452a8c4010b1295dca0d70a9d435 icedtea-pointer-types.patch
5f3552dbb430a84fef70c0f6594f2c1db3bd51a1a17cd7d137ded804d35e0430815ddf1aebc58507875d17d5392af6e005027da54651f71cf1e09d1cba10dd53 loongarch-fpu_control.patch
601ac59e59d32cbaf91f7541bd8173b38c68cbec96a7fb74227017afc8e5dc6ce4b8be03e92dd34cf52370e5d52beb780808af57b17c79c53ae8ec64cd34a92d Example.java
"

View File

@ -0,0 +1,16 @@
// Copied from https://www.graalvm.org/22.0/reference-manual/native-image/.
public class Example {
public static void main(String[] args) {
String str = "Native Image is awesome";
String reversed = reverseString(str);
System.out.println("The reversed string is: " + reversed);
}
public static String reverseString(String str) {
if (str.isEmpty())
return str;
return reverseString(str.substring(1)) + str.charAt(0);
}
}

View File

@ -0,0 +1,133 @@
--- openjdk/hotspot/src/os/linux/vm/attachListener_linux.cpp
+++ openjdk/hotspot/src/os/linux/vm/attachListener_linux.cpp
@@ -446,14 +446,14 @@
void AttachListener::vm_start() {
char fn[UNIX_PATH_MAX];
- struct stat64 st;
+ struct stat st;
int ret;
int n = snprintf(fn, UNIX_PATH_MAX, "%s/.java_pid%d",
os::get_temp_directory(), os::current_process_id());
assert(n < (int)UNIX_PATH_MAX, "java_pid file name buffer overflow");
- RESTARTABLE(::stat64(fn, &st), ret);
+ RESTARTABLE(::stat(fn, &st), ret);
if (ret == 0) {
ret = ::unlink(fn);
if (ret == -1) {
@@ -480,8 +480,8 @@
bool AttachListener::check_socket_file() {
int ret;
- struct stat64 st;
- ret = stat64(LinuxAttachListener::path(), &st);
+ struct stat st;
+ ret = stat(LinuxAttachListener::path(), &st);
if (ret == -1) { // need to restart attach listener.
debug_only(warning("Socket file %s does not exist - Restart Attach Listener",
LinuxAttachListener::path()));
@@ -521,12 +521,12 @@
char fn[PATH_MAX+1];
sprintf(fn, ".attach_pid%d", os::current_process_id());
int ret;
- struct stat64 st;
- RESTARTABLE(::stat64(fn, &st), ret);
+ struct stat st;
+ RESTARTABLE(::stat(fn, &st), ret);
if (ret == -1) {
snprintf(fn, sizeof(fn), "%s/.attach_pid%d",
os::get_temp_directory(), os::current_process_id());
- RESTARTABLE(::stat64(fn, &st), ret);
+ RESTARTABLE(::stat(fn, &st), ret);
}
if (ret == 0) {
// simple check to avoid starting the attach mechanism when
--- openjdk/hotspot/src/os/linux/vm/os_linux.cpp
+++ openjdk/hotspot/src/os/linux/vm/os_linux.cpp
@@ -5613,13 +5613,13 @@
int o_delete = (oflag & O_DELETE);
oflag = oflag & ~O_DELETE;
- fd = ::open64(path, oflag, mode);
+ fd = ::open(path, oflag, mode);
if (fd == -1) return -1;
//If the open succeeded, the file might still be a directory
{
- struct stat64 buf64;
- int ret = ::fstat64(fd, &buf64);
+ struct stat buf64;
+ int ret = ::fstat(fd, &buf64);
int st_mode = buf64.st_mode;
if (ret != -1) {
@@ -5696,17 +5696,17 @@
if (!rewrite_existing) {
oflags |= O_EXCL;
}
- return ::open64(path, oflags, S_IREAD | S_IWRITE);
+ return ::open(path, oflags, S_IREAD | S_IWRITE);
}
// return current position of file pointer
jlong os::current_file_offset(int fd) {
- return (jlong)::lseek64(fd, (off64_t)0, SEEK_CUR);
+ return (jlong)::lseek(fd, (off_t)0, SEEK_CUR);
}
// move file pointer to the specified offset
jlong os::seek_to_file_offset(int fd, jlong offset) {
- return (jlong)::lseek64(fd, (off64_t)offset, SEEK_SET);
+ return (jlong)::lseek(fd, (off_t)offset, SEEK_SET);
}
// This code originates from JDK's sysAvailable
@@ -5715,9 +5715,9 @@
int os::available(int fd, jlong *bytes) {
jlong cur, end;
int mode;
- struct stat64 buf64;
+ struct stat buf64;
- if (::fstat64(fd, &buf64) >= 0) {
+ if (::fstat(fd, &buf64) >= 0) {
mode = buf64.st_mode;
if (S_ISCHR(mode) || S_ISFIFO(mode) || S_ISSOCK(mode)) {
/*
@@ -5732,11 +5732,11 @@
}
}
}
- if ((cur = ::lseek64(fd, 0L, SEEK_CUR)) == -1) {
+ if ((cur = ::lseek(fd, 0L, SEEK_CUR)) == -1) {
return 0;
- } else if ((end = ::lseek64(fd, 0L, SEEK_END)) == -1) {
+ } else if ((end = ::lseek(fd, 0L, SEEK_END)) == -1) {
return 0;
- } else if (::lseek64(fd, cur, SEEK_SET) == -1) {
+ } else if (::lseek(fd, cur, SEEK_SET) == -1) {
return 0;
}
*bytes = end - cur;
--- openjdk/hotspot/src/os/linux/vm/os_linux.inline.hpp
+++ openjdk/hotspot/src/os/linux/vm/os_linux.inline.hpp
@@ -88,7 +88,7 @@
inline const int os::default_file_open_flags() { return 0;}
inline jlong os::lseek(int fd, jlong offset, int whence) {
- return (jlong) ::lseek64(fd, offset, whence);
+ return (jlong) ::lseek(fd, offset, whence);
}
inline int os::fsync(int fd) {
@@ -100,7 +100,7 @@
}
inline int os::ftruncate(int fd, jlong length) {
- return ::ftruncate64(fd, length);
+ return ::ftruncate(fd, length);
}
// macros for restartable system calls

View File

@ -0,0 +1,135 @@
diff --git icedtea/hotspot/src/os/linux/vm/jvm_linux.cpp icedtea/hotspot/src/os/linux/vm/jvm_linux.cpp
index ba84788..c22281f 100644
--- openjdk/hotspot/src/os/linux/vm/jvm_linux.cpp
+++ openjdk/hotspot/src/os/linux/vm/jvm_linux.cpp
@@ -154,7 +154,9 @@ struct siglabel siglabels[] = {
#ifdef SIGSTKFLT
"STKFLT", SIGSTKFLT, /* Stack fault. */
#endif
+#ifdef SIGCLD
"CLD", SIGCLD, /* Same as SIGCHLD (System V). */
+#endif
"CHLD", SIGCHLD, /* Child status has changed (POSIX). */
"CONT", SIGCONT, /* Continue (POSIX). */
"STOP", SIGSTOP, /* Stop, unblockable (POSIX). */
diff --git icedtea/hotspot/src/os/linux/vm/os_linux.cpp icedtea/hotspot/src/os/linux/vm/os_linux.cpp
index 89ba0ff..e84837a 100644
--- openjdk/hotspot/src/os/linux/vm/os_linux.cpp
+++ openjdk/hotspot/src/os/linux/vm/os_linux.cpp
@@ -94,7 +94,6 @@
# include <string.h>
# include <syscall.h>
# include <sys/sysinfo.h>
-# include <gnu/libc-version.h>
# include <sys/ipc.h>
# include <sys/shm.h>
# include <link.h>
@@ -530,6 +529,13 @@ void os::Linux::hotspot_sigmask(Thread* thread) {
// detecting pthread library
void os::Linux::libpthread_init() {
+#if 1
+ // Hard code Alpine Linux supported musl compatible settings
+ os::Linux::set_glibc_version("glibc 2.9");
+ os::Linux::set_libpthread_version("NPTL");
+ os::Linux::set_is_NPTL();
+ os::Linux::set_is_floating_stack();
+#else
// Save glibc and pthread version strings. Note that _CS_GNU_LIBC_VERSION
// and _CS_GNU_LIBPTHREAD_VERSION are supported in glibc >= 2.3.2. Use a
// generic name for earlier versions.
@@ -588,6 +594,7 @@ void os::Linux::libpthread_init() {
if (os::Linux::is_NPTL() || os::Linux::supports_variable_stack_size()) {
os::Linux::set_is_floating_stack();
}
+#endif
}
/////////////////////////////////////////////////////////////////////////////
@@ -2834,6 +2841,11 @@ extern "C" JNIEXPORT void numa_warn(int number, char *where, ...) { }
extern "C" JNIEXPORT void numa_error(char *where) { }
extern "C" JNIEXPORT int fork1() { return fork(); }
+static void *dlvsym(void *handle, const char *name, const char *ver)
+{
+ return dlsym(handle, name);
+}
+
// Handle request to load libnuma symbol version 1.1 (API v1). If it fails
// load symbol from base version instead.
void* os::Linux::libnuma_dlsym(void* handle, const char *name) {
diff --git openjdk/hotspot/src/os/linux/vm/os_linux.inline.hpp openjdk/hotspot/src/os/linux/vm/os_linux.inline.hpp
index 10d56d8..b9b2b77 100644
--- openjdk/hotspot/src/os/linux/vm/os_linux.inline.hpp
+++ openjdk/hotspot/src/os/linux/vm/os_linux.inline.hpp
@@ -33,7 +33,7 @@
#include <unistd.h>
#include <sys/socket.h>
-#include <sys/poll.h>
+#include <poll.h>
#include <netdb.h>
inline void* os::thread_local_storage_at(int index) {
diff --git openjdk/hotspot/src/os_cpu/linux_aarch64/vm/os_linux_aarch64.cpp openjdk/hotspot/src/os_cpu/linux_aarch64/vm/os_linux_aarch64.cpp
index d2c10e0..20f657f 100644
--- openjdk/hotspot/src/os_cpu/linux_aarch64/vm/os_linux_aarch64.cpp
+++ openjdk/hotspot/src/os_cpu/linux_aarch64/vm/os_linux_aarch64.cpp
@@ -75,7 +75,7 @@
# include <pwd.h>
# include <poll.h>
# include <ucontext.h>
-# include <fpu_control.h>
+# include <linux/types.h> /* provides __u64 */
#define REG_FP 29
diff --git openjdk/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp openjdk/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp
index 38388cb..2505ba8 100644
--- openjdk/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp
+++ openjdk/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp
@@ -72,7 +72,6 @@
# include <pwd.h>
# include <poll.h>
# include <ucontext.h>
-# include <fpu_control.h>
#ifdef AMD64
#define REG_SP REG_RSP
@@ -544,6 +543,9 @@ JVM_handle_linux_signal(int sig,
return true; // Mute compiler
}
+#define _FPU_GETCW(cw) __asm__ __volatile__ ("fnstcw %0" : "=m" (*&cw))
+#define _FPU_SETCW(cw) __asm__ __volatile__ ("fldcw %0" : : "m" (*&cw))
+
void os::Linux::init_thread_fpu_state(void) {
#ifndef AMD64
// set fpu to 53 bit precision
diff --git openjdk/hotspot/src/os_cpu/linux_x86/vm/threadLS_linux_x86.hpp openjdk/hotspot/src/os_cpu/linux_x86/vm/threadLS_linux_x86.hpp
index f3f2f26..6b50cfa 100644
--- openjdk/hotspot/src/os_cpu/linux_x86/vm/threadLS_linux_x86.hpp
+++ openjdk/hotspot/src/os_cpu/linux_x86/vm/threadLS_linux_x86.hpp
@@ -32,7 +32,9 @@
// map stack pointer to thread pointer - see notes in threadLS_linux_x86.cpp
#define SP_BITLENGTH 32
#define PAGE_SHIFT 12
+ #ifndef PAGE_SIZE
#define PAGE_SIZE (1UL << PAGE_SHIFT)
+ #endif
static Thread* _sp_map[1UL << (SP_BITLENGTH - PAGE_SHIFT)];
public:
diff --git openjdk/hotspot/src/share/vm/utilities/globalDefinitions_gcc.hpp openjdk/hotspot/src/share/vm/utilities/globalDefinitions_gcc.hpp
index efa0b4e..6df2302 100644
--- openjdk/hotspot/src/share/vm/utilities/globalDefinitions_gcc.hpp
+++ openjdk/hotspot/src/share/vm/utilities/globalDefinitions_gcc.hpp
@@ -235,7 +235,7 @@ inline int g_isnan(double f) { return isnand(f); }
#elif defined(__APPLE__)
inline int g_isnan(double f) { return isnan(f); }
#elif defined(LINUX) || defined(_ALLBSD_SOURCE)
-inline int g_isnan(float f) { return isnanf(f); }
+inline int g_isnan(float f) { return isnan(f); }
inline int g_isnan(double f) { return isnan(f); }
#else
#error "missing platform-specific definition here"

View File

@ -0,0 +1,79 @@
--- openjdk.orig/common/autoconf/configure
+++ openjdk/common/autoconf/configure
@@ -103,7 +103,7 @@
}
# Check for local changes
-check_hg_updates
+run_autogen_or_fail
if test -e $conf_custom_script_dir/generated-configure.sh; then
# Test if open configure is newer than custom configure, if so, custom needs to
--- openjdk.orig/common/autoconf/jdk-options.m4
+++ openjdk/common/autoconf/jdk-options.m4
@@ -159,7 +159,7 @@
AC_SUBST(JVM_VARIANT_ZEROSHARK)
AC_SUBST(JVM_VARIANT_CORE)
- INCLUDE_SA=true
+ AC_CHECK_HEADER(thread_db.h,INCLUDE_SA=true,INCLUDE_SA=false)
if test "x$JVM_VARIANT_ZERO" = xtrue ; then
INCLUDE_SA=false
fi
--- openjdk.orig/hotspot/make/linux/makefiles/defs.make
+++ openjdk/hotspot/make/linux/makefiles/defs.make
@@ -305,6 +305,9 @@
# Serviceability Binaries
# No SA Support for PPC, IA64, ARM or zero
+# or if thread_db.h missing (musl)
+
+ifneq ($(wildcard /usr/include/thread_db.h),)
ADD_SA_BINARIES/x86 = $(EXPORT_JRE_LIB_ARCH_DIR)/libsaproc.$(LIBRARY_SUFFIX) \
$(EXPORT_LIB_DIR)/sa-jdi.jar
ADD_SA_BINARIES/sparc = $(EXPORT_JRE_LIB_ARCH_DIR)/libsaproc.$(LIBRARY_SUFFIX) \
@@ -322,6 +322,11 @@
endif
endif
endif
+else
+ADD_SA_BINARIES/x86 =
+ADD_SA_BINARIES/sparc =
+ADD_SA_BINARIES/aarch64 =
+endif
ADD_SA_BINARIES/ppc =
ADD_SA_BINARIES/ia64 =
ADD_SA_BINARIES/arm =
--- openjdk.orig/hotspot/make/linux/makefiles/sa.make
+++ openjdk/hotspot/make/linux/makefiles/sa.make
@@ -59,9 +59,11 @@
# if $(AGENT_DIR) does not exist, we don't build SA
# also, we don't build SA on Itanium or zero.
+# check for thread_db.h too (musl does not have it).
all:
- if [ -d $(AGENT_DIR) -a "$(SRCARCH)" != "ia64" \
+ if [ -d $(AGENT_DIR) -a -f /usr/include/thread_db.h \
+ -a "$(SRCARCH)" != "ia64" \
-a "$(SRCARCH)" != "zero" ] ; then \
$(MAKE) -f sa.make $(GENERATED)/sa-jdi.jar; \
fi
--- openjdk.orig/hotspot/make/linux/makefiles/saproc.make
+++ openjdk/hotspot/make/linux/makefiles/saproc.make
@@ -61,12 +61,15 @@
# if $(AGENT_DIR) does not exist, we don't build SA
# also, we don't build SA on Itanium or zero.
+# check for thread_db.h too (musl does not have it).
+ifneq ($(wildcard /usr/include/thread_db.h),)
ifneq ($(wildcard $(AGENT_DIR)),)
ifneq ($(filter-out ia64 zero,$(SRCARCH)),)
BUILDLIBSAPROC = $(LIBSAPROC)
endif
endif
+endif
ifneq ($(ALT_SASRCDIR),)
ALT_SAINCDIR=-I$(ALT_SASRCDIR) -DALT_SASRCDIR

View File

@ -0,0 +1,16 @@
--- openjdk/jdk/src/share/bin/splashscreen_stubs.c
+++ openjdk/jdk/src/share/bin/splashscreen_stubs.c
@@ -61,11 +61,11 @@
#define INVOKEV(name) _INVOKE(name, ,;)
int DoSplashLoadMemory(void* pdata, int size) {
- INVOKE(SplashLoadMemory, NULL)(pdata, size);
+ INVOKE(SplashLoadMemory, 0)(pdata, size);
}
int DoSplashLoadFile(const char* filename) {
- INVOKE(SplashLoadFile, NULL)(filename);
+ INVOKE(SplashLoadFile, 0)(filename);
}
void DoSplashInit(void) {

View File

@ -0,0 +1,31 @@
From 0cc98b7468fe1ee280f61ec8933ea0289b5a330d Mon Sep 17 00:00:00 2001
From: Clive Verghese <verghese@amazon.com>
Date: Wed, 4 Aug 2021 22:06:19 +0000
Subject: [PATCH] Fix LinuxThreads detection in MUSL
---
.../src/solaris/native/sun/tools/attach/LinuxVirtualMachine.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/jdk/src/solaris/native/sun/tools/attach/LinuxVirtualMachine.c b/src/jdk/src/solaris/native/sun/tools/attach/LinuxVirtualMachine.c
index 6017308d0b..a583b4bae8 100644
--- openjdk/jdk/src/solaris/native/sun/tools/attach/LinuxVirtualMachine.c
+++ openjdk/jdk/src/solaris/native/sun/tools/attach/LinuxVirtualMachine.c
@@ -195,6 +195,9 @@ JNIEXPORT void JNICALL Java_sun_tools_attach_LinuxVirtualMachine_connect
JNIEXPORT jboolean JNICALL Java_sun_tools_attach_LinuxVirtualMachine_isLinuxThreads
(JNIEnv *env, jclass cls)
{
+# ifdef MUSL_LIBC
+ return JNI_FALSE;
+# else
# ifndef _CS_GNU_LIBPTHREAD_VERSION
# define _CS_GNU_LIBPTHREAD_VERSION 3
# endif
@@ -222,6 +225,7 @@ JNIEXPORT jboolean JNICALL Java_sun_tools_attach_LinuxVirtualMachine_isLinuxThre
res = (jboolean)(strstr(s, "NPTL") == NULL);
free(s);
return res;
+# endif
}
/*

View File

@ -0,0 +1,27 @@
--- openjdk.orig/jdk/src/solaris/native/java/lang/UNIXProcess_md.c
+++ openjdk/jdk/src/solaris/native/java/lang/UNIXProcess_md.c
@@ -552,7 +552,11 @@
startChild(JNIEnv *env, jobject process, ChildStuff *c, const char *helperpath) {
switch (c->mode) {
case MODE_VFORK:
+// use regular fork when running on musl
+// this should fix deadlocks on aarch64
+#if defined(__GLIBC__) || defined(__UCLIBC__)
return vforkChild(c);
+#endif
case MODE_FORK:
return forkChild(c);
#if defined(__solaris__) || defined(_ALLBSD_SOURCE) || defined(_AIX)
@@ -651,8 +655,12 @@
if (resultPid < 0) {
switch (c->mode) {
case MODE_VFORK:
+// use regular fork when running on musl
+// this should fix deadlocks on aarch64
+#if defined(__GLIBC__) || defined(__UCLIBC__)
throwIOException(env, errno, "vfork failed");
break;
+#endif
case MODE_FORK:
throwIOException(env, errno, "fork failed");
break;

View File

@ -0,0 +1,20 @@
--- openjdk.orig/jdk/src/solaris/native/sun/xawt/XToolkit.c
+++ openjdk/jdk/src/solaris/native/sun/xawt/XToolkit.c
@@ -27,7 +27,7 @@
#include <X11/Xutil.h>
#include <X11/Xos.h>
#include <X11/Xatom.h>
-#ifdef __linux__
+#if defined(__linux__) && defined(__GLIBC__) && ! defined(__UCLIBC__)
#include <execinfo.h>
#endif
@@ -689,7 +689,7 @@
return ret;
}
-#ifdef __linux__
+#if defined(__linux__) && defined(__GLIBC__) && ! defined(__UCLIBC__)
void print_stack(void)
{
void *array[10];

View File

@ -0,0 +1,42 @@
--- openjdk/jdk/src/solaris/native/java/net/net_util_md.c.orig
+++ openjdk/jdk/src/solaris/native/java/net/net_util_md.c
@@ -561,7 +561,7 @@
static struct localinterface *localifs = 0;
static int localifsSize = 0; /* size of array */
-static int nifs = 0; /* number of entries used in array */
+static int nifs = -1; /* number of entries used in array */
/* not thread safe: make sure called once from one thread */
@@ -573,6 +573,10 @@
int index, x1, x2, x3;
unsigned int u0,u1,u2,u3,u4,u5,u6,u7,u8,u9,ua,ub,uc,ud,ue,uf;
+ if (nifs >= 0)
+ return ;
+ nifs = 0;
+
if ((f = fopen("/proc/net/if_inet6", "r")) == NULL) {
return ;
}
@@ -601,7 +605,7 @@
localifs = (struct localinterface *) realloc (
localifs, sizeof (struct localinterface)* (localifsSize+5));
if (localifs == 0) {
- nifs = 0;
+ nifs = -1;
fclose (f);
return;
}
@@ -624,9 +628,7 @@
static int getLocalScopeID (char *addr) {
struct localinterface *lif;
int i;
- if (localifs == 0) {
- initLocalIfs();
- }
+ initLocalIfs();
for (i=0, lif=localifs; i<nifs; i++, lif++) {
if (memcmp (addr, lif->localaddr, 16) == 0) {
return lif->index;

View File

@ -0,0 +1,14 @@
musl needs LD_LIBRARY_PATH set because when .so is opened with dlopen(/abs/path)
it does not qualify for providing symbols for NEEDED dependency.
--- openjdk.orig/jdk/src/solaris/bin/java_md_solinux.c
+++ openjdk/jdk/src/solaris/bin/java_md_solinux.c
@@ -291,6 +291,8 @@
char *dmllp = NULL;
char *p; /* a utility pointer */
+ return JNI_TRUE;
+
#ifdef AIX
/* We always have to set the LIBPATH on AIX because ld doesn't support $ORIGIN. */
return JNI_TRUE;

View File

@ -0,0 +1,15 @@
musl doesn't have isnanf, and this fixes an implicit-function-decl
how did this even compile without failing at link time?
rest for implicit
--
--- openjdk/jdk/src/solaris/native/common/jdk_util_md.h
+++ openjdk/jdk/src/solaris/native/common/jdk_util_md.h
@@ -37,7 +37,7 @@
#define ISNAND(d) isnan(d)
#elif defined(__linux__) || defined(_ALLBSD_SOURCE)
#include <math.h>
-#define ISNANF(f) isnanf(f)
+#define ISNANF(f) isnan(f)
#define ISNAND(d) isnan(d)
#elif defined(_AIX)
#include <math.h>

View File

@ -0,0 +1,143 @@
--- openjdk.orig/jdk/src/aix/native/java/net/aix_close.c
+++ openjdk/jdk/src/aix/native/java/net/aix_close.c
@@ -62,7 +62,7 @@
#include <unistd.h>
#include <errno.h>
-#include <sys/poll.h>
+#include <poll.h>
/*
* Stack allocated by thread when doing blocking operation
--- openjdk.orig/jdk/src/aix/native/sun/nio/ch/AixNativeThread.c
+++ openjdk/jdk/src/aix/native/sun/nio/ch/AixNativeThread.c
@@ -32,7 +32,7 @@
#include "sun_nio_ch_NativeThread.h"
#include <pthread.h>
-#include <sys/signal.h>
+#include <signal.h>
/* Also defined in src/aix/native/java/net/aix_close.c */
#define INTERRUPT_SIGNAL (SIGRTMAX - 1)
--- openjdk.orig/jdk/src/aix/native/sun/nio/ch/AixPollPort.c
+++ openjdk/jdk/src/aix/native/sun/nio/ch/AixPollPort.c
@@ -34,7 +34,7 @@
#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
-#include <sys/poll.h>
+#include <poll.h>
#include <sys/pollset.h>
#include <fcntl.h>
#include <stddef.h>
--- openjdk.orig/jdk/src/macosx/javavm/export/jvm_md.h
+++ openjdk/jdk/src/macosx/javavm/export/jvm_md.h
@@ -60,7 +60,7 @@
#include <sys/stat.h>
#include <fcntl.h>
#include <errno.h>
-#include <sys/signal.h>
+#include <signal.h>
/* O Flags */
--- openjdk.orig/jdk/src/solaris/javavm/export/jvm_md.h
+++ openjdk/jdk/src/solaris/javavm/export/jvm_md.h
@@ -65,7 +65,7 @@
#include <sys/stat.h>
#include <fcntl.h>
#include <errno.h>
-#include <sys/signal.h>
+#include <signal.h>
/* O Flags */
--- openjdk.orig/jdk/src/solaris/native/java/net/bsd_close.c
+++ openjdk/jdk/src/solaris/native/java/net/bsd_close.c
@@ -36,7 +36,7 @@
#include <sys/uio.h>
#include <unistd.h>
#include <errno.h>
-#include <sys/poll.h>
+#include <poll.h>
/*
* Stack allocated by thread when doing blocking operation
--- openjdk.orig/jdk/src/solaris/native/java/net/linux_close.c
+++ openjdk/jdk/src/solaris/native/java/net/linux_close.c
@@ -34,7 +34,7 @@
#include <sys/uio.h>
#include <unistd.h>
#include <errno.h>
-#include <sys/poll.h>
+#include <poll.h>
/*
* Stack allocated by thread when doing blocking operation
--- openjdk.orig/jdk/src/solaris/native/java/net/net_util_md.h
+++ openjdk/jdk/src/solaris/native/java/net/net_util_md.h
@@ -33,7 +33,7 @@
#include <unistd.h>
#ifndef USE_SELECT
-#include <sys/poll.h>
+#include <poll.h>
#endif
--- openjdk.orig/jdk/src/solaris/native/sun/nio/ch/DevPollArrayWrapper.c
+++ openjdk/jdk/src/solaris/native/sun/nio/ch/DevPollArrayWrapper.c
@@ -28,7 +28,7 @@
#include "jvm.h"
#include "jlong.h"
#include "sun_nio_ch_DevPollArrayWrapper.h"
-#include <sys/poll.h>
+#include <poll.h>
#include <unistd.h>
#include <sys/time.h>
--- openjdk.orig/jdk/src/solaris/native/sun/nio/ch/NativeThread.c
+++ openjdk/jdk/src/solaris/native/sun/nio/ch/NativeThread.c
@@ -34,7 +34,7 @@
#ifdef __linux__
#include <pthread.h>
- #include <sys/signal.h>
+ #include <signal.h>
/* Also defined in net/linux_close.c */
#define INTERRUPT_SIGNAL (SIGRTMAX - 2)
#elif __solaris__
--- openjdk.orig/jdk/src/solaris/native/sun/nio/ch/Net.c
+++ openjdk/jdk/src/solaris/native/sun/nio/ch/Net.c
@@ -23,7 +23,7 @@
* questions.
*/
-#include <sys/poll.h>
+#include <poll.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <string.h>
--- openjdk.orig/jdk/src/solaris/native/sun/nio/fs/LinuxWatchService.c
+++ openjdk/jdk/src/solaris/native/sun/nio/fs/LinuxWatchService.c
@@ -32,7 +32,7 @@
#include <dlfcn.h>
#include <sys/types.h>
#include <sys/socket.h>
-#include <sys/poll.h>
+#include <poll.h>
#include <sys/inotify.h>
#include "sun_nio_fs_LinuxWatchService.h"
--- openjdk.orig/jdk/src/solaris/transport/socket/socket_md.c
+++ openjdk/jdk/src/solaris/transport/socket/socket_md.c
@@ -37,7 +37,7 @@
#include <thread.h>
#else
#include <pthread.h>
-#include <sys/poll.h>
+#include <poll.h>
#endif
#include "socket_md.h"

View File

@ -0,0 +1,83 @@
diff -ru openjdk.orig/jdk/src/share/native/com/sun/java/util/jar/pack/zip.cpp openjdk/jdk/src/share/native/com/sun/java/util/jar/pack/zip.cpp
--- openjdk.orig/jdk/src/share/native/com/sun/java/util/jar/pack/zip.cpp 2017-01-25 04:22:03.000000000 +0000
+++ openjdk/jdk/src/share/native/com/sun/java/util/jar/pack/zip.cpp 2017-02-06 11:23:47.041165210 +0000
@@ -46,6 +46,8 @@
#include "zip.h"
+#define uchar unsigned char
+
#ifdef NO_ZLIB
inline bool jar::deflate_bytes(bytes& head, bytes& tail) {
diff -ru openjdk.orig/jdk/src/share/native/com/sun/java/util/jar/pack/zip.h openjdk/jdk/src/share/native/com/sun/java/util/jar/pack/zip.h
--- openjdk.orig/jdk/src/share/native/com/sun/java/util/jar/pack/zip.h 2017-01-25 04:22:03.000000000 +0000
+++ openjdk/jdk/src/share/native/com/sun/java/util/jar/pack/zip.h 2017-02-06 11:23:47.047832009 +0000
@@ -23,9 +23,7 @@
* questions.
*/
-#define ushort unsigned short
-#define uint unsigned int
-#define uchar unsigned char
+#include <sys/types.h>
struct unpacker;
diff -ru openjdk.orig/jdk/src/share/native/sun/awt/medialib/mlib_types.h openjdk/jdk/src/share/native/sun/awt/medialib/mlib_types.h
--- openjdk.orig/jdk/src/share/native/sun/awt/medialib/mlib_types.h 2017-01-25 04:22:03.000000000 +0000
+++ openjdk/jdk/src/share/native/sun/awt/medialib/mlib_types.h 2017-02-06 11:23:47.047832009 +0000
@@ -27,6 +27,7 @@
#ifndef MLIB_TYPES_H
#define MLIB_TYPES_H
+#include <stddef.h> /* for NULL */
#include <limits.h>
#if defined(_MSC_VER)
#include <float.h> /* for FLT_MAX and DBL_MAX */
diff -ru openjdk.orig/jdk/src/solaris/native/java/net/Inet4AddressImpl.c openjdk/jdk/src/solaris/native/java/net/Inet4AddressImpl.c
--- openjdk.orig/jdk/src/solaris/native/java/net/Inet4AddressImpl.c 2017-01-25 04:22:03.000000000 +0000
+++ openjdk/jdk/src/solaris/native/java/net/Inet4AddressImpl.c 2017-02-06 11:23:47.047832009 +0000
@@ -47,7 +47,7 @@
#include "java_net_Inet4AddressImpl.h"
-#if defined(__GLIBC__) || (defined(__FreeBSD__) && (__FreeBSD_version >= 601104))
+#if defined(__linux__) || (defined(__FreeBSD__) && (__FreeBSD_version >= 601104))
#define HAS_GLIBC_GETHOSTBY_R 1
#endif
diff -ru openjdk.orig/jdk/src/solaris/native/java/net/linux_close.c openjdk/jdk/src/solaris/native/java/net/linux_close.c
--- openjdk.orig/jdk/src/solaris/native/java/net/linux_close.c 2017-01-25 04:22:03.000000000 +0000
+++ openjdk/jdk/src/solaris/native/java/net/linux_close.c 2017-02-06 11:23:47.047832009 +0000
@@ -56,7 +56,7 @@
/*
* Signal to unblock thread
*/
-static int sigWakeup = (__SIGRTMAX - 2);
+static int sigWakeup;
/*
* fdTable holds one entry per file descriptor, up to a certain
@@ -95,6 +95,9 @@
/*
* Setup the signal handler
*/
+#ifndef __AIX
+ sigWakeup = SIGRTMAX - 2;
+#endif
sa.sa_handler = sig_wakeup;
sa.sa_flags = 0;
sigemptyset(&sa.sa_mask);
diff -ru openjdk.orig/jdk/src/solaris/native/sun/nio/ch/NativeThread.c openjdk/jdk/src/solaris/native/sun/nio/ch/NativeThread.c
--- openjdk.orig/jdk/src/solaris/native/sun/nio/ch/NativeThread.c 2017-01-25 04:22:03.000000000 +0000
+++ openjdk/jdk/src/solaris/native/sun/nio/ch/NativeThread.c 2017-02-06 11:23:47.051165409 +0000
@@ -36,7 +36,7 @@
#include <pthread.h>
#include <sys/signal.h>
/* Also defined in net/linux_close.c */
- #define INTERRUPT_SIGNAL (__SIGRTMAX - 2)
+ #define INTERRUPT_SIGNAL (SIGRTMAX - 2)
#elif __solaris__
#include <thread.h>
#include <signal.h>

View File

@ -0,0 +1,50 @@
Patch-Source: https://gitweb.gentoo.org/repo/gentoo.git/plain/dev-java/openjdk/files/openjdk-8.402_p06-0002-Fix-Wincompatible-pointer-types.patch
--
From 57b8fef20b090ffdf99bcf2c3f5fc8d0d4472788 Mon Sep 17 00:00:00 2001
From: Sam James <sam@gentoo.org>
Date: Wed, 6 Mar 2024 11:54:24 +0000
Subject: [PATCH 2/4] Fix -Wincompatible-pointer-types
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Backport https://github.com/openjdk/jdk17u/commit/6632e6c6ca74101b45b052fb7962376fbe97605e.
```
jdk8u-jdk8u402-ga/jdk/src/share/native/sun/awt/image/jpeg/imageioJPEG.c: In function Java_com_sun_imageio_plugins_jpeg_JPEGImageWriter_writeImage:
jdk8u-jdk8u402-ga/jdk/src/share/native/sun/awt/image/jpeg/imageioJPEG.c:2853:19: error: passing argument 1 of freeArray from incompatible pointer type [-Wincompatible-pointer-types]
2853 | freeArray(scale, numBands);
| ^~~~~
| |
| UINT8 ** {aka unsigned char **}
jdk8u-jdk8u402-ga/jdk/src/share/native/sun/awt/image/jpeg/imageioJPEG.c:2689:30: note: expected void ** but argument is of type UINT8 ** {aka unsigned char **}
2689 | static void freeArray(void** arr, jint size) {
| ~~~~~~~^~~
jdk8u-jdk8u402-ga/jdk/src/share/native/sun/awt/image/jpeg/imageioJPEG.c:2860:19: error: passing argument 1 of freeArray from incompatible pointer type [-Wincompatible-pointer-types]
2860 | freeArray(scale, numBands);
| ^~~~~
| |
| UINT8 ** {aka unsigned char **}
```
Signed-off-by: Sam James <sam@gentoo.org>
---
jdk/src/share/native/sun/awt/image/jpeg/imageioJPEG.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/jdk/src/share/native/sun/awt/image/jpeg/imageioJPEG.c b/jdk/src/share/native/sun/awt/image/jpeg/imageioJPEG.c
index 7e1d8c9..163003c 100644
--- a/jdk/src/share/native/sun/awt/image/jpeg/imageioJPEG.c
+++ b/jdk/src/share/native/sun/awt/image/jpeg/imageioJPEG.c
@@ -2686,7 +2686,7 @@ Java_com_sun_imageio_plugins_jpeg_JPEGImageWriter_writeTables
RELEASE_ARRAYS(env, data, NULL);
}
-static void freeArray(void** arr, jint size) {
+static void freeArray(UINT8** arr, jint size) {
int i;
if (arr != NULL) {
for (i = 0; i < size; i++) {
--
2.44.0

View File

@ -0,0 +1,10 @@
--- a/hotspot/src/os_cpu/linux_loongarch/vm/os_linux_loongarch.cpp
+++ b/hotspot/src/os_cpu/linux_loongarch/vm/os_linux_loongarch.cpp
@@ -72,7 +72,6 @@
# include <pwd.h>
# include <poll.h>
# include <ucontext.h>
-# include <fpu_control.h>
#define REG_SP 3
#define REG_FP 22