You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

reboot_cmd.c 1.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /*
  2. * Copyright (C) 2010 Michael Brown <mbrown@fensystems.co.uk>.
  3. *
  4. * This program is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU General Public License as
  6. * published by the Free Software Foundation; either version 2 of the
  7. * License, or any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful, but
  10. * WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. * General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program; if not, write to the Free Software
  16. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  17. */
  18. #include <realmode.h>
  19. #include <ipxe/command.h>
  20. #include <ipxe/parseopt.h>
  21. FILE_LICENCE ( GPL2_OR_LATER );
  22. /** @file
  23. *
  24. * Reboot command
  25. *
  26. */
  27. /** "reboot" options */
  28. struct reboot_options {};
  29. /** "reboot" option list */
  30. static struct option_descriptor reboot_opts[] = {};
  31. /** "reboot" command descriptor */
  32. static struct command_descriptor reboot_cmd =
  33. COMMAND_DESC ( struct reboot_options, reboot_opts, 0, 0, "" );
  34. /**
  35. * The "reboot" command
  36. *
  37. * @v argc Argument count
  38. * @v argv Argument list
  39. * @ret rc Return status code
  40. */
  41. static int reboot_exec ( int argc, char **argv ) {
  42. struct reboot_options opts;
  43. int rc;
  44. /* Parse options */
  45. if ( ( rc = parse_options ( argc, argv, &reboot_cmd, &opts ) ) != 0 )
  46. return rc;
  47. /* Reboot system */
  48. __asm__ __volatile__ ( REAL_CODE ( "ljmp $0xf000, $0xfff0" ) : : );
  49. return 0;
  50. }
  51. /** "reboot" command */
  52. struct command reboot_command __command = {
  53. .name = "reboot",
  54. .exec = reboot_exec,
  55. };