2 * This file is part of the coreboot project.
4 * Copyright (C) 2009 Rudolf Marek <r.marek@assembler.cz>
5 * Copyright (C) 2009 coresystems GmbH
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; version 2 of the License.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21 #define WAKEUP_BASE 0x600
22 #define RELOCATED(x) (x - __wakeup + WAKEUP_BASE)
30 /* First prepare the jmp to the resume vector */
31 mov 0x4(%esp), %eax /* vector */
32 /* last 4 bits of linear addr are taken as offset */
34 movw %ax, (__wakeup_offset)
36 /* the rest is taken as segment */
38 movw %ax, (__wakeup_segment)
40 /* Then overwrite coreboot with our backed up memory */
59 /* Activate the right segment descriptor real mode. */
60 ljmp $0x28, $RELOCATED(1f)
63 /* 16 bit code from here on... */
65 /* Load the segment registers w/ properly configured
66 * segment descriptors. They will retain these
67 * configurations (limits, writability, etc.) once
68 * protected mode is turned off.
77 /* Turn off protection */
82 /* Now really going into real mode */
83 ljmp $0, $RELOCATED(1f)
92 /* This is a FAR JMP to the OS waking vector. The C code changed
93 * the address to be correct.
97 __wakeup_offset = RELOCATED(.)
100 __wakeup_segment = RELOCATED(.)
104 __wakeup_size = ( . - __wakeup)