commit - 39df7cd8dd598a6d95c851dc6b69b6fbea683b4d
commit + 83cd8a8e99d04253314b60aa491176f237250037
blob - 0c878a1eb542bb6bcc634b8e842d5721fdaccc2a
blob + 91350d93658eef52d1cbcc5be62f5bf4032775da
--- src/cpu.c
+++ src/cpu.c
alu ("div");
break;
case 0b0000001'101: // divu
- c = b != 0 ? a / b : -1;
+ c = b != 0 ? a / b : (u64)-1;
alu ("divu");
break;
case 0b0000001'110: // rem
- c = b != 0 ? (i64)a % (i64)b : a;
+ c = b != 0 ? (i64)a % (i64)b : (i64)a;
alu ("rem");
break;
case 0b0000001'111: // remu
c = b != 0 ? a % b : 1;
alu ("remu");
break;
+ default:
+ goto ud;
}
cpu_set (rd, c);
break;
alu ("divw");
break;
case 0b000001'101: // divuw
- c = extend (b != 0 ? (u32)a / (u32)b : -1);
+ c = extend (b != 0 ? (u32)a / (u32)b : (u32)-1);
alu ("divuw");
break;
case 0b000001'110: // remw
blob - 0fdb8431581673d815c4611a6f56838ddaf0b614
blob + 9ada52fb6a271150c560cdd20e4e74f7de42eeeb
--- src/exec.c
+++ src/exec.c
char buffer[sizeof (*ehdr)];
if (read (fd, buffer, sizeof (buffer)) != sizeof (buffer))
err (1, "read_elf_ehdr()");
- decode_elf64_ehdr (ehdr, buffer);
+ decode_elf64_ehdr (ehdr, (uint8_t *)buffer);
}
int my_execve (const char *path, char **argv, char **envp)
blob - 4c367bd11bfe114032fcf6f6573f29b1054327f4
blob + d2cbcf1530cd6d8035c7fbb7190bf9ec8bf51508
--- src/linurv.c
+++ src/linurv.c
if (read (fd, buffer, ehdr.phentsize) != sizeof (buffer))
err (1, "failed to read program header %u", i);
- decode_elf64_phdr (&phdr, buffer);
+ decode_elf64_phdr (&phdr, (uint8_t *)buffer);
switch (phdr.type) {
case PT_NULL: