📄 os_linux.inc
字号:
%assign CTL_MAXNAME 10%assign CTL_KERN 1 ;General kernel info and control%assign CTL_VM 2 ;VM management%assign CTL_NET 3 ;Networking%assign CTL_PROC 4 ;Process info%assign CTL_FS 5 ;Filesystems%assign CTL_DEBUG 6 ;Debugging%assign CTL_DEV 7 ;Devices%assign CTL_BUS 8 ;Busses%assign CTL_ABI 9 ;Binary emulation%assign CTL_CPU 10 ;CPU stuff (speed scaling, etc)%assign KERN_OSTYPE 1 ;string: system version%assign KERN_OSRELEASE 2 ;string: system release%assign KERN_OSREV 3 ;int: system revision%assign KERN_VERSION 4 ;string: compile time info%assign KERN_SECUREMASK 5 ;struct: maximum rights mask%assign KERN_PROF 6 ;table: profiling information%assign KERN_NODENAME 7%assign KERN_HOSTNAME KERN_NODENAME%assign KERN_DOMAINNAME 8%assign KERN_CAP_BSET 14 ;int: capability bounding set%assign KERN_PANIC 15 ;int: panic timeout%assign KERN_REALROOTDEV 16 ;real root device to mount after initrd%assign KERN_SPARC_REBOOT 21 ;reboot command on Sparc%assign KERN_CTLALTDEL 22 ;int: allow ctl-alt-del to reboot%assign KERN_PRINTK 23 ;struct: control printk logging parameters%assign KERN_NAMETRANS 24 ;Name translation%assign KERN_PPC_HTABRECLAIM 25 ;turn htab reclaimation on/off on PPC%assign KERN_PPC_ZEROPAGED 26 ;turn idle page zeroing on/off on PPC%assign KERN_PPC_POWERSAVE_NAP 27 ;use nap mode for power saving%assign KERN_MODPROBE 28%assign KERN_SG_BIG_BUFF 29%assign KERN_ACCT 30 ;BSD process accounting parameters%assign KERN_PPC_L2CR 31 ;l2cr register on PPC%assign KERN_RTSIGNR 32 ;Number of rt sigs queued%assign KERN_RTSIGMAX 33 ;Max queuable %assign KERN_SHMMAX 34 ;long: Maximum shared memory segment%assign KERN_MSGMAX 35 ;int: Maximum size of a messege%assign KERN_MSGMNB 36 ;int: Maximum message queue size%assign KERN_MSGPOOL 37 ;int: Maximum system message pool size%assign KERN_SYSRQ 38 ;int: Sysreq enable %assign KERN_MAX_THREADS 39 ;int: Maximum nr of threads in the system%assign KERN_RANDOM 40 ;Random driver%assign KERN_SHMALL 41 ;int: Maximum size of shared memory%assign KERN_MSGMNI 42 ;int: msg queue identifiers%assign KERN_SEM 43 ;struct: sysv semaphore limits%assign KERN_SPARC_STOP_A 44 ;int: Sparc Stop-A enable%assign KERN_SHMMNI 45 ;int: shm array identifiers%assign KERN_OVERFLOWUID 46 ;int: overflow UID%assign KERN_OVERFLOWGID 47 ;int: overflow GID%assign KERN_SHMPATH 48 ;string: path to shm fs%assign KERN_HOTPLUG 49 ;string: path to hotplug policy agent%assign KERN_IEEE_EMULATION_WARNINGS 50 ;int: unimplemented ieee instructions%assign KERN_S390_USER_DEBUG_LOGGING 51 ;int: dumps of user faults%assign KERN_CORE_USES_PID 52 ;int: use core or core.%pid%assign KERN_TAINTED 53 ;int: various kernel tainted flags%assign KERN_CADPID 54 ;int: PID of the process to notify on CAD;;linux/mount.h;%assign MS_RDONLY 1 ;Mount read-only%assign MS_NOSUID 2 ;Ignore suid and sgid bits%assign MS_NODEV 4 ;Disallow access to device special files%assign MS_NOEXEC 8 ;Disallow program execution%assign MS_SYNCHRONOUS 16 ;Writes are synced at once%assign MS_REMOUNT 32 ;Alter flags of a mounted FS%assign MS_MANDLOCK 64 ;Allow mandatory locks on an FS%assign MS_NOATIME 1024 ;Do not update access times%assign MS_NODIRATIME 2048 ;Do not update directory access times%assign MS_BIND 4096%assign MS_REC 16384%assign MS_VERBOSE 32768%assign MS_ACTIVE (1<<30)%assign MS_NOUSER (1<<31)%assign MS_MGC_VAL 0xc0ed0000;;linux/hdreg.h;%assign HDIO_GETGEO 0x0301 ;get device geometry;;utmp.h;%define _PATH_UTMP "/var/run/utmp"%assign UT_LINESIZE 32%assign UT_NAMESIZE 32%assign UT_HOSTSIZE 256%assign RUN_LVL 1 ;The system's runlevel%assign BOOT_TIME 2 ;Time of system boot%assign NEW_TIME 3 ;Time after system clock changed%assign OLD_TIME 4 ;Time when system clock changed%assign INIT_PROCESS 5 ;Process spawned by the init process%assign LOGIN_PROCESS 6 ;Session leader of a logged in user%assign USER_PROCESS 7 ;Normal process%assign DEAD_PROCESS 8 ;Terminated process%assign ACCOUNTING 9struc exit_status.e_termination SHORT 1 ;Process termination status.e_exit SHORT 1 ;Process exit statusendstrucstruc utmp.ut_type SHORT 1 ;Type of login.__pad1 SHORT 1 .ut_pid U32 1 ;Process ID of login process.ut_line CHAR UT_LINESIZE ;Devicename.ut_id CHAR 4 ;Inittab ID.ut_user CHAR UT_NAMESIZE ;Username.ut_host CHAR UT_HOSTSIZE ;Hostname for remote login.ut_exit SHORT 2 ;Exit status of a process marked as DEAD_PROCESS.ut_session LONG 1 ;Session ID, used for windowing.ut_tv ULONG 2 ;Time entry was made.ut_addr_v6 U32 4 ;Internet address of remote host.__unused CHAR 20 ;Reserved for future useendstruc;;sys/sysinfo.h;struc sysinfo.uptime LONG 1.loads ULONG 3.totalram ULONG 1.freeram ULONG 1.sharedram ULONG 1.bufferram ULONG 1.totalswap ULONG 1.freeswap ULONG 1.procs USHORT 1%if __KERNEL__ <= 22.pad CHAR 22%else.totalhigh ULONG 1.freehigh ULONG 1.mem_unit ULONG 1.pad CHAR 8%endifendstruc;;system calls;%macro __pushargs 2-8%if %1>0 %if %1>1 %if %1>2 %if %1>3 %if %1>4 %if %1>5 %if %2>5 _push %8,ebp %else push ebp %endif %endif %if %2>4 _push %7,edi %else push edi %endif %endif %if %2>3 _push %6,esi %else push esi %endif %endif %if %2>2 _push %5,edx %else push edx %endif %endif %if %2>1 _push %4,ecx %else push ecx %endif %endif %if %2>0 _push %3,ebx %else push ebx %endif%endif%endmacro;;net/socket.c;%if __SYSCALL__=__S_KERNEL__%define __OS_SYSCALL_NETWORK__%macro sys_socketcall 0-3 __syscall socketcall, 3, %0, %1, %2, %3%endmacro%macro sys_socket 0-3 __pushargs 3, %0, %1, %2, %3 sys_socketcall SYS_SOCKET,esp _add esp,(3 * 4)%endmacro%macro sys_accept 0-3 __pushargs 3, %0, %1, %2, %3 sys_socketcall SYS_ACCEPT,esp _add esp,(3 * 4)%endmacro%macro sys_connect 0-3 __pushargs 3, %0, %1, %2, %3 sys_socketcall SYS_CONNECT,esp _add esp,(3 * 4)%endmacro%macro sys_bind 0-3 __pushargs 3, %0, %1, %2, %3 sys_socketcall SYS_BIND,esp _add esp,(3 * 4)%endmacro%macro sys_setsockopt 0-5 __pushargs 5, %0, %1, %2, %3, %4, %5 sys_socketcall SYS_SETSOCKOPT,esp _add esp,(5 * 4)%endmacro%macro sys_getsockname 0-3 __pushargs 3, %0, %1, %2, %3 sys_socketcall SYS_GETSOCKNAME,esp _add esp,(3 * 4)%endmacro%macro sys_shutdown 0-2 __pushargs 2, %0, %1, %2 sys_socketcall SYS_SHUTDOWN,esp _add esp,(2 * 4)%endmacro%macro sys_listen 0-2 __pushargs 2, %0, %1, %2 sys_socketcall SYS_LISTEN,esp _add esp,(2 * 4)%endmacro%macro sys_send 0-4 __pushargs 4, %0, %1, %2, %3, %4 sys_socketcall SYS_SEND,esp _add esp,(4 * 4)%endmacro%macro sys_recv 0-4 __pushargs 4, %0, %1, %2, %3, %4 sys_socketcall SYS_RECV,esp _add esp,(4 * 4)%endmacro%macro sys_sendto 0-6 __pushargs 6, %0, %1, %2, %3, %4, %5, %6 sys_socketcall SYS_SENDTO,esp _add esp,(6 * 4)%endmacro%macro sys_recvfrom 0-6 __pushargs 6, %0, %1, %2, %3, %4, %5, %6 sys_socketcall SYS_RECVFROM,esp _add esp,(6 * 4)%endmacro%macro sys_sendmsg 0-3 __pushargs 3, %0, %1, %2, %3 sys_socketcall SYS_SENDMSG,esp _add esp,(3 * 4)%endmacro%macro sys_recvmsg 0-3 __pushargs 3, %0, %1, %2, %3 sys_socketcall SYS_RECVMSG,esp _add esp,(3 * 4)%endmacro%endif;;arch/i386/kernel/sys_i386.c;%if __SYSCALL__=__S_KERNEL__%define __OS_SYSCALL_MMAP__struc mmap_arg_struct.addr ULONG 1.len ULONG 1.prot ULONG 1.flags ULONG 1.fd ULONG 1.offset ULONG 1endstruc%macro sys_oldmmap 0-1 __syscall mmap, 1, %0, %1%endmacro%macro sys_mmap 0-6%if __KERNEL__ >= 24 __syscall mmap2, 6, %0, %1, %2, %3, %4, %5, %6%else __pushargs 6, %0, %1, %2, %3, %4, %5, %6 sys_oldmmap esp _add esp,(6 * 4)%endif%endmacro%endif%macro sys_vhangup 0 __syscall vhangup, 0%endmacro;;kernel/sys.c;%if __SYSCALL__=__S_KERNEL__%define __OS_SYSCALL_REBOOT__%macro sys_reboot 0-4 __syscall reboot, 4, %0, %1, %2, %3, %4%endmacro%endif%if __SYSCALL__=__S_LIBC__%define __OS_SYSCALL_GETDENTS__%macro sys_getdents 0-3 __syscall getdents64, 3, %0, %1, %2, %3%endmacro%endif;;Linux specific syscalls;%macro sys_llseek 0-5 __syscall llseek, 5, %0, %1, %2, %3, %4, %5%endmacro;;arch/i386/kernel/ioport.c;%macro sys_ioperm 0-3 __syscall ioperm, 3, %0, %1, %2, %3%endmacro%macro sys_iopl 0-1 __syscall iopl, 1, %0, %1%endmacro;;arch/i386/kernel/process.c;%macro sys_idle 0 __syscall idle, 0%endmacro%macro sys_clone 0-2 __syscall clone, 2, %0, %1, %2%endmacro;;arch/i386/kernel/ldt.c;%macro sys_modify_ldt 0-3 __syscall modify_ldt, 3, %0, %1, %2, %3%endmacro;;arch/i386/kernel/vm86.c;%macro sys_vm86old 0-1 __syscall vm86old, 1, %0, %1%endmacro%macro sys_vm86 0-2 __syscall vm86, 2, %0, %1, %2%endmacro;;kernel/info.c;%macro sys_sysinfo 0-1 __syscall sysinfo, 1, %0, %1%endmacro;;kernel/printk.c;%macro sys_syslog 0-3 __syscall syslog, 3, %0, %1, %2, %3%endmacro;;fs/buffer.c;%macro sys_bdflush 0-2 __syscall bdflush, 2, %0, %1, %2%endmacro;;mm/swapfile.c;%macro sys_swapon 0-2 __syscall swapon, 2, %0, %1, %2%endmacro%macro sys_swapoff 0-1 __syscall swapoff, 1, %0, %1%endmacro;%macro sys__sysctl 0-1 __syscall sysctl, 1, %0, %1%endmacro%macro sys_sysctl 0-6 __pushargs 6, %0, %1, %2, %3, %4, %5, %6 sys__sysctl esp _add esp,(6 * 4)%endmacro;%macro sys_rt_sigreturn 0-1 __syscall rt_sigreturn, 1, %0, %1%endmacro%macro sys_rt_sigsuspend 0-2 __syscall rt_sigsuspend, 2, %0, %1, %2%endmacro;;kernel/module.c;%macro sys_delete_module 0-1 __syscall delete_module, 1, %0, %1%endmacro%macro sys_init_module 0-2 __syscall init_module, 2, %0, %1, %2%endmacro%macro sys_create_module 0-2 __syscall create_module, 2, %0, %1, %2%endmacro%macro sys_query_module 0-5 __syscall query_module, 5, %0, %1, %2, %3, %4, %5%endmacro%macro sys_get_kernel_syms 0-1 __syscall get_kernel_syms, 1, %0, %1%endmacro;%macro sys_umount2 0-2 __syscall umount2, 2, %0, %1, %2%endmacro%macro sys_sbrk 0-1 __syscall brk, 1, %0, %1%endmacro%endif ;__LINUX_INC
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -