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.

pxe_exit_hook.c 1.9KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /** @file
  2. *
  3. * PXE exit hook
  4. *
  5. */
  6. /*
  7. * Copyright (C) 2010 Shao Miller <shao.miller@yrdsb.edu.on.ca>.
  8. *
  9. * This program is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU General Public License as
  11. * published by the Free Software Foundation; either version 2 of the
  12. * License, or any later version.
  13. *
  14. * This program is distributed in the hope that it will be useful, but
  15. * WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  17. * General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU General Public License
  20. * along with this program; if not, write to the Free Software
  21. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
  22. * 02110-1301, USA.
  23. */
  24. FILE_LICENCE ( GPL2_OR_LATER );
  25. #include <stdint.h>
  26. #include <realmode.h>
  27. #include <pxe.h>
  28. /** PXE exit hook */
  29. extern segoff_t __data16 ( pxe_exit_hook );
  30. #define pxe_exit_hook __use_data16 ( pxe_exit_hook )
  31. /**
  32. * FILE EXIT HOOK
  33. *
  34. * @v file_exit_hook Pointer to a struct
  35. * s_PXENV_FILE_EXIT_HOOK
  36. * @v s_PXENV_FILE_EXIT_HOOK::Hook SEG16:OFF16 to jump to
  37. * @ret #PXENV_EXIT_SUCCESS Successfully set hook
  38. * @ret #PXENV_EXIT_FAILURE We're not an NBP build
  39. * @ret s_PXENV_FILE_EXIT_HOOK::Status PXE status code
  40. *
  41. */
  42. static PXENV_EXIT_t
  43. pxenv_file_exit_hook ( struct s_PXENV_FILE_EXIT_HOOK *file_exit_hook ) {
  44. DBG ( "PXENV_FILE_EXIT_HOOK" );
  45. /* We'll jump to the specified SEG16:OFF16 during exit */
  46. pxe_exit_hook.segment = file_exit_hook->Hook.segment;
  47. pxe_exit_hook.offset = file_exit_hook->Hook.offset;
  48. file_exit_hook->Status = PXENV_STATUS_SUCCESS;
  49. return PXENV_EXIT_SUCCESS;
  50. }
  51. /** PXE file API */
  52. struct pxe_api_call pxe_file_api_exit_hook __pxe_api_call =
  53. PXE_API_CALL ( PXENV_FILE_EXIT_HOOK, pxenv_file_exit_hook,
  54. struct s_PXENV_FILE_EXIT_HOOK );