⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 comboot.inc

📁 linux内核
💻 INC
📖 第 1 页 / 共 2 页
字号:
;; INT 22h AX=0006h	Open file;comapi_open:		push ds		mov ds,P_ES		mov si,P_SI		mov di,InitRD		push di		call mangle_name		pop di		pop ds		call searchdir		jz comapi_err		mov P_AX,ax		mov P_HAX,dx		mov P_CX,SECTOR_SIZE		mov P_SI,si		clc		ret;; INT 22h AX=0007h	Read file;comapi_read:		mov es,P_ES		mov bx,P_BX		mov si,P_SI		mov cx,P_CX		call getfssec		jnc .noteof		xor si,si		; SI <- 0 on EOF, CF <- 0.noteof:	mov P_SI,si		ret;; INT 22h AX=0008h	Close file;comapi_close:		; Do nothing for now.  Eventually implement		; an internal API for this.		clc		ret;; INT 22h AX=0009h	Call PXE stack;%if IS_PXELINUXcomapi_pxecall:		mov bx,P_BX		mov es,P_ES		mov di,P_DI		call pxenv		mov P_AX,ax		clc		ret%elsecomapi_pxecall	equ comapi_err			; Not available%endif;; INT 22h AX=000Ah	Get Derivative-Specific Info;comapi_derinfo:		mov P_AL,my_id%if IS_SYSLINUX || IS_MDSLINUX || IS_EXTLINUX		mov al,[DriveNumber]		mov P_DL,al		mov P_ES,cs		mov P_BX,PartInfo%elif IS_PXELINUX		mov ax,[APIVer]		mov P_DX,ax		mov ax,[StrucPtr]		mov P_BX,ax		mov ax,[StrucPtr+2]		mov P_ES,ax		mov ax,[InitStack]		mov P_SI,ax		mov ax,[InitStack+2]		mov P_FS,ax%elif IS_ISOLINUX		mov al,[DriveNo]		mov P_DL,al		mov P_ES,cs		mov P_BX,spec_packet%endif		clc		ret;; INT 22h AX=000Bh	Get Serial Console Configuration;comapi_serialcfg:		mov ax,[SerialPort]		mov P_DX,ax		mov ax,[BaudDivisor]		mov P_CX,ax		mov ax,[FlowControl]		or al,ah		mov ah,[FlowIgnore]		shr ah,4		test byte [DisplayCon],01h		jnz .normalconsole		or ah,80h.normalconsole:		mov P_BX,ax		clc		ret;; INT 22h AX=000Ch	Perform final cleanup;comapi_cleanup:%if IS_PXELINUX		; Unload PXE if requested		test dl,3		setnz [KeepPXE]		sub bp,sp		; unload_pxe may move the stack around		call unload_pxe		add bp,sp		; restore frame pointer...%elif IS_SYSLINUX || IS_MDSLINUX || IS_EXTLINUX		; Restore original FDC table		mov eax,[OrigFDCTabPtr]		mov [fdctab],eax%endif		; Reset the floppy disk subsystem		xor ax,ax		xor dx,dx		int 13h		clc		ret;; INT 22h AX=000Dh	Clean up then replace bootstrap;comapi_chainboot:		call comapi_cleanup		mov eax,P_EDI		mov [trackbuf+4],eax		; Copy from		mov eax,P_ECX		mov [trackbuf+8],eax		; Total bytes		mov eax,7C00h		mov [trackbuf],eax		; Copy to		mov [EntryPoint],eax		; CS:IP entry point		mov esi,P_ESI		mov edx,P_EBX		mov bx,P_DS		jmp replace_bootstrap_one;; INT 22h AX=000Eh	Get configuration file name;comapi_configfile:		mov P_ES,cs		mov P_BX,ConfigName		clc		ret;; INT 22h AX=000Fh	Get IPAPPEND strings;%if IS_PXELINUXcomapi_ipappend:		mov P_ES,cs		mov P_CX,numIPAppends		mov P_BX,IPAppends		clc		ret		section .data		alignb 2, db 0IPAppends	dw IPOption		dw BOOTIFStrnumIPAppends	equ ($-IPAppends)/2%elsecomapi_ipappend equ comapi_err%endif		section .text;; INT 22h AX=0010h	Resolve hostname;%if IS_PXELINUXcomapi_dnsresolv:		mov ds,P_ES		mov si,P_BX		call dns_resolv		mov P_EAX,eax		ret%elsecomapi_dnsresolv equ comapi_err%endif				section .text;; INT 22h AX=0011h	Maximum number of shuffle descriptors;comapi_maxshuffle:		mov P_CX,(2*trackbufsize)/12		ret;; INT 22h AX=0012h	Cleanup, shuffle and boot;comapi_shuffle:		call comapi_cleanup		mov cx,P_CX		cmp cx,(2*trackbufsize)/12		ja .error		push cx				; On stack: descriptor count		lea cx,[ecx+ecx*2]		; CX *= 3		mov fs,P_ES		mov si,P_DI		mov di,trackbuf		push di				; On stack: descriptor list address		fs rep movsd			; Copy the list		mov eax,P_EBP		mov [EntryPoint],eax		; CS:IP entry point		mov esi,P_ESI		mov edx,P_EBX		mov bx,P_DS		jmp replace_bootstrap.error:		stc		ret;; INT 22h AX=0013h	Idle call;;; *** FIX THIS ***; The idle call seems to have detrimental effects on some machines when; called from a COM32 context (WHY?) --  disable it for now.;%if 0 ; def HAVE_IDLEcomapi_idle:		DO_IDLE		clc		ret%elsecomapi_idle	equ comapi_err%endif;; INT 22h AX=0014h	Local boot;%if IS_PXELINUX || IS_ISOLINUXcomapi_localboot:		mov ax,P_DX		jmp local_boot%elsecomapi_localboot equ comapi_err%endif;; INT 22h AX=0015h	Feature flags;comapi_features:		mov P_ES,cs		mov P_BX,feature_flags		mov P_CX,feature_flags_len		clc		ret;; INT 22h AX=0016h	Run kernel image;comapi_runkernel:		push ds		mov ds,P_DS		mov si,P_SI		mov di,KernelName		push di		call mangle_name		pop di		pop ds		call searchdir		jz comapi_err		; The kernel image was found, so we can load it...		mov [Kernel_SI],si		mov [Kernel_EAX],ax		mov [Kernel_EAX+2],dx				; It's not just possible, but quite likely, that ES:BX		; points into real_mode_seg, so we need to exercise some		; special care here... use xfer_buf_seg as an intermediary		push ds		push es		mov ax,xfer_buf_seg		mov ds,P_ES		mov si,P_BX		mov es,ax		xor di,di		call strcpy		pop es		pop ds%if IS_PXELINUX		mov al,P_CL		mov [IPAppend],al%endif		xor ax,ax		mov bx,.finish		jmp comboot_exit_special.finish:		; Copy the command line into its proper place		push ds		push es		mov ax,xfer_buf_seg		mov dx,real_mode_seg		mov ds,ax		mov es,dx		xor si,si		mov di,cmd_line_here		call strcpy		mov byte [es:di-1],' '		; Simulate APPEND		pop es		pop ds		mov [CmdLinePtr],di		mov word [CmdOptPtr],zero_string		jmp kernel_good_saved		section .data%macro 		int21 2		db %1		dw %2%endmacroint21_table:		int21	00h, comboot_return		int21	01h, comboot_getkey		int21	02h, comboot_writechr		int21	04h, comboot_writeserial		int21	08h, comboot_getkeynoecho		int21	09h, comboot_writestr		int21	0Bh, comboot_checkkey		int21	30h, comboot_checkver		int21	4Ch, comboot_return		int21	 -1, comboot_bogusint21_count	equ ($-int21_table)/3		align 2, db 0int22_table:		dw comapi_err		; 0000 unimplemented syscall		dw comapi_get_version	; 0001 get SYSLINUX version		dw comapi_writestr	; 0002 write string		dw comapi_run		; 0003 run specified command		dw comapi_run_default	; 0004 run default command		dw comapi_textmode	; 0005 force text mode		dw comapi_open		; 0006 open file		dw comapi_read		; 0007 read file		dw comapi_close		; 0008 close file		dw comapi_pxecall	; 0009 call PXE stack		dw comapi_derinfo	; 000A derivative-specific info		dw comapi_serialcfg	; 000B get serial port config		dw comapi_cleanup	; 000C perform final cleanup		dw comapi_chainboot	; 000D clean up then bootstrap		dw comapi_configfile	; 000E get name of config file		dw comapi_ipappend	; 000F get ipappend strings		dw comapi_dnsresolv	; 0010 resolve hostname		dw comapi_maxshuffle	; 0011 maximum shuffle descriptors		dw comapi_shuffle	; 0012 cleanup, shuffle and boot		dw comapi_idle		; 0013 idle call		dw comapi_localboot	; 0014 local boot		dw comapi_features	; 0015 feature flags		dw comapi_runkernel	; 0016 run kernel imageint22_count	equ ($-int22_table)/2APIKeyWait	db 0APIKeyFlag	db 0zero_string	db 0			; Empty, null-terminated string;; This is the feature flag array for INT 22h AX=0015hfeature_flags:%if IS_PXELINUX		db 1			; Have local boot, idle not noop%elif IS_ISOLINUX		db 3			; Have local boot, idle is noop%else		db 2			; No local boot, idle is noop%endiffeature_flags_len equ ($-feature_flags)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -