|
; $Id: abort.inc,v 1.1 2007-09-01 22:44:04 niro Exp $ |
|
1 |
; ----------------------------------------------------------------------- |
; ----------------------------------------------------------------------- |
2 |
; |
; |
3 |
; Copyright 2005 H. Peter Anvin - All Rights Reserved |
; Copyright 2005-2009 H. Peter Anvin - All Rights Reserved |
4 |
|
; Copyright 2009 Intel Corporation; author: H. Peter Anvin |
5 |
; |
; |
6 |
; This program is free software; you can redistribute it and/or modify |
; This program is free software; you can redistribute it and/or modify |
7 |
; it under the terms of the GNU General Public License as published by |
; it under the terms of the GNU General Public License as published by |
18 |
; |
; |
19 |
|
|
20 |
section .text |
section .text |
21 |
|
|
22 |
|
; |
23 |
|
; dot_pause: same as abort_check, except prints a dot, too |
24 |
|
; assumes CS == DS |
25 |
|
; |
26 |
|
dot_pause: |
27 |
|
push si |
28 |
|
mov si,dot_msg |
29 |
|
call writestr_qchk |
30 |
|
pop si |
31 |
|
; fall through |
32 |
|
|
33 |
; |
; |
34 |
; abort_check: let the user abort with <ESC> or <Ctrl-C> |
; abort_check: let the user abort with <ESC> or <Ctrl-C> |
35 |
; |
; |
36 |
abort_check: |
abort_check: |
37 |
|
call reset_idle ; Not idle despite pollchar |
38 |
call pollchar |
call pollchar |
39 |
jz .ret1 |
jz .ret1 |
40 |
pusha |
pusha |
47 |
.ret1: ret |
.ret1: ret |
48 |
|
|
49 |
.kill: mov si,aborted_msg |
.kill: mov si,aborted_msg |
50 |
|
mov bx,enter_command |
51 |
; ... fall through ... |
jmp abort_load_chain |
52 |
|
|
53 |
; |
; |
54 |
; abort_load: Called by various routines which wants to print a fatal |
; abort_load: Called by various routines which wants to print a fatal |
58 |
; and the stack forcibly. |
; and the stack forcibly. |
59 |
; |
; |
60 |
; SI = offset (in _text) of error message to print |
; SI = offset (in _text) of error message to print |
61 |
|
; BX = future entry point (abort_load_chain) |
62 |
; |
; |
63 |
abort_load: |
abort_load: |
64 |
mov ax,cs ; Restore CS = DS = ES |
mov bx,error_or_command |
65 |
mov ds,ax |
abort_load_chain: |
66 |
mov es,ax |
RESET_STACK_AND_SEGS AX |
67 |
%if IS_SYSLINUX || IS_EXTLINUX |
call writestr ; Expects SI -> error msg |
|
mov ss,ax ; Just in case... |
|
|
mov sp,StackBuf-2*3 ; Reset stack |
|
|
%elif IS_PXELINUX |
|
|
lss esp,[BaseStack] |
|
|
%elif IS_ISOLINUX |
|
|
lss sp,[StackPtr] |
|
|
%else |
|
|
NEED TO KNOW HOW TO RESET STACK |
|
|
%endif |
|
|
sti |
|
|
call cwritestr ; Expects SI -> error msg |
|
68 |
|
|
69 |
; Return to the command prompt |
; Return to the command prompt |
70 |
|
jmp bx |
71 |
|
|
72 |
|
; |
73 |
|
; error_or_command: Execute ONERROR if appropriate, otherwise enter_command |
74 |
|
; |
75 |
|
error_or_command: |
76 |
|
mov cx,[OnerrorLen] |
77 |
|
and cx,cx |
78 |
|
jnz on_error |
79 |
jmp enter_command |
jmp enter_command |
80 |
|
|
81 |
|
section .data |
82 |
|
aborted_msg db ' aborted.', CR, LF, 0 |
83 |
|
|
84 |
|
section .text |