Skip to content

Commit

Permalink
add arm64 support
Browse files Browse the repository at this point in the history
  • Loading branch information
lacraig2 committed May 21, 2024
1 parent 1b6e150 commit 0559ea6
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 0 deletions.
27 changes: 27 additions & 0 deletions hypercall.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,18 @@ static inline void igloo_hypercall(unsigned long num, unsigned long arg1) {
: // No clobber
);

#elif defined(CONFIG_AARCH64)
register unsigned long long x0 asm("x0") = num;
register unsigned long long x1 asm("x1") = arg1;

asm volatile(
"mov x0, %0 \t\n\
mov x1, %1 \t\n\
msr S0_0_c5_c0_0, xzr"
:
: "r"(x0), "r"(x1)
:
);
#elif defined(CONFIG_ARM)
register uint32_t r0 asm("r0") = num;
register uint32_t r1 asm("r1") = arg1;
Expand Down Expand Up @@ -41,7 +52,23 @@ static inline unsigned long igloo_hypercall2(unsigned long num, unsigned long ar
);

return r0;
#elif defined(CONFIG_AARCH64)
register unsigned long long x0 asm("x0") = num;
register unsigned long long x1 asm("x1") = arg1;
register unsigned long long x2 asm("x2") = arg2;

asm volatile(
"mov x0, %0 \t\n\
mov x1, %1 \t\n\
mov x2, %2 \t\n\
msr S0_0_c5_c0_0, xzr \t\n\
mov %0, x0\t\n"
: "=g"(x0)
: "r"(x0), "r"(x1), "r"(x2)
:
);

return x0;
#elif defined(CONFIG_MIPS)
register unsigned long a0 asm("a0") = num;
register unsigned long a1 asm("a1") = arg1;
Expand Down
5 changes: 5 additions & 0 deletions package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ mv nvram.o $SCRATCH/nvram.o.armel
mv libnvram.so $SCRATCH/libnvram.so.armel
make clean

CC=aarch64-linux-musl-gcc make CFLAGS="-DCONFIG_AARCH64=1" libnvram.so -C /app
mv nvram.o $SCRATCH/nvram.o.aarch64
mv libnvram.so $SCRATCH/libnvram.so.aarch64
make clean

CC=mipsel-linux-musl-gcc make CFLAGS="-DCONFIG_MIPS=1 -march=mips32r2" libnvram.so -C /app
mv nvram.o $SCRATCH/nvram.o.mipsel
mv libnvram.so $SCRATCH/libnvram.so.mipsel
Expand Down
1 change: 1 addition & 0 deletions setup_all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ set -eux

rm -f *.so.*
./setup.sh arm
./setup.sh aarch64
./setup.sh mipsel
./setup.sh mipseb
./setup.sh mips64eb
Expand Down

0 comments on commit 0559ea6

Please sign in to comment.