;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; RDOS operating system ; Copyright (C) 1988-2000, Leif Ekblad ; ; This program is free software; you can redistribute it and/or modify ; it under the terms of the GNU General Public License as published by ; the Free Software Foundation; either version 2 of the License, or ; (at your option) any later version. The only exception to this rule ; is for commercial usage in embedded systems. For information on ; usage in commercial embedded systems, contact embedded@rdos.net ; ; This program is distributed in the hope that it will be useful, ; but WITHOUT ANY WARRANTY; without even the implied warranty of ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ; GNU General Public License for more details. ; ; You should have received a copy of the GNU General Public License ; along with this program; if not, write to the Free Software ; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ; ; The author of this program may be contacted at leif@rdos.net ; ; EXEC.DEF ; Common executable loader related types ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; dev_name EQU 8 dev_param EQU 90h dev_next EQU 0E0h dev_type EQU 0E4h dev_ip EQU 0FAh load_gs EQU 32 load_fs EQU 28 load_ds EQU 24 load_es EQU 20 load_ss EQU 16 load_esp EQU 12 load_eflags EQU 8 load_cs EQU 4 load_eip EQU 0 load_eax EQU -4 load_ebx EQU -8 load_ecx EQU -12 load_edx EQU -16 load_esi EQU -20 load_edi EQU -24 load_ebp EQU -28 user_edi EQU 0 user_esi EQU 4 user_edx EQU 8 user_ecx EQU 12 user_ebx EQU 16 user_eax EQU 20 user_eflags EQU 24 user_ret EQU 28 exec_block STRUC exec_enviro DW ? exec_line DD ? exec_fcb1 DD ? exec_fcb2 DD ? exec_block ENDS exeh_seg STRUC exeh_signature DW ? exeh_size_lsb DW ? exeh_size_msb DW ? exeh_reloc_ant DW ? exeh_size_header DW ? exeh_minalloc DW ? exeh_maxalloc DW ? exeh_ss DW ? exeh_sp DW ? exeh_checksum DW ? exeh_ip DW ? exeh_cs DW ? exeh_reloc_offs DW ? exeh_ov_nr DW ? exeh_seg ENDS spawn_struc STRUC s_name DW ? s_cmd DW ? s_curr_dir DW ? s_env DW ? s_loader_name DD ? s_param DW ? s_parent_app_sel DW ? s_thread DW ? s_app DW ? s_ret_code DW ? s_proc_sel DW ? s_sect1 section_typ <> s_switch DB ? spawn_struc ENDS exec_load_struc STRUC el_prev DW ? el_next DW ? el_pid DW ? el_name DW ? el_cmd DW ? el_curr_dir DW ? el_env DW ? el_param DW ? el_ret_code DW ? el_wake_thread DW ? el_done DW ? exec_load_struc ENDS load_param_struc STRUC lp_param_offs DD ? lp_param_sel DD ? lp_startdir_offs DD ? lp_startdir_sel DD ? lp_env_offs DD ? lp_env_sel DD ? load_param_struc ENDS MAX_PROGRAM_MODULES = 256 MAX_PROGRAM_PROCESSES = 256 MAX_PROCESS_THREADS = 256 MAX_PROCESS_MODULES = 256 program_struc STRUC pr_loader DW ? pr_kernel_file DW ? pr_name_sel DW ? pr_cmd_sel DW ? pr_dir_sel DW ? pr_env_sel DW ? pr_debug_id DW ? pr_thread DW ? pr_parent_thread DW ? pr_section section_typ <> pr_bitness DB ? pr_filler DB ? pr_handle_mem_sel DW ? pr_handle_sel DW ? pr_server_linear DD ? pr_memmap_list DD ? pr_memmap_spinlock spinlock_typ <> pr_debug_wait DW ? pr_event_suppress DW ? pr_curr_event DW ? pr_event_queue DW ? pr_event_spinlock spinlock_typ <> pr_pm_int DD 100h DUP(?,?) pr_pm_exc DD 20h DUP(?,?) pr_cow_thread DW ? pr_cow_counter DW ? pr_cow_section section_typ <> pr_fault_linear DD ?,? pr_fault_counter DW ? pr_page_table_count DW ? pr_page_dir_arr DD MAX_PROGRAM_PROCESSES DUP(?) pr_page_table_arr DD MAX_PROGRAM_PROCESSES DUP(?) pr_temp_ind DW ? pr_temp_arr DD MAX_PROGRAM_PROCESSES DUP(?) pr_module_count DW ? pr_module_arr DW MAX_PROGRAM_MODULES DUP(?) pr_process_count DW ? pr_process_arr DW MAX_PROGRAM_PROCESSES DUP(?) program_struc ENDS process_struc STRUC pf_program_id DW ? pf_program_sel DW ? pf_cr3 DD ? pf_page_dir DD ? pf_page_table DD ? pf_exit_code DW ? pf_cur_dir_sel DW ? pf_env_sel DW ? pf_timer_sel DW ? pf_handle_linear DD ? pf_virt_flags DW ? pf_wait_sti DW ? pf_cli_thread DW ? pf_iopl DW ? pf_ldt_obj DW ? pf_mem_blocks DD ? pf_mem_section section_typ <> pf_section section_typ <> pf_thread_count DW ? pf_thread_arr DW MAX_PROCESS_THREADS DUP(?) pf_module_count DW ? pf_module_arr DW MAX_PROCESS_MODULES DUP(?) pf_module_usage_arr DW MAX_PROCESS_MODULES DUP(?) pf_name DB ? process_struc ENDS loader_interface_struc STRUC ; IN EDX Fault address loader_pagefault_proc DD ?,? ; IN BX C file handle ; OUT GS Program sel loader_is_valid_exe_proc DD ?,? ; IN DS:ESI Image name ; IN ES:EDI Cmd line ; IN BX C file handle ; IN GS Program sel ; OUT BX Module selector loader_init_exe_proc DD ?,? ; IN BX Program ID ; IN ES:EDI Thread name loader_create_process_proc DD ?,? ; IN GS Program sel ; IN BX Module selector ; IN EBP Stack frame loader_fixup_exe_proc DD ?,? ; IN EBP Stack frame loader_unload_exe_user_proc DD ?,? ; IN GS Program sel ; IN BX Module selector loader_unload_exe_kernel_proc DD ?,? ; IN DS:EBX Instruction to patch ; IN EAX Gate # loader_patch_proc DD ?,? ; OUT ES:(E)DI Name loader_get_exe_proc DD ?,? ; OUT ES:(E)DI Cmd line loader_get_cmd_line_proc DD ?,? ; OUT ES:(E)DI Environment loader_get_env_proc DD ?,? ; IN DS New thread block loader_init_thread_proc DD ?,? ; IN GS Program sel ; IN EBP Stack frame loader_start_thread_proc DD ?,? ; IN EBP Stack frame loader_free_thread_user_proc DD ?,? ; IN GS Program sel loader_free_thread_kernel_proc DD ?,? ; IN ES Thread loader_kernel_event_proc DD ?,? ; IN (E)AX Size ; OUT (E)DX Address loader_allocate_mem_proc DD ?,? ; IN (E)DX Address loader_free_mem_proc DD ?,? ; IN (E)AX Size ; OUT (E)DX Address loader_debug_allocate_mem_proc DD ?,? ; IN (E)DX Address loader_debug_free_mem_proc DD ?,? ; IN DS:ESI Image name ; IN BX C file handle ; OUT BX Module sel loader_init_dll_proc DD ?,? ; IN GS Program sel ; IN BX Module sel ; IN EBP Stack frame loader_fixup_dll_proc DD ?,? ; IN BX Module sel ; IN EBP Stack frame loader_unload_dll_proc DD ?,? ; IN BX Module sel loader_free_dll_proc DD ?,? ; IN ES:(E)DI DLL address ; OUT BX Module sel loader_get_current_dll_proc DD ?,? ; IN BX Module sel ; IN ES:(E)DI Proc name ; OUT DS:(E)SI Proc address loader_get_proc_proc DD ?,? ; IN BX Module sel ; IN EAX Resource ID ; IN EDX Resource type ; OUT DS:(E)SI Resource address ; OUT (E)CX Resource size loader_get_resource_proc DD ?,? ; IN BX Module sel ; IN (E)CX Buffer size ; IN ES:(E)DI Buffer ; OUT (E)AX Name size loader_get_name_proc DD ?,? ; IN EBP Stack frame ; OUT DS:ESI User registers loader_regs_to_user_proc DD ?,? ; IN EBP Stack frame ; IN BX Gate sel loader_add_gate_proc DD ?,? ; IN FS Debugged process sel ; IN GS Debugged program sel loader_stop_debug_proc DD ?,? ; IN FS Debugged process sel ; IN GS Debugged program sel ; IN DX Debugger process ID loader_attach_debug_proc DD ?,? ; OUT Child: EAX = 0 ; OUT Parent: EAX = child thread selector loader_fork_proc DD ?,? ; IN EBP Stack frame loader_detach_user_fork_proc DD ?,? loader_detach_kernel_fork_proc DD ?,? ; IN EDX Image linear ; OUT GS Program sel loader_is_valid_serv_proc DD ?,? ; IN BX Program ID ; IN ES:EDI Thread name ; IN EDX Server image header loader_create_serv_proc DD ?,? ; IN DS:ESI Image name ; IN ES:EDI Cmd line ; IN EDX Image linear ; IN GS Program sel ; OUT BX Module selector loader_init_serv_proc DD ?,? loader_interface_struc ENDS module_struc STRUC mod_base DD ?,? mod_size DD ?,? mod_code_sel DW ? mod_data_sel DW ? mod_name_offs DW ? mod_id DW ? mod_loader DW ? mod_c_file_handle DW ? mod_serv_linear DD ? mod_section section_typ <> mod_key DB ? module_struc ENDS debug_event_struc STRUC debug_event_prev DW ? debug_event_next DW ? debug_event_thread DW ? debug_event_size DW ? debug_event_code DB ? debug_event_struc ENDS kernel_timer_entry STRUC kte_timeout DD ?,? kte_callback DD ?,? kernel_timer_entry ENDS user_timer_entry STRUC ute_timeout DD ?,? ute_callback DD ? ute_param DD ? user_timer_entry ENDS USER_TIMER_ENTRIES = 252 kernel_timer_struc STRUC kt_kernel_ptr DD ? kt_user_ptr DD ? kt_started DB ? kt_flags DB ? kt_section section_typ <> kt_kernel_head DW ? kt_user_head DW ? kt_kernel_list DW USER_TIMER_ENTRIES DUP(?) kt_user_list DW USER_TIMER_ENTRIES DUP(?) kernel_timer_struc ENDS kernel_active_timer STRUC kat_pending_map DD 8 DUP(?) kat_completed_map DD 8 DUP(?) kat_entries DB 16 * USER_TIMER_ENTRIES DUP(?) kernel_active_timer ENDS kernel_req_timer STRUC krt_req_map DD 8 DUP(?) krt_done_map DD 8 DUP(?) krt_entries DB 16 * USER_TIMER_ENTRIES DUP(?) kernel_req_timer ENDS user_active_timer STRUC uat_pending_map DD 8 DUP(?) uat_completed_map DD 8 DUP(?) uat_entries DB 16 * USER_TIMER_ENTRIES DUP(?) user_active_timer ENDS user_req_timer STRUC urt_req_map DD 8 DUP(?) urt_done_map DD 8 DUP(?) urt_entries DB 16 * USER_TIMER_ENTRIES DUP(?) user_req_timer ENDS kernel_timer STRUC kt_req kernel_req_timer <> kt_active kernel_active_timer <> kernel_timer ENDS user_timer STRUC ut_rw_active user_active_timer <> ut_req user_req_timer <> ut_ro_active user_active_timer <> user_timer ENDS