(func_addr, ...args)
| 299 | } |
| 300 | |
| 301 | push_call(func_addr, ...args) { |
| 302 | if (args.length > 6) { |
| 303 | throw TypeError( |
| 304 | 'push_call() does not support functions that have more than 6' |
| 305 | + ' arguments'); |
| 306 | } |
| 307 | |
| 308 | for (let i = 0; i < args.length; i++) { |
| 309 | this.push_gadget(argument_pops[i]); |
| 310 | this.push_value(args[i]); |
| 311 | } |
| 312 | |
| 313 | // The address of our buffer seems to be always aligned to 8 bytes. |
| 314 | // SysV calling convention requires the stack is aligned to 16 bytes on |
| 315 | // function entry, so push an additional 8 bytes to pad the stack. We |
| 316 | // pushed a "ret" gadget for a noop. |
| 317 | if ((this.position & (0x10 - 1)) !== 0) { |
| 318 | this.push_gadget('ret'); |
| 319 | } |
| 320 | |
| 321 | if (typeof func_addr === 'string') { |
| 322 | this.push_gadget(func_addr); |
| 323 | } else { |
| 324 | this.push_value(func_addr); |
| 325 | } |
| 326 | } |
| 327 | |
| 328 | push_syscall(syscall_name, ...args) { |
| 329 | if (typeof syscall_name !== 'string') { |
no test coverage detected