?? linux.hhf
字號:
screen_bitmap :dword; cpu_type :dword; int_revectored :revectored_struct; int21_revectored:revectored_struct; vm86plus :vm86plus_info_struct; endrecord; pt_regs: record _ebx :dword; _ecx :dword; _edx :dword; _esi :dword; _edi :dword; _ebp :dword; _eax :dword; xds :dword; xes :dword; orig_eax:dword; _eip :dword; xcs :dword; eflags :dword; _esp :dword; xss :dword; endrecord; user_regs_struct: record _ebx :dword; _ecx :dword; _edx :dword; _esi :dword; _edi :dword; _ebp :dword; _eax :dword; _ds :word; __ds :word; _es :word; __es :word; _fs :word; __fs :word; _gs :word; __gs :word; orig_eax:dword; _eip :dword; _cs :word; __cs :word; eflags :dword; _esp :dword; _ss :word; __ss :word; endrecord; i387_fsave_struct:record _cwd :dword; swd :dword; twd :dword; fip :dword; fcs :dword; foo :dword; fos :dword; st_space:tbyte[8]; status :dword; endrecord; user_i387_struct :i387_fsave_struct; i387_fxsave_struct:record _cwd :word; swd :word; twd :word; fop :word; fip :dword; fcs :dword; foo :dword; fos :dword; mxcsr :dword; reserved :dword; st_space :dword[32]; // 8*16 bytes for each fp-reg. xmm_space :dword[32]; padding :dword[56]; endrecord; user_fxsr_struct : i387_fxsave_struct; i387_soft_struct:record _cwd :dword; swd :dword; twd :dword; fip :dword; fcs :dword; foo :dword; fos :dword; st_space :tbyte[8]; ftop :byte; changed :byte; lookahead :byte; no_update :byte; rm :byte; alimit :byte; info :dword; // pointer to info struct. entry_eip :dword; align( 4 ); endrecord; i387_union:union _fsave :i387_fsave_struct; _fxsave :i387_fxsave_struct; soft :i387_soft_struct; endunion; thread_struct:record _esp0 :dword; _eip :dword; _esp :dword; _fs :dword; _gs :dword; debugreg :dword[8]; _cr2 :dword; trap_no :dword; error_code :dword; i387 :i387_union; vm86_info :pointer to vm86_struct; screen_bitmap :dword; v86flags :dword; v86mask :dword; v86mode :dword; saved_esp0 :dword; ioperm :dword; io_bitmap :dword[ io_bitmap_size_c + 1 ]; align( 4 ); endrecord;end linux;#endif // processor_hhf#if( ! @defined( signals_hhf ))?signals_hhf := true;#if( ! @defined( ipc_hhf ))?ipc_hhf := true;namespace linux; //@fast;const // ipc system mode bits ipc_creat := $200; // create key if it doesn't exist ipc_excl := $400; // Fail if key exists. ipc_nowait := $800; // Return on error wait // ipc system command codes for msgctl, semctl, and shmctl. ipc_rmid := 0; ipc_set := 1; ipc_stat := 2; ipc_info := 3; ipc_private := 0; // IPC command codes: ipcop_semop := 1; ipcop_semget := 2; ipcop_semctl := 3; ipcop_msgsnd := 11; ipcop_msgrcv := 12; ipcop_msgget := 13; ipcop_msgctl := 14; ipcop_shmat := 21; ipcop_shmdt := 22; ipcop_shmget := 23; ipcop_shmctl := 24; // message flags msg_noerror := $1000; msg_except := $2000; msg_stat := 11; msg_info := 12; msgmax := 8192; msgmnb := 16384; // shared memory flags shm_locked := $400; shm_dest := $200; shm_r := $100; shm_w := $80; shm_rdonly := $1000; shm_rnd := $2000; shm_remap := $4000; shm_lock := 11; shm_unlock := 12; shm_stat := 13; shm_info := 14; shmlba := page_size; // Constants for mmap functions: mcl_current := 1; mcl_future := 2; mremap_maymove := 1; madv_normal := 0; madv_random := 1; madv_sequential := 2; madv_willneed := 3; madv_dontneed := 4; type // ipc data structure used to pass permission to IPC operations. ipc_perm: record _key :key_t; uid :uid_t; gid :gid_t; cuid :uid_t; cgid :gid_t; mode :word; seq :word; endrecord; end linux;#endif // ipc_hhfnamespace linux; //@fast; const _nsig := 64; _nseg_words := 2; // Constants for signals: sighup := 1; sigint := 2; sigquit := 3; sigill := 4; sigtrap := 5; sigabrt := 6; sigiot := 6; sigbus := 7; sigfpe := 8; sigkill := 9; sigusr1 := 10; sigsegv := 11; sigusr2 := 12; sigpipe := 13; sigalrm := 14; sigterm := 15; sigstkflt := 16; sigcld := 17; sigchld := 17; sigcont := 18; sigstop := 19; sigtstp := 20; sigttin := 21; sigttou := 22; sigurg := 23; sigxcpu := 24; sigxfsz := 25; sigvtalrm := 26; sigprof := 27; sigwinch:= 28; sigpoll := 29; sigio := 29; sigpwr := 30; sigsys := 31; sigunused := 31; __sigrtmin := 32; sa_nocldstop := $00000001; sa_nocldwait := $00000002; sa_siginfo := $00000004; sa_onstack := $08000000; sa_restart := $10000000; sa_nodefer := $40000000; sa_resethand := $80000000; sa_nomask := $40000000; sa_oneshot := $80000000; sa_interrupt := $20000000; sa_restorer := $04000000; ill_illopc := 1; ill_prvopc := 5; fpe_intdiv := 1; fpe_intovf := 2; fpe_fltdiv := 3; fpe_fltovf := 4; fpe_fltund := 5; fpe_fltres := 6; fpe_fltinv := 7; fpe_fltsub := 8; trap_brkpt := 1; trap_trace := 2; ss_onstack := 1; ss_disable := 2; minsigstksz := 2048; sigstksz := 8192; //_nsig := 64; _nsig_bpw := 32; _nsig_word := _nsig div _nsig_bpw; type stack_t:record ss_sp :dword; ss_flags:dword; ss_size :size_t; endrecord; sigset_t:dword[32]; __sighandler_t :procedure( signal:int32 ); siginfo_t:record si_signo :int32; si_errno :int32; si_code :int32; _sifields: union _pad :dword[ 29 ]; /* kill() */ _kill: record _pid :@global:linux.pid_t; _uid :@global:linux.uid_t; endrecord; /* POSIX.1b timers */ _timer: record _timer1 :uns32; _timer2 :uns32; endrecord; /* POSIX.1b signals */ _rt: record _pid :@global:linux.pid_t; _uid :@global:linux.uid_t; _sigval :dword; endrecord; /* SIGCHLD */ _sigchld: record _pid :@global:linux.pid_t; _uid :@global:linux.uid_t; _status :int32; _utime :@global:linux.clock_t; _stime :@global:linux.clock_t; endrecord; /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */ _sigfault: record _addr :dword; endrecord; /* SIGPOLL */ _sigpoll: record _band :int32; _fd :int32; endrecord; endunion; endrecord; sigaction_t:record sa_sigaction:procedure ( signum:int32; var siginfo:siginfo_t; var buf:var ); sa_mask :old_sigset_t; sa_flags :dword; sa_restorer :procedure; endrecord; sigpending_t:record head :dword; //pointer to sigqueue; tail :dword; //pointer to pointer to sigqueue. signal :sigset_t; endrecord; k_sigaction: record sa :sigaction_t; endrecord; signal_struct: record count :atomic_t; action :k_sigaction[_nsig]; siglock :spinlock_t; endrecord;end linux;#endif //signals_hhf#if( ! @defined( tqueue_hhf ))?tqueue_hhf := true;namespace linux; //@fast;type tq_struct: record list :list_head; sync :dword; routine :procedure; data :dword; endrecord; end linux;#endif //tqueue_hhf#if( ! @defined( semaphore_hhf ))?semaphore_hhf := true;namespace linux; //@fast;const // semaphore flags and commands sem_undo := $200; sem_getpid := 11; sem_getval := 12; sem_getall := 13; sem_getncnt := 14; sem_getzcnt := 15; sem_setval := 16; sem_setall := 17; sem_stat := 18; sem_info := 19; semmni := 128; semmsl := 250; semmns := semmni * semmsl; semopm := 32; semvmx := 32767; semume := semopm; semmnu := semmns; semaem := semvmx >> 1; semmap := semmns; semusz := 20; rw_lock_unlocked:= 0; type // semaphore data structures: semid_ds: record sem_perm :ipc_perm; sem_otime :time_t; sem_ctime :time_t; __sembase :dword; // pointer to sem. __sem_pending :dword; // pointer to sem_queue __sem_pending_list :dword; // pointer to sem_queue __undo :dword; // pointer to sem_undo sem_nsems :word; align(4); endrecord; sembuf: record sem_num :word; sem_op :word; sem_flag:word; endrecord; semun: union _val :dword; buf :dword; //pointer to semid_ds array :pointer to word; //array for getall, setall. __buf :dword; //pointer to seminfo. endunion; seminfo: record semmap :dword; semmni :dword; semmns :dword; semmnu :dword; semmsl :dword; semopm :dword; semume :dword; semusz :dword; semvmx :dword; semaem :dword; endrecord; rw_semaphore:record count :dword; wait_lock :spinlock_t; wait_list :list_head; endrecord; semaphore:record count :atomic_t; sleepers :dword; _wait :wait_queue_head_t; endrecord; #macro sema_init( s, v ):reg; mov( v, s.count ); mov( 0, s.sleepers ); mov( linux.rw_lock_unlocked, s._wait._lock ); push( eax ); lea( eax, s._wait.task_list); mov( eax, (type linux.wait_queue_head_t [eax]).task_list.next ); mov( eax, (type linux.wait_queue_head_t [eax]).task_list.prev ); pop( eax ); #endmacro #macro init_mutex(s); sema_init(s,1) #endmacro #macro init_mutex_lock(s); sema_init(s,0) #endmacro procedure __down( var sem:semaphore ); @use eax; @cdecl; @external; #macro down(s); lock.dec( s.count.counter ); // s better be a semaphore object! if( @s ) then push(eax); // We're calling C code, which will push(ecx); // munge EAX, ECX, and EDX. push(edx); linux.__down( s ); add( 4, esp ); pop( edx ); pop( ecx ); pop( eax ); endif; #endmacro #macro up(s); lock.inc( s.count.counter ); // s better be a semaphore object! if( @le ) then push(eax); // We're calling C code, which will push(ecx); // munge EAX, ECX, and EDX. push(edx); linux.wake_up( s._wait ); add( 4, esp ); pop( edx ); pop( ecx ); pop( eax ); endif; #endmacro // Linux system function __down_failed_interruptible // requires a pointer to a semaphore object in ECX! procedure __down_failed_interruptible ( var sem:semaphore in ecx ); @external; #macro down_interruptible(s); returns ( { // This is ugly code; if you want it done better, do // it manually (no macro invocation!) // Warning: this macro cannot assume s <> "[eax]", // hence a large percentage of the ugliness. // // s better be a semaphore object! lock.dec( s.count.counter ); if( @s ) then push(ecx); linux.__down_failed_interruptible( s ); pop( ecx ); else xor( eax, eax ); // return success. endif; }, "eax" ) #endmacro procedure __down_failed_trylock ( var sem:semaphore in ecx ); @external; #macro down_trylock(s); returns ( { // This is ugly code; if you want it done better, do // it manually (no macro invocation!) // Warning: this macro cannot assume s <> "[eax]", // hence a large percentage of the ugliness. // // s better be a semaphore object! lock.dec( s.count.counter ); if( @s ) then push(ecx); linux.__down_failed_trylock( s ); pop( ecx ); else xor( eax, eax ); // We succeeded. endif; }, "eax" ) #endmacroend linux;#endif // semaphore_hhfnamespace linux; //@fast;const // clone/sysclone flags: csignal := $000000ff; clone_vm := $00000100; clone_fs := $00000200; clone_files := $00000400; clone_sighand := $00000800; clone_pid := $00001000; clone_ptrace := $00002000; clone_vfork := $00004000; clone_parent := $00008000; clone_thread := $00010000; clone_signal := clone_sighand | clone_thread; // task values task_running := 0; task_interruptible := 1; task_uninterruptible:= 2; task_zombie := 3; task_stopped := 4; // scheduler policies: sched_other := 0; sched_fifo := 1; sched_rr := 2; _sched_yield := $10; // per process flags: pf_alignwarn := $00000001; pf_starting := $00000002; pf_exiting := $00000004; pf_forknoexec := $00000040; pf_superpriv := $00000100; pf_dumpcore := $00000200; pf_signaled := $00000400;
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -