3
* GRUB -- GRand Unified Bootloader
4
* Copyright (C) 2008,2009 Free Software Foundation, Inc.
6
* GRUB is free software: you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation, either version 3 of the License, or
9
* (at your option) any later version.
11
* GRUB 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.
16
* You should have received a copy of the GNU General Public License
17
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
20
#include <grub/symbol.h>
21
#include <grub/boot.h>
22
#include <grub/machine/boot.h>
23
#include <grub/machine/kernel.h>
24
#include <multiboot.h>
28
#define CODE_ADDR 0x6000
29
#define DATA_ADDR ((GRUB_BOOT_MACHINE_KERNEL_ADDR) + 0x200)
31
#define CDSEC_SHIFT 11
50
.long 0 /* LBA of primary volume descriptor. */
52
.long 0 /* LBA of boot file. */
54
.long 0 /* Length of boot file. */
56
.long 0 /* Checksum of boot file */
58
.space (10*4) /* Reserved */
63
/* Boot from CDROM. */
67
movw $(CODE_ADDR), %sp
71
movw $(0x7C00 + err_noboot_msg - start), %si
72
movl %cs: bi_length - LOCAL(next)(%bx), %ecx
76
addl $((1 << CDSEC_SHIFT) - 1), %ecx
77
shrl $CDSEC_SHIFT, %ecx
79
movl %cs: bi_file - LOCAL(next)(%bx), %esi
81
call LOCAL(read_cdrom)
83
ljmp $(DATA_ADDR >> 4), $0
88
* ecx: number of sectors
93
/* Number of blocks to read. */
100
/* Buffer address. */
101
pushw $((DATA_ADDR - 0x400)>> 4)
124
movb $0x42, %ah /* Try again. */
130
shrw $1, %di /* Reduce transfer size. */
141
shlw $(CDSEC_SHIFT - 4), %ax
153
movw $(0x7C00 + err_cdfail_msg - start), %si
166
.ascii "no boot info\0"
169
.ascii "cdrom read fails\0"