?? linux.hhf
字號(hào):
flags :dword; nsyms :uns32; ndeps :uns32; syms :pointer to module_symbol; deps :pointer to module_ref; refs :pointer to module_ref; init :procedure; @returns( "eax" ); cleanup :procedure; // The following members are all optional. // At run-time, compare their offsets against // the size_of_struct field to see if they are // actually present (use mod_member_present for this). ex_table_start :pointer to exception_table_entry; ex_table_end :pointer to exception_table_entry; persist_start :pointer to module_persist; persist_end :pointer to module_persist; can_unload :procedure; @returns( "eax" ); runsize :dword; kallsyms_start :pointer to char; kallsyms_end :pointer to char; archdata_start :pointer to char; archdata_end :pointer to char; kernel_data :pointer to char; endrecord; // mod_member_present- passed a module_t object and // a field. Checks to see if the field is present in // the particular instance of the module object. // returns an "above" (@a) condition code if the field is present. // Generally, you'd invoke this macro where a (run-time) // boolean expression is expected (e.g., in an IF stmt). #macro mod_member_present(__mod,__member):__fn; ?__fn := "linux.module_t." + @string:__member; returns({ cmp ( __mod.size_of_struct, @offset( @text(__fn) ) ); },"@a") #endmacro // mod_can_query - returns true in EAX if we can query the // module. We can query it if it's running or initializing, // but not deleted. Note that this macros *know* the values // of mod_running, mod_initializing, and mod_deleted and // you must rewrite this macros if their values change. #macro mod_can_query(__mod); returns ({ mov( (type byte __mod.flags), al ); and ( linux.mod_running // Bit 0 | linux.mod_initializing // Bit 6 | linux.mod_deleted, // Bit 1 eax ); ror( 1, al ); // r0i0_000d shr( 1, al ); // 0r0i_0000 d (in carry) setnbe( al ); // carry = @b so fail if @be. },"eax" ) #endmacro static __this_module :module_t; @external( "__this_module" ); #macro mod_inc_use_count; push( eax ); mov( linux.__this_module.uc.usecount.counter, eax ); lock.inc( (type dword [eax]) ); or ( linux.mod_visited | linux.mod_used_once, linux.__this_module.flags ); pop( eax ); #endmacro #macro mod_dec_use_count; push( eax ); mov( linux.__this_module.uc.usecount.counter, eax ); lock.dec( (type dword [eax]) ); or( linux.mod_visited, linux.__this_module.flags ); pop( eax ); #endmacro #macro mod_in_use; returns ( { if ( linux.mod_member_present( can_unload ) && linux.__this_module <> 0 ) then call( linux.__this_module.can_unload ); else mov ( linux.__this_module.uc.usecount.counter, eax ); mov( [eax], eax ); endif; }, "eax" ) #endmacro // module_parm( sym, typ) - // sym must be the name of a global variable. // typ must be a string constant. // Creates a parameter definition record in the object file. #macro module_parm( sym, typ):modname,modstr; ?modname :string := "__module_parm_" + @string:sym; ?modstr :string := "parm_" + @string:sym + "=" + typ; #emit( " .globl " + modname ) #emit( " .section .modinfo" ) #emit( " .type " + modname + ",@object" ) #emit ( " .size " + modname + "," + string(@length(modstr)+1) ) #emit( modname + ":" ) #emit( " .string """ + modstr + """" ) #endmacro // module_parm_desc( sym, typ) - // sym must be the name of a global variable. // cmnt must be a string constant. // Creates a parameter description record in the object file. #macro module_parm_desc( sym, cmnt):modname,modstr; ?modname :string := "__module_parm_desc_" + @string:sym; ?modstr :string := "parm_desc_" + @string:sym + "=" + cmnt; #emit( " .globl " + modname ) #emit( " .align 32" ) #emit( " .type " + modname + ",@object" ) #emit ( " .size " + modname + "," + string(@length(modstr)+1) ) #emit( modname + ":" ) #emit( " .string """ + modstr + """" ) #endmacro #if( @defined( __kernel__ ))type inter_module_entry: record list :list_head; im_name :pointer to char; owner :pointer to module_t; userdata:dword; endrecord; procedure _inter_module_register ( _string :string; var module :module_t; var data :var ); @cdecl; @external( "inter_module_register" ); #macro inter_module_register( __s, __m, __d ); returns ({ push( eax ); push( ecx ); push( edx ); _inter_module_register( __s, __m, __d ); add( 12, esp ); pop( edx ); pop( ecx ); pop( eax ); },"" ) #endmacro procedure _inter_module_unregister ( _string :string ); @cdecl; @external( "inter_module_unregister" ); #macro inter_module_unregister( __s, __m, __d ); returns ({ push( eax ); push( ecx ); push( edx ); _inter_module_register( __s ); pop( eax ); // removes __s pop( edx ); pop( ecx ); pop( eax ); },"" ) #endmacro procedure _inter_module_get ( _string :string ); @cdecl; @external( "inter_module_get" ); #macro inter_module_get( __s ); returns ({ push( ecx ); push( edx ); _inter_module_get( __s ); pop( ecx ); // removes __s pop( edx ); pop( ecx ); },"eax" ) #endmacro procedure _inter_module_put ( _string :string ); @cdecl; @external( "inter_module_put" ); #macro inter_module_put( __s ); returns ({ push( eax ); push( ecx ); push( edx ); _inter_module_put( __s ); pop( ecx ); // removes __s pop( edx ); pop( ecx ); pop( eax ); },"" ) #endmacro procedure _inter_module_get_request ( _string :string; _module :string ); @cdecl; @external( "inter_module_get_request" ); #macro inter_module_get_request( __s, __m ); returns ({ push( ecx ); push( edx ); _inter_module_get_request( __s, __m ); add( 8, esp ); pop( edx ); pop( ecx ); },"eax" ) #endmacro #endif //__kernel__ end linux; #endif // module_hhf#if( ! @defined( timer_hhf ))?timer_hhf := true;namespace linux; //@fast;const tvn_bits := 6; tvr_bits := 8; tvn_size := 1 << tvn_bits; tvr_size := 1 << tvr_bits; tvn_mask := tvn_size - 1; tvr_mask := tvr_size - 1; noof_tvecs := 5; type timer_list: record list :list_head; expires :dword; data :dword; function:procedure( p:dword ); @cdecl; base :pointer to tvec_base_t; endrecord; timer_t :timer_list; timer_pt:pointer to timer_t; tvec_t: record index :dword; vec :list_head[ tvn_size ]; endrecord; tvec_root_t: record index :dword; vec :list_head[ tvr_size ]; endrecord; tvec_base_t: record _lock :spinlock_t; timer_jiffies :dword; running_timer :pointer to timer_t; tv1 :tvec_root_t; tv2 :tvec_t; tv3 :tvec_t; tv4 :tvec_t; tv5 :tvec_t; endrecord; static tvec_bases :tvec_base_t; @external; // Actually an array. procedure add_timer( var timer:timer_t ); @cdecl; @external; procedure del_timer( var timer:timer_t ); @use eax; @cdecl; @external; procedure mod_timer( var timer:timer_t; expires:dword ); @cdecl; @external; procedure it_real_fn( u:dword ); @cdecl; @external; procedure init_timers; @external; procedure run_local_timers; @external; #macro init_timer( __timer); returns ({ mov( 0, __timer.list.next ); mov( 0, __timer.list.prev ); mov( &tvec_bases, __timer.base ); },"" ) #endmacro #macro timer_pending( __timer ); returns ({ cmp( __timer.list.next, 0 ); }, "@ne") #endmacroend linux;#endif //timer_hhf#if( ! @defined( system_hhf ))?system_hhf := true;namespace linux; //@fast; // The __dummy[] arguments forces the use // of "()" after these macros so they better // match the C syntax. #macro mb(__dummy[]); returns ({ lock.add( 0, (type dword [esp])); },"" ) #endmacro #macro rmb(__dummy[]); returns ({ lock.add( 0, (type dword [esp])); }, "" ) #endmacro #macro wmb(__dummy[]); // Current intel CPUs already order writes. #endmacro #macro set_mb(__var, __value); returns ({ push( eax ); mov( __value, eax ); xchg( eax, __var ); pop( eax ); },"" ) #endmacro #macro set_wmb(__var, __value ); returns ({ push( eax ); mov( __value, eax ); mov( eax, __var ); pop( eax ); }, "", ) #endmacro #if( @defined( __smp__ )) procedure __global_cli; @cdecl; @external; procedure __global_sti; @cdecl; @external; #endif #macro _cli; returns ({ #if( @defined( __smp__ )) __global_cli(); #else cli(); #endif }, "eax" ) #endmacro #macro _sti; returns ({ #if( @defined( __smp__ )) __global_sti(); #else sti(); #endif }, "eax" ) #endmacro end linux;#endif // system_hhf#if( ! @defined( param_hhf ))?param_hhf := true;namespace linux; //@fast;const #if( !@defined( hz ) ) hz := 100; #endif #if( !@defined( ngroups )) ngroups := 32; #endif #if( !@defined( nogroup )) ngroup := -1; #endif maxHostNameLen := 64; exec_pagesize := 4096; #if( @defined( __kernel__ )) clocks_per_sec := 100; #endif end linux;#endif // param_hhf#if( ! @defined( sched_hhf ))?sched_hhf := true;#if( ! @defined( resource_hhf ))?resource_hhf := true;#if( !@defined( time_hhf ))?time_hhf := true;namespace linux; //@fast;const // itimer related constants itimer_real := 0; itimer_virtual := 1; itimer_prof := 2; type timeval: record tv_sec :time_t; tv_usec :suseconds_t; endrecord; timex:record modes :dword; offset :dword; freq :dword; maxerror :dword; esterror :dword; status :dword; constant :dword; precision :dword; tolerance :dword; time :timeval; tick :dword; ppsfreq :dword; jitter :dword; shift :int32; stabil :dword; jitcnt :dword; calcnt :dword; errcnt :dword; stbcnt :dword; align( 128 ); endrecord; timespec: record tv_sec :time_t; tv_nsec :dword; endrecord; timezone: record tz_minuteswest :int32; tz_dsttime :int32; endrecord; tms:record tms_utime :clock_t; tms_stime :clock_t; tms_cutime :clock_t; tms_cstime :clock_t; endrecord; itimerval: record it_interval :timeval; it_value :timeval; endrecord; utimbuf: record actime :time_t; modtime :time_t; endrecord;end linux;#endif //time_hhfnamespace linux; //@fast;const // Constants for the resource limit calls: rlimit_cpu := 0; rlimit_fsize := 1; rlimit_data := 2; rlimit_stack := 3; rlimit_core := 4; rlimit_rss := 5; rlimit_nproc := 6; rlimit_nofile := 7; rlimit_memlock := 8; rlimit_as := 9; rlimit_locks := 10; rlimit_nlimits := 11; rlimit_inifinty := $ffff_ffff; type rlimit_t:record rlim_cur :dword; rlim_max :dword; endrecord; rlimit :rlimit_t; rusage_t: record ru_utime :timeval; ru_stime :timeval; ru_maxrss :dword; ru_ixrss :dword; ru_idrss :dword; ru_isrss :dword; ru_minflt :dword; ru_majflt :dword; ru_nswap :dword; ru_inblock :dword; ru_oublock :dword; ru_msgsnd :dword; ru_msgrcv :dword; ru_nsignals :dword; ru_nvcsw :dword; ru_nivcsw :dword; endrecord;end linux;#endif //resource_hhf#if( ! @defined( processor_hhf ))?processor_hhf := true;namespace linux; //@fast;const io_bitmap_size_c:= 32; type mm_segment_t: record seg :dword; endrecord; revectored_struct: record __map :dword[8]; endrecord; vm86_regs: record _ebx :dword; _ecx :dword; _edx :dword; _esi :dword; _edi :dword; _ebp :dword; _eax :dword; __null_ds :dword; __null_es :dword; __null_fs :dword; __null_gs :dword; orig_eax :dword; _eip :dword; _cs :word; _csh :word; eflags :dword; _esp :dword; _ss :word; _ssh :word; _es :word; _esh :word; _ds :word; _dsh :word; _fs :word; _fsh :word; _gs :word; _gsh :word; endrecord; vm86_struct: record regs :vm86_regs; flags :dword; screen_bitmap :dword; cpu_type :dword; int_revectored :revectored_struct; int21_revectored:revectored_struct; endrecord; vm86plus_info_struct: record flags :dword; vm86dbg_intxxtab :byte[32]; endrecord; vm86plus_struct: record regs :vm86_regs; flags :dword;
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -