コード例 #1
0
ファイル: ntldr.c プロジェクト: Spacy/grub-fuse
static grub_err_t
grub_ntldr_boot (void)
{
  struct grub_relocator16_state state = { 
    .cs = GRUB_NTLDR_SEGMENT,
    .ip = 0,
    .ds = 0,
    .es = 0,
    .fs = 0,
    .gs = 0,
    .ss = 0,
    .sp = 0x7c00,
    .edx = edx
  };
  grub_video_set_mode ("text", 0, 0);

  return grub_relocator16_boot (rel, state);
}

static grub_err_t
grub_ntldr_unload (void)
{
  grub_relocator_unload (rel);
  rel = NULL;
  grub_dl_unref (my_mod);
  return GRUB_ERR_NONE;
}
コード例 #2
0
ファイル: reboot.c プロジェクト: Arvian/GRUB2
void
grub_reboot (void)
{
  struct grub_relocator *relocator = NULL;
  grub_relocator_chunk_t ch;
  grub_err_t err;
  void *buf;
  struct grub_relocator16_state state;
  grub_uint16_t segment;

  relocator = grub_relocator_new ();
  if (!relocator)
    while (1);
  err = grub_relocator_alloc_chunk_align (relocator, &ch, 0x1000, 0x1000,
					  grub_reboot_end - grub_reboot_start,
					  16, GRUB_RELOCATOR_PREFERENCE_NONE,
					  0);
  if (err)
    while (1);
  buf = get_virtual_current_address (ch);
  grub_memcpy (buf, grub_reboot_start, grub_reboot_end - grub_reboot_start);

  segment = ((grub_addr_t) get_physical_target_address (ch)) >> 4;
  state.gs = state.fs = state.es = state.ds = state.ss = segment;
  state.sp = 0;
  state.cs = segment;
  state.ip = 0;
  state.a20 = 0;

  grub_stop_floppy ();
  
  err = grub_relocator16_boot (relocator, state);

  while (1);
}
コード例 #3
0
ファイル: freedos.c プロジェクト: 376473984/TrustedGRUB2
static grub_err_t
grub_freedos_boot (void)
{
  struct grub_relocator16_state state = { 
    .cs = GRUB_FREEDOS_SEGMENT,
    .ip = 0,

    .ds = GRUB_FREEDOS_STACK_SEGMENT,
    .es = 0,
    .fs = 0,
    .gs = 0,
    .ss = GRUB_FREEDOS_STACK_SEGMENT,
    .sp = GRUB_FREEDOS_STACK_POINTER,
    .ebp = GRUB_FREEDOS_STACK_BPB_POINTER,
    .ebx = ebx,
    .edx = ebx,
    .a20 = 1
  };
  grub_video_set_mode ("text", 0, 0);

  return grub_relocator16_boot (rel, state);
}

static grub_err_t
grub_freedos_unload (void)
{
  grub_relocator_unload (rel);
  rel = NULL;
  grub_dl_unref (my_mod);
  return GRUB_ERR_NONE;
}
コード例 #4
0
static grub_err_t
grub_pxechain_boot (void)
{
  struct grub_relocator16_state state = { 
    .cs = 0,
    .ip = 0x7c00,
    .ds = 0,
    .es = 0,
    .fs = 0,
    .gs = 0,
    .ss = 0,
    .sp = 0x7c00,
    .edx = edx
  };
  struct grub_net_bootp_packet *bp;

  bp = grub_pxe_get_cached (GRUB_PXENV_PACKET_TYPE_DHCP_ACK);

  grub_video_set_mode ("text", 0, 0);

  if (bp && boot_file[0])
    grub_memcpy (bp->boot_file, boot_file, sizeof (bp->boot_file));
  if (bp && server_name[0])
    grub_memcpy (bp->server_name, server_name, sizeof (bp->server_name));

  return grub_relocator16_boot (rel, state);
}

static grub_err_t
grub_pxechain_unload (void)
{
  grub_relocator_unload (rel);
  rel = NULL;
  grub_dl_unref (my_mod);
  return GRUB_ERR_NONE;
}