English Persian
open:
push dword mode
push dword flags
push dword path
mov eax, 5
push eax ; Or any other dword
int 80h
add esp, byte 16
open:
push dword mode
push dword flags
push dword path
mov eax, 5
push eax ; Or any other dword
int 80h
add esp, byte 16
open:
mov eax, 5
mov ebx, path
mov ecx, flags
mov edx, mode
int 80h
open:
mov eax, 5
mov ebx, path
mov ecx, flags
mov edx, mode
int 80h
0 STD NOHIDE { int nosys(void); } syscall nosys_args int
1 STD NOHIDE { void exit(int rval); } exit rexit_args void
2 STD POSIX { int fork(void); }
3 STD POSIX { ssize_t read(int fd, void *buf, size_t nbyte); }
4 STD POSIX { ssize_t write(int fd, const void *buf, size_t nbyte); }
5 STD POSIX { int open(char *path, int flags, int mode); }
6 STD POSIX { int close(int fd); }
etc...
0 STD NOHIDE { int nosys(void); } syscall nosys_args int
1 STD NOHIDE { void exit(int rval); } exit rexit_args void
2 STD POSIX { int fork(void); }
3 STD POSIX { ssize_t read(int fd, void *buf, size_t nbyte); }
4 STD POSIX { ssize_t write(int fd, const void *buf, size_t nbyte); }
5 STD POSIX { int open(char *path, int flags, int mode); }
6 STD POSIX { int close(int fd); }
etc...
%ifdef LINUX
%define SYS_execve 11
%else
%define SYS_execve 59
%endif
%ifdef LINUX
%define SYS_execve 11
%else
%define SYS_execve 59
%endif
sys.open:
sys.close:
[etc...]
int 80h
ret
sys.open:
sys.close:
[etc...]
int 80h
ret
%define stdin 0
%define stdout 1
%define stderr 2
%define stdin 0
%define stdout 1
%define stderr 2
%define SYS_nosys 0
%define SYS_exit 1
%define SYS_fork 2
%define SYS_read 3
%define SYS_write 4
; [etc...]
%define SYS_nosys 0
%define SYS_exit 1
%define SYS_fork 2
%define SYS_read 3
%define SYS_write 4
; [etc...]
section .text
align 4
access.the.bsd.kernel:
int 80h
ret
section .text
align 4
access.the.bsd.kernel:
int 80h
ret
%macro system 1
mov eax, %1
call access.the.bsd.kernel
%endmacro
%macro system 1
mov eax, %1
call access.the.bsd.kernel
%endmacro
1: %include 'system.inc'
2:
3: section .data
4: hello db 'Hello, World!', 0Ah
5: hbytes equ $-hello
6:
7: section .text
8: global _start
9: _start:
10: push dword hbytes
11: push dword hello
12: push dword stdout
13: sys.write
14:
15: push dword 0
16: sys.exit
1: %include 'system.inc'
2:
3: section .data
4: hello db 'Hello, World!', 0Ah
5: hbytes equ $-hello
6:
7: section .text
8: global _start
9: _start:
10: push dword hbytes
11: push dword hello
12: push dword stdout
13: sys.write
14:
15: push dword 0
16: sys.exit
mov al, [esi]
inc esi
mov al, [esi]
inc esi
ungetc:
dec esi
inc ebx
ret
ungetc:
dec esi
inc ebx
ret
section .bss
resb 16 ; or whatever the value you came up with
ibuffer resb BUFSIZE
obuffer resb BUFSIZE
section .bss
resb 16 ; or whatever the value you came up with
ibuffer resb BUFSIZE
obuffer resb BUFSIZE
ungetc:
dec esi
inc ebx
mov [esi], al
ret
ungetc:
dec esi
inc ebx
mov [esi], al
ret
%define SYS_open 5
%define SYS_close 6
%define SYS_open 5
%define SYS_close 6
webvars webvars
carriage return / line feed carriage return / line feed
carriage return carriage return
line feed / carriage return line feed / carriage return
line feed line feed