|
用grub直接启动xp embedded的sdi成功!
有关sdi的代码
很明显不是syslinux的if (is_sdi)
{
unsigned long long bytes_needed;
unsigned long long base;
bytes_needed = filemax;
base = 0;
if (mbi.flags & MB_INFO_MEM_MAP)
{
struct AddrRangeDesc *map = (struct AddrRangeDesc *) mbi.mmap_addr;
int end_addr = mbi.mmap_addr + mbi.mmap_length;
for (; end_addr > (int) map; map = (struct AddrRangeDesc *) (((int) map) + 4 + map->size))
{
unsigned long long top_end;
if (map->Type != MB_ARD_MEMORY)
continue;
top_end = map->BaseAddr + map->Length;
if (top_end > 0x100000000ULL)
top_end = 0x100000000ULL;
/* 0x4000000ULL is 64 MB , 0x200000ULL is 2 MB */
#define MIN_EMU_BASE 0x200000ULL
if (map->Length >= bytes_needed
&& (base = (top_end - bytes_needed) & 0xfffff000) >= MIN_EMU_BASE /* page align */
&& map->Length >= top_end - base)
break; /* success */
base = 0;
}
}
else
grub_printf ("Address Map BIOS Interface is not activated.\n");
if (base < MIN_EMU_BASE)
{
grub_close ();
return errnum = ERR_WONT_FIT;
}
#undef MIN_EMU_BASE
//filepos = 0;
if (grub_read ((char *)((int)base), -1) != filemax)
{
grub_close ();
if (errnum == ERR_NONE)
errnum = ERR_READ;
return 1;
}
grub_close ();
if (int13_on_hook)
{
unset_int13_handler ();
int13_on_hook = 0;
}
#define BootCodeOffsetLow (*(unsigned long *)((int)base + 0x10))
#define BootCodeSizeLow (*(unsigned long *)((int)base + 0x18))
read_length = BootCodeSizeLow;
if (read_length > 0x90000)
read_length = 0x90000;
grub_memmove((char *)0x110000, (char *)((unsigned int)base + BootCodeOffsetLow), read_length);
#undef BootCodeOffsetLow
#undef BootCodeSizeLow
if (! chainloader_edx_set)
{
chainloader_edx = (unsigned int)base | 0x41;
chainloader_edx_set = 1;
}
} 先来说一个这个补丁的bug吧
在vmware中试验
sdi文件为16M左右
在bios setup中把memory map设置为extended就会出现错误
|
|