Setting up alpha stack frames (Timothy Jones)
6 May 2003 19:18:05 -0400

          From comp.compilers

Related articles
Setting up alpha stack frames (2003-05-06)
Re: Setting up alpha stack frames (2003-05-14)
Re: Setting up alpha stack frames (Peter \Firefly\Lund) (2003-05-14)
Re: Setting up alpha stack frames (2003-05-14)
| List of all articles for this month |

From: (Timothy Jones)
Newsgroups: comp.compilers,comp.arch
Date: 6 May 2003 19:18:05 -0400
Keywords: architecture, question
Posted-Date: 06 May 2003 19:18:05 EDT

Hi all,

I'm having some trouble adding an instruction (even if it's a nop) to
the start of a procedure before the stack frame is initialised. I want
to put it here because I want it to go before any other instruction is
executed in each basic block.

The first problem I had was with alignment. I started with the
following code, where hello is the name of a simple procedure which
prints "Hello World!". I added the nop at the start and get this

ldgp $gp,0($27)
lda $sp,-32($sp)
stq $26,0($sp)
.mask 0x04000000, -32
.frame $sp, 32, $26, 16
.prologue 1,
stq $gp,24($sp)
.loc 2 5
lda $16,__tmp_string_0
lda $27,printf
jsr $26,($27)
ldq $gp,24($sp)
.loc 2 6
ldq $26,0($sp)
lda $sp,32($sp)
ret ($26),1
.end hello

romeu:~> cc -o main.before main.s
romeu:~> ./main.before
Unaligned access pid=21607 <main.before> va=0x14000014c pc=0x1200011a8
ra=0x1200011ec inst=0xa77d80d0
zsh: segmentation fault (core dumped) ./main.before

So I add alignment like this:

                .align 0
                .align 4
ldgp $gp,0($27)

romeu:~> cc -o main.align main.s
romeu:~> ./main.align
zsh: segmentation fault (core dumped) ./main.align

I don't know what the problem is at all. I can't see a reason this
alters anything in the program itself and all symbols are labels at
the point I add the instruction so they shouldn't be affected. Can
anybody help or point me in another direction at all?


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.