From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 13c6a4,2b8a9d7fb0ea5fd9,start X-Google-Attributes: gid13c6a4,public X-Google-Thread: 1164f8,2b8a9d7fb0ea5fd9,start X-Google-Attributes: gid1164f8,public X-Google-ArrivalTime: 1993-09-30 01:49:55 PST Path: gmd.de!newsserver.jvnc.net!howland.reston.ans.net!agate!agate.Berkeley.EDU!asah From: asah@cs.Berkeley.EDU (Adam Sah) Newsgroups: comp.sys.dec,comp.os.osf.osf1 Subject: ALPHA ASM: loading a literal address... Date: 30 Sep 1993 08:42:16 GMT Organization: University of California, Berkeley Distribution: world Message-ID: NNTP-Posting-Host: ginsberg.cs.berkeley.edu 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."