1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21#include <types.h>
22#include <lib.h>
23#include <console.h>
24#include <msr.h>
25#include <macros.h>
26#include <cpu.h>
27#include <stage1.h>
28#include <globalvars.h>
29#include <string.h>
30#include <mtrr.h>
31#include <via_c7.h>
32
33
34
35
36void disable_car(void)
37{
38 printk(BIOS_DEBUG, "disable_car entry\n");
39
40
41
42
43
44
45
46 struct global_vars *const newlocation = (struct global_vars *)((RAM_STACK_BASE - sizeof(struct global_vars *) - sizeof(struct global_vars)) & ~0x7);
47
48 memcpy(newlocation, global_vars(), sizeof(struct global_vars));
49 printk(BIOS_DEBUG, "disable_car global_vars copy done\n");
50
51 *(struct global_vars **)(RAM_STACK_BASE - sizeof(struct global_vars *)) = newlocation;
52
53 printk(BIOS_DEBUG, "disable_car global_vars pointer adjusted\n");
54 printk(BIOS_DEBUG, "entering asm code now\n");
55
56 __asm__ __volatile__(
57 " movl %[newesp], %%esp \n"
58
59
60
61 " movl %%cr0, %%eax \n"
62 " orl $(0x1<<30),%%eax \n"
63 " movl %%eax, %%cr0 \n"
64
65
66
67 " xorl %%eax, %%eax \n"
68 " xorl %%edx, %%edx \n"
69 " movl $0x201, %%ecx \n"
70 " wrmsr \n"
71 " movl $0x200, %%ecx \n"
72 " wrmsr \n"
73
74
75 " movl %[_MTRRdefType_MSR], %%ecx \n"
76 " xorl %%edx, %%edx \n"
77
78 " movl $0x00000800, %%eax \n"
79 " wrmsr \n"
80
81
82 " movl %%cr0, %%eax \n"
83 " andl $0x9fffffff,%%eax \n"
84 " movl %%eax, %%cr0 \n"
85
86 " wbinvd \n"
87
88 " call stage1_phase3 \n"
89 :: [newesp] "i" (newlocation),
90 [_MTRRdefType_MSR] "i" (MTRRdefType_MSR)
91 : "memory");
92}
93
94void stop_ap(void)
95{
96}
97
98