sync and try changes

This commit is contained in:
Alexander Nicholi 2021-02-04 08:33:22 -05:00
commit dbd7edba10
No known key found for this signature in database
GPG key ID: B75B2EB05540F74C
811 changed files with 2014 additions and 11694 deletions

View file

@ -21,6 +21,7 @@
#include "libc/errno.h"
#include "libc/fmt/fmt.h"
#include "libc/macros.h"
#include "libc/mem/fmt.h"
#include "libc/mem/mem.h"
#include "libc/str/str.h"
#include "libc/str/tpenc.h"

View file

@ -28,7 +28,7 @@
#include "libc/mem/mem.h"
#include "libc/runtime/runtime.h"
#include "libc/str/str.h"
#include "libc/str/tpencode.internal.h"
#include "libc/str/tpenc.h"
#include "third_party/xed/x86.h"
#include "tool/build/lib/case.h"
#include "tool/build/lib/demangle.h"
@ -134,12 +134,18 @@ static char *DisLineCode(struct Dis *d, char *p) {
static char *DisLineData(struct Dis *d, char *p, const uint8_t *b, size_t n) {
size_t i;
uint64_t w;
p = DisColumn(DisAddr(d, p), p, ADDRLEN);
p = DisColumn(DisByte(p, b, n), p, 64);
p = HighStart(p, g_high.comment);
*p++ = '#';
*p++ = ' ';
for (i = 0; i < n; ++i) p += tpencode(p, 8, bing(b[i], 0), false);
for (i = 0; i < n; ++i) {
w = tpenc(bing(b[i], 0));
do {
*p++ = w;
} while ((w >>= 8));
}
p = HighEnd(p);
*p = '\0';
return p;

View file

@ -21,6 +21,7 @@
#include "libc/calls/calls.h"
#include "libc/log/check.h"
#include "libc/macros.h"
#include "libc/mem/fmt.h"
#include "libc/mem/mem.h"
#include "libc/runtime/gc.h"
#include "libc/runtime/memtrack.h"

View file

@ -140,7 +140,7 @@ void LoadProgram(struct Machine *m, const char *prog, char **args, char **vars,
size_t i, mappedsize;
DCHECK_NOTNULL(prog);
elf->prog = prog;
if ((fd = open(prog, O_RDONLY)) == -1 ||
if ((fd = open(prog, O_RDWR)) == -1 ||
(fstat(fd, &st) == -1 || !st.st_size)) {
fputs(prog, stderr);
fputs(": not found\n", stderr);

View file

@ -466,7 +466,7 @@ static int AppendIovsGuest(struct Machine *m, struct Iovs *iv, int64_t iovaddr,
}
static struct sigaction *CoerceSigactionToCosmo(
struct sigaction *dst, const struct sigaction$linux *src) {
struct sigaction *dst, const struct sigaction_linux *src) {
if (!src) return NULL;
memset(dst, 0, sizeof(*dst));
ASSIGN(dst->sa_handler, src->sa_handler);
@ -476,8 +476,8 @@ static struct sigaction *CoerceSigactionToCosmo(
return dst;
}
static struct sigaction$linux *CoerceSigactionToLinux(
struct sigaction$linux *dst, const struct sigaction *src) {
static struct sigaction_linux *CoerceSigactionToLinux(
struct sigaction_linux *dst, const struct sigaction *src) {
if (!dst) return NULL;
memset(dst, 0, sizeof(*dst));
ASSIGN(dst->sa_handler, src->sa_handler);
@ -1145,14 +1145,14 @@ static int OpSigaction(struct Machine *m, int sig, int64_t act, int64_t old) {
int rc;
struct OpSigactionMemory {
struct sigaction act, old;
uint8_t b[sizeof(struct sigaction$linux)];
uint8_t b[sizeof(struct sigaction_linux)];
void *p[2];
} * mem;
if (!(mem = malloc(sizeof(*mem)))) return enomem();
if ((rc = sigaction(
XlatSignal(sig),
CoerceSigactionToCosmo(
&mem->act, LoadBuf(m, act, sizeof(struct sigaction$linux))),
&mem->act, LoadBuf(m, act, sizeof(struct sigaction_linux))),
&mem->old)) != -1) {
CoerceSigactionToLinux(BeginStoreNp(m, old, sizeof(mem->b), mem->p, mem->b),
&mem->old);