Usenet comp.sys.dec (1990-2013)
 help / color / mirror / Atom feed
* ALPHA ASM: loading a literal address...
@ 1993-09-30  8:42 Adam Sah
  0 siblings, 0 replies; only message in thread
From: Adam Sah @ 1993-09-30  8:42 UTC (permalink / raw)



I'm trying to load a 64-bit literal address (ptr to a function) into a
  register, and so far have wasted about 8 hours trying.  I seem to be
  stuck on sign extension, and how to get past this insanity...
  (this has to be a literal, because I have no reference by which to find
  in-memory data: I'm trying to reset the gp (r27) to a previously saved
  value, which is only known at runtime)

here's my current sequence (in this example, I'm loading 000000012000c770,
  but I can't play games - this addr is only known at runtime... (ie. not
  at link-time)).  I load the upper 32 bits (16 at a time) into r27 and
  shift them over by 32 bits.  Then I use r25 as a temp register to load
  the lower 32 bits in the same fashion.  This was only split to ease
  debugging...

00000000    0 clr      r27_t12
00000004    1 clr      r25_t11
00000008    2 ldah     r27_t12,0(r31_zero)
0000000c    3 lda      r27_t12,1(r27_t12)
00000010    4 sll      r27_t12,#20,r27_t12
00000014    5 ldah     r25_t11,2000(r31_zero)
00000018    6 lda      r25_t11,C770(r25_t11)
0000001c    7 bis      r27_t12,r25_t11,r27_t12

what I'm getting in r27 is: (part of dbx output)
$r25_t11=0x1fffc770                     $r26_ra=0x12000ed94
$r27_t12=0x11fffc770                    $r28_at=0xffffffffffffffff

it looks like the '2000' 16 bits is getting mushed when we load the lower
  16 bits (c770).  I think this is a sign extension problem, but I'm not
  sure how to fix it.  Can you help?

(email copy pref)

--
Thanks again,
-A.Sah'93                     ...Adam Sah...asah@cs.Berkeley.EDU...
                                   "Life___ is complicated."



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~1993-09-30  8:42 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1993-09-30  8:42 ALPHA ASM: loading a literal address Adam Sah

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox