1 | ; Project name : XTIDE Universal BIOS
|
---|
2 | ; Description : Functions to access BOOTVARS struct.
|
---|
3 |
|
---|
4 | ; Section containing code
|
---|
5 | SECTION .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 | ;--------------------------------------------------------------------
|
---|
18 | ALIGN JUMP_ALIGN
|
---|
19 | BootVars_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 | ; BootVars_SwitchToBootMenuStack
|
---|
31 | ; Parameters:
|
---|
32 | ; Nothing
|
---|
33 | ; Returns:
|
---|
34 | ; SS:SP: Pointer to top of Boot Menu stack
|
---|
35 | ; Corrupts registers:
|
---|
36 | ; AX
|
---|
37 | ;--------------------------------------------------------------------
|
---|
38 | ALIGN JUMP_ALIGN
|
---|
39 | BootVars_SwitchToBootMenuStack:
|
---|
40 | pop ax ; Pop return address
|
---|
41 | cli ; Disable interrupts
|
---|
42 | LOAD_BDA_SEGMENT_TO ss, sp
|
---|
43 | mov sp, BOOTVARS.rgbMnuStack ; Load offset to stack
|
---|
44 | sti ; Enable interrupts
|
---|
45 | jmp ax
|
---|
46 |
|
---|
47 |
|
---|
48 | ;--------------------------------------------------------------------
|
---|
49 | ; Restores SS and SP to initial boot loader values.
|
---|
50 | ;
|
---|
51 | ; BootVars_SwitchBackToPostStack
|
---|
52 | ; Parameters:
|
---|
53 | ; Nothing
|
---|
54 | ; Returns:
|
---|
55 | ; SS:SP: Ptr to POST stack
|
---|
56 | ; Corrupts registers:
|
---|
57 | ; AX
|
---|
58 | ;--------------------------------------------------------------------
|
---|
59 | ALIGN JUMP_ALIGN
|
---|
60 | BootVars_SwitchBackToPostStack:
|
---|
61 | pop ax ; Pop return address
|
---|
62 | cli ; Disable interrupts
|
---|
63 | LOAD_BDA_SEGMENT_TO ss, sp
|
---|
64 | %ifndef USE_386
|
---|
65 | mov sp, [ss:BOOTVARS.dwPostStack]
|
---|
66 | mov ss, [ss:BOOTVARS.dwPostStack+2]
|
---|
67 | %else
|
---|
68 | lss sp, [ss:BOOTVARS.dwPostStack]
|
---|
69 | %endif
|
---|
70 | sti ; Enable interrupts
|
---|
71 | jmp ax
|
---|