Exemplo n.º 1
0
void
c_main(void *stack, unsigned long argc)
{
	print_string(1, "Stack at: ");
	print_hex(1, (unsigned long)stack);
	print_string(1, "\n");
	print_string(1, "argc: ");
	print_hex(1, argc);
	print_string(1, "\n");
	linux_exit(0);
}
Exemplo n.º 2
0
int main(void)
{
  if (dummy_rpc_init(IAM_SERV_IO))
  {
    linux_write(1, "RPC init failed\n", 16);
    linux_exit(0);
  }

  if (register_rpc(io_rpcs, rpc_io_desc, 4))
  {
    linux_write(1, "Error while registering rpcs\n", 29);
    linux_exit(0);
  }

  if (listen_rpc())
  {
    linux_write(1, "Error while listening for rpcs\n", 31);
    linux_exit(0);
  }

  return 0;
}
Exemplo n.º 3
0
void c_main(int ac, char **av, char **env)
{
	char *file_to_map = av[1];
	void *mapped;
	void *fptr;
	struct stat sb;
	Elf64_Ehdr *junk1 = NULL, *junk2 = NULL;

	/* print_string(1, "static_dyn_load_run\n"); */

	if (0 > linux_stat(file_to_map, &sb))
	{
		error_msg("stat() failed ");
		linux_exit(1);
	}

	mapped = linux_mmap(NULL, sb.st_size, 0x07, 0x22, -1, 0);
	/* print_address("File mapped in at", mapped); */

	if (mapped == (void *)-1)
	{
		error_msg("mmap() failed ");
		linux_exit(1);
	}

	copy_in(file_to_map, mapped);

	fptr = load_elf(mapped, 1, &junk1, &junk2);
	/* print_address("Entry point at", fptr); */

	linux_munmap(mapped, sb.st_size);

	/* print_address("Y setting stack to ", av - 1); */
	SET_STACK(av - 1);
	JMP_ADDR(fptr);
}