source: xtideuniversalbios/trunk/XTIDE_Universal_BIOS/Src/Boot/BootVars.asm@ 116

Last change on this file since 116 was 116, checked in by krille_n_@…, 14 years ago

Changes to all parts of the project:

  • Removed a redundant macro (HPIO_NORMALIZE_PTR)
  • Deleted XTIDE_Universal_BIOS/Inc/BiosData.inc since that was also redundant.
  • Size optimization: Changed the LOAD_BDA_SEGMENT_TO macro to use the stack on 186+ processors (the old behaviour can still be used where needed).
  • Made other minor size optimizations and cleanups to various functions, mostly in the Int13h handler.
File size: 2.5 KB
Line 
1; Project name : XTIDE Universal BIOS
2; Description : Functions to access BOOTVARS struct.
3
4; Section containing code
5SECTION .text
6
7;--------------------------------------------------------------------
8; Stores POST stack pointer to BOOTVARS.
9;
10; BootVars_StorePostStackPointer
11; Parameters:
12; DS: BDA and Interrupt Vector segment (zero)
13; Returns:
14; Nothing
15; Corrupts registers:
16; AX
17;--------------------------------------------------------------------
18ALIGN JUMP_ALIGN
19BootVars_StorePostStackPointer:
20 pop ax ; Pop return address
21 mov [BOOTVARS.dwPostStack], sp
22 mov [BOOTVARS.dwPostStack+2], ss
23 jmp ax
24
25
26;--------------------------------------------------------------------
27; Initializes stack for boot menu usage.
28; POST stack is not large enough when DPTs are stored to 30:0h.
29;
30; Note regarding LOAD_BDA_SEGMENT_TO: If you force the use of SP
31; then you also have to unconditionally enable the CLI/STI pair.
32; The reason for this is that only some buggy 808x CPU:s need the
33; CLI/STI instruction pair when changing stacks. Other CPU:s disable
34; interrupts automatically when SS is modified for the duration of
35; the immediately following instruction to give time to change SP.
36;
37; BootVars_SwitchToBootMenuStack
38; Parameters:
39; Nothing
40; Returns:
41; SS:SP: Pointer to top of Boot Menu stack
42; Corrupts registers:
43; AX
44;--------------------------------------------------------------------
45ALIGN JUMP_ALIGN
46BootVars_SwitchToBootMenuStack:
47 pop ax ; Pop return address
48%ifndef USE_186
49 cli ; Disable interrupts
50%endif
51 LOAD_BDA_SEGMENT_TO ss, sp
52 mov sp, BOOTVARS.rgbMnuStack ; Load offset to stack
53%ifndef USE_186
54 sti ; Enable interrupts
55%endif
56 jmp ax
57
58
59;--------------------------------------------------------------------
60; Restores SS and SP to initial boot loader values.
61;
62; Before doing any changes, see the note regarding
63; LOAD_BDA_SEGMENT_TO in BootVars_SwitchToBootMenuStack
64;
65; BootVars_SwitchBackToPostStack
66; Parameters:
67; Nothing
68; Returns:
69; SS:SP: Ptr to POST stack
70; Corrupts registers:
71; AX
72;--------------------------------------------------------------------
73ALIGN JUMP_ALIGN
74BootVars_SwitchBackToPostStack:
75 pop ax ; Pop return address
76%ifndef USE_186
77 cli ; Disable interrupts
78%endif
79 LOAD_BDA_SEGMENT_TO ss, sp
80%ifndef USE_386
81 mov sp, [ss:BOOTVARS.dwPostStack]
82 mov ss, [ss:BOOTVARS.dwPostStack+2]
83%else
84 lss sp, [ss:BOOTVARS.dwPostStack]
85%endif
86%ifndef USE_186
87 sti ; Enable interrupts
88%endif
89 jmp ax
Note: See TracBrowser for help on using the repository browser.