vesa_stage.S 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687
  1. /*
  2. * VESA real-mode stage: runs at 0x7E00 before protected mode.
  3. *
  4. * Called by the boot sector in real mode (CS=0, IP=0x7E00).
  5. * Probes the E820 map, enables A20, copies the command-pack rootfs into
  6. * high memory (INT 15h AH=87h, so the CPU never leaves real mode), walks
  7. * the VBE mode list and picks the best mode (highest resolution, >= 16 bpp,
  8. * LFB, fits in VRAM), writes the mode info to 0x600 and the boot info to
  9. * 0x500, then enters protected mode and jumps to kernel_entry.
  10. *
  11. * If no VESA mode works, boots in text mode (valid=0 at 0x600).
  12. */
  13. .code16
  14. .section .text.stage2, "ax", @progbits
  15. .globl _vesa_stage
  16. /* E820 map constants (must match mm.h). */
  17. .equ E820_MAGIC, 0xE820E820
  18. .equ E820_BUF_END, 0x1008 + 32*24 /* 32 entries * 24 bytes */
  19. /* Rootfs/boot-info constants (must match rootfs.h / bootinfo.h). */
  20. .equ ROOTFS_VERSION, 1
  21. .equ PACK_MAX, 0x400000 /* 4 MB gzip payload cap */
  22. .equ PACK_MIN_ADDR, 0x900000 /* just above the VGA shadow reserve */
  23. .equ PACK_TOP_ADDR, 0x1000000 /* INT 15h AH=87h has a 24-bit base */
  24. .equ BOOT_INFO_MAGIC, 0x4E425349
  25. .equ BOOT_INFO_VERSION, 2
  26. .equ BOOT_INFO_WORDS, 12
  27. _vesa_stage:
  28. xorw %ax, %ax
  29. movw %ax, %ds
  30. movw %ax, %es
  31. cld
  32. movb %dl, stage_drive
  33. /* Ask the BIOS whether this drive supports EDD LBA reads. USB sticks
  34. * are sometimes presented as floppies (DL=0); the CHS geometry used
  35. * below cannot reach a rootfs image there. */
  36. movb stage_drive, %dl
  37. movb $0x41, %ah
  38. movw $0x55AA, %bx
  39. int $0x13
  40. jc 1f
  41. cmpw $0xAA55, %bx
  42. jne 1f
  43. testb $0x01, %cl
  44. jz 1f
  45. movb $1, use_lba
  46. 1: xorw %ax, %ax
  47. movw %ax, %ds
  48. movw %ax, %es
  49. /* No UEFI boot-info block on the BIOS path (see bootinfo.h). The boot
  50. * sector used 0x500 as its disk-address packet, so clear the magic;
  51. * write_bootinfo fills in the real block before the PM jump. */
  52. movl $0, 0x500
  53. /* ---- Probe INT 15h E820 memory map into 0:0x1000 ----
  54. * Layout (see mm.h): [magic u32][count u32][24-byte entries...].
  55. * Stored below the kernel (0x7E00) so it survives kexec reloads,
  56. * which re-run kernel_main but not this real-mode stage. */
  57. movl $E820_MAGIC, 0x1000 /* magic */
  58. movl $0, 0x1004 /* count = 0 */
  59. xorl %ebx, %ebx /* continuation value */
  60. movl $0x1008, %edi /* ES:DI -> first entry */
  61. e820_loop:
  62. xorw %ax, %ax
  63. movw %ax, %es /* (re)set ES for the BIOS buffer */
  64. movl $0xE820, %eax
  65. movl $0x534D4150, %edx /* "SMAP" */
  66. movl $24, %ecx
  67. int $0x15
  68. jc e820_done /* CF set -> unsupported / done */
  69. cmpl $0x534D4150, %eax
  70. jne e820_done /* not "SMAP" -> done */
  71. cmpb $20, %cl
  72. jb e820_done /* too short -> stop */
  73. movl $0, 20(%edi) /* zero ACPI attrs (BIOS may write 20 B) */
  74. incl 0x1004 /* count++ */
  75. addl $24, %edi
  76. testl %ebx, %ebx
  77. jz e820_done /* continuation == 0 -> done */
  78. cmpl $E820_BUF_END, %edi
  79. jae e820_done /* buffer full -> stop */
  80. jmp e820_loop
  81. e820_done:
  82. /* ---- Rootfs: copy the command pack into high RAM ----
  83. * The pack is a gzip blob behind a one-sector NBROOT1 header (rootfs.h).
  84. * The destination is the top of RAM below 16 MB (the AH=87h block move
  85. * uses 24-bit descriptor bases), well above the 1..9 MB shadow reserve. */
  86. call enable_a20
  87. xorw %ax, %ax
  88. movw %ax, %ds
  89. movw %ax, %es
  90. movw $msg_pack, %si
  91. call print_str
  92. movzbl stage_drive, %eax
  93. call print_hex32
  94. movw $msg_lba, %si
  95. call print_str
  96. movl pack_lba, %eax
  97. call print_hex32
  98. movw $msg_e, %si
  99. call print_str
  100. movzbl use_lba, %eax
  101. addl $'0', %eax
  102. movb $0x0E, %ah
  103. movb $0x00, %bh
  104. int $0x10
  105. movw $msg_end, %si
  106. call print_str
  107. movl 0x7C42, %eax /* boot-sector pack_lba field */
  108. movl %eax, pack_lba
  109. movl $0, pack_addr
  110. movl $0, pack_bytes
  111. testl %eax, %eax
  112. jz pack_fail
  113. movl pack_lba, %eax
  114. movw $1, %cx
  115. call read_sectors
  116. jc pack_fail
  117. /* Validate the header at 0x80000: "NBROOT1\0", version 1. */
  118. movl $0x80000, %esi
  119. movl 0(%esi), %eax
  120. cmpl $0x4F52424E, %eax /* "NBRO" */
  121. jne pack_fail
  122. movl 4(%esi), %eax
  123. cmpl $0x0031544F, %eax /* "OT1\0" */
  124. jne pack_fail
  125. cmpl $ROOTFS_VERSION, 8(%esi)
  126. jne pack_fail
  127. movl 12(%esi), %eax /* pack_bytes */
  128. testl %eax, %eax
  129. jz pack_fail
  130. cmpl $PACK_MAX, %eax
  131. ja pack_fail
  132. movl %eax, pack_bytes
  133. movw $msg_dot, %si
  134. call print_str
  135. call compute_pack_addr
  136. testl %eax, %eax
  137. jz pack_noroom
  138. movl %eax, pack_addr
  139. movl $0, pack_off
  140. load_loop:
  141. movl pack_off, %eax
  142. cmpl pack_bytes, %eax
  143. jae load_ok
  144. movl pack_bytes, %ecx
  145. subl %eax, %ecx
  146. addl $511, %ecx
  147. shrl $9, %ecx
  148. cmpl $64, %ecx
  149. jbe 1f
  150. movl $64, %ecx
  151. 1: movl %ecx, chunk_sectors
  152. movl pack_off, %eax
  153. shrl $9, %eax
  154. addl pack_lba, %eax
  155. incl %eax /* pack data starts after the header */
  156. call read_sectors
  157. jc pack_fail
  158. movl chunk_sectors, %eax
  159. shll $9, %eax
  160. movl %eax, copy_len
  161. movl pack_addr, %eax
  162. addl pack_off, %eax
  163. movl %eax, copy_dst
  164. call bios_copy
  165. jc pack_fail
  166. movl chunk_sectors, %eax
  167. shll $9, %eax
  168. addl %eax, pack_off
  169. movw $msg_dot, %si
  170. call print_str
  171. jmp load_loop
  172. load_ok:
  173. movw $msg_ok, %si
  174. call print_str
  175. jmp pack_done
  176. pack_noroom:
  177. movw $msg_noroom, %si
  178. call print_str
  179. jmp pack_clear
  180. pack_fail:
  181. movw $msg_fail, %si
  182. call print_str
  183. pack_clear:
  184. movl $0, pack_addr
  185. movl $0, pack_bytes
  186. pack_done:
  187. /* read_sectors leaves ES at the staging segment; the VBE calls below
  188. * expect a normal zero segment. */
  189. xorw %ax, %ax
  190. movw %ax, %ds
  191. movw %ax, %es
  192. /* ---- VBE Controller Info into 0:0x2000 ---- */
  193. movw $0x2000, %di
  194. movw $0x4256, (%di) /* "VB" */
  195. movw $0x3245, 2(%di) /* "E2" */
  196. movw $0x4F00, %ax
  197. int $0x10
  198. cmpw $0x004F, %ax
  199. jnz vesa_no_vbe
  200. /* Save VRAM size (offset 0x12: TotalMemory in 64KB blocks). */
  201. movw 0x12(%di), %ax
  202. testw %ax, %ax
  203. jnz 1f
  204. movw $0xFFFF, %ax
  205. 1: movw %ax, vram_64k
  206. /* Get mode list pointer (offset 0x0E: far pointer seg:off). */
  207. movw 0x200E, %si /* offset (buffer at 0x2000) */
  208. movw 0x2010, %ax /* segment */
  209. movw %ax, %fs /* FS:SI = mode list */
  210. /* ---- Walk mode list, pick best mode ---- */
  211. movw $0, best_mode
  212. movl $0, best_score
  213. walk_modes:
  214. movw %fs:(%si), %cx
  215. cmpw $0xFFFF, %cx
  216. jz walk_done
  217. addw $2, %si
  218. /* Query mode info: VBE 4F01h into 0:0x2200. */
  219. pushw %si
  220. pushw %cx
  221. xorw %ax, %ax
  222. movw %ax, %es
  223. movw $0x2200, %di
  224. movw $0x4F01, %ax
  225. int $0x10
  226. popw %cx
  227. popw %si
  228. cmpw $0x004F, %ax
  229. jnz walk_modes
  230. /* Check: supported (bit 0) + graphics (bit 4) + LFB (bit 7). */
  231. movw 0x2200, %ax
  232. andw $0x0091, %ax
  233. cmpw $0x0091, %ax
  234. jnz walk_modes
  235. /* Check: BitsPerPixel >= 16. */
  236. cmpb $16, 0x2219
  237. jb walk_modes
  238. /* TODO: Remove this width cap when display scaling is improved. */
  239. cmpw $1280, 0x2212
  240. ja walk_modes
  241. /* Check: fits in VRAM. */
  242. movw 0x2210, %ax
  243. mulw 0x2214
  244. testw %ax, %ax
  245. jz 2f
  246. incw %dx
  247. 2: cmpw vram_64k, %dx
  248. ja walk_modes
  249. /* Score = width * height + bpp. */
  250. movzwl 0x2212, %eax
  251. movzwl 0x2214, %edx
  252. imull %edx, %eax
  253. movzbl 0x2219, %edx
  254. addl %edx, %eax
  255. cmpl best_score, %eax
  256. jbe walk_modes
  257. movl %eax, best_score
  258. movw %cx, best_mode
  259. /* Save mode info block to 0:0x2400. */
  260. pushw %si
  261. pushw %cx
  262. movw $0x2200, %si
  263. movw $0x2400, %di
  264. movw $128, %cx
  265. cld
  266. rep movsw
  267. popw %cx
  268. popw %si
  269. jmp walk_modes
  270. walk_done:
  271. /* Did we find a mode? */
  272. movw best_mode, %cx
  273. testw %cx, %cx
  274. jz vesa_no_vbe
  275. /* ---- Set the mode ---- */
  276. movw %cx, %bx
  277. orw $0x4000, %bx /* LFB */
  278. movw $0x4F02, %ax
  279. int $0x10
  280. cmpw $0x004F, %ax
  281. jnz vesa_no_vbe
  282. /* ---- Fill 0x600 boot FB info from saved block at 0x2400 ---- */
  283. movw $0x600, %bx
  284. movb $1, (%bx)
  285. movw 0x2412, %ax
  286. movw %ax, 1(%bx) /* width */
  287. movw 0x2414, %ax
  288. movw %ax, 3(%bx) /* height */
  289. movw 0x2410, %ax
  290. movw %ax, 5(%bx) /* pitch */
  291. movb 0x2419, %al
  292. movb %al, 7(%bx) /* bpp */
  293. movw 0x2428, %ax
  294. movw %ax, 8(%bx) /* lfb_base lo */
  295. movw 0x242A, %ax
  296. movw %ax, 10(%bx) /* lfb_base hi */
  297. movw vram_64k, %ax
  298. movw %ax, 12(%bx) /* vram_64k */
  299. jmp stage_finish
  300. vesa_no_vbe:
  301. /* No VESA: stay in text mode, mark fb info invalid. */
  302. movw $0x600, %bx
  303. movb $0, (%bx)
  304. stage_finish:
  305. /* Publish the boot info after the last BIOS call that could touch
  306. * 0x500, then enter protected mode. */
  307. call write_bootinfo
  308. jmp enter_pm
  309. /* ---- A20 ---------------------------------------------------------------- */
  310. enable_a20:
  311. movw $0x2401, %ax
  312. int $0x15
  313. call a20_wait
  314. movb $0xD1, %al
  315. outb %al, $0x64
  316. call a20_wait
  317. movb $0xDF, %al
  318. outb %al, $0x60
  319. call a20_wait
  320. inb $0x92, %al
  321. testb $0x02, %al
  322. jnz 1f
  323. orb $0x02, %al
  324. andb $0xFE, %al
  325. outb %al, $0x92
  326. 1: ret
  327. a20_wait:
  328. inb $0x64, %al
  329. testb $0x02, %al
  330. jnz a20_wait
  331. ret
  332. /* ---- Read sectors via INT 13h ------------------------------------------
  333. * in: eax = LBA, cx = sector count
  334. * out: data at 0x80000, CF set on failure
  335. * Clobbers all general registers. */
  336. read_sectors:
  337. movl %eax, rd_lba
  338. movw %cx, rd_left
  339. movw $0, rd_off
  340. movw $0, rd_tries
  341. read_retry:
  342. movw rd_off, %bx
  343. xorw %ax, %ax
  344. movw %ax, %ds
  345. movw $0x8000, %ax
  346. movw %ax, %es
  347. movb stage_drive, %dl
  348. cmpb $0, use_lba
  349. jne read_lba
  350. cmpb $0x80, %dl
  351. jb read_chs
  352. read_lba:
  353. /* EDD LBA read */
  354. movw $0x10, 0x500
  355. movw $1, 0x502
  356. movw %bx, 0x504
  357. movw $0x8000, 0x506
  358. movl rd_lba, %eax
  359. movl %eax, 0x508
  360. movl $0, 0x50C
  361. movw $0x500, %si
  362. movb $0x42, %ah
  363. jmp read_int
  364. read_chs:
  365. movw rd_lba, %ax
  366. xorw %dx, %dx
  367. movw $18, %di
  368. divw %di
  369. movb %dl, %cl
  370. incb %cl
  371. xorw %dx, %dx
  372. movw $2, %di
  373. divw %di
  374. movb %dl, %dh
  375. movb %al, %ch
  376. movb stage_drive, %dl
  377. movb $0x02, %ah
  378. movb $1, %al
  379. movw rd_off, %bx
  380. read_int:
  381. int $0x13
  382. jnc read_ok
  383. /* Reset and retry the same sector a few times. */
  384. pushw %cx
  385. movb stage_drive, %dl
  386. xorw %ax, %ax
  387. int $0x13
  388. popw %cx
  389. incw rd_tries
  390. cmpw $3, rd_tries
  391. jb read_retry
  392. stc
  393. ret
  394. read_ok:
  395. incl rd_lba
  396. addw $0x200, rd_off
  397. decw rd_left
  398. jnz read_retry
  399. clc
  400. ret
  401. /* ---- Pick the pack destination from the E820 map -----------------------
  402. * The AH=87h block move uses 24-bit bases, so stay below 16 MB.
  403. * out: eax = 4 KB-aligned destination (0 when there is no room) */
  404. compute_pack_addr:
  405. movl pack_bytes, %ebx
  406. addl $0xFFF, %ebx
  407. andl $0xFFFFF000, %ebx
  408. movl $0, best_addr
  409. cmpl $E820_MAGIC, 0x1000
  410. jne pack_addr_fallback
  411. movl 0x1004, %ecx
  412. testl %ecx, %ecx
  413. jz pack_addr_fallback
  414. movl $0x1008, %esi
  415. pack_addr_loop:
  416. cmpl $1, 16(%esi) /* E820_RAM */
  417. jne 1f
  418. movl 0(%esi), %eax /* base low */
  419. cmpl $PACK_TOP_ADDR, %eax
  420. jae 1f
  421. movl 4(%esi), %edx /* base high */
  422. testl %edx, %edx
  423. jnz 1f
  424. addl 8(%esi), %eax /* end = base + length low */
  425. jc 2f
  426. cmpl $PACK_TOP_ADDR, %eax
  427. jbe 3f
  428. 2: movl $PACK_TOP_ADDR, %eax
  429. 3: /* Need [end - need, end) to fit inside the entry. */
  430. movl 0(%esi), %edx
  431. addl %ebx, %edx
  432. jc 1f
  433. cmpl %edx, %eax
  434. jb 1f
  435. subl %ebx, %eax
  436. andl $0xFFFFF000, %eax
  437. cmpl $PACK_MIN_ADDR, %eax
  438. jb 1f
  439. cmpl best_addr, %eax
  440. jbe 1f
  441. movl %eax, best_addr
  442. 1: addl $24, %esi
  443. decl %ecx
  444. jnz pack_addr_loop
  445. movl best_addr, %eax
  446. ret
  447. pack_addr_fallback:
  448. /* No usable E820 map: matches mm_init's 16 MB fallback. */
  449. movl $PACK_TOP_ADDR, %eax
  450. cmpl %ebx, %eax
  451. jbe 1f
  452. subl %ebx, %eax
  453. andl $0xFFFFF000, %eax
  454. cmpl $PACK_MIN_ADDR, %eax
  455. jb 1f
  456. ret
  457. 1: xorl %eax, %eax
  458. ret
  459. /* ---- Copy a chunk to high memory with INT 15h AH=87h -------------------
  460. * in: copy_dst (24-bit), copy_len; source is 0x80000.
  461. * Copies in 16-bit words; returns with CF set on failure. */
  462. bios_copy:
  463. movl copy_dst, %eax
  464. movw %ax, bios_gdt + 0x1A /* dest base 15:0 */
  465. shrl $16, %eax
  466. movb %al, bios_gdt + 0x1C /* dest base 23:16 */
  467. movl copy_len, %ecx
  468. shrl $1, %ecx /* AH=87h counts words */
  469. jz bios_copy_done
  470. xorw %ax, %ax
  471. movw %ax, %es
  472. movw $bios_gdt, %si
  473. movw $0x8700, %ax
  474. int $0x15
  475. jc bios_copy_fail
  476. bios_copy_done:
  477. clc
  478. ret
  479. bios_copy_fail:
  480. stc
  481. ret
  482. /* ---- Print a NUL-terminated string with the BIOS teletype ------------- */
  483. print_str:
  484. pushw %ax
  485. pushw %bx
  486. movb $0x0E, %ah
  487. xorw %bx, %bx
  488. 1: lodsb
  489. testb %al, %al
  490. jz 2f
  491. int $0x10
  492. jmp 1b
  493. 2: popw %bx
  494. popw %ax
  495. ret
  496. /* ---- Hex print (EAX, 8 digits) ----------------------------------------- */
  497. print_hex32:
  498. movl $8, %ecx
  499. jmp print_hex
  500. print_hex:
  501. pushal
  502. movl %eax, %ebx
  503. 1: roll $4, %ebx
  504. movl %ebx, %eax
  505. andl $0x0F, %eax
  506. cmpl $10, %eax
  507. jb 2f
  508. addl $55, %eax
  509. jmp 3f
  510. 2: addl $48, %eax
  511. 3: movb $0x0E, %ah
  512. movb $0x00, %bh
  513. int $0x10
  514. loop 1b
  515. popal
  516. ret
  517. /* ---- Boot-info block at 0x500 (bootinfo.h) ----------------------------
  518. * twelve dwords: magic, version, checksum, rsdp, flags, pack_addr,
  519. * pack_size, reserved[5]; the checksum makes the sum zero. */
  520. write_bootinfo:
  521. xorw %ax, %ax
  522. movw %ax, %ds
  523. movl $BOOT_INFO_MAGIC, 0x500
  524. movl $BOOT_INFO_VERSION, 0x504
  525. movl $0, 0x508
  526. movl $0, 0x50C
  527. movl $0, 0x510
  528. movl pack_addr, %eax
  529. movl %eax, 0x514
  530. movl pack_bytes, %eax
  531. movl %eax, 0x518
  532. movl $0, 0x51C
  533. movl $0, 0x520
  534. movl $0, 0x524
  535. movl $0, 0x528
  536. movl $0, 0x52C
  537. xorl %eax, %eax
  538. movl $0x500, %esi
  539. movl $BOOT_INFO_WORDS, %ecx
  540. 1: addl (%esi), %eax
  541. addl $4, %esi
  542. loop 1b
  543. negl %eax
  544. movl %eax, 0x508
  545. ret
  546. /* ---- Protected-mode entry ---------------------------------------------- */
  547. enter_pm:
  548. cli
  549. lgdt stage2_gdtr
  550. movl %cr0, %eax
  551. orl $1, %eax
  552. movl %eax, %cr0
  553. .byte 0x66, 0xea
  554. .long stage2_pm
  555. .word 0x08
  556. .code32
  557. stage2_pm:
  558. movw $0x10, %ax
  559. movw %ax, %ds
  560. movw %ax, %es
  561. movw %ax, %fs
  562. movw %ax, %gs
  563. movw %ax, %ss
  564. movl $__boot_stack_top, %esp
  565. jmp kernel_entry
  566. .align 4
  567. stage2_gdt:
  568. .quad 0
  569. .word 0xffff, 0x0000
  570. .byte 0x00, 0x9a, 0xcf, 0x00
  571. .word 0xffff, 0x0000
  572. .byte 0x00, 0x92, 0xcf, 0x00
  573. stage2_gdt_end:
  574. stage2_gdtr:
  575. .word stage2_gdt_end - stage2_gdt - 1
  576. .long stage2_gdt
  577. /* ---- INT 15h AH=87h descriptor table (48 bytes) -----------------------
  578. * 16 zero bytes, source descriptor at 0x10 (0x80000, 64 KB), destination
  579. * at 0x18 (patched per chunk), 16 zero bytes. */
  580. .align 16
  581. bios_gdt:
  582. .quad 0
  583. .quad 0
  584. /* source: limit 0xFFFF, base 0x80000, access 0x93, 16-bit data */
  585. .word 0xFFFF
  586. .word 0x0000
  587. .byte 0x08
  588. .byte 0x93
  589. .word 0x0000
  590. /* destination: limit 0xFFFF, base patched, access 0x93 */
  591. .word 0xFFFF
  592. .word 0x0000
  593. .byte 0x00
  594. .byte 0x93
  595. .word 0x0000
  596. .quad 0
  597. .quad 0
  598. /* ---- Stage variables --------------------------------------------------- */
  599. .align 4
  600. stage_drive: .byte 0
  601. use_lba: .byte 0
  602. pack_lba: .long 0
  603. pack_bytes: .long 0
  604. pack_addr: .long 0
  605. pack_off: .long 0
  606. chunk_sectors: .long 0
  607. copy_dst: .long 0
  608. copy_len: .long 0
  609. best_addr: .long 0
  610. rd_lba: .long 0
  611. rd_off: .word 0
  612. rd_left: .word 0
  613. rd_tries: .word 0
  614. msg_pack: .asciz "Loading rootfs [d="
  615. msg_lba: .asciz " lba="
  616. msg_e: .asciz " e="
  617. msg_end: .asciz "]... "
  618. msg_dot: .asciz "."
  619. msg_ok: .asciz " ok\r\n"
  620. msg_noroom: .asciz " skipped (no room)\r\n"
  621. msg_fail: .asciz " failed\r\n"
  622. .align 2
  623. vram_64k:
  624. .word 0
  625. best_mode:
  626. .word 0
  627. best_score:
  628. .long 0