| Elliott Hughes | 5c9f0b4 | 2011-12-15 18:15:46 -0800 | [diff] [blame] | 1 | #include "asm_support.h" |
| 2 | |
| Shih-wei Liao | d102998 | 2012-01-19 17:53:17 +0800 | [diff] [blame] | 3 | #if defined(__APPLE__) |
| 4 | // Mac OS X mangles the functions with an underscore prefix |
| 5 | #define art_deliver_exception_from_code _art_deliver_exception_from_code |
| 6 | #define art_proxy_invoke_handler _art_proxy_invoke_handler |
| 7 | #define artDeliverExceptionFromCode _artDeliverExceptionFromCode |
| 8 | #endif |
| 9 | |
| Elliott Hughes | 5c9f0b4 | 2011-12-15 18:15:46 -0800 | [diff] [blame] | 10 | .globl art_deliver_exception_from_code |
| 11 | /* |
| 12 | * Called by managed code, saves callee saves and then calls artThrowException |
| 13 | * that will place a mock Method* at the bottom of the stack. |
| 14 | * EAX holds the exception. |
| 15 | */ |
| 16 | art_deliver_exception_from_code: |
| 17 | // Create frame |
| 18 | pushl %edi // Save callee saves |
| 19 | pushl %esi |
| 20 | pushl %ebp |
| 21 | pushl %ebx |
| 22 | pushl $0 |
| 23 | pushl $0 |
| 24 | pushl $0 // Will be clobbered to be Method* |
| 25 | mov %esp, %ecx |
| 26 | // Outgoing argument set up |
| 27 | pushl $0 // Alignment padding |
| 28 | pushl %ecx // pass SP |
| 29 | pushl %fs:THREAD_SELF_OFFSET // pass fs:offsetof(Thread,self_) |
| 30 | pushl %eax // pass Throwable* |
| 31 | call artDeliverExceptionFromCode // artDeliverExceptionFromCode(Throwable*, Thread*, SP) |
| 32 | int3 |
| 33 | |
| 34 | // TODO |
| 35 | .globl art_proxy_invoke_handler |
| 36 | art_proxy_invoke_handler: |
| 37 | int3 |