Deleted Added
full compact
machdep.c (251039) machdep.c (254025)
1/*-
2 * Copyright (c) 1992 Terrence R. Lambert.
3 * Copyright (c) 1982, 1987, 1990 The Regents of the University of California.
4 * All rights reserved.
5 *
6 * This code is derived from software contributed to Berkeley by
7 * William Jolitz.
8 *

--- 24 unchanged lines hidden (view full) ---

33 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
34 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35 * SUCH DAMAGE.
36 *
37 * from: @(#)machdep.c 7.4 (Berkeley) 6/3/91
38 */
39
40#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 1992 Terrence R. Lambert.
3 * Copyright (c) 1982, 1987, 1990 The Regents of the University of California.
4 * All rights reserved.
5 *
6 * This code is derived from software contributed to Berkeley by
7 * William Jolitz.
8 *

--- 24 unchanged lines hidden (view full) ---

33 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
34 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35 * SUCH DAMAGE.
36 *
37 * from: @(#)machdep.c 7.4 (Berkeley) 6/3/91
38 */
39
40#include <sys/cdefs.h>
41__FBSDID("$FreeBSD: head/sys/i386/i386/machdep.c 251039 2013-05-27 18:39:39Z kib $");
41__FBSDID("$FreeBSD: head/sys/i386/i386/machdep.c 254025 2013-08-07 06:21:20Z jeff $");
42
43#include "opt_apic.h"
44#include "opt_atalk.h"
45#include "opt_atpic.h"
46#include "opt_compat.h"
47#include "opt_cpu.h"
48#include "opt_ddb.h"
49#include "opt_inet.h"

--- 3123 unchanged lines hidden (view full) ---

3173
3174 if (!has_f00f_bug)
3175 return;
3176
3177 GIANT_REQUIRED;
3178
3179 printf("Intel Pentium detected, installing workaround for F00F bug\n");
3180
42
43#include "opt_apic.h"
44#include "opt_atalk.h"
45#include "opt_atpic.h"
46#include "opt_compat.h"
47#include "opt_cpu.h"
48#include "opt_ddb.h"
49#include "opt_inet.h"

--- 3123 unchanged lines hidden (view full) ---

3173
3174 if (!has_f00f_bug)
3175 return;
3176
3177 GIANT_REQUIRED;
3178
3179 printf("Intel Pentium detected, installing workaround for F00F bug\n");
3180
3181 tmp = kmem_alloc(kernel_map, PAGE_SIZE * 2);
3181 tmp = kmem_malloc(kernel_arena, PAGE_SIZE * 2, M_WAITOK | M_ZERO);
3182 if (tmp == 0)
3182 if (tmp == 0)
3183 panic("kmem_alloc returned 0");
3183 panic("kmem_malloc returned 0");
3184
3185 /* Put the problematic entry (#6) at the end of the lower page. */
3186 new_idt = (struct gate_descriptor*)
3187 (tmp + PAGE_SIZE - 7 * sizeof(struct gate_descriptor));
3188 bcopy(idt, new_idt, sizeof(idt0));
3189 r_idt.rd_base = (u_int)new_idt;
3190 lidt(&r_idt);
3191 idt = new_idt;
3184
3185 /* Put the problematic entry (#6) at the end of the lower page. */
3186 new_idt = (struct gate_descriptor*)
3187 (tmp + PAGE_SIZE - 7 * sizeof(struct gate_descriptor));
3188 bcopy(idt, new_idt, sizeof(idt0));
3189 r_idt.rd_base = (u_int)new_idt;
3190 lidt(&r_idt);
3191 idt = new_idt;
3192 if (vm_map_protect(kernel_map, tmp, tmp + PAGE_SIZE,
3193 VM_PROT_READ, FALSE) != KERN_SUCCESS)
3194 panic("vm_map_protect failed");
3192 pmap_protect(kernel_pmap, tmp, tmp + PAGE_SIZE, VM_PROT_READ);
3195}
3196#endif /* defined(I586_CPU) && !NO_F00F_HACK */
3197
3198/*
3199 * Construct a PCB from a trapframe. This is called from kdb_trap() where
3200 * we want to start a backtrace from the function that caused us to enter
3201 * the debugger. We have the context in the trapframe, but base the trace
3202 * on the PCB. The PCB doesn't have to be perfect, as long as it contains

--- 548 unchanged lines hidden ---
3193}
3194#endif /* defined(I586_CPU) && !NO_F00F_HACK */
3195
3196/*
3197 * Construct a PCB from a trapframe. This is called from kdb_trap() where
3198 * we want to start a backtrace from the function that caused us to enter
3199 * the debugger. We have the context in the trapframe, but base the trace
3200 * on the PCB. The PCB doesn't have to be perfect, as long as it contains

--- 548 unchanged lines hidden ---