Merge commit 'origin/nolen' into gpxe-support
[syslinux.git] / abort.inc
blob0f443829b29a129fcd46938f9fb7dcca6fe09e1d
1 ; -----------------------------------------------------------------------
3 ;   Copyright 2005-2008 H. Peter Anvin - All Rights Reserved
5 ;   This program is free software; you can redistribute it and/or modify
6 ;   it under the terms of the GNU General Public License as published by
7 ;   the Free Software Foundation, Inc., 53 Temple Place Ste 330,
8 ;   Boston MA 02111-1307, USA; either version 2 of the License, or
9 ;   (at your option) any later version; incorporated herein by reference.
11 ; -----------------------------------------------------------------------
14 ; abort.inc
16 ; Code to terminate a kernel load
19                 section .text
21 ; abort_check: let the user abort with <ESC> or <Ctrl-C>
23 abort_check:
24                 call pollchar
25                 jz .ret1
26                 pusha
27                 call getchar
28                 cmp al,27                       ; <ESC>
29                 je .kill
30                 cmp al,3                        ; <Ctrl-C>
31                 je .kill
32 .ret2:          popa
33 .ret1:          ret
35 .kill:          mov si,aborted_msg
36                 mov bx,enter_command
37                 jmp abort_load_chain
40 ; abort_load: Called by various routines which wants to print a fatal
41 ;             error message and return to the command prompt.  Since this
42 ;             may happen at just about any stage of the boot process, assume
43 ;             our state is messed up, and just reset the segment registers
44 ;             and the stack forcibly.
46 ;             SI    = offset (in _text) of error message to print
47 ;             BX    = future entry point (abort_load_chain)
49 abort_load:
50                 mov bx,error_or_command
51 abort_load_chain:
52                 RESET_STACK_AND_SEGS AX
53                 call cwritestr                  ; Expects SI -> error msg
55                 ; Return to the command prompt
56                 jmp bx
59 ; error_or_command: Execute ONERROR if appropriate, otherwise enter_command
61 error_or_command:
62                 mov cx,[OnerrorLen]
63                 and cx,cx
64                 jnz on_error
65                 jmp enter_command
67                 section .data
68 aborted_msg     db ' aborted.', CR, LF, 0
70                 section .text