From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1164f8,b21ae2574b9acb6b X-Google-Attributes: gid1164f8,public From: ivie@cc.usu.edu (Roger Ivie) Subject: Re: loading data addresses on Alpha Date: 1996/05/03 Message-ID: <1996May3.094838.79529@cc.usu.edu>#1/1 X-Deja-AN: 152827292 references: organization: Utah State University newsgroups: comp.sys.dec In article , craigp@world.std.com (Craig Partridge) writes: Well, after my fiasco discussing MSCP and bad block replacement on port-vax, I promised myself I wouldn't post about things I didn't know really well. I just couldn't resist this one, though... > How does one load addresses into registers on the Alpha? > > Having plowed through the manuals and various bits of code, it appears there > are two choices: > > * I can laboriously load 16-bits of the address at a time using > LDA and LDAH and one shift. This eats several instructions. > > * Various assemblers seem to offer a single instruction macro expansion of > LDA, that loads a particular address using some offset from (I believe) > the global pointer (GP). What I can't puzzle out is how this is done > and how GP is initialized. Your choices are basically load it using LDA and LDAH etc. or arrange to have a location lying around somewhere convenient containing the valud you need to load. The address of a procedure on the Alpha is really the address of a record containing a pair of addresses: the entry point of the procedure and the value that should be loaded into one of the other registers so that procedure can get to its constants (the "literal pool"). It's been a while since I dorked with this stuff, but you should be able to see this happen in MACRO32 if you compile with /list/show=machine. In the expansion of the single-word LDA equivalent, you should see a reference through the pointer into the literal pool to a word containing the value; i.e., the LDA expands into an instruction and a data word. -- -------------------------+--------------------------------------------- Roger Ivie | P v Q -> P ivie@cc.usu.edu | -- Gordon B. Hinckley http://cc.usu.edu/~ivie/ |