Remove env->ready_for_interrupt_injection
[qemu-kvm/fedora.git] / kvm / bios / rombios32start.S
blobc4f3366897cafa47014252becf2b3d979781fb6a
1 /////////////////////////////////////////////////////////////////////////
2 // $Id: rombios32start.S,v 1.3 2006/10/02 06:29:38 vruppert Exp $
3 /////////////////////////////////////////////////////////////////////////
4 //
5 //  32 bit Bochs BIOS init code
6 //  Copyright (C) 2006 Fabrice Bellard
7 //
8 //  This library is free software; you can redistribute it and/or
9 //  modify it under the terms of the GNU Lesser General Public
10 //  License as published by the Free Software Foundation; either
11 //  version 2 of the License, or (at your option) any later version.
13 //  This library is distributed in the hope that it will be useful,
14 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
15 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16 //  Lesser General Public License for more details.
18 //  You should have received a copy of the GNU Lesser General Public
19 //  License along with this library; if not, write to the Free Software
20 //  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA
21 #include "rombios.h"
23 .globl _start
24 .globl smp_ap_boot_code_start
25 .globl smp_ap_boot_code_end
26 .global smm_relocation_start
27 .global smm_relocation_end
28 .global smm_code_start
29 .global smm_code_end
31 _start:
32   /* clear bss section */
33   xor %eax, %eax
34   mov $__bss_start, %edi
35   mov $_end, %ecx
36   sub %edi, %ecx
37   rep stosb
39   jmp rombios32_init
41   .code16
42 smp_ap_boot_code_start:
43   xor %ax, %ax
44   mov %ax, %ds
45   xor %eax, %eax
46   xor %edx, %edx
47   mov $0x10, %ecx
48   wrmsr
50   mov $SMP_MSR_ADDR, %ebx
51 11:
52   mov 0(%ebx), %ecx
53   test %ecx, %ecx
54   jz 12f
55   mov 4(%ebx), %eax
56   mov 8(%ebx), %edx
57   wrmsr
58   add $12, %ebx
59   jmp 11b
60 12:
62   incw CPU_COUNT_ADDR
64   hlt
65   jmp 1b
66 smp_ap_boot_code_end:
68 /* code to relocate SMBASE to 0xa0000 */
69 smm_relocation_start:
70   mov $0x38000 + 0x7efc, %ebx
71   addr32 mov (%ebx), %al  /* revision ID to see if x86_64 or x86 */
72   cmp $0x64, %al
73   je 1f
74   mov $0x38000 + 0x7ef8, %ebx
75   jmp 2f
77   mov $0x38000 + 0x7f00, %ebx
79   movl $0xa0000, %eax
80   addr32 movl %eax, (%ebx)
81   /* indicate to the BIOS that the SMM code was executed */
82   mov $0x00, %al
83   movw $0xb3, %dx
84   outb %al, %dx
85   rsm
86 smm_relocation_end:
88 /* minimal SMM code to enable or disable ACPI */
89 smm_code_start:
90   movw $0xb2, %dx
91   inb %dx, %al
92   cmp $0xf0, %al
93   jne 1f
95   /* ACPI disable */
96   mov $PM_IO_BASE + 0x04, %dx /* PMCNTRL */
97   inw %dx, %ax
98   andw $~1, %ax
99   outw %ax, %dx
101   jmp 2f
104   cmp $0xf1, %al
105   jne 2f
107   /* ACPI enable */
108   mov $PM_IO_BASE + 0x04, %dx /* PMCNTRL */
109   inw %dx, %ax
110   orw $1, %ax
111   outw %ax, %dx
114   rsm
115 smm_code_end: