- 论坛徽章:
- 0
|
POWERPC (32位)环境下编译,我试着编译了一下这个汇编源文件,好多错误, startup.s 文件内容如下:
.file "startup.s"
.text
.align 2
.globl _start
_start:
addis r1,r0,__SP_INIT@h
ori r1,r1,__SP_INIT@l
stwu r0,-72(r1)
bl main
SPIN_HERE:
nop
b SPIN_HERE
.extern ExtIntHandler
.globl ExtIntTable
.globl DecrementerInt
EXTERNAL_INTERRUPT_VECTOR: .equ 0x500 # 问题出在这里,在POWERPC 下,不允话这样的变量定义吗...
R0_OFFSET: .equ (0*4)
R1_OFFSET: .equ (1*4)
R2_OFFSET: .equ (2*4)
R3_OFFSET: .equ (3*4)
R4_OFFSET: .equ (4*4)
R5_OFFSET: .equ (5*4)
R6_OFFSET: .equ (6*4)
R7_OFFSET: .equ (7*4)
R8_OFFSET: .equ (8*4)
R9_OFFSET: .equ (9*4)
R10_OFFSET: .equ (10*4)
R11_OFFSET: .equ (11*4)
R12_OFFSET: .equ (12*4) # R12 Stack Offset
SRR0_OFFSET: .equ (13*4) # SRR0 Stack Offset
SRR1_OFFSET: .equ (14*4) # SRR1 Stack Offset
LR_OFFSET: .equ (15*4) # LR Stack Offset
CTR_OFFSET: .equ (16*4) # CTR Stack Offset
XER_OFFSET: .equ (17*4) # XER Stack Offset
CR_OFFSET: .equ (18*4) # CR Stack Offset
STACK_SZ: .equ (20*4) # Quad-Word Aligned Interrupt Stack Frame
C_FRAME_SZ: .equ (4*4) # Quad-Word Aligned C Frame Size
SRR0: .equ 26 # Save/Restore Register 0
SRR1: .equ 27 # Save/Restore Register 1
.text
DecrementerInt:
rfi
ExtIntTable:
stwu r0, -STACK_SZ+R0_OFFSET(r1)
mfspr r0, SRR0
stw r0, SRR0_OFFSET(r1)
mfspr r0, SRR1
stw r0, SRR1_OFFSET(r1)
stw r3, R3_OFFSET(r1) # Store r3
stw r4, R4_OFFSET(r1) # Store r4
stw r5, R5_OFFSET(r1) # Store r5
stw r6, R6_OFFSET(r1) # Store r6
stw r7, R7_OFFSET(r1) # Store r7
stw r8, R8_OFFSET(r1) # Store r8
stw r9, R9_OFFSET(r1) # Store r9
stw r10, R10_OFFSET(r1) # Store r10
stw r11, R11_OFFSET(r1) # Store r11
stw r12, R12_OFFSET(r1) # Store r12
mflr r0
stw r0, LR_OFFSET(r1)
mfctr r0
stw r0, CTR_OFFSET(r1)
mfxer r0
stw r0, XER_OFFSET(r1)
mfcr r0
stw r0, CR_OFFSET(r1)
subi r1,r1,C_FRAME_SZ
addi r3,r0,EXTERNAL_INTERRUPT_VECTOR
bla ExtIntHandler
addi r1,r1,C_FRAME_SZ
lwz r0, CR_OFFSET(r1)
mtcrf 0xff,r0
lwz r0, XER_OFFSET(r1)
mtxer r0
lwz r0, CTR_OFFSET(r1)
mtctr r0
lwz r0, LR_OFFSET(r1)
mtlr r0
lwz r12, R12_OFFSET(r1) # Store r12
lwz r11, R11_OFFSET(r1) # Store r11
lwz r10, R10_OFFSET(r1) # Store r10
lwz r9, R9_OFFSET(r1) # Store r9
lwz r8, R8_OFFSET(r1) # Store r8
lwz r7, R7_OFFSET(r1) # Store r7
lwz r6, R6_OFFSET(r1) # Store r6
lwz r5, R5_OFFSET(r1) # Store r5
lwz r4, R4_OFFSET(r1) # Store r4
lwz r3, R3_OFFSET(r1) # Store r3
lwz r0, SRR1_OFFSET(r1)
mtspr SRR1, r0
lwz r0, SRR0_OFFSET(r1)
mtspr SRR0, r0
lwz r0, R0_OFFSET(r1)
addi r1, r1, STACK_SZ
rfi
.word 64 # pad space
编译后出错信息如下:ppc-linux-as -o startup.o startup.s
startup.s: Assembler messages:
startup.s:28: Error: expected symbol name
startup.s:29: Error: expected symbol name
startup.s:30: Error: expected symbol name
startup.s:31: Error: expected symbol name
startup.s:32: Error: expected symbol name
startup.s:33: Error: expected symbol name
startup.s:34: Error: expected symbol name
startup.s:35: Error: expected symbol name
startup.s:36: Error: expected symbol name
startup.s:37: Error: expected symbol name
startup.s:38: Error: expected symbol name
startup.s:39: Error: expected symbol name
startup.s:40: Error: expected symbol name
startup.s:41: Error: expected symbol name
startup.s:42: Error: expected symbol name
startup.s:43: Error: expected symbol name
startup.s:44: Error: expected symbol name
startup.s:45: Error: expected symbol name
startup.s:46: Error: expected symbol name
startup.s:47: Error: expected symbol name
startup.s:48: Error: expected symbol name
startup.s:50: Error: expected symbol name
startup.s:28: Error: expected symbol name 这个地方对应的语句为: EXTERNAL_INTERRUPT_VECTOR: .equ 0x500
startup.s:29: Error: expected symbol name 对应的语句为: R0_OFFSET: .equ (0*4)
......................不允许这样定义吗? 要如何定义
[ 本帖最后由 nflx 于 2009-5-17 16:56 编辑 ] |
|