============================================================== VIRTUAL MACHINE ============================================================== */
| 33 | ============================================================== |
| 34 | */ |
| 35 | intptr_t VM_Call( int callnum, ... ) |
| 36 | { |
| 37 | intptr_t args[8] = { 0 }; |
| 38 | va_list ap; |
| 39 | |
| 40 | if ( cgvm.entryPoint ) { |
| 41 | va_start( ap, callnum ); |
| 42 | for ( size_t i = 0; i < ARRAY_LEN( args ); i++ ) |
| 43 | args[i] = va_arg( ap, intptr_t ); |
| 44 | va_end(ap); |
| 45 | |
| 46 | return cgvm.entryPoint( callnum, args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7] ); |
| 47 | } |
| 48 | return -1; |
| 49 | } |
| 50 | |
| 51 | // The syscall mechanism relies on stack manipulation to get it's args. |
| 52 | // This is likely due to C's inability to pass "..." parameters to a function in one clean chunk. |
no outgoing calls
no test coverage detected