Improve AARCH64 execution

This change fixes bugs in the APE loader. The execve() unit tests are
now enabled for MODE=aarch64. See the README for how you need to have
binfmt_misc configured with Qemu to run them. Apple Silicon bugs have
been fixed too, e.g. tkill() now works.
This commit is contained in:
Justine Tunney 2023-09-11 13:51:37 -07:00
parent 1965d7488e
commit 77a7873057
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
31 changed files with 599 additions and 195 deletions

View file

@ -17,6 +17,8 @@
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/calls/calls.h"
#include "libc/runtime/runtime.h"
#include "libc/stdio/stdio.h"
#include "libc/sysv/consts/o.h"
#include "libc/testlib/testlib.h"
@ -31,9 +33,24 @@ __static_yoink("zipos");
*/
void testlib_extract(const char *zip, const char *to, int mode) {
int fdin, fdout;
ASSERT_NE(-1, (fdin = open(zip, O_RDONLY)));
ASSERT_NE(-1, (fdout = creat(to, mode)));
ASSERT_NE(-1, copyfd(fdin, fdout, -1));
ASSERT_NE(-1, close(fdout));
ASSERT_NE(-1, close(fdin));
if ((fdin = open(zip, O_RDONLY)) == -1) {
perror(zip);
exit(1);
}
if ((fdout = creat(to, mode)) == -1) {
perror(to);
exit(1);
}
if (copyfd(fdin, fdout, -1) == -1) {
perror(zip);
exit(1);
}
if (close(fdout)) {
perror(to);
exit(1);
}
if (close(fdin)) {
perror(zip);
exit(1);
}
}