|
Revision a70ce33ffb90eff0453b1889537d725130e62236, 1.4 KB
(checked in by H. Peter Anvin <hpa@…>, 3 years ago)
|
|
pxelinux: be more paranoid about saving/restoring flags
Save and restore flags around writechr and the PXE stack call, just in
case the underlying stack does something weird.
Signed-off-by: H. Peter Anvin <hpa@…>
|
-
Property mode set to
100644
|
| Line | |
|---|
| 1 | ; |
|---|
| 2 | ; writechr: Write a single character in AL to the console without |
|---|
| 3 | ; mangling any registers. This does raw console writes, |
|---|
| 4 | ; since some PXE BIOSes seem to interfere regular console I/O. |
|---|
| 5 | ; |
|---|
| 6 | %if IS_ISOLINUX |
|---|
| 7 | writechr_full: |
|---|
| 8 | %else |
|---|
| 9 | writechr: |
|---|
| 10 | %endif |
|---|
| 11 | pushfd |
|---|
| 12 | push ds |
|---|
| 13 | push cs |
|---|
| 14 | pop ds |
|---|
| 15 | test byte [UsingVGA], 08h |
|---|
| 16 | jz .videook |
|---|
| 17 | call vgaclearmode |
|---|
| 18 | .videook: |
|---|
| 19 | call write_serial ; write to serial port if needed |
|---|
| 20 | test byte [DisplayCon],01h ; Write to screen? |
|---|
| 21 | jz .nothing |
|---|
| 22 | |
|---|
| 23 | pushad |
|---|
| 24 | mov bh,[BIOS_page] |
|---|
| 25 | push ax |
|---|
| 26 | mov ah,03h ; Read cursor position |
|---|
| 27 | int 10h |
|---|
| 28 | pop ax |
|---|
| 29 | cmp al,8 |
|---|
| 30 | je .bs |
|---|
| 31 | cmp al,13 |
|---|
| 32 | je .cr |
|---|
| 33 | cmp al,10 |
|---|
| 34 | je .lf |
|---|
| 35 | push dx |
|---|
| 36 | mov bh,[BIOS_page] |
|---|
| 37 | mov bl,07h ; White on black |
|---|
| 38 | mov cx,1 ; One only |
|---|
| 39 | mov ah,09h ; Write char and attribute |
|---|
| 40 | int 10h |
|---|
| 41 | pop dx |
|---|
| 42 | inc dl |
|---|
| 43 | cmp dl,[VidCols] |
|---|
| 44 | jna .curxyok |
|---|
| 45 | xor dl,dl |
|---|
| 46 | .lf: inc dh |
|---|
| 47 | cmp dh,[VidRows] |
|---|
| 48 | ja .scroll |
|---|
| 49 | .curxyok: mov bh,[BIOS_page] |
|---|
| 50 | mov ah,02h ; Set cursor position |
|---|
| 51 | int 10h |
|---|
| 52 | .ret: popad |
|---|
| 53 | .nothing: |
|---|
| 54 | pop ds |
|---|
| 55 | popfd |
|---|
| 56 | ret |
|---|
| 57 | .scroll: dec dh |
|---|
| 58 | mov bh,[BIOS_page] |
|---|
| 59 | mov ah,02h |
|---|
| 60 | int 10h |
|---|
| 61 | mov ax,0601h ; Scroll up one line |
|---|
| 62 | mov bh,[ScrollAttribute] |
|---|
| 63 | xor cx,cx |
|---|
| 64 | mov dx,[ScreenSize] ; The whole screen |
|---|
| 65 | int 10h |
|---|
| 66 | jmp short .ret |
|---|
| 67 | .cr: xor dl,dl |
|---|
| 68 | jmp short .curxyok |
|---|
| 69 | .bs: sub dl,1 |
|---|
| 70 | jnc .curxyok |
|---|
| 71 | mov dl,[VidCols] |
|---|
| 72 | sub dh,1 |
|---|
| 73 | jnc .curxyok |
|---|
| 74 | xor dh,dh |
|---|
| 75 | jmp short .curxyok |
|---|