Kevin O'Connor | f076a3e | 2008-02-25 22:25:15 -0500 | [diff] [blame] | 1 | // 32bit code to Power On Self Test (POST) a machine. |
| 2 | // |
| 3 | // Copyright (C) 2008 Kevin O'Connor <kevin@koconnor.net> |
| 4 | // Copyright (C) 2002 MandrakeSoft S.A. |
| 5 | // |
| 6 | // This file may be distributed under the terms of the GNU GPLv3 license. |
| 7 | |
| 8 | #include "ioport.h" // PORT_* |
Kevin O'Connor | f076a3e | 2008-02-25 22:25:15 -0500 | [diff] [blame] | 9 | #include "config.h" // CONFIG_* |
| 10 | #include "cmos.h" // CMOS_* |
| 11 | #include "util.h" // memset |
| 12 | #include "biosvar.h" // struct bios_data_area_s |
Kevin O'Connor | 2ad3744 | 2008-05-06 19:49:01 -0400 | [diff] [blame] | 13 | #include "ata.h" // hard_drive_setup |
Kevin O'Connor | 3bbcc14 | 2008-04-13 17:07:33 -0400 | [diff] [blame] | 14 | #include "disk.h" // floppy_drive_setup |
Kevin O'Connor | c781293 | 2008-06-08 23:08:12 -0400 | [diff] [blame] | 15 | #include "memmap.h" // add_e820 |
Kevin O'Connor | f54c150 | 2008-06-14 15:56:16 -0400 | [diff] [blame] | 16 | #include "pic.h" // pic_setup |
Kevin O'Connor | 0525d29 | 2008-07-04 06:18:30 -0400 | [diff] [blame] | 17 | #include "pci.h" // create_pirtable |
| 18 | #include "acpi.h" // acpi_bios_init |
Kevin O'Connor | 9521e26 | 2008-07-04 13:04:29 -0400 | [diff] [blame] | 19 | #include "bregs.h" // struct bregs |
Kevin O'Connor | c659fde | 2008-12-28 23:43:20 -0500 | [diff] [blame] | 20 | #include "boot.h" // IPL |
Kevin O'Connor | f076a3e | 2008-02-25 22:25:15 -0500 | [diff] [blame] | 21 | |
Kevin O'Connor | 438f635 | 2008-03-30 21:46:53 -0400 | [diff] [blame] | 22 | #define bda ((struct bios_data_area_s *)MAKE_FARPTR(SEG_BDA, 0)) |
Kevin O'Connor | f076a3e | 2008-02-25 22:25:15 -0500 | [diff] [blame] | 23 | |
Kevin O'Connor | d21c089 | 2008-11-26 17:02:43 -0500 | [diff] [blame] | 24 | void |
| 25 | __set_irq(int vector, void *loc) |
Kevin O'Connor | e3677b1 | 2008-07-04 15:29:23 -0400 | [diff] [blame] | 26 | { |
| 27 | SET_BDA(ivecs[vector].seg, SEG_BIOS); |
Kevin O'Connor | 2fda7cb | 2008-07-05 20:41:53 -0400 | [diff] [blame] | 28 | SET_BDA(ivecs[vector].offset, (u32)loc - BUILD_BIOS_ADDR); |
Kevin O'Connor | e3677b1 | 2008-07-04 15:29:23 -0400 | [diff] [blame] | 29 | } |
| 30 | |
Kevin O'Connor | d21c089 | 2008-11-26 17:02:43 -0500 | [diff] [blame] | 31 | #define set_irq(vector, func) do { \ |
| 32 | extern void func (void); \ |
| 33 | __set_irq(vector, func); \ |
| 34 | } while (0) |
Kevin O'Connor | 2fda7cb | 2008-07-05 20:41:53 -0400 | [diff] [blame] | 35 | |
Kevin O'Connor | e3677b1 | 2008-07-04 15:29:23 -0400 | [diff] [blame] | 36 | static void |
Kevin O'Connor | f076a3e | 2008-02-25 22:25:15 -0500 | [diff] [blame] | 37 | init_bda() |
| 38 | { |
Kevin O'Connor | 35192dd | 2008-06-08 19:18:33 -0400 | [diff] [blame] | 39 | dprintf(3, "init bda\n"); |
Kevin O'Connor | f076a3e | 2008-02-25 22:25:15 -0500 | [diff] [blame] | 40 | memset(bda, 0, sizeof(*bda)); |
| 41 | |
Kevin O'Connor | d21c089 | 2008-11-26 17:02:43 -0500 | [diff] [blame] | 42 | // Initialize all vectors to a dummy handler. |
Kevin O'Connor | f076a3e | 2008-02-25 22:25:15 -0500 | [diff] [blame] | 43 | int i; |
Kevin O'Connor | e3677b1 | 2008-07-04 15:29:23 -0400 | [diff] [blame] | 44 | for (i=0; i<256; i++) |
Kevin O'Connor | d21c089 | 2008-11-26 17:02:43 -0500 | [diff] [blame] | 45 | set_irq(i, dummy_iret_handler); |
Kevin O'Connor | f076a3e | 2008-02-25 22:25:15 -0500 | [diff] [blame] | 46 | |
Kevin O'Connor | d21c089 | 2008-11-26 17:02:43 -0500 | [diff] [blame] | 47 | // Initialize all hw vectors to a default hw handler. |
| 48 | for (i=0x08; i<=0x0f; i++) |
Kevin O'Connor | ffdc9ee | 2008-12-20 13:10:00 -0500 | [diff] [blame] | 49 | set_irq(i, entry_hwpic1); |
Kevin O'Connor | d21c089 | 2008-11-26 17:02:43 -0500 | [diff] [blame] | 50 | for (i=0x70; i<=0x77; i++) |
Kevin O'Connor | ffdc9ee | 2008-12-20 13:10:00 -0500 | [diff] [blame] | 51 | set_irq(i, entry_hwpic2); |
Kevin O'Connor | d21c089 | 2008-11-26 17:02:43 -0500 | [diff] [blame] | 52 | |
| 53 | // Initialize software handlers. |
| 54 | set_irq(0x10, entry_10); |
Kevin O'Connor | b4f0e89 | 2008-12-13 18:33:05 -0500 | [diff] [blame] | 55 | set_irq(0x11, entry_11_official); |
| 56 | set_irq(0x12, entry_12_official); |
| 57 | set_irq(0x13, entry_13_official); |
Kevin O'Connor | d21c089 | 2008-11-26 17:02:43 -0500 | [diff] [blame] | 58 | set_irq(0x14, entry_14); |
| 59 | set_irq(0x15, entry_15); |
| 60 | set_irq(0x16, entry_16); |
| 61 | set_irq(0x17, entry_17); |
| 62 | set_irq(0x18, entry_18); |
Kevin O'Connor | b4f0e89 | 2008-12-13 18:33:05 -0500 | [diff] [blame] | 63 | set_irq(0x19, entry_19_official); |
Kevin O'Connor | d21c089 | 2008-11-26 17:02:43 -0500 | [diff] [blame] | 64 | set_irq(0x1a, entry_1a); |
| 65 | set_irq(0x1c, entry_1c); |
| 66 | set_irq(0x40, entry_40); |
Kevin O'Connor | f076a3e | 2008-02-25 22:25:15 -0500 | [diff] [blame] | 67 | |
Kevin O'Connor | f076a3e | 2008-02-25 22:25:15 -0500 | [diff] [blame] | 68 | // set vector 0x79 to zero |
| 69 | // this is used by 'gardian angel' protection system |
Kevin O'Connor | e906149 | 2008-03-11 21:54:18 -0400 | [diff] [blame] | 70 | SET_BDA(ivecs[0x79].seg, 0); |
| 71 | SET_BDA(ivecs[0x79].offset, 0); |
Kevin O'Connor | f076a3e | 2008-02-25 22:25:15 -0500 | [diff] [blame] | 72 | |
Kevin O'Connor | d21c089 | 2008-11-26 17:02:43 -0500 | [diff] [blame] | 73 | __set_irq(0x1E, &diskette_param_table2); |
Kevin O'Connor | f076a3e | 2008-02-25 22:25:15 -0500 | [diff] [blame] | 74 | } |
| 75 | |
| 76 | static void |
| 77 | init_ebda() |
| 78 | { |
Kevin O'Connor | 4d7c37e | 2008-12-26 23:50:17 -0500 | [diff] [blame] | 79 | int esize = DIV_ROUND_UP(sizeof(struct extended_bios_data_area_s), 1024); |
| 80 | SET_BDA(mem_size_kb, 640 - esize); |
| 81 | u16 eseg = FARPTR_TO_SEG((640 - esize) * 1024); |
| 82 | SET_BDA(ebda_seg, eseg); |
| 83 | |
| 84 | struct extended_bios_data_area_s *ebda = get_ebda_ptr(); |
Kevin O'Connor | 38fcbfe | 2008-02-25 22:30:47 -0500 | [diff] [blame] | 85 | memset(ebda, 0, sizeof(*ebda)); |
Kevin O'Connor | 4d7c37e | 2008-12-26 23:50:17 -0500 | [diff] [blame] | 86 | ebda->size = esize; |
| 87 | SET_BDA(ivecs[0x41].seg, eseg); |
Kevin O'Connor | e906149 | 2008-03-11 21:54:18 -0400 | [diff] [blame] | 88 | SET_BDA(ivecs[0x41].offset |
Kevin O'Connor | 9f0d94d | 2008-04-13 17:25:30 -0400 | [diff] [blame] | 89 | , offsetof(struct extended_bios_data_area_s, fdpt[0])); |
Kevin O'Connor | 4d7c37e | 2008-12-26 23:50:17 -0500 | [diff] [blame] | 90 | SET_BDA(ivecs[0x46].seg, eseg); |
| 91 | SET_BDA(ivecs[0x46].offset |
Kevin O'Connor | 9f0d94d | 2008-04-13 17:25:30 -0400 | [diff] [blame] | 92 | , offsetof(struct extended_bios_data_area_s, fdpt[1])); |
Kevin O'Connor | f076a3e | 2008-02-25 22:25:15 -0500 | [diff] [blame] | 93 | } |
| 94 | |
| 95 | static void |
Kevin O'Connor | 9571ac2 | 2008-05-17 22:20:27 -0400 | [diff] [blame] | 96 | ram_probe(void) |
| 97 | { |
Kevin O'Connor | 35192dd | 2008-06-08 19:18:33 -0400 | [diff] [blame] | 98 | dprintf(3, "Find memory size\n"); |
Kevin O'Connor | f64f0db | 2008-05-18 02:42:58 -0400 | [diff] [blame] | 99 | if (CONFIG_COREBOOT) { |
Kevin O'Connor | c781293 | 2008-06-08 23:08:12 -0400 | [diff] [blame] | 100 | coreboot_fill_map(); |
Kevin O'Connor | f64f0db | 2008-05-18 02:42:58 -0400 | [diff] [blame] | 101 | } else { |
| 102 | // On emulators, get memory size from nvram. |
Kevin O'Connor | 59c35f2 | 2008-10-25 23:05:42 -0400 | [diff] [blame] | 103 | u32 rs = ((inb_cmos(CMOS_MEM_EXTMEM2_LOW) << 16) |
| 104 | | (inb_cmos(CMOS_MEM_EXTMEM2_HIGH) << 24)); |
Kevin O'Connor | f64f0db | 2008-05-18 02:42:58 -0400 | [diff] [blame] | 105 | if (rs) |
| 106 | rs += 16 * 1024 * 1024; |
| 107 | else |
Kevin O'Connor | 59c35f2 | 2008-10-25 23:05:42 -0400 | [diff] [blame] | 108 | rs = (((inb_cmos(CMOS_MEM_EXTMEM_LOW) << 10) |
| 109 | | (inb_cmos(CMOS_MEM_EXTMEM_HIGH) << 18)) |
Kevin O'Connor | f64f0db | 2008-05-18 02:42:58 -0400 | [diff] [blame] | 110 | + 1 * 1024 * 1024); |
Kevin O'Connor | e791636 | 2008-12-28 22:03:17 -0500 | [diff] [blame] | 111 | RamSize = rs; |
Kevin O'Connor | c781293 | 2008-06-08 23:08:12 -0400 | [diff] [blame] | 112 | add_e820(0, rs, E820_RAM); |
| 113 | |
Kevin O'Connor | 59c35f2 | 2008-10-25 23:05:42 -0400 | [diff] [blame] | 114 | // Check for memory over 4Gig |
| 115 | u64 high = ((inb_cmos(CMOS_MEM_HIGHMEM_LOW) << 16) |
| 116 | | (inb_cmos(CMOS_MEM_HIGHMEM_MID) << 24) |
| 117 | | ((u64)inb_cmos(CMOS_MEM_HIGHMEM_HIGH) << 32)); |
Kevin O'Connor | e791636 | 2008-12-28 22:03:17 -0500 | [diff] [blame] | 118 | RamSizeOver4G = high; |
Kevin O'Connor | 59c35f2 | 2008-10-25 23:05:42 -0400 | [diff] [blame] | 119 | add_e820(0x100000000ull, high, E820_RAM); |
| 120 | |
Kevin O'Connor | c781293 | 2008-06-08 23:08:12 -0400 | [diff] [blame] | 121 | /* reserve 256KB BIOS area at the end of 4 GB */ |
| 122 | add_e820(0xfffc0000, 256*1024, E820_RESERVED); |
Kevin O'Connor | f64f0db | 2008-05-18 02:42:58 -0400 | [diff] [blame] | 123 | } |
Kevin O'Connor | 9571ac2 | 2008-05-17 22:20:27 -0400 | [diff] [blame] | 124 | |
Kevin O'Connor | b8d7a47 | 2008-06-21 11:43:32 -0400 | [diff] [blame] | 125 | // Don't declare any memory between 0xa0000 and 0x100000 |
| 126 | add_e820(0xa0000, 0x50000, E820_HOLE); |
| 127 | |
Kevin O'Connor | c781293 | 2008-06-08 23:08:12 -0400 | [diff] [blame] | 128 | // Mark known areas as reserved. |
Kevin O'Connor | 4d7c37e | 2008-12-26 23:50:17 -0500 | [diff] [blame] | 129 | add_e820((u32)MAKE_FARPTR(GET_BDA(ebda_seg), 0), GET_EBDA(size) * 1024 |
| 130 | , E820_RESERVED); |
Kevin O'Connor | e3677b1 | 2008-07-04 15:29:23 -0400 | [diff] [blame] | 131 | add_e820(BUILD_BIOS_ADDR, BUILD_BIOS_SIZE, E820_RESERVED); |
Kevin O'Connor | c781293 | 2008-06-08 23:08:12 -0400 | [diff] [blame] | 132 | |
Kevin O'Connor | e791636 | 2008-12-28 22:03:17 -0500 | [diff] [blame] | 133 | dprintf(1, "Ram Size=0x%08x\n", RamSize); |
Kevin O'Connor | 9571ac2 | 2008-05-17 22:20:27 -0400 | [diff] [blame] | 134 | } |
| 135 | |
| 136 | static void |
Kevin O'Connor | 0525d29 | 2008-07-04 06:18:30 -0400 | [diff] [blame] | 137 | init_bios_tables(void) |
| 138 | { |
| 139 | if (CONFIG_COREBOOT) |
| 140 | // XXX - not supported on coreboot yet. |
| 141 | return; |
| 142 | |
Kevin O'Connor | 0525d29 | 2008-07-04 06:18:30 -0400 | [diff] [blame] | 143 | create_pirtable(); |
| 144 | |
| 145 | mptable_init(); |
| 146 | |
| 147 | smbios_init(); |
| 148 | |
| 149 | acpi_bios_init(); |
| 150 | } |
| 151 | |
| 152 | static void |
Kevin O'Connor | f076a3e | 2008-02-25 22:25:15 -0500 | [diff] [blame] | 153 | init_boot_vectors() |
| 154 | { |
Kevin O'Connor | 4096702 | 2008-07-21 22:23:05 -0400 | [diff] [blame] | 155 | if (! CONFIG_BOOT) |
| 156 | return; |
Kevin O'Connor | 35192dd | 2008-06-08 19:18:33 -0400 | [diff] [blame] | 157 | dprintf(3, "init boot device ordering\n"); |
| 158 | |
Kevin O'Connor | 38fcbfe | 2008-02-25 22:30:47 -0500 | [diff] [blame] | 159 | // Floppy drive |
Kevin O'Connor | c659fde | 2008-12-28 23:43:20 -0500 | [diff] [blame] | 160 | struct ipl_entry_s *ip = &IPL.table[0]; |
Kevin O'Connor | 38fcbfe | 2008-02-25 22:30:47 -0500 | [diff] [blame] | 161 | ip->type = IPL_TYPE_FLOPPY; |
| 162 | ip++; |
| 163 | |
| 164 | // First HDD |
| 165 | ip->type = IPL_TYPE_HARDDISK; |
| 166 | ip++; |
| 167 | |
| 168 | // CDROM |
Kevin O'Connor | 180a959 | 2008-03-04 22:50:53 -0500 | [diff] [blame] | 169 | if (CONFIG_CDROM_BOOT) { |
Kevin O'Connor | 38fcbfe | 2008-02-25 22:30:47 -0500 | [diff] [blame] | 170 | ip->type = IPL_TYPE_CDROM; |
| 171 | ip++; |
| 172 | } |
| 173 | |
Kevin O'Connor | c659fde | 2008-12-28 23:43:20 -0500 | [diff] [blame] | 174 | IPL.count = ip - IPL.table; |
| 175 | SET_EBDA(boot_sequence, 0xffff); |
Kevin O'Connor | f64f0db | 2008-05-18 02:42:58 -0400 | [diff] [blame] | 176 | if (CONFIG_COREBOOT) { |
| 177 | // XXX - hardcode defaults for coreboot. |
Kevin O'Connor | c659fde | 2008-12-28 23:43:20 -0500 | [diff] [blame] | 178 | IPL.bootorder = 0x00000231; |
| 179 | IPL.checkfloppysig = 1; |
Kevin O'Connor | f64f0db | 2008-05-18 02:42:58 -0400 | [diff] [blame] | 180 | } else { |
| 181 | // On emulators, get boot order from nvram. |
Kevin O'Connor | c659fde | 2008-12-28 23:43:20 -0500 | [diff] [blame] | 182 | IPL.bootorder = (inb_cmos(CMOS_BIOS_BOOTFLAG2) |
| 183 | | ((inb_cmos(CMOS_BIOS_BOOTFLAG1) & 0xf0) << 4)); |
Kevin O'Connor | f64f0db | 2008-05-18 02:42:58 -0400 | [diff] [blame] | 184 | if (!(inb_cmos(CMOS_BIOS_BOOTFLAG1) & 1)) |
Kevin O'Connor | c659fde | 2008-12-28 23:43:20 -0500 | [diff] [blame] | 185 | IPL.checkfloppysig = 1; |
Kevin O'Connor | f64f0db | 2008-05-18 02:42:58 -0400 | [diff] [blame] | 186 | } |
Kevin O'Connor | f076a3e | 2008-02-25 22:25:15 -0500 | [diff] [blame] | 187 | } |
| 188 | |
Kevin O'Connor | da4a648 | 2008-06-08 13:48:06 -0400 | [diff] [blame] | 189 | // Main setup code. |
Kevin O'Connor | f076a3e | 2008-02-25 22:25:15 -0500 | [diff] [blame] | 190 | static void |
Kevin O'Connor | f076a3e | 2008-02-25 22:25:15 -0500 | [diff] [blame] | 191 | post() |
| 192 | { |
Kevin O'Connor | f076a3e | 2008-02-25 22:25:15 -0500 | [diff] [blame] | 193 | init_bda(); |
Kevin O'Connor | f076a3e | 2008-02-25 22:25:15 -0500 | [diff] [blame] | 194 | init_ebda(); |
| 195 | |
Kevin O'Connor | f54c150 | 2008-06-14 15:56:16 -0400 | [diff] [blame] | 196 | pic_setup(); |
Kevin O'Connor | e6eb3f5 | 2008-04-13 17:37:41 -0400 | [diff] [blame] | 197 | timer_setup(); |
Kevin O'Connor | 714325c | 2008-11-01 20:32:27 -0400 | [diff] [blame] | 198 | mathcp_setup(); |
| 199 | |
Kevin O'Connor | acf1374 | 2008-11-29 11:19:19 -0500 | [diff] [blame] | 200 | smp_probe_setup(); |
Kevin O'Connor | cf89e66 | 2008-11-28 11:56:37 -0500 | [diff] [blame] | 201 | |
Kevin O'Connor | ceea03c | 2008-11-08 21:36:35 -0500 | [diff] [blame] | 202 | memmap_setup(); |
| 203 | ram_probe(); |
| 204 | |
Kevin O'Connor | 0c3068d | 2008-12-21 17:51:36 -0500 | [diff] [blame] | 205 | pnp_setup(); |
Kevin O'Connor | 714325c | 2008-11-01 20:32:27 -0400 | [diff] [blame] | 206 | vga_setup(); |
| 207 | |
Kevin O'Connor | f076a3e | 2008-02-25 22:25:15 -0500 | [diff] [blame] | 208 | kbd_setup(); |
| 209 | lpt_setup(); |
| 210 | serial_setup(); |
Kevin O'Connor | f54c150 | 2008-06-14 15:56:16 -0400 | [diff] [blame] | 211 | mouse_setup(); |
Kevin O'Connor | a2e7380 | 2008-02-27 10:27:00 -0500 | [diff] [blame] | 212 | |
Kevin O'Connor | 0525d29 | 2008-07-04 06:18:30 -0400 | [diff] [blame] | 213 | pci_bios_setup(); |
Kevin O'Connor | 4bbd3b3 | 2008-12-10 21:01:00 -0500 | [diff] [blame] | 214 | smm_init(); |
| 215 | |
Kevin O'Connor | 0525d29 | 2008-07-04 06:18:30 -0400 | [diff] [blame] | 216 | init_bios_tables(); |
Kevin O'Connor | c781293 | 2008-06-08 23:08:12 -0400 | [diff] [blame] | 217 | memmap_finalize(); |
| 218 | |
Kevin O'Connor | 3bbcc14 | 2008-04-13 17:07:33 -0400 | [diff] [blame] | 219 | floppy_drive_setup(); |
Kevin O'Connor | 9f0d94d | 2008-04-13 17:25:30 -0400 | [diff] [blame] | 220 | hard_drive_setup(); |
Kevin O'Connor | a2e7380 | 2008-02-27 10:27:00 -0500 | [diff] [blame] | 221 | |
| 222 | init_boot_vectors(); |
Kevin O'Connor | a4d3576 | 2008-03-08 15:43:03 -0500 | [diff] [blame] | 223 | |
Kevin O'Connor | 714325c | 2008-11-01 20:32:27 -0400 | [diff] [blame] | 224 | optionrom_setup(); |
Kevin O'Connor | f076a3e | 2008-02-25 22:25:15 -0500 | [diff] [blame] | 225 | } |
| 226 | |
Kevin O'Connor | da4a648 | 2008-06-08 13:48:06 -0400 | [diff] [blame] | 227 | // 32-bit entry point. |
Kevin O'Connor | 1978676 | 2008-03-05 21:09:59 -0500 | [diff] [blame] | 228 | void VISIBLE32 |
Kevin O'Connor | f076a3e | 2008-02-25 22:25:15 -0500 | [diff] [blame] | 229 | _start() |
| 230 | { |
Kevin O'Connor | 95576e7 | 2008-03-01 09:57:51 -0500 | [diff] [blame] | 231 | init_dma(); |
Kevin O'Connor | 95576e7 | 2008-03-01 09:57:51 -0500 | [diff] [blame] | 232 | |
Kevin O'Connor | 61d6b06 | 2008-06-21 12:15:10 -0400 | [diff] [blame] | 233 | debug_serial_setup(); |
Kevin O'Connor | da4a648 | 2008-06-08 13:48:06 -0400 | [diff] [blame] | 234 | dprintf(1, "Start bios\n"); |
| 235 | |
Kevin O'Connor | acf1374 | 2008-11-29 11:19:19 -0500 | [diff] [blame] | 236 | // Allow writes to modify bios area (0xf0000) |
Kevin O'Connor | da4a648 | 2008-06-08 13:48:06 -0400 | [diff] [blame] | 237 | make_bios_writable(); |
| 238 | |
| 239 | // Perform main setup code. |
Kevin O'Connor | f076a3e | 2008-02-25 22:25:15 -0500 | [diff] [blame] | 240 | post(); |
Kevin O'Connor | da4a648 | 2008-06-08 13:48:06 -0400 | [diff] [blame] | 241 | |
| 242 | // Present the user with a bootup menu. |
| 243 | interactive_bootmenu(); |
| 244 | |
Kevin O'Connor | e90f264 | 2008-06-28 12:18:39 -0400 | [diff] [blame] | 245 | // Setup bios checksum. |
Kevin O'Connor | 2fda7cb | 2008-07-05 20:41:53 -0400 | [diff] [blame] | 246 | extern char bios_checksum; |
| 247 | bios_checksum = -checksum((u8*)BUILD_BIOS_ADDR, BUILD_BIOS_SIZE - 1); |
Kevin O'Connor | e90f264 | 2008-06-28 12:18:39 -0400 | [diff] [blame] | 248 | |
Kevin O'Connor | da4a648 | 2008-06-08 13:48:06 -0400 | [diff] [blame] | 249 | // Prep for boot process. |
| 250 | make_bios_readonly(); |
Kevin O'Connor | da4a648 | 2008-06-08 13:48:06 -0400 | [diff] [blame] | 251 | |
| 252 | // Invoke int 19 to start boot process. |
| 253 | dprintf(3, "Jump to int19\n"); |
| 254 | struct bregs br; |
| 255 | memset(&br, 0, sizeof(br)); |
| 256 | call16_int(0x19, &br); |
Kevin O'Connor | f076a3e | 2008-02-25 22:25:15 -0500 | [diff] [blame] | 257 | } |
Kevin O'Connor | 4b39b82 | 2008-05-08 21:47:33 -0400 | [diff] [blame] | 258 | |
Kevin O'Connor | 2fda7cb | 2008-07-05 20:41:53 -0400 | [diff] [blame] | 259 | // Ughh - some older gcc compilers have a bug which causes VISIBLE32 |
| 260 | // functions to not be exported as a global variable - force _start |
| 261 | // to be global here. |
| 262 | asm(".global _start"); |