-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #58 from futurecore/improve-asm-tests
Remove max_insts from asm tests.
- Loading branch information
Showing
5 changed files
with
79 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,41 @@ | ||
#include "epiphany-macros.h" | ||
.global main | ||
interrupt_handler: | ||
mov r0, #1 | ||
mov r1, %low(message) | ||
movt r1, %high(message) | ||
mov r2, #17 | ||
mov r3, #5 | ||
trap #7 | ||
TEAR_DOWN | ||
main: | ||
mov r0, #0x3ff | ||
movts ilatst, r0 ; After this instruction ILAT will hold 0x3fe. One bit | ||
; will be cleared and put into IPEND. | ||
TEAR_DOWN | ||
; ivt = (uint32_t *) 0x24; | ||
mov r0, #0x24 | ||
; branch_addr = (uint32_t) &interrupt_handler; | ||
mov r1, %low(interrupt_handler) | ||
movt r1, %high(interrupt_handler) | ||
; branch_addr -= (uint32_t) ivt; | ||
sub r2, r1, r0 | ||
; branch_addr = (branch_addr >> 1); | ||
lsr r2, r2, #1 | ||
; rel_branch_instruction32 = 0xe8; | ||
mov r3, 0xe8 | ||
; rel_branch_instruction32 |= ((branch_addr & (0x00ffffff))) << 8; | ||
mov r4, %low(0x00ffffff) | ||
movt r4, %high(0x00ffffff) | ||
and r5, r2, r4 ; branch_addr & (0x00ffffff) | ||
mov r6, #8 | ||
lsl r7, r5, r6 ; (branch_addr & 0x00ffffff) << 8 | ||
orr r8, r3, r7 | ||
; *ivt = rel_branch_instruction32; | ||
str r8, [r0, #0] | ||
; Clear interrupt mask. | ||
mov r45, 0 | ||
movts imask, r45 | ||
; Enable interrupts. | ||
gie | ||
; Set interrupt latch. | ||
mov r45, 0x200 | ||
movts ilatst, r45 | ||
message: | ||
.ascii "Interrupt fired.\n" |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,42 @@ | ||
#include "epiphany-macros.h" | ||
.global main | ||
main: | ||
interrupt_handler: | ||
mov r0, #1 | ||
mov r1, %low(message) | ||
movt r1, %high(message) | ||
mov r2, #17 | ||
mov r3, #5 | ||
trap #7 | ||
rti | ||
TEAR_DOWN | ||
main: | ||
; ivt = (uint32_t *) 0x24; | ||
mov r0, #0x24 | ||
; branch_addr = (uint32_t) &interrupt_handler; | ||
mov r1, %low(interrupt_handler) | ||
movt r1, %high(interrupt_handler) | ||
; branch_addr -= (uint32_t) ivt; | ||
sub r2, r1, r0 | ||
; branch_addr = (branch_addr >> 1); | ||
lsr r2, r2, #1 | ||
; rel_branch_instruction32 = 0xe8; | ||
mov r3, 0xe8 | ||
; rel_branch_instruction32 |= ((branch_addr & (0x00ffffff))) << 8; | ||
mov r4, %low(0x00ffffff) | ||
movt r4, %high(0x00ffffff) | ||
and r5, r2, r4 ; branch_addr & (0x00ffffff) | ||
mov r6, #8 | ||
lsl r7, r5, r6 ; (branch_addr & 0x00ffffff) << 8 | ||
orr r8, r3, r7 | ||
; *ivt = rel_branch_instruction32; | ||
str r8, [r0, #0] | ||
; Clear interrupt mask. | ||
mov r45, 0 | ||
movts imask, r45 | ||
; Enable interrupts. | ||
gie | ||
; Set interrupt latch. | ||
mov r45, 0x200 | ||
movts ilatst, r45 | ||
TEAR_DOWN | ||
message: | ||
.ascii "Interrupt fired.\n" |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters