OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [tags/] [gnu-src/] [gdb-6.8/] [pre-binutils-2.20.1-sync/] [sim/] [testsuite/] [sim/] [arm/] [hello.ms] - Diff between revs 157 and 223

Go to most recent revision | Only display areas with differences | Details | Blame | View Log

Rev 157 Rev 223
# output(): Hello, world.\n
# output(): Hello, world.\n
# mach(): all
# mach(): all
# Emit hello world while switching back and forth between arm/thumb.
# Emit hello world while switching back and forth between arm/thumb.
# ??? Unfinished
# ??? Unfinished
        .macro invalid
        .macro invalid
# This is "undefined" but it's not properly decoded yet.
# This is "undefined" but it's not properly decoded yet.
        .word 0x07ffffff
        .word 0x07ffffff
# This is stc which isn't recognized yet.
# This is stc which isn't recognized yet.
        stc 0,cr0,[r0]
        stc 0,cr0,[r0]
        .endm
        .endm
        .global _start
        .global _start
_start:
_start:
# Run some simple insns to confirm the engine is at least working.
# Run some simple insns to confirm the engine is at least working.
        nop
        nop
# Skip over output text.
# Skip over output text.
        bl skip_output
        bl skip_output
hello_text:
hello_text:
        .asciz "Hello, world.\n"
        .asciz "Hello, world.\n"
        .p2align 2
        .p2align 2
skip_output:
skip_output:
# Prime loop.
# Prime loop.
        mov r4, r14
        mov r4, r14
output_next:
output_next:
# Switch arm->thumb to output next chacter.
# Switch arm->thumb to output next chacter.
# At this point r4 must point to the next character to output.
# At this point r4 must point to the next character to output.
        adr r0, into_thumb + 1
        adr r0, into_thumb + 1
        bx r0
        bx r0
into_thumb:
into_thumb:
        .thumb
        .thumb
# Output a character.
# Output a character.
        mov r0,#3 @ writec angel call
        mov r0,#3 @ writec angel call
        mov r1,r4
        mov r1,r4
        swi 0xab @ ??? Confirm number.
        swi 0xab @ ??? Confirm number.
# Switch thumb->arm.
# Switch thumb->arm.
        adr r5, back_to_arm
        adr r5, back_to_arm
        bx r5
        bx r5
        .p2align 2
        .p2align 2
back_to_arm:
back_to_arm:
        .arm
        .arm
# Load next character, see if done.
# Load next character, see if done.
        add r4,r4,#1
        add r4,r4,#1
        sub r3,r3,r3
        sub r3,r3,r3
        ldrb r5,[r4,r3]
        ldrb r5,[r4,r3]
        teq r5,#0
        teq r5,#0
        beq done
        beq done
# Output a character (in arm mode).
# Output a character (in arm mode).
        mov r0,#3
        mov r0,#3
        mov r1,r4
        mov r1,r4
        swi #0x123456
        swi #0x123456
# Load next character, see if done.
# Load next character, see if done.
        add r4,r4,#1
        add r4,r4,#1
        sub r3,r3,r3
        sub r3,r3,r3
        ldrb r5,[r4,r3]
        ldrb r5,[r4,r3]
        teq r5,#0
        teq r5,#0
        bne output_next
        bne output_next
done:
done:
        mov r0,#0x18
        mov r0,#0x18
        ldr r1,exit_code
        ldr r1,exit_code
        swi #0x123456
        swi #0x123456
# If that fails, try to die with an invalid insn.
# If that fails, try to die with an invalid insn.
        invalid
        invalid
exit_code:
exit_code:
        .word 0x20026
        .word 0x20026
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.