1 /* Copyright (C) 2006 Michael Brown <mbrown@fensystems.co.uk>.
3 * This program is free software; you can redistribute it and/or
4 * modify it under the terms of the GNU General Public License as
5 * published by the Free Software Foundation; either version 2 of the
6 * License, or any later version.
8 * This program is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 * A hidden region of Etherboot
24 * This represents a region that will be edited out of the system's
27 * This structure is accessed by assembly code, so must not be
30 struct hidden_region {
31 /* Physical start address */
33 /* Physical end address */
37 /* Linker-defined symbols */
41 /** Assembly routine in e820mangler.S */
44 /** Vector for storing original INT 15 handler */
45 extern struct segoff __text16 ( int15_vector );
46 #define int15_vector __use_text16 ( int15_vector )
49 * Unique IDs for hidden regions
56 * List of hidden regions
58 * Must be terminated by a zero entry.
60 struct hidden_region __data16_array ( hidden_regions, [] ) = {
62 { 0, 0, } /* Terminator */
64 #define hidden_regions __use_data16 ( hidden_regions )
69 * Installs an INT 15 handler to edit Etherboot out of the memory map
70 * returned by the BIOS.
72 void hide_etherboot ( void ) {
73 hidden_regions[TEXT].start = virt_to_phys ( _text );
74 hidden_regions[TEXT].end = virt_to_phys ( _end );
76 DBG ( "Hiding [%lx,%lx)\n",
77 ( unsigned long ) hidden_regions[TEXT].start,
78 ( unsigned long ) hidden_regions[TEXT].end );
80 hook_bios_interrupt ( 0x15, ( unsigned int ) int15,
87 * Uninstalls the INT 15 handler installed by hide_etherboot(), if
90 void unhide_etherboot ( void ) {
91 unhook_bios_interrupt ( 0x15, ( unsigned int ) int15,