Add qemu 2.4.0
[kvmfornfv.git] / qemu / roms / ipxe / src / arch / i386 / interface / pxe / pxe_exit_hook.c
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
26 FILE_LICENCE ( GPL2_OR_LATER );
27
28 #include <stdint.h>
29 #include <realmode.h>
30 #include <pxe.h>
31
32 /** PXE exit hook */
33 extern segoff_t __data16 ( pxe_exit_hook );
34 #define pxe_exit_hook __use_data16 ( pxe_exit_hook )
35
36 /**
37  * FILE EXIT HOOK
38  *
39  * @v file_exit_hook                    Pointer to a struct
40  *                                      s_PXENV_FILE_EXIT_HOOK
41  * @v s_PXENV_FILE_EXIT_HOOK::Hook      SEG16:OFF16 to jump to
42  * @ret #PXENV_EXIT_SUCCESS             Successfully set hook
43  * @ret #PXENV_EXIT_FAILURE             We're not an NBP build
44  * @ret s_PXENV_FILE_EXIT_HOOK::Status  PXE status code
45  *
46  */
47 static PXENV_EXIT_t
48 pxenv_file_exit_hook ( struct s_PXENV_FILE_EXIT_HOOK *file_exit_hook ) {
49         DBG ( "PXENV_FILE_EXIT_HOOK" );
50
51         /* We'll jump to the specified SEG16:OFF16 during exit */
52         pxe_exit_hook.segment = file_exit_hook->Hook.segment;
53         pxe_exit_hook.offset = file_exit_hook->Hook.offset;
54         file_exit_hook->Status = PXENV_STATUS_SUCCESS;
55         return PXENV_EXIT_SUCCESS;
56 }
57
58 /** PXE file API */
59 struct pxe_api_call pxe_file_api_exit_hook __pxe_api_call =
60         PXE_API_CALL ( PXENV_FILE_EXIT_HOOK, pxenv_file_exit_hook,
61                        struct s_PXENV_FILE_EXIT_HOOK );