diff options
Diffstat (limited to 'core/comboot.inc')
-rw-r--r-- | core/comboot.inc | 108 |
1 files changed, 51 insertions, 57 deletions
diff --git a/core/comboot.inc b/core/comboot.inc index cdba16d5..25409595 100644 --- a/core/comboot.inc +++ b/core/comboot.inc @@ -17,7 +17,7 @@ ;; Common code for running a COMBOOT image ;; - section .text + section .text16 ; Parameter registers definition; this is the definition ; of the stack frame used by INT 21h and INT 22h. @@ -63,7 +63,7 @@ ; Looks like a COMBOOT image but too large comboot_too_large: - call close_file + pm_call close_file mov si,err_comlarge call writestr jmp enter_command @@ -126,7 +126,7 @@ is_comboot_image: mov bx,100h ; Load at <seg>:0100h mov cx,10000h >> SECTOR_SHIFT ; Absolute maximum # of sectors - call getfssec + pm_call getfssec cmp ecx,65536-256-2 ; Maximum size ja comboot_too_large @@ -148,8 +148,8 @@ comboot_return: cli ; May not have a safe stack jmp comboot_exit ; -; Set up the COMBOOT API interrupt vectors. This is also used -; by the COM32 code. +; Set up the COMBOOT API interrupt vectors. This is now done at +; initialization time. ; comboot_setup_api: mov di,DOSErrTramp ; Error trampolines @@ -178,11 +178,23 @@ comboot_setup_api: loop .loop2 ret - section .bss +; +; Restore the original state of the COMBOOT API vectors +; +comboot_cleanup_api: + pusha + mov si,DOSSaveVectors + mov di,4*20h + mov cx,20h + rep movsd ; Restore DOS-range vectors + popa + ret + + section .bss16 alignb 4 DOSSaveVectors resd 32 - section .data + section .data16 %define comboot_err(x) (DOSErrTramp+4*((x)-20h)) comboot_vectors: @@ -219,7 +231,7 @@ comboot_vectors: dw comboot_err(3Eh) ; INT 3E = DOS FPU emulation dw comboot_err(3Fh) ; INT 3F = DOS overlay manager - section .text + section .text16 ; INT 21h: generic DOS system call comboot_int21: sti @@ -295,12 +307,6 @@ comboot_exit_msg: pop bx ; Return address RESET_STACK_AND_SEGS SI ; Contains sti, cld call adjust_screen ; The COMBOOT program might have changed the screen - pusha - mov si,DOSSaveVectors - mov di,4*20h - mov cx,20h - rep movsd ; Restore DOS-range vectors - popa jcxz .nomsg mov si,KernelCName call writestr @@ -511,9 +517,9 @@ comapi_open: mov ds,P_ES mov si,P_SI mov di,InitRD - call mangle_name + pm_call mangle_name pop ds - call searchdir + pm_call searchdir jz comapi_err mov P_EAX,eax mov P_CX,SECTOR_SIZE @@ -529,7 +535,7 @@ comapi_read: mov bx,P_BX mov si,P_SI mov cx,P_CX - call getfssec + pm_call getfssec jnc .noteof xor si,si ; SI <- 0 on EOF, CF <- 0 .noteof: mov P_SI,si @@ -541,7 +547,7 @@ comapi_read: ; comapi_close: mov si,P_SI - call close_file + pm_call close_file clc ret @@ -629,7 +635,7 @@ comapi_cleanup: test dl,3 setnz [KeepPXE] sub bp,sp ; unload_pxe may move the stack around - call unload_pxe + pm_call unload_pxe add bp,sp ; restore frame pointer... %elif IS_SYSLINUX || IS_EXTLINUX ; Restore original FDC table @@ -680,10 +686,11 @@ comapi_ipappend: ; INT 22h AX=0010h Resolve hostname ; %if IS_PXELINUX + extern pxe_dns_resolv comapi_dnsresolv: mov ds,P_ES mov si,P_BX - call dns_resolv + pm_call pxe_dns_resolv mov P_EAX,eax clc ret @@ -691,7 +698,7 @@ comapi_dnsresolv: comapi_dnsresolv equ comapi_err %endif - section .text + section .text16 ; ; INT 22h AX=0011h Obsolete @@ -742,9 +749,9 @@ comapi_runkernel: mov ds,P_DS mov si,P_SI mov di,KernelName - call mangle_name + pm_call mangle_name pop ds - call searchdir + pm_call searchdir jz comapi_err ; The kernel image was found, so we can load it... @@ -892,59 +899,44 @@ comapi_getcwd: ; ; INT 22h AX=0020h Open directory ; -%if IS_SYSLINUX +%if IS_PXELINUX +comapi_opendir equ comapi_err + +%else comapi_opendir: - push ds - mov ds,P_ES + mov es,P_ES mov si,P_SI mov di,InitRD - call mangle_name - pop ds - call searchdir - jnz comapi_err ; Didn't find a directory + pm_call opendir + jz comapi_err ; Didn't find a directory cmp eax,0 jz comapi_err ; Found nothing - ;ZF is unset - call alloc_fill_dir - mov P_EAX,eax - mov P_CX,SECTOR_SIZE - mov P_SI,si + mov P_EAX,eax clc ret -%else -comapi_opendir equ comapi_err %endif ; ; INT 22h AX=0021h Read directory ; -%if IS_SYSLINUX +%if IS_PXELINUX +comapi_readdir equ comapi_err + +%else comapi_readdir: - mov es,P_ES - mov di,P_DI - mov si,P_SI - call readdir - mov P_EAX,eax - mov P_DL,dl - mov P_EBX,ebx - mov P_SI,si + mov esi,P_ESI ; The address of DIR structure + pm_call readdir + mov P_EAX,eax ; The address of newly read dirent structure ret -%else -comapi_readdir equ comapi_err %endif ; ; INT 22h AX=0022h Close directory ; -%if IS_SYSLINUX comapi_closedir: - mov si,P_SI - call close_dir - clc + mov esi,P_ESI ; The address of DIR structure + pm_call closedir ret -%else -comapi_closedir equ comapi_err -%endif ; ; INT 22h AX=0023h Query shuffler size @@ -963,7 +955,7 @@ comapi_shufraw: mov ecx,P_ECX jmp shuffle_and_boot_raw - section .data + section .data16 %macro int21 2 db %1 @@ -1042,8 +1034,10 @@ feature_flags_len equ ($-feature_flags) err_notdos db ': attempted DOS system call INT ',0 err_comlarge db 'COMBOOT image too large.', CR, LF, 0 - section .bss1 + section .bss16 alignb 4 DOSErrTramp resd 33 ; Error trampolines + + global ConfigName, CurrentDirName ConfigName resb FILENAME_MAX CurrentDirName resb FILENAME_MAX |