summaryrefslogtreecommitdiffstats
path: root/contrib/syslinux-4.02/core/abort.inc
blob: 9b181363e0b93ec30a20e3c892ce65aede60acf6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
; -----------------------------------------------------------------------
;
;   Copyright 2005-2009 H. Peter Anvin - All Rights Reserved
;   Copyright 2009 Intel Corporation; author: H. Peter Anvin
;
;   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, Inc., 53 Temple Place Ste 330,
;   Boston MA 02111-1307, USA; either version 2 of the License, or
;   (at your option) any later version; incorporated herein by reference.
;
; -----------------------------------------------------------------------

;
; abort.inc
;
; Code to terminate a kernel load
;

		section .text16

;
; dot_pause: same as abort_check, except prints a dot, too
;            assumes CS == DS
;
dot_pause:
		push si
		mov si,dot_msg
		call writestr_qchk
		pop si
		; fall through

;
; abort_check: let the user abort with <ESC> or <Ctrl-C>
;
abort_check:
		call reset_idle			; Not idle despite pollchar
		call pollchar
		jz .ret1
		pusha
		call getchar
		cmp al,27			; <ESC>
		je .kill
		cmp al,3			; <Ctrl-C>
		je .kill
.ret2:		popa
.ret1:		ret

.kill:		mov si,aborted_msg
		mov bx,enter_command
		jmp abort_load_chain

;
; abort_load: Called by various routines which wants to print a fatal
;             error message and return to the command prompt.  Since this
;             may happen at just about any stage of the boot process, assume
;             our state is messed up, and just reset the segment registers
;             and the stack forcibly.
;
;             SI    = offset (in _text) of error message to print
;	      BX    = future entry point (abort_load_chain)
;
abort_load:
		mov bx,error_or_command
abort_load_chain:
		RESET_STACK_AND_SEGS AX
                call writestr                  ; Expects SI -> error msg

		; Return to the command prompt
		jmp bx

;
; error_or_command: Execute ONERROR if appropriate, otherwise enter_command
;
error_or_command:
		mov cx,[OnerrorLen]
		and cx,cx
		jnz on_error
		jmp enter_command

		section .data16
aborted_msg	db ' aborted.', CR, LF, 0

		section .text16