From da4abda2a1718c74b39134764ae6f694041a25e4 Mon Sep 17 00:00:00 2001 From: Shenghou Ma Date: Wed, 4 Feb 2015 21:30:22 -0500 Subject: [PATCH] liblink, cmd/5a: fix reglist parsing/printing after changing REG_R0 to 32 Fixes #9759. Change-Id: I263f1251b9401371231374551c4f71c70cb6e359 Signed-off-by: Shenghou Ma Reviewed-on: https://go-review.googlesource.com/3931 Reviewed-by: Dave Cheney --- src/cmd/5a/a.y | 10 +++++----- src/cmd/5a/y.tab.c | 10 +++++----- src/cmd/5a/y.tab.h | 2 +- src/liblink/asm5.c | 4 ++-- src/liblink/list5.c | 5 +++-- 5 files changed, 16 insertions(+), 15 deletions(-) diff --git a/src/cmd/5a/a.y b/src/cmd/5a/a.y index 429f7437c6e86d..fbf583def403a4 100644 --- a/src/cmd/5a/a.y +++ b/src/cmd/5a/a.y @@ -38,7 +38,7 @@ %union { Sym *sym; - int32 lval; + int64 lval; double dval; char sval[8]; Addr addr; @@ -460,20 +460,20 @@ fcon: reglist: spreg { - $$ = 1 << $1; + $$ = 1ULL << $1; } | spreg '-' spreg { int i; $$=0; for(i=$1; i<=$3; i++) - $$ |= 1<pc), p->from.sym->na switch(o->type) { case 38: /* movm $con,oreg -> stm */ o1 = (0x4 << 25); - o1 |= p->from.offset & 0xffff; + o1 |= (p->from.offset >> REG_R0) & 0xffff; o1 |= (p->to.reg&15) << 16; aclass(ctxt, &p->to); break; case 39: /* movm oreg,$con -> ldm */ o1 = (0x4 << 25) | (1 << 20); - o1 |= p->to.offset & 0xffff; + o1 |= (p->to.offset >> REG_R0) & 0xffff; o1 |= (p->from.reg&15) << 16; aclass(ctxt, &p->from); break; diff --git a/src/liblink/list5.c b/src/liblink/list5.c index 3d3e8e7d122853..bce13c24fb2875 100644 --- a/src/liblink/list5.c +++ b/src/liblink/list5.c @@ -222,7 +222,8 @@ RAconv(Fmt *fp) { char str[STRINGSZ]; Addr *a; - int i, v; + int i; + vlong v; a = va_arg(fp->args, Addr*); sprint(str, "GOK-reglist"); @@ -232,7 +233,7 @@ RAconv(Fmt *fp) break; if(a->sym != nil) break; - v = a->offset; + v = a->offset >> REG_R0; strcpy(str, ""); for(i=0; i