mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-22 21:32:31 +00:00
Add APE interpreter example (#263)
This commit is contained in:
parent
5b60e5a37d
commit
969174e155
7 changed files with 210 additions and 14 deletions
16
libc/linux/execve.h
Normal file
16
libc/linux/execve.h
Normal file
|
@ -0,0 +1,16 @@
|
|||
#ifndef COSMOPOLITAN_LIBC_LINUX_EXECVE_H_
|
||||
#define COSMOPOLITAN_LIBC_LINUX_EXECVE_H_
|
||||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||
|
||||
forceinline long LinuxExecve(const char *program, char *const argv[],
|
||||
char *const envp[]) {
|
||||
long rc;
|
||||
asm volatile("syscall"
|
||||
: "=a"(rc)
|
||||
: "0"(59), "D"(program), "S"(argv), "d"(envp)
|
||||
: "rcx", "r11", "memory");
|
||||
return rc;
|
||||
}
|
||||
|
||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||
#endif /* COSMOPOLITAN_LIBC_LINUX_EXECVE_H_ */
|
Loading…
Add table
Add a link
Reference in a new issue