Lines 90-96
Link Here
|
90 |
static jmp_buf env_for_exit; |
90 |
static jmp_buf env_for_exit; |
91 |
|
91 |
|
92 |
/* The current color for console. */ |
92 |
/* The current color for console. */ |
93 |
static int console_current_color = A_NORMAL; |
93 |
int console_current_color = A_NORMAL; |
94 |
|
94 |
|
95 |
/* The file descriptor for a serial device. */ |
95 |
/* The file descriptor for a serial device. */ |
96 |
static int serial_fd = -1; |
96 |
static int serial_fd = -1; |
Lines 113-143
Link Here
|
113 |
char *scratch, *simstack; |
113 |
char *scratch, *simstack; |
114 |
int i; |
114 |
int i; |
115 |
|
115 |
|
|
|
116 |
auto void doit (void); |
117 |
|
116 |
/* We need a nested function so that we get a clean stack frame, |
118 |
/* We need a nested function so that we get a clean stack frame, |
117 |
regardless of how the code is optimized. */ |
119 |
regardless of how the code is optimized. */ |
118 |
static volatile void doit () |
120 |
auto void doit (void) |
119 |
{ |
121 |
{ |
120 |
/* Make sure our stack lives in the simulated memory area. */ |
122 |
/* Make sure our stack lives in the simulated memory area. */ |
121 |
asm volatile ("movl %%esp, %0\n\tmovl %1, %%esp\n" |
123 |
asm volatile ("movl %%esp, %0\n\tmovl %1, %%esp\n" |
122 |
: "=&r" (realstack) : "r" (simstack)); |
124 |
: "=&r" (realstack) : "r" (simstack)); |
123 |
|
125 |
|
124 |
/* Do a setjmp here for the stop command. */ |
126 |
/* Do a setjmp here for the stop command. */ |
125 |
if (! setjmp (env_for_exit)) |
127 |
if (! setjmp (env_for_exit)) |
126 |
{ |
128 |
{ |
127 |
/* Actually enter the generic stage2 code. */ |
129 |
/* Actually enter the generic stage2 code. */ |
128 |
status = 0; |
130 |
status = 0; |
129 |
init_bios_info (); |
131 |
init_bios_info (); |
130 |
} |
132 |
} |
131 |
else |
133 |
else |
132 |
{ |
134 |
{ |
133 |
/* If ERRNUM is non-zero, then set STATUS to non-zero. */ |
135 |
/* If ERRNUM is non-zero, then set STATUS to non-zero. */ |
134 |
if (errnum) |
136 |
if (errnum) |
135 |
status = 1; |
137 |
status = 1; |
136 |
} |
138 |
} |
137 |
|
139 |
|
138 |
/* Replace our stack before we use any local variables. */ |
140 |
/* Replace our stack before we use any local variables. */ |
139 |
asm volatile ("movl %0, %%esp\n" : : "r" (realstack)); |
141 |
asm volatile ("movl %0, %%esp\n" : : "r" (realstack)); |
140 |
} |
142 |
} |
141 |
|
143 |
|
142 |
assert (grub_scratch_mem == 0); |
144 |
assert (grub_scratch_mem == 0); |
143 |
scratch = malloc (0x100000 + EXTENDED_MEMSIZE + 15); |
145 |
scratch = malloc (0x100000 + EXTENDED_MEMSIZE + 15); |