From: H. Peter Anvin Date: Tue, 31 Mar 2009 16:54:31 +0000 (-0700) Subject: shuffler: comboot interface to the new shuffler X-Git-Tag: syslinux-3.80-pre1~15^2~36^2~14 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1656aefeb6b7195db38d25065137c4f37655f33a;p=profile%2Fivi%2Fsyslinux.git shuffler: comboot interface to the new shuffler Impact: new feature COMBOOT interface to the new shuffler; resurrect comapi_chainboot as that functionality is still potentially relevant. Signed-off-by: H. Peter Anvin --- diff --git a/core/bcopyxx.inc b/core/bcopyxx.inc index cab02c5..aa1ce4a 100644 --- a/core/bcopyxx.inc +++ b/core/bcopyxx.inc @@ -246,7 +246,7 @@ pm_shuffle: jmp .loop .done: and esi,esi - jnz pm_shuffle_real_mode + jz pm_shuffle_real_mode jmp edi ; Protected mode entry ; We have a real-mode entry point, so we need to return diff --git a/core/bootsect.inc b/core/bootsect.inc index 2daa6e7..515f1f5 100644 --- a/core/bootsect.inc +++ b/core/bootsect.inc @@ -160,9 +160,8 @@ replace_bootstrap: ; Terminating entry... lea eax,[di+12] stosd - mov ax,1 ; EAX[31:16] == 0 already + xor ax,ax ; EAX[31:16] == 0 already stosd ; Real mode - dec ax stosd ; End of list ; Copy the stub diff --git a/core/cleanup.inc b/core/cleanup.inc index dca6491..1b00e0b 100644 --- a/core/cleanup.inc +++ b/core/cleanup.inc @@ -21,7 +21,7 @@ ; cleanup_hardware: ; ; Shut down anything transient. *No segment assumptions*. -; Can trash any registers. +; Preserves all registers. ; cleanup_hardware: pushad diff --git a/core/comboot.inc b/core/comboot.inc index 12dc26b..5e28df3 100644 --- a/core/comboot.inc +++ b/core/comboot.inc @@ -649,16 +649,26 @@ comapi_cleanup: mov eax,[OrigFDCTabPtr] mov [fdctab],eax %endif - ; Reset the floppy disk subsystem - xor ax,ax - xor dx,dx - int 13h + call cleanup_hardware clc ret ; -; INT 22h AX=000Dh Obsolete +; 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 + push eax ; Entry point on stack + mov esi,P_ESI + mov edx,P_EBX + mov bx,P_DS + jmp replace_bootstrap_one ; ; INT 22h AX=000Eh Get configuration file name @@ -991,7 +1001,10 @@ comapi_shufsize: ; INT 22h AX=0024h Cleanup, shuffle and boot raw ; comapi_shufraw: - ret + call comapi_cleanup + mov ebx,P_EDI + mov edx,P_EBX + jmp shuffle_and_boot_raw section .data diff --git a/doc/comboot.txt b/doc/comboot.txt index 5f57da7..9667867 100644 --- a/doc/comboot.txt +++ b/doc/comboot.txt @@ -568,15 +568,7 @@ AX=0010h [3.00] Resolve hostname [PXELINUX] all uses of IP addresses in PXE are also in network byte order. -AX=0011h [3.05] Maximum number of shuffle descriptors - Input: AX 0011h - Output: CX maximum number of descriptors - - This routine reports the maximum number of shuffle descriptors - permitted in a call to functions 0012h, 001Ah and 001Bh. - - This is guaranteed to be at least 64. For the current - version, this is 682 for all derivatives. +AX=0011h [3.05] Obsoleted in 3.75 AX=0012h [3.50] Cleanup, shuffle and boot @@ -806,85 +798,10 @@ AX=0019h [3.50] Read disk [SYSLINUX, ISOLINUX, EXTLINUX] 2048-byte CD-ROM sector numbers. -AX=001Ah [3.50] Cleanup, shuffle and boot to flat protected mode - Input: AX 001Ah - DX derivative-specific flags (see function 000Ch) - ES:DI shuffle descriptor list (must be in low memory) - CX number of shuffle descriptors - DS:SI pointer to register values (must be in low memory) - Output: Does not return - (if CX is too large the routine returns with CF=1) +AX=001Ah [3.50] Obsoleted in 3.75 - This routine performs final cleanup, then performs a sequence - of copies, and jumps to a specified protected mode entry point. - This is otherwise similar to function 0012h; see that function - for the meaning of ES:DI and CX. - - DS:SI points to the initial register file, which is a structure - of 9 dwords (available in ): - - struct syslinux_pm_regs { - uint32_t eax; /* Offset 0 */ - uint32_t ecx; /* Offset 4 */ - uint32_t edx; /* Offset 8 */ - uint32_t ebx; /* Offset 12 */ - uint32_t esp; /* Offset 16 */ - uint32_t ebp; /* Offset 20 */ - uint32_t esi; /* Offset 24 */ - uint32_t edi; /* Offset 28 */ - - uint32_t eip; /* Offset 32 */ - }; - - Protected mode is entered with all data segments set up as a - flat 32-bit read/write segment and the code segment a flat 32-bit - read/execute segment. Interrupts and paging is off, CPL=0, DF=0; - however, GDT, LDT and IDT are undefined, so it is up to the - invoked code to set new descriptor tables to its liking. - - -AX=001Bh [3.50] Cleanup, shuffle and boot to real mode - Input: AX 001Bh - DX derivative-specific flags (see function 000Ch) - ES:DI shuffle descriptor list (must be in low memory) - CX number of shuffle descriptors - DS:SI pointer to register values (must be in low memory) - Output: Does not return - (if CX is too large the routine returns with CF=1) - This routine performs final cleanup, then performs a sequence - of copies, and jumps to a specified entry point. - This is similar to function 0012h but allow more control over - the initial register state; see that function for the meaning of - ES:DI and CX. - - DS:SI points to the initial register file, which is a structure - in the following format (available in ; - note that this is a completely different structure from the - com32sys_t structure described at the top of this document!): - - struct syslinux_rm_regs { - uint16_t es; /* Offset 0 */ - uint16_t _unused_cs; /* Offset 2 */ - uint16_t ds; /* Offset 4 */ - uint16_t ss; /* Offset 6 */ - uint16_t fs; /* Offset 8 */ - uint16_t gs; /* Offset 10 */ - - reg32_t eax; /* Offset 12 */ - reg32_t ecx; /* Offset 16 */ - reg32_t edx; /* Offset 20 */ - reg32_t ebx; /* Offset 24 */ - reg32_t esp; /* Offset 28 */ - reg32_t ebp; /* Offset 32 */ - reg32_t esi; /* Offset 36 */ - reg32_t edi; /* Offset 40 */ - - uint16_t ip; /* Offset 44 */ - uint16_t cs; /* Offset 46 */ - }; - - Interrupts are off and DF=0 on entry. +AX=001Bh [3.50] Obsoleted in 3.75 AX=001Ch [3.60] Get pointer to auxilliary data vector @@ -965,3 +882,63 @@ AX=0022h [3.74] Close directory Output SI 0 Closes a directory. + + +AX=0023h [3.75] Get shuffler parameters + Input: AX 0023h + Output: CX size of shuffler "safe area" in bytes + Other registers reserved for future use + + This call gives the size of the required shuffler "safe area", + in bytes; for call 0024h. In the future, it may provide + additional parameters. + + +AX=0024h [3.75] Cleanup, shuffle and boot, raw version + Input: AX 0024h + DX derivative-specific flags (see function 000Ch) + EDI shuffle descriptor list + EBX pointer to a "safe area" in memory + Output: Does not return + + This routine performs final cleanup, then performs a sequence + of copies, and jumps to a specified real mode entry point. + This is a more general version of function 000Dh, which can + also be used to load other types of programs. + + Unlike previous obsolete versions of this function, there are + no restrictions that copies must not touch memory below + address 7C00h. Either the shuffle descriptor list or the safe + area (or both) may be located in high memory. + + EDI points to a list of descriptors each of the form: + + Offset Size Meaning + 0 dword destination address + 4 dword source address (-1 = zero) + 8 dword length in bytes (0 = end of list) + + The copies are overlap-safe, like memmove(). + + If the source address is -1 (FFFFFFFFh) then the block + specified by the destination address and the length is set to + all zero. + + The list is terminated by an entry with length 0. For that + entry, the destination is used as an entry point, and the + source represents the type of entry point: + + 0 Real mode (dst is CS:IP) + 1 Flat 32-bit protected mode (dst is EIP) + + This routine does not set up any register state whatsoever, + including stack. It is the responsibility of the caller to + make sure the entry point provided sets up any registers + needed. This is particularly important that a real mode entry + point reloads all data segment registers at the earliest + possible point. + + It is the responsibility of the caller that neither the + descriptor list nor the "safe area" is disturbed by the copy + sequence. It is, however, safe to overwrite descriptors + already consumed.