Difference between revisions of "Alpha Assembly"
(Imported from http://web.archive.org/web/20100713091906/http://www.alphalinux.org/wiki/index.php?title=Alpha_Assembly&action=edit) |
(No difference)
|
Latest revision as of 18:07, 29 August 2019
Contents
Registers
The Alpha has split integer and floating-point register files. It has 32 64-bit wide integer and 32 64-bit wide floating-point registers.[1]
Integer Registers
Of the 32 integer registers, 12 are temporary registers, 6 are saved across function calls, and 6 are for passing arguments. The $31 register always holds the value 0. Writes to it are ignored.[1]
| Register | Alternate Name | Preserved? | Purpose |
|---|---|---|---|
| $0 | $v0 | No | Return Value |
| $1-$8 | $t0-$t7 | No | Temporary Registers |
| $9-$14 | $s0-$s5 | Yes | Saved Registers |
| $15 | $s6 or $fp | Yes | Saved Register or Frame Pointer |
| $16-$21 | $a0-$a5 | No | Function Arguments |
| $22-$25 | $t8-$t11 | No | Temporary Registers |
| $26 | $ra | Yes | Function Return Address |
| $27 | $pv or $t12 | No | Procedure Value or Temporary Register |
| $28 | $at | No | Reserved for Assembler |
| $29 | $gp | No | Global Pointer |
| $30 | $sp | Yes | Stack Pointer |
| $31 | $zero | Zero Sink |
Floating-Point Registers
Of the 32 floating-point registers, 15 are temporary registers, 8 are saved across function calls, and 6 are for passing arguments. The $f31 register always holds the value 0.0. Writes to it are ignored.[1]
| Register | Preserved? | Purpose |
|---|---|---|
| $f0 | No | Return Value |
| $f1 | No | Return Value of Imaginary Part |
| $f2-$f9 | Yes | Saved Registers |
| $f10-$f15 | No | Temporary Registers |
| $f16-$f21 | No | Function Arguments |
| $f22-$f30 | No | Temporary Registers |
| $f31 | Zero Sink |
Hello, World!
# hello.S # gcc hello.S -o hello # ./hello .data PRINT: .ascii "Hello, World!\n" .text .align 4 .set noreorder .arch ev4 .globl main .ent main main: ldgp $gp,0($27) # load global pointer (necessary) stq $26,0($sp) # setup stack pointer lda $16,PRINT # load format string # $16 is first argument to functions jsr $26,printf # call printf ldgp $gp,0($26) # reload global pointer # (necessary after function calls) mov $31,$0 # return val = 0 ldq $26,0($sp) # clean up stack ret $31,($26),1 # return, (1 signifies return from a procedure) .end main
External Links
- Alpha Architecture Chip Documents
- Alpha Assembly for Linux/UNIX
- Introduction to Alpha
- Re: Question re: Alpha asm code