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

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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., 51 Franklin Street, Fifth Floor, Boston, MA
  17. * 02110-1301, USA.
  18. */
  19. #include <realmode.h>
  20. #include <ipxe/command.h>
  21. #include <ipxe/parseopt.h>
  22. FILE_LICENCE ( GPL2_OR_LATER );
  23. /** @file
  24. *
  25. * Reboot command
  26. *
  27. */
  28. /** "reboot" options */
  29. struct reboot_options {};
  30. /** "reboot" option list */
  31. static struct option_descriptor reboot_opts[] = {};
  32. /** "reboot" command descriptor */
  33. static struct command_descriptor reboot_cmd =
  34. COMMAND_DESC ( struct reboot_options, reboot_opts, 0, 0, "" );
  35. /**
  36. * The "reboot" command
  37. *
  38. * @v argc Argument count
  39. * @v argv Argument list
  40. * @ret rc Return status code
  41. */
  42. static int reboot_exec ( int argc, char **argv ) {
  43. struct reboot_options opts;
  44. int rc;
  45. /* Parse options */
  46. if ( ( rc = parse_options ( argc, argv, &reboot_cmd, &opts ) ) != 0 )
  47. return rc;
  48. /* Reboot system */
  49. __asm__ __volatile__ ( REAL_CODE ( "ljmp $0xf000, $0xfff0" ) : : );
  50. return 0;
  51. }
  52. /** "reboot" command */
  53. struct command reboot_command __command = {
  54. .name = "reboot",
  55. .exec = reboot_exec,
  56. };