erik quanstrom
2013-08-21 18:36:40 UTC
vc vlongs are broken for cast
for example, _v2uc produces the code:
acid; asm(_v2uc)
_v2uc 0x00005360 MOVW rv+8(FP),R1
_v2uc+0x4 0x00005364 JMP (R31)
_v2uc+0x8 0x00005368 AND $0xff,R1
i think this should be
MOVW rv+12(FP),R1
JMP (R31)
AND $0xff,R1
since the high 32-bits of the vlong should be first, since
this is a BE machine. perhaps there's supposed to be a
special calling convention for vlongs?
here's an example of the issue:
void
main(void)
{
uvlong x;
x = 0x012345678abcdefull;
print("(uchar)x %.2ux\n", (uchar)x);
exits("");
}
mikro; v.x
x = 0012345678abcdef
(uchar)x ef
marshalling a 64-bit pointer in this way will lay down the
bytes with the hi and lo reversed.
- erik
for example, _v2uc produces the code:
acid; asm(_v2uc)
_v2uc 0x00005360 MOVW rv+8(FP),R1
_v2uc+0x4 0x00005364 JMP (R31)
_v2uc+0x8 0x00005368 AND $0xff,R1
i think this should be
MOVW rv+12(FP),R1
JMP (R31)
AND $0xff,R1
since the high 32-bits of the vlong should be first, since
this is a BE machine. perhaps there's supposed to be a
special calling convention for vlongs?
here's an example of the issue:
void
main(void)
{
uvlong x;
x = 0x012345678abcdefull;
print("(uchar)x %.2ux\n", (uchar)x);
exits("");
}
mikro; v.x
x = 0012345678abcdef
(uchar)x ef
marshalling a 64-bit pointer in this way will lay down the
bytes with the hi and lo reversed.
- erik