Skip to content

Commit

Permalink
Merge pull request #14 from robert-lytton/master
Browse files Browse the repository at this point in the history
Update assembly for XS2A
  • Loading branch information
Andy Lucas committed Oct 21, 2015
2 parents 7840b23 + 4052534 commit 94f20a9
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
File renamed without changes.
1 change: 0 additions & 1 deletion module_trycatch/module_build_info
Expand Up @@ -8,4 +8,3 @@
# optimization level -O3).
#
# You can also set MODULE_XCC_C_FLAGS, MODULE_XCC_XC_FLAGS etc..

19 changes: 19 additions & 0 deletions module_trycatch/src/trycatch_asm.S
Expand Up @@ -9,7 +9,13 @@
.globl trycatch_trap_handler
.type trycatch_trap_handler, @function
.align XS1_KEP_ALIGNMENT
#ifdef __XS2A__
.issue_mode single
trycatch_trap_handler:
ENTSP_lu6 0
#else
trycatch_trap_handler:
#endif
// No need to save state since we end by calling longjmp.

// Set sp to trycatch_state.
Expand All @@ -27,16 +33,29 @@ trycatch_trap_handler:

// Store et and ed.
get r11, et
#ifdef __XS2A__
// An additional et bit (0x16) indicates
// the lane that caused the exception.
zext r11, 4
#endif
stw r11, sp[0]
get r11, ed
stw r11, sp[1]

// Leave kernel mode.
kret

#ifdef __XS2A__
.align 4
.issue_mode single
return_from_exception:
// Call longjump.
ENTSP_lu6 0
#else
.align 2
return_from_exception:
// Call longjump.
#endif
ldw r0, sp[2]
ldc r1, 1
bu longjmp
Expand Down

0 comments on commit 94f20a9

Please sign in to comment.