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 2.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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. * You can also choose to distribute this program under the terms of
  25. * the Unmodified Binary Distribution Licence (as given in the file
  26. * COPYING.UBDL), provided that you have satisfied its requirements.
  27. */
  28. FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
  29. #include <stdint.h>
  30. #include <realmode.h>
  31. #include <pxe.h>
  32. /** PXE exit hook */
  33. extern segoff_t __data16 ( pxe_exit_hook );
  34. #define pxe_exit_hook __use_data16 ( pxe_exit_hook )
  35. /**
  36. * FILE EXIT HOOK
  37. *
  38. * @v file_exit_hook Pointer to a struct
  39. * s_PXENV_FILE_EXIT_HOOK
  40. * @v s_PXENV_FILE_EXIT_HOOK::Hook SEG16:OFF16 to jump to
  41. * @ret #PXENV_EXIT_SUCCESS Successfully set hook
  42. * @ret #PXENV_EXIT_FAILURE We're not an NBP build
  43. * @ret s_PXENV_FILE_EXIT_HOOK::Status PXE status code
  44. *
  45. */
  46. static PXENV_EXIT_t
  47. pxenv_file_exit_hook ( struct s_PXENV_FILE_EXIT_HOOK *file_exit_hook ) {
  48. DBG ( "PXENV_FILE_EXIT_HOOK" );
  49. /* We'll jump to the specified SEG16:OFF16 during exit */
  50. pxe_exit_hook.segment = file_exit_hook->Hook.segment;
  51. pxe_exit_hook.offset = file_exit_hook->Hook.offset;
  52. file_exit_hook->Status = PXENV_STATUS_SUCCESS;
  53. return PXENV_EXIT_SUCCESS;
  54. }
  55. /** PXE file API */
  56. struct pxe_api_call pxe_file_api_exit_hook __pxe_api_call =
  57. PXE_API_CALL ( PXENV_FILE_EXIT_HOOK, pxenv_file_exit_hook,
  58. struct s_PXENV_FILE_EXIT_HOOK );