blob: 0c15b1560c538a485e3b44952e099eeb6f41e4f1 [file] [log] [blame]
Stefan Reinauer38cd29e2009-08-11 21:28:25 +00001/*
2 * This file is part of the coreboot project.
3 *
Stefan Reinauer9839cbd2010-04-21 20:06:10 +00004 * Copyright (C) 2007 Advanced Micro Devices, Inc.
5 * Copyright (C) 2009-2010 coresystems GmbH
Stefan Reinauer38cd29e2009-08-11 21:28:25 +00006 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; version 2 of the License.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
Stefan Reinauer6c641ee2009-09-23 21:52:45 +000018 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
Stefan Reinauer38cd29e2009-08-11 21:28:25 +000019 */
20
21#include <device/pci.h>
22#include <string.h>
23
Stefan Reinauer38cd29e2009-08-11 21:28:25 +000024#include <arch/io.h>
Stefan Reinauer42dc7212009-10-24 00:47:07 +000025#include <arch/registers.h>
Stefan Reinauer38cd29e2009-08-11 21:28:25 +000026#include <console/console.h>
Libra Lic1436932009-12-23 19:16:47 +000027#include <arch/interrupt.h>
Stefan Reinauerc1efb902011-10-12 14:30:59 -070028#include <cbfs.h>
29#include <delay.h>
Stefan Reinauerb6b88712011-10-12 14:35:54 -070030#include <pc80/i8259.h>
Stefan Reinauer216fa462011-10-12 14:25:07 -070031#include "x86.h"
Stefan Reinauerc1efb902011-10-12 14:30:59 -070032#include "vbe.h"
33#include "../../src/lib/jpeg.h"
Stefan Reinauer38cd29e2009-08-11 21:28:25 +000034
Stefan Reinauer841af5e2010-05-11 15:39:20 +000035void (*realmode_call)(u32 addr, u32 eax, u32 ebx, u32 ecx, u32 edx,
Stefan Reinauerc1efb902011-10-12 14:30:59 -070036 u32 esi, u32 edi) __attribute__((regparm(0))) =
37 (void *)&__realmode_call;
Stefan Reinauer841af5e2010-05-11 15:39:20 +000038
Stefan Reinauer5ff7c132011-10-31 12:56:45 -070039void (*realmode_interrupt)(u32 intno, u32 eax, u32 ebx, u32 ecx, u32 edx,
Stefan Reinauerc1efb902011-10-12 14:30:59 -070040 u32 esi, u32 edi) __attribute__((regparm(0))) =
41 (void *)&__realmode_interrupt;
Stefan Reinauer841af5e2010-05-11 15:39:20 +000042
Stefan Reinauer841af5e2010-05-11 15:39:20 +000043static void setup_bda(void)
44{
45 /* clear BIOS DATA AREA */
46 memset((void *)0x400, 0, 0x200);
47
48 write16(0x413, FAKE_MEMORY_SIZE / 1024);
49 write16(0x40e, INITIAL_EBDA_SEGMENT);
50
51 /* Set up EBDA */
52 memset((void *)(INITIAL_EBDA_SEGMENT << 4), 0, INITIAL_EBDA_SIZE);
53 write16((INITIAL_EBDA_SEGMENT << 4) + 0x0, INITIAL_EBDA_SIZE / 1024);
54}
55
56static void setup_rombios(void)
57{
58 const char date[] = "06/11/99";
59 memcpy((void *)0xffff5, &date, 8);
60
61 const char ident[] = "PCI_ISA";
62 memcpy((void *)0xfffd9, &ident, 7);
63
64 /* system model: IBM-AT */
65 write8(0xffffe, 0xfc);
66}
Stefan Reinauer38cd29e2009-08-11 21:28:25 +000067
68int (*intXX_handler[256])(struct eregs *regs) = { NULL };
69
70static int intXX_exception_handler(struct eregs *regs)
71{
Stefan Reinauer14e22772010-04-27 06:56:47 +000072 printk(BIOS_INFO, "Oops, exception %d while executing option rom\n",
Stefan Reinauer38cd29e2009-08-11 21:28:25 +000073 regs->vector);
Stefan Reinauer14e22772010-04-27 06:56:47 +000074 x86_exception(regs); // Call coreboot exception handler
Stefan Reinauer38cd29e2009-08-11 21:28:25 +000075
Stefan Reinauerb6b88712011-10-12 14:35:54 -070076 return 0; // Never really returns
Stefan Reinauer38cd29e2009-08-11 21:28:25 +000077}
78
79static int intXX_unknown_handler(struct eregs *regs)
80{
Myles Watsonf53eaa32010-09-09 14:42:58 +000081 printk(BIOS_INFO, "Unsupported software interrupt #0x%x eax 0x%x\n",
82 regs->vector, regs->eax);
Stefan Reinauer38cd29e2009-08-11 21:28:25 +000083
84 return -1;
85}
86
Libra Lic1436932009-12-23 19:16:47 +000087/* setup interrupt handlers for mainboard */
88void mainboard_interrupt_handlers(int intXX, void *intXX_func)
89{
90 intXX_handler[intXX] = intXX_func;
91}
92
Stefan Reinauer38cd29e2009-08-11 21:28:25 +000093static void setup_interrupt_handlers(void)
94{
95 int i;
96
Stefan Reinauer14e22772010-04-27 06:56:47 +000097 /* The first 16 intXX functions are not BIOS services,
Stefan Reinauer38cd29e2009-08-11 21:28:25 +000098 * but the CPU-generated exceptions ("hardware interrupts")
99 */
100 for (i = 0; i < 0x10; i++)
101 intXX_handler[i] = &intXX_exception_handler;
Stefan Reinauer14e22772010-04-27 06:56:47 +0000102
Stefan Reinauer38cd29e2009-08-11 21:28:25 +0000103 /* Mark all other intXX calls as unknown first */
104 for (i = 0x10; i < 0x100; i++)
Libra Lic1436932009-12-23 19:16:47 +0000105 {
106 /* If the mainboard_interrupt_handler isn't called first.
107 */
108 if(!intXX_handler[i])
109 {
110 /* Now set the default functions that are actually
Stefan Reinauerc1efb902011-10-12 14:30:59 -0700111 * needed to initialize the option roms. This is
112 * very slick, as it allows us to implement mainboard
113 * specific interrupt handlers, such as the int15.
Libra Lic1436932009-12-23 19:16:47 +0000114 */
115 switch (i) {
Myles Watsonf53eaa32010-09-09 14:42:58 +0000116 case 0x10:
117 intXX_handler[0x10] = &int10_handler;
118 break;
Libra Lic1436932009-12-23 19:16:47 +0000119 case 0x12:
120 intXX_handler[0x12] = &int12_handler;
121 break;
Myles Watsonf53eaa32010-09-09 14:42:58 +0000122 case 0x16:
123 intXX_handler[0x16] = &int16_handler;
124 break;
Libra Lic1436932009-12-23 19:16:47 +0000125 case 0x1a:
126 intXX_handler[0x1a] = &int1a_handler;
127 break;
128 default:
129 intXX_handler[i] = &intXX_unknown_handler;
130 break;
131 }
132 }
133 }
Stefan Reinauer38cd29e2009-08-11 21:28:25 +0000134}
135
136static void write_idt_stub(void *target, u8 intnum)
137{
138 unsigned char *codeptr;
139 codeptr = (unsigned char *) target;
140 memcpy(codeptr, &__idt_handler, (size_t)&__idt_handler_size);
141 codeptr[3] = intnum; /* modify int# in the code stub. */
142}
143
144static void setup_realmode_idt(void)
145{
146 struct realmode_idt *idts = (struct realmode_idt *) 0;
147 int i;
148
149 /* Copy IDT stub code for each interrupt. This might seem wasteful
150 * but it is really simple
151 */
152 for (i = 0; i < 256; i++) {
153 idts[i].cs = 0;
154 idts[i].offset = 0x1000 + (i * (u32)&__idt_handler_size);
155 write_idt_stub((void *)((u32 )idts[i].offset), i);
156 }
157
158 /* Many option ROMs use the hard coded interrupt entry points in the
Stefan Reinauer14e22772010-04-27 06:56:47 +0000159 * system bios. So install them at the known locations.
Stefan Reinauer38cd29e2009-08-11 21:28:25 +0000160 */
Stefan Reinauer14e22772010-04-27 06:56:47 +0000161
Stefan Reinauer38cd29e2009-08-11 21:28:25 +0000162 /* int42 is the relocated int10 */
Stefan Reinauer714e2a12010-04-24 23:15:23 +0000163 write_idt_stub((void *)0xff065, 0x42);
Stefan Reinauer841af5e2010-05-11 15:39:20 +0000164 /* BIOS Int 11 Handler F000:F84D */
165 write_idt_stub((void *)0xff84d, 0x11);
166 /* BIOS Int 12 Handler F000:F841 */
167 write_idt_stub((void *)0xff841, 0x12);
168 /* BIOS Int 13 Handler F000:EC59 */
169 write_idt_stub((void *)0xfec59, 0x13);
170 /* BIOS Int 14 Handler F000:E739 */
171 write_idt_stub((void *)0xfe739, 0x14);
172 /* BIOS Int 15 Handler F000:F859 */
Stefan Reinauer14e22772010-04-27 06:56:47 +0000173 write_idt_stub((void *)0xff859, 0x15);
Stefan Reinauer841af5e2010-05-11 15:39:20 +0000174 /* BIOS Int 16 Handler F000:E82E */
175 write_idt_stub((void *)0xfe82e, 0x16);
176 /* BIOS Int 17 Handler F000:EFD2 */
177 write_idt_stub((void *)0xfefd2, 0x17);
178 /* ROM BIOS Int 1A Handler F000:FE6E */
179 write_idt_stub((void *)0xffe6e, 0x1a);
Stefan Reinauer38cd29e2009-08-11 21:28:25 +0000180}
181
Stefan Reinauerc1efb902011-10-12 14:30:59 -0700182#if CONFIG_FRAMEBUFFER_SET_VESA_MODE
183static u8 vbe_get_mode_info(vbe_mode_info_t * mode_info)
184{
Stefan Reinauerb6b88712011-10-12 14:35:54 -0700185 printk(BIOS_DEBUG, "Getting information about VESA mode %04x\n",
186 mode_info->video_mode);
Stefan Reinauerc1efb902011-10-12 14:30:59 -0700187 char *buffer = (char *)&__buffer;
188 u16 buffer_seg = (((unsigned long)buffer) >> 4) & 0xff00;
189 u16 buffer_adr = ((unsigned long)buffer) & 0xffff;
190 realmode_interrupt(0x10, VESA_GET_MODE_INFO, 0x0000,
191 mode_info->video_mode, 0x0000, buffer_seg, buffer_adr);
Stefan Reinauerb6b88712011-10-12 14:35:54 -0700192 memcpy(mode_info->mode_info_block, buffer, sizeof(vbe_mode_info_t));
Stefan Reinauerc1efb902011-10-12 14:30:59 -0700193 return 0;
194}
195
196static u8 vbe_set_mode(vbe_mode_info_t * mode_info)
197{
Stefan Reinauerb6b88712011-10-12 14:35:54 -0700198 printk(BIOS_DEBUG, "Setting VESA mode %04x\n", mode_info->video_mode);
Stefan Reinauerc1efb902011-10-12 14:30:59 -0700199 // request linear framebuffer mode
200 mode_info->video_mode |= (1 << 14);
201 // request clearing of framebuffer
202 mode_info->video_mode &= ~(1 << 15);
203 realmode_interrupt(0x10, VESA_SET_MODE, mode_info->video_mode,
204 0x0000, 0x0000, 0x0000, 0x0000);
205 return 0;
206}
207
208vbe_mode_info_t mode_info;
209
210/* These two functions could probably even be generic between
211 * yabel and x86 native. TBD later.
212 */
213void vbe_set_graphics(void)
214{
215 mode_info.video_mode = (1 << 14) | CONFIG_FRAMEBUFFER_VESA_MODE;
216 vbe_get_mode_info(&mode_info);
217 unsigned char *framebuffer =
Stefan Reinauerb6b88712011-10-12 14:35:54 -0700218 (unsigned char *)mode_info.vesa.phys_base_ptr;
Stefan Reinauerc1efb902011-10-12 14:30:59 -0700219 printk(BIOS_DEBUG, "framebuffer: %p\n", framebuffer);
Stefan Reinauerc1efb902011-10-12 14:30:59 -0700220 vbe_set_mode(&mode_info);
221#if CONFIG_BOOTSPLASH
222 struct jpeg_decdata *decdata;
223 decdata = malloc(sizeof(*decdata));
224 unsigned char *jpeg = cbfs_find_file("bootsplash.jpg",
225 CBFS_TYPE_BOOTSPLASH);
226 if (!jpeg) {
227 return;
228 }
229 int ret = 0;
230 ret = jpeg_decode(jpeg, framebuffer, 1024, 768, 16, decdata);
231#endif
232}
233
234void vbe_textmode_console(void)
235{
236 delay(2);
237 realmode_interrupt(0x10, 0x0003, 0x0000, 0x0000,
238 0x0000, 0x0000, 0x0000);
239}
240
241void fill_lb_framebuffer(struct lb_framebuffer *framebuffer)
242{
Stefan Reinauerb6b88712011-10-12 14:35:54 -0700243 framebuffer->physical_address = mode_info.vesa.phys_base_ptr;
Stefan Reinauerc1efb902011-10-12 14:30:59 -0700244
245 framebuffer->x_resolution = le16_to_cpu(mode_info.vesa.x_resolution);
246 framebuffer->y_resolution = le16_to_cpu(mode_info.vesa.y_resolution);
247 framebuffer->bytes_per_line =
248 le16_to_cpu(mode_info.vesa.bytes_per_scanline);
249 framebuffer->bits_per_pixel = mode_info.vesa.bits_per_pixel;
250
251 framebuffer->red_mask_pos = mode_info.vesa.red_mask_pos;
252 framebuffer->red_mask_size = mode_info.vesa.red_mask_size;
253
254 framebuffer->green_mask_pos = mode_info.vesa.green_mask_pos;
255 framebuffer->green_mask_size = mode_info.vesa.green_mask_size;
256
257 framebuffer->blue_mask_pos = mode_info.vesa.blue_mask_pos;
258 framebuffer->blue_mask_size = mode_info.vesa.blue_mask_size;
259
260 framebuffer->reserved_mask_pos = mode_info.vesa.reserved_mask_pos;
261 framebuffer->reserved_mask_size = mode_info.vesa.reserved_mask_size;
262}
263#endif
264
Stefan Reinauer38cd29e2009-08-11 21:28:25 +0000265void run_bios(struct device *dev, unsigned long addr)
266{
Stefan Reinauer841af5e2010-05-11 15:39:20 +0000267 u32 num_dev = (dev->bus->secondary << 8) | dev->path.pci.devfn;
268
Stefan Reinauerb6b88712011-10-12 14:35:54 -0700269 /* Setting up required hardware.
270 * Removing this will cause random illegal instruction exceptions
271 * in some option roms.
272 */
273 setup_i8259();
274
Stefan Reinauer841af5e2010-05-11 15:39:20 +0000275 /* Set up BIOS Data Area */
276 setup_bda();
277
278 /* Set up some legacy information in the F segment */
279 setup_rombios();
Libra Lic1436932009-12-23 19:16:47 +0000280
Stefan Reinauer38cd29e2009-08-11 21:28:25 +0000281 /* Set up C interrupt handlers */
282 setup_interrupt_handlers();
283
Stefan Reinauer841af5e2010-05-11 15:39:20 +0000284 /* Set up real-mode IDT */
Stefan Reinauer38cd29e2009-08-11 21:28:25 +0000285 setup_realmode_idt();
286
287 memcpy(REALMODE_BASE, &__realmode_code, (size_t)&__realmode_code_size);
288 printk(BIOS_SPEW, "Real mode stub @%p: %d bytes\n", REALMODE_BASE,
289 (u32)&__realmode_code_size);
290
291 printk(BIOS_DEBUG, "Calling Option ROM...\n");
Stefan Reinauer841af5e2010-05-11 15:39:20 +0000292 /* TODO ES:DI Pointer to System BIOS PnP Installation Check Structure */
293 /* Option ROM entry point is at OPROM start + 3 */
294 realmode_call(addr + 0x0003, num_dev, 0xffff, 0x0000, 0xffff, 0x0, 0x0);
Stefan Reinauer38cd29e2009-08-11 21:28:25 +0000295 printk(BIOS_DEBUG, "... Option ROM returned.\n");
Stefan Reinauerc1efb902011-10-12 14:30:59 -0700296
297#if CONFIG_FRAMEBUFFER_SET_VESA_MODE
298 vbe_set_graphics();
299#endif
Stefan Reinauer38cd29e2009-08-11 21:28:25 +0000300}
301
Stefan Reinauerd4814bd2011-04-21 20:45:45 +0000302#if CONFIG_GEODE_VSA
Stefan Reinauer9839cbd2010-04-21 20:06:10 +0000303#include <cpu/amd/lxdef.h>
304#include <cpu/amd/vr.h>
305#include <cbfs.h>
306
307#define VSA2_BUFFER 0x60000
308#define VSA2_ENTRY_POINT 0x60020
309
310// TODO move to a header file.
311void do_vsmbios(void);
312
313/* VSA virtual register helper */
314static u32 VSA_vrRead(u16 classIndex)
315{
316 u32 eax, ebx, ecx, edx;
317 asm volatile (
318 "movw $0x0AC1C, %%dx\n"
319 "orl $0x0FC530000, %%eax\n"
320 "outl %%eax, %%dx\n"
321 "addb $2, %%dl\n"
322 "inw %%dx, %%ax\n"
Stefan Reinauer14e22772010-04-27 06:56:47 +0000323 : "=a" (eax), "=b"(ebx), "=c"(ecx), "=d"(edx)
Stefan Reinauer9839cbd2010-04-21 20:06:10 +0000324 : "a"(classIndex)
325 );
326
327 return eax;
328}
329
330void do_vsmbios(void)
331{
332 printk(BIOS_DEBUG, "Preparing for VSA...\n");
333
Stefan Reinauer9839cbd2010-04-21 20:06:10 +0000334 /* Set up C interrupt handlers */
335 setup_interrupt_handlers();
336
337 /* Setting up realmode IDT */
338 setup_realmode_idt();
339
340 memcpy(REALMODE_BASE, &__realmode_code, (size_t)&__realmode_code_size);
341 printk(BIOS_SPEW, "VSA: Real mode stub @%p: %d bytes\n", REALMODE_BASE,
342 (u32)&__realmode_code_size);
343
344 if ((unsigned int)cbfs_load_stage("vsa") != VSA2_ENTRY_POINT) {
345 printk(BIOS_ERR, "Failed to load VSA.\n");
346 return;
347 }
348
349 unsigned char *buf = (unsigned char *)VSA2_BUFFER;
350 printk(BIOS_DEBUG, "VSA: Buffer @%p *[0k]=%02x\n", buf, buf[0]);
351 printk(BIOS_DEBUG, "VSA: Signature *[0x20-0x23] is %02x:%02x:%02x:%02x\n",
352 buf[0x20], buf[0x21], buf[0x22], buf[0x23]);
353
354 /* Check for code to emit POST code at start of VSA. */
355 if ((buf[0x20] != 0xb0) || (buf[0x21] != 0x10) ||
356 (buf[0x22] != 0xe6) || (buf[0x23] != 0x80)) {
357 printk(BIOS_WARNING, "VSA: Signature incorrect. Install failed.\n");
358 return;
359 }
360
361 printk(BIOS_DEBUG, "Calling VSA module...\n");
Stefan Reinauer841af5e2010-05-11 15:39:20 +0000362
Stefan Reinauer9839cbd2010-04-21 20:06:10 +0000363 /* ECX gets SMM, EDX gets SYSMEM */
Stefan Reinauer5ff7c132011-10-31 12:56:45 -0700364 realmode_call(VSA2_ENTRY_POINT, 0x0, 0x0, MSR_GLIU0_SMM,
Stefan Reinauer841af5e2010-05-11 15:39:20 +0000365 MSR_GLIU0_SYSMEM, 0x0, 0x0);
366
Stefan Reinauer9839cbd2010-04-21 20:06:10 +0000367 printk(BIOS_DEBUG, "... VSA module returned.\n");
368
369 /* Restart timer 1 */
370 outb(0x56, 0x43);
371 outb(0x12, 0x41);
372
373 /* Check that VSA is running OK */
374 if (VSA_vrRead(SIGNATURE) == VSA2_SIGNATURE)
375 printk(BIOS_DEBUG, "VSM: VSA2 VR signature verified.\n");
376 else
377 printk(BIOS_ERR, "VSM: VSA2 VR signature not valid. Install failed.\n");
378}
379#endif
380
Stefan Reinauer14e22772010-04-27 06:56:47 +0000381/* interrupt_handler() is called from assembler code only,
Stefan Reinauer9839cbd2010-04-21 20:06:10 +0000382 * so there is no use in putting the prototype into a header file.
383 */
Stefan Reinauer38cd29e2009-08-11 21:28:25 +0000384int __attribute__((regparm(0))) interrupt_handler(u32 intnumber,
385 u32 gsfs, u32 dses,
386 u32 edi, u32 esi,
387 u32 ebp, u32 esp,
388 u32 ebx, u32 edx,
389 u32 ecx, u32 eax,
Uwe Hermann312673c2009-10-27 21:49:33 +0000390 u32 cs_ip, u16 stackflags);
391
392int __attribute__((regparm(0))) interrupt_handler(u32 intnumber,
393 u32 gsfs, u32 dses,
394 u32 edi, u32 esi,
395 u32 ebp, u32 esp,
396 u32 ebx, u32 edx,
397 u32 ecx, u32 eax,
Stefan Reinauer38cd29e2009-08-11 21:28:25 +0000398 u32 cs_ip, u16 stackflags)
399{
400 u32 ip;
401 u32 cs;
402 u32 flags;
403 int ret = -1;
404 struct eregs reg_info;
405
406 ip = cs_ip & 0xffff;
407 cs = cs_ip >> 16;
408 flags = stackflags;
409
Myles Watson6c9bc012010-09-07 22:30:15 +0000410#if CONFIG_REALMODE_DEBUG
Stefan Reinauer38cd29e2009-08-11 21:28:25 +0000411 printk(BIOS_DEBUG, "oprom: INT# 0x%x\n", intnumber);
412 printk(BIOS_DEBUG, "oprom: eax: %08x ebx: %08x ecx: %08x edx: %08x\n",
413 eax, ebx, ecx, edx);
414 printk(BIOS_DEBUG, "oprom: ebp: %08x esp: %08x edi: %08x esi: %08x\n",
415 ebp, esp, edi, esi);
416 printk(BIOS_DEBUG, "oprom: ip: %04x cs: %04x flags: %08x\n",
417 ip, cs, flags);
Myles Watson6c9bc012010-09-07 22:30:15 +0000418#endif
Stefan Reinauer38cd29e2009-08-11 21:28:25 +0000419
420 // Fetch arguments from the stack and put them into
421 // a structure that we want to pass on to our sub interrupt
422 // handlers.
423 reg_info = (struct eregs) {
424 .eax=eax,
425 .ecx=ecx,
426 .edx=edx,
427 .ebx=ebx,
428 .esp=esp,
429 .ebp=ebp,
430 .esi=esi,
431 .edi=edi,
432 .vector=intnumber,
433 .error_code=0, // ??
434 .eip=ip,
435 .cs=cs,
436 .eflags=flags // ??
437 };
438
439 // Call the interrupt handler for this int#
440 ret = intXX_handler[intnumber](&reg_info);
441
442 // Put registers back on the stack. The assembler code
443 // will later pop them.
444 // What happens here is that we force (volatile!) changing
445 // the values of the parameters of this function. We do this
Stefan Reinauer14e22772010-04-27 06:56:47 +0000446 // because we know that they stay alive on the stack after
Stefan Reinauer38cd29e2009-08-11 21:28:25 +0000447 // we leave this function. Don't say this is bollocks.
448 *(volatile u32 *)&eax = reg_info.eax;
449 *(volatile u32 *)&ecx = reg_info.ecx;
450 *(volatile u32 *)&edx = reg_info.edx;
451 *(volatile u32 *)&ebx = reg_info.ebx;
452 *(volatile u32 *)&esi = reg_info.esi;
453 *(volatile u32 *)&edi = reg_info.edi;
454 flags = reg_info.eflags;
455
456 /* Pass errors back to our caller via the CARRY flag */
457 if (ret) {
Stefan Reinauerf75b19a2010-04-22 18:15:32 +0000458 printk(BIOS_DEBUG,"int%02x call returned error.\n", intnumber);
Stefan Reinauer38cd29e2009-08-11 21:28:25 +0000459 flags |= 1; // error: set carry
460 }else{
461 flags &= ~1; // no error: clear carry
462 }
463 *(volatile u16 *)&stackflags = flags;
464
465 return ret;
466}
467