5e: byte access incorrectly checked for long; brk has to round up addresses

This commit is contained in:
aiju 2018-09-28 22:53:24 +00:00
parent 451b0c7976
commit f75bbcdd45
2 changed files with 2 additions and 1 deletions

View file

@ -124,7 +124,7 @@ single(u32int instr)
addr += offset;
if((instr & fB) == 0)
addr = evenaddr(addr, 3);
targ = vaddr(addr, 4, &seg);
targ = vaddr(addr, (instr & fB) == 0 ? 4 : 1, &seg);
switch(instr & (fB | fL)) {
case 0:
*(u32int*) targ = *Rd;

View file

@ -254,6 +254,7 @@ sysbrk(void)
v = arg(0);
if(systrace)
fprint(2, "brk(%#lux)\n", v);
v = v + 7 & -8;
if(v >= P->S[SEGSTACK]->start)
sysfatal("bss > stack, wtf?");
if(v < P->S[SEGBSS]->start)