summaryrefslogtreecommitdiff
path: root/utils/libmach/qobj.c
diff options
context:
space:
mode:
Diffstat (limited to 'utils/libmach/qobj.c')
-rw-r--r--utils/libmach/qobj.c26
1 files changed, 18 insertions, 8 deletions
diff --git a/utils/libmach/qobj.c b/utils/libmach/qobj.c
index 5decad08..e5a2222b 100644
--- a/utils/libmach/qobj.c
+++ b/utils/libmach/qobj.c
@@ -4,6 +4,7 @@
*/
#include <lib9.h>
#include <bio.h>
+#include <mach.h>
#include "qc/q.out.h"
#include "obj.h"
@@ -21,25 +22,33 @@ static void skip(Biobuf*, int);
int
_isq(char *s)
{
- return (s[0]&0377) == ANAME /* ANAME */
- && s[1] == D_FILE /* type */
- && s[2] == 1 /* sym */
- && s[3] == '<'; /* name of file */
+ return (s[0]&0377) == ANAME /* ANAME */
+ && (s[1]&0377) == ANAME>>8
+ && s[2] == D_FILE /* type */
+ && s[3] == 1 /* sym */
+ && s[4] == '<'; /* name of file */
}
int
_readq(Biobuf *bp, Prog *p)
{
- int as, n;
+ int as, n, c;
Addr a;
- as = Bgetc(bp); /* as */
+ as = Bgetc(bp); /* as(low) */
if(as < 0)
return 0;
+ c = Bgetc(bp); /* as(high) */
+ if(c < 0)
+ return 0;
+ as |= ((c & 0xff) << 8);
p->kind = aNone;
+ p->sig = 0;
if(as == ANAME || as == ASIGNAME){
- if(as == ASIGNAME)
- skip(bp, 4); /* signature */
+ if(as == ASIGNAME){
+ Bread(bp, &p->sig, 4);
+ p->sig = beswal(p->sig);
+ }
p->kind = aName;
p->type = type2char(Bgetc(bp)); /* type */
p->sym = Bgetc(bp); /* sym */
@@ -93,6 +102,7 @@ addr(Biobuf *bp)
break;
case D_SPR:
case D_OREG:
+ case D_DCR:
case D_CONST:
case D_BRANCH:
off = Bgetc(bp);