iPXE
pxe_exit_hook.c
Go to the documentation of this file.
1 /** @file
2  *
3  * PXE exit hook
4  *
5  */
6 
7 /*
8  * Copyright (C) 2010 Shao Miller <shao.miller@yrdsb.edu.on.ca>.
9  *
10  * This program is free software; you can redistribute it and/or
11  * modify it under the terms of the GNU General Public License as
12  * published by the Free Software Foundation; either version 2 of the
13  * License, or any later version.
14  *
15  * This program is distributed in the hope that it will be useful, but
16  * WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18  * General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program; if not, write to the Free Software
22  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
23  * 02110-1301, USA.
24  *
25  * You can also choose to distribute this program under the terms of
26  * the Unmodified Binary Distribution Licence (as given in the file
27  * COPYING.UBDL), provided that you have satisfied its requirements.
28  */
29 
30 FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
31 
32 #include <stdint.h>
33 #include <realmode.h>
34 #include <pxe.h>
35 
36 /** PXE exit hook */
38 #define pxe_exit_hook __use_data16 ( pxe_exit_hook )
39 
40 /**
41  * FILE EXIT HOOK
42  *
43  * @v file_exit_hook Pointer to a struct
44  * s_PXENV_FILE_EXIT_HOOK
45  * @v s_PXENV_FILE_EXIT_HOOK::Hook SEG16:OFF16 to jump to
46  * @ret #PXENV_EXIT_SUCCESS Successfully set hook
47  * @ret #PXENV_EXIT_FAILURE We're not an NBP build
48  * @ret s_PXENV_FILE_EXIT_HOOK::Status PXE status code
49  *
50  */
51 static PXENV_EXIT_t
52 pxenv_file_exit_hook ( struct s_PXENV_FILE_EXIT_HOOK *file_exit_hook ) {
53  DBG ( "PXENV_FILE_EXIT_HOOK" );
54 
55  /* We'll jump to the specified SEG16:OFF16 during exit */
56  pxe_exit_hook.segment = file_exit_hook->Hook.segment;
57  pxe_exit_hook.offset = file_exit_hook->Hook.offset;
58  file_exit_hook->Status = PXENV_STATUS_SUCCESS;
59  return PXENV_EXIT_SUCCESS;
60 }
61 
62 /** PXE file API */
63 struct pxe_api_call pxe_file_api_exit_hook __pxe_api_call =
65  struct s_PXENV_FILE_EXIT_HOOK );
SEGOFF16_t Hook
SEG16:OFF16 to jump to.
Definition: pxe_api.h:1691
#define PXE_API_CALL(_opcode, _entry, _params_type)
Define a PXE API call.
Definition: pxe.h:108
UINT16_t PXENV_EXIT_t
A PXE exit code.
Definition: pxe_types.h:44
static PXENV_EXIT_t pxenv_file_exit_hook(struct s_PXENV_FILE_EXIT_HOOK *file_exit_hook)
FILE EXIT HOOK.
Definition: pxe_exit_hook.c:52
Parameter block for pxenv_file_exit_hook()
Definition: pxe_api.h:1689
#define pxe_exit_hook
Definition: pxe_exit_hook.c:38
segoff_t __data16(pxe_exit_hook)
PXE exit hook.
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
#define PXENV_EXIT_SUCCESS
No error occurred.
Definition: pxe_types.h:45
A PXE API call.
Definition: pxe.h:81
PXENV_STATUS_t Status
PXE status code.
Definition: pxe_api.h:1690
struct pxe_api_call pxe_file_api_exit_hook __pxe_api_call
PXE file API.
Definition: pxe_exit_hook.c:63
#define PXENV_FILE_EXIT_HOOK
PXE API function code for pxenv_file_exit_hook()
Definition: pxe_api.h:1686
#define PXENV_STATUS_SUCCESS
Definition: pxe_error.h:19
#define DBG(...)
Print a debugging message.
Definition: compiler.h:498