9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] more on why vc can't produce amd64 executables
@ 2013-08-21 18:36 erik quanstrom
  2013-08-21 18:49 ` Bakul Shah
  0 siblings, 1 reply; 8+ messages in thread
From: erik quanstrom @ 2013-08-21 18:36 UTC (permalink / raw)
  To: 9fans

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



^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2013-08-22 16:54 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-08-21 18:36 [9fans] more on why vc can't produce amd64 executables erik quanstrom
2013-08-21 18:49 ` Bakul Shah
2013-08-21 18:57   ` erik quanstrom
2013-08-21 19:25     ` Bakul Shah
2013-08-21 19:29       ` erik quanstrom
2013-08-21 21:44       ` erik quanstrom
2013-08-22 15:32         ` Bakul Shah
2013-08-22 16:54           ` erik quanstrom

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).