mirror of
				https://github.com/xcat2/xNBA.git
				synced 2025-11-03 21:02:36 +00:00 
			
		
		
		
	[prefix] When we have to hook INT 19, chain to original handler if possible
When the BIOS doesn't support BBS, hooking INT 19 is the only way to add ourselves as a boot device. If we have to do this, we should at least try to chain to the original INT 19 vector if our boot fails. Idea suggested by Andrew Schran <aschran@google.com>
This commit is contained in:
		@@ -173,6 +173,8 @@ hook_int19:
 | 
			
		||||
	call	print_message
 | 
			
		||||
	xorw	%ax, %ax
 | 
			
		||||
	movw	%ax, %es
 | 
			
		||||
	pushl	%es:( 0x19 * 4 )
 | 
			
		||||
	popl	orig_int19
 | 
			
		||||
	pushw	%cs
 | 
			
		||||
	pushw	$int19_entry
 | 
			
		||||
	popl	%es:( 0x19 * 4 )
 | 
			
		||||
@@ -345,14 +347,24 @@ bev_entry:
 | 
			
		||||
 | 
			
		||||
/* INT19 entry point
 | 
			
		||||
 *
 | 
			
		||||
 * Called via the hooked INT 19 if we detected a non-PnP BIOS.
 | 
			
		||||
 * Called via the hooked INT 19 if we detected a non-PnP BIOS.  We
 | 
			
		||||
 * attempt to return via the original INT 19 vector (if we were able to
 | 
			
		||||
 * store it).
 | 
			
		||||
 */
 | 
			
		||||
int19_entry:
 | 
			
		||||
	pushw	%cs
 | 
			
		||||
	call	exec
 | 
			
		||||
	/* No real way to return from INT19 */
 | 
			
		||||
	movl	%cs:orig_int19, %eax
 | 
			
		||||
	testl	%eax, %eax
 | 
			
		||||
	je	1f
 | 
			
		||||
	/* Chain to original INT 19 vector */
 | 
			
		||||
	ljmp	*%cs:orig_int19
 | 
			
		||||
1:	/* No chained vector: issue INT 18 as a last resort */
 | 
			
		||||
	int	$0x18
 | 
			
		||||
	.size	int19_entry, . - int19_entry
 | 
			
		||||
orig_int19:
 | 
			
		||||
	.long	0
 | 
			
		||||
	.size	orig_int19, . - orig_int19
 | 
			
		||||
 | 
			
		||||
/* Execute as a boot device
 | 
			
		||||
 *
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user