Move the amd64 and i386 pcb to the bottom of the uarea, and move the kernel stack to the top. Change the pcb layouts so that fpu save area is at the end and is 64byte aligned ready for xsave (saving the ymm registers). Welcome to 6.99.32diff -r1.55 -r1.56 src/sys/arch/amd64/amd64/genassym.cf
(dsl)
--- src/sys/arch/amd64/amd64/genassym.cf 2014/02/15 10:11:14 1.55
+++ src/sys/arch/amd64/amd64/genassym.cf 2014/02/20 18:19:09 1.56
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | # $NetBSD: genassym.cf,v 1.55 2014/02/15 10:11:14 dsl Exp $ | 1 | # $NetBSD: genassym.cf,v 1.56 2014/02/20 18:19:09 dsl Exp $ | |
2 | 2 | |||
3 | # | 3 | # | |
4 | # Copyright (c) 1998, 2006, 2007, 2008 The NetBSD Foundation, Inc. | 4 | # Copyright (c) 1998, 2006, 2007, 2008 The NetBSD Foundation, Inc. | |
5 | # All rights reserved. | 5 | # All rights reserved. | |
6 | # | 6 | # | |
7 | # This code is derived from software contributed to The NetBSD Foundation | 7 | # This code is derived from software contributed to The NetBSD Foundation | |
8 | # by Charles M. Hannum, and by Andrew Doran. | 8 | # by Charles M. Hannum, and by Andrew Doran. | |
9 | # | 9 | # | |
10 | # Redistribution and use in source and binary forms, with or without | 10 | # Redistribution and use in source and binary forms, with or without | |
11 | # modification, are permitted provided that the following conditions | 11 | # modification, are permitted provided that the following conditions | |
12 | # are met: | 12 | # are met: | |
13 | # 1. Redistributions of source code must retain the above copyright | 13 | # 1. Redistributions of source code must retain the above copyright | |
14 | # notice, this list of conditions and the following disclaimer. | 14 | # notice, this list of conditions and the following disclaimer. | |
@@ -171,27 +171,26 @@ define P_MD_SYSCALL offsetof(struct pro | @@ -171,27 +171,26 @@ define P_MD_SYSCALL offsetof(struct pro | |||
171 | 171 | |||
172 | define LW_SYSTEM LW_SYSTEM | 172 | define LW_SYSTEM LW_SYSTEM | |
173 | 173 | |||
174 | define M_DATA offsetof(struct mbuf, m_data) | 174 | define M_DATA offsetof(struct mbuf, m_data) | |
175 | define M_LEN offsetof(struct mbuf, m_len) | 175 | define M_LEN offsetof(struct mbuf, m_len) | |
176 | define M_NEXT offsetof(struct mbuf, m_next) | 176 | define M_NEXT offsetof(struct mbuf, m_next) | |
177 | 177 | |||
178 | define IP_SRC offsetof(struct ip, ip_src) | 178 | define IP_SRC offsetof(struct ip, ip_src) | |
179 | define IP_DST offsetof(struct ip, ip_dst) | 179 | define IP_DST offsetof(struct ip, ip_dst) | |
180 | 180 | |||
181 | define PCB_CR3 offsetof(struct pcb, pcb_cr3) | 181 | define PCB_CR3 offsetof(struct pcb, pcb_cr3) | |
182 | define PCB_RBP offsetof(struct pcb, pcb_rbp) | 182 | define PCB_RBP offsetof(struct pcb, pcb_rbp) | |
183 | define PCB_RSP offsetof(struct pcb, pcb_rsp) | 183 | define PCB_RSP offsetof(struct pcb, pcb_rsp) | |
184 | define PCB_USERSP offsetof(struct pcb, pcb_usersp) | |||
185 | define PCB_RSP0 offsetof(struct pcb, pcb_rsp0) | 184 | define PCB_RSP0 offsetof(struct pcb, pcb_rsp0) | |
186 | define PCB_CR0 offsetof(struct pcb, pcb_cr0) | 185 | define PCB_CR0 offsetof(struct pcb, pcb_cr0) | |
187 | define PCB_ONFAULT offsetof(struct pcb, pcb_onfault) | 186 | define PCB_ONFAULT offsetof(struct pcb, pcb_onfault) | |
188 | define PCB_FLAGS offsetof(struct pcb, pcb_flags) | 187 | define PCB_FLAGS offsetof(struct pcb, pcb_flags) | |
189 | define PCB_COMPAT32 PCB_COMPAT32 | 188 | define PCB_COMPAT32 PCB_COMPAT32 | |
190 | define PCB_FS offsetof(struct pcb, pcb_fs) | 189 | define PCB_FS offsetof(struct pcb, pcb_fs) | |
191 | define PCB_GS offsetof(struct pcb, pcb_gs) | 190 | define PCB_GS offsetof(struct pcb, pcb_gs) | |
192 | 191 | |||
193 | define TF_RDI offsetof(struct trapframe, tf_rdi) | 192 | define TF_RDI offsetof(struct trapframe, tf_rdi) | |
194 | define TF_RSI offsetof(struct trapframe, tf_rsi) | 193 | define TF_RSI offsetof(struct trapframe, tf_rsi) | |
195 | define TF_RDX offsetof(struct trapframe, tf_rdx) | 194 | define TF_RDX offsetof(struct trapframe, tf_rdx) | |
196 | define TF_RCX offsetof(struct trapframe, tf_rcx) | 195 | define TF_RCX offsetof(struct trapframe, tf_rcx) | |
197 | define TF_R8 offsetof(struct trapframe, tf_r8) | 196 | define TF_R8 offsetof(struct trapframe, tf_r8) |
--- src/sys/arch/amd64/amd64/machdep.c 2014/02/15 22:20:41 1.205
+++ src/sys/arch/amd64/amd64/machdep.c 2014/02/20 18:19:09 1.206
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: machdep.c,v 1.205 2014/02/15 22:20:41 dsl Exp $ */ | 1 | /* $NetBSD: machdep.c,v 1.206 2014/02/20 18:19:09 dsl Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 1996, 1997, 1998, 2000, 2006, 2007, 2008, 2011 | 4 | * Copyright (c) 1996, 1997, 1998, 2000, 2006, 2007, 2008, 2011 | |
5 | * The NetBSD Foundation, Inc. | 5 | * The NetBSD Foundation, Inc. | |
6 | * All rights reserved. | 6 | * All rights reserved. | |
7 | * | 7 | * | |
8 | * This code is derived from software contributed to The NetBSD Foundation | 8 | * This code is derived from software contributed to The NetBSD Foundation | |
9 | * by Charles M. Hannum and by Jason R. Thorpe of the Numerical Aerospace | 9 | * by Charles M. Hannum and by Jason R. Thorpe of the Numerical Aerospace | |
10 | * Simulation Facility, NASA Ames Research Center. | 10 | * Simulation Facility, NASA Ames Research Center. | |
11 | * | 11 | * | |
12 | * This code is derived from software contributed to The NetBSD Foundation | 12 | * This code is derived from software contributed to The NetBSD Foundation | |
13 | * by Coyote Point Systems, Inc. which was written under contract to Coyote | 13 | * by Coyote Point Systems, Inc. which was written under contract to Coyote | |
14 | * Point by Jed Davis and Devon O'Dell. | 14 | * Point by Jed Davis and Devon O'Dell. | |
@@ -101,27 +101,27 @@ | @@ -101,27 +101,27 @@ | |||
101 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | 101 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
102 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | 102 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
103 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | 103 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
104 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | 104 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
105 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | 105 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
106 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 106 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
107 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 107 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
108 | * SUCH DAMAGE. | 108 | * SUCH DAMAGE. | |
109 | * | 109 | * | |
110 | * @(#)machdep.c 7.4 (Berkeley) 6/3/91 | 110 | * @(#)machdep.c 7.4 (Berkeley) 6/3/91 | |
111 | */ | 111 | */ | |
112 | 112 | |||
113 | #include <sys/cdefs.h> | 113 | #include <sys/cdefs.h> | |
114 | __KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.205 2014/02/15 22:20:41 dsl Exp $"); | 114 | __KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.206 2014/02/20 18:19:09 dsl Exp $"); | |
115 | 115 | |||
116 | /* #define XENDEBUG_LOW */ | 116 | /* #define XENDEBUG_LOW */ | |
117 | 117 | |||
118 | #include "opt_modular.h" | 118 | #include "opt_modular.h" | |
119 | #include "opt_user_ldt.h" | 119 | #include "opt_user_ldt.h" | |
120 | #include "opt_ddb.h" | 120 | #include "opt_ddb.h" | |
121 | #include "opt_kgdb.h" | 121 | #include "opt_kgdb.h" | |
122 | #include "opt_cpureset_delay.h" | 122 | #include "opt_cpureset_delay.h" | |
123 | #include "opt_mtrr.h" | 123 | #include "opt_mtrr.h" | |
124 | #include "opt_realmem.h" | 124 | #include "opt_realmem.h" | |
125 | #include "opt_xen.h" | 125 | #include "opt_xen.h" | |
126 | #ifndef XEN | 126 | #ifndef XEN | |
127 | #include "opt_physmem.h" | 127 | #include "opt_physmem.h" | |
@@ -457,27 +457,27 @@ x86_64_tls_switch(struct lwp *l) | @@ -457,27 +457,27 @@ x86_64_tls_switch(struct lwp *l) | |||
457 | 457 | |||
458 | /* | 458 | /* | |
459 | * Set up proc0's TSS and LDT. | 459 | * Set up proc0's TSS and LDT. | |
460 | */ | 460 | */ | |
461 | void | 461 | void | |
462 | x86_64_proc0_tss_ldt_init(void) | 462 | x86_64_proc0_tss_ldt_init(void) | |
463 | { | 463 | { | |
464 | struct lwp *l = &lwp0; | 464 | struct lwp *l = &lwp0; | |
465 | struct pcb *pcb = lwp_getpcb(l); | 465 | struct pcb *pcb = lwp_getpcb(l); | |
466 | 466 | |||
467 | pcb->pcb_flags = 0; | 467 | pcb->pcb_flags = 0; | |
468 | pcb->pcb_fs = 0; | 468 | pcb->pcb_fs = 0; | |
469 | pcb->pcb_gs = 0; | 469 | pcb->pcb_gs = 0; | |
470 | pcb->pcb_rsp0 = (uvm_lwp_getuarea(l) + KSTACK_SIZE - 16) & ~0xf; | 470 | pcb->pcb_rsp0 = (uvm_lwp_getuarea(l) + USPACE - 16) & ~0xf; | |
471 | pcb->pcb_iopl = SEL_KPL; | 471 | pcb->pcb_iopl = SEL_KPL; | |
472 | 472 | |||
473 | pmap_kernel()->pm_ldt_sel = GSYSSEL(GLDT_SEL, SEL_KPL); | 473 | pmap_kernel()->pm_ldt_sel = GSYSSEL(GLDT_SEL, SEL_KPL); | |
474 | pcb->pcb_cr0 = rcr0() & ~CR0_TS; | 474 | pcb->pcb_cr0 = rcr0() & ~CR0_TS; | |
475 | l->l_md.md_regs = (struct trapframe *)pcb->pcb_rsp0 - 1; | 475 | l->l_md.md_regs = (struct trapframe *)pcb->pcb_rsp0 - 1; | |
476 | 476 | |||
477 | #if !defined(XEN) | 477 | #if !defined(XEN) | |
478 | lldt(pmap_kernel()->pm_ldt_sel); | 478 | lldt(pmap_kernel()->pm_ldt_sel); | |
479 | #else | 479 | #else | |
480 | { | 480 | { | |
481 | struct physdev_op physop; | 481 | struct physdev_op physop; | |
482 | xen_set_ldt((vaddr_t) ldtstore, LDT_SIZE >> 3); | 482 | xen_set_ldt((vaddr_t) ldtstore, LDT_SIZE >> 3); | |
483 | /* Reset TS bit and set kernel stack for interrupt handlers */ | 483 | /* Reset TS bit and set kernel stack for interrupt handlers */ |
--- src/sys/arch/amd64/include/pcb.h 2014/02/11 20:17:16 1.24
+++ src/sys/arch/amd64/include/pcb.h 2014/02/20 18:19:10 1.25
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: pcb.h,v 1.24 2014/02/11 20:17:16 dsl Exp $ */ | 1 | /* $NetBSD: pcb.h,v 1.25 2014/02/20 18:19:10 dsl Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 1998 The NetBSD Foundation, Inc. | 4 | * Copyright (c) 1998 The NetBSD Foundation, Inc. | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * This code is derived from software contributed to The NetBSD Foundation | 7 | * This code is derived from software contributed to The NetBSD Foundation | |
8 | * by Charles M. Hannum. | 8 | * by Charles M. Hannum. | |
9 | * | 9 | * | |
10 | * Redistribution and use in source and binary forms, with or without | 10 | * Redistribution and use in source and binary forms, with or without | |
11 | * modification, are permitted provided that the following conditions | 11 | * modification, are permitted provided that the following conditions | |
12 | * are met: | 12 | * are met: | |
13 | * 1. Redistributions of source code must retain the above copyright | 13 | * 1. Redistributions of source code must retain the above copyright | |
14 | * notice, this list of conditions and the following disclaimer. | 14 | * notice, this list of conditions and the following disclaimer. | |
@@ -62,50 +62,47 @@ | @@ -62,50 +62,47 @@ | |||
62 | * | 62 | * | |
63 | * @(#)pcb.h 5.10 (Berkeley) 5/12/91 | 63 | * @(#)pcb.h 5.10 (Berkeley) 5/12/91 | |
64 | */ | 64 | */ | |
65 | 65 | |||
66 | /* | 66 | /* | |
67 | * XXXfvdl these copyrights don't really match anymore | 67 | * XXXfvdl these copyrights don't really match anymore | |
68 | */ | 68 | */ | |
69 | 69 | |||
70 | #ifndef _AMD64_PCB_H_ | 70 | #ifndef _AMD64_PCB_H_ | |
71 | #define _AMD64_PCB_H_ | 71 | #define _AMD64_PCB_H_ | |
72 | 72 | |||
73 | #ifdef __x86_64__ | 73 | #ifdef __x86_64__ | |
74 | 74 | |||
75 | #include <sys/signal.h> | 75 | #include <x86/cpu_extended_state.h> | |
76 | ||||
77 | #include <machine/segments.h> | |||
78 | #include <machine/tss.h> | |||
79 | #include <x86/fpu.h> | |||
80 | #include <machine/sysarch.h> | |||
81 | 76 | |||
82 | #define NIOPORTS 1024 /* # of ports we allow to be mapped */ | 77 | #define NIOPORTS 1024 /* # of ports we allow to be mapped */ | |
83 | 78 | |||
84 | struct pcb { | 79 | struct pcb { | |
85 | int pcb_flags; | 80 | int pcb_flags; | |
86 | #define PCB_USER_LDT 0x01 /* has user-set LDT */ | 81 | #define PCB_USER_LDT 0x01 /* has user-set LDT */ | |
87 | #define PCB_COMPAT32 0x02 | 82 | #define PCB_COMPAT32 0x02 | |
88 | u_int pcb_cr0; /* saved image of CR0 */ | 83 | u_int pcb_cr0; /* saved image of CR0 */ | |
89 | uint64_t pcb_rsp0; | 84 | uint64_t pcb_rsp0; | |
90 | uint64_t pcb_cr2; /* page fault address (CR2) */ | 85 | uint64_t pcb_cr2; /* page fault address (CR2) */ | |
91 | uint64_t pcb_cr3; | 86 | uint64_t pcb_cr3; | |
92 | uint64_t pcb_rsp; | 87 | uint64_t pcb_rsp; | |
93 | uint64_t pcb_rbp; | 88 | uint64_t pcb_rbp; | |
94 | uint64_t pcb_usersp; | |||
95 | uint32_t pcb_unused[2]; /* unused */ | |||
96 | union savefpu pcb_savefpu __aligned(16); /* floating point state */ | |||
97 | uint32_t pcb_unused_1[4]; /* unused */ | |||
98 | void *pcb_onfault; /* copyin/out fault recovery */ | 89 | void *pcb_onfault; /* copyin/out fault recovery */ | |
99 | struct cpu_info *pcb_fpcpu; /* cpu holding our fp state. */ | |||
100 | uint64_t pcb_fs; | 90 | uint64_t pcb_fs; | |
101 | uint64_t pcb_gs; | 91 | uint64_t pcb_gs; | |
102 | int pcb_iopl; | 92 | int pcb_iopl; | |
93 | ||||
94 | uint32_t pcb_unused[11]; /* unused */ | |||
95 | ||||
96 | struct cpu_info *pcb_fpcpu; /* cpu holding our fp state. */ | |||
97 | union savefpu pcb_savefpu __aligned(64); /* floating point state */ | |||
98 | /* **** DO NOT ADD ANYTHING HERE **** */ | |||
103 | }; | 99 | }; | |
100 | __CTASSERT(sizeof(struct pcb) - sizeof (union savefpu) == 128); | |||
104 | 101 | |||
105 | #else /* __x86_64__ */ | 102 | #else /* __x86_64__ */ | |
106 | 103 | |||
107 | #include <i386/pcb.h> | 104 | #include <i386/pcb.h> | |
108 | 105 | |||
109 | #endif /* __x86_64__ */ | 106 | #endif /* __x86_64__ */ | |
110 | 107 | |||
111 | #endif /* _AMD64_PCB_H_ */ | 108 | #endif /* _AMD64_PCB_H_ */ |
--- src/sys/arch/amd64/include/proc.h 2014/02/15 10:11:15 1.18
+++ src/sys/arch/amd64/include/proc.h 2014/02/20 18:19:10 1.19
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: proc.h,v 1.18 2014/02/15 10:11:15 dsl Exp $ */ | 1 | /* $NetBSD: proc.h,v 1.19 2014/02/20 18:19:10 dsl Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 1991 Regents of the University of California. | 4 | * Copyright (c) 1991 Regents of the University of California. | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * Redistribution and use in source and binary forms, with or without | 7 | * Redistribution and use in source and binary forms, with or without | |
8 | * modification, are permitted provided that the following conditions | 8 | * modification, are permitted provided that the following conditions | |
9 | * are met: | 9 | * are met: | |
10 | * 1. Redistributions of source code must retain the above copyright | 10 | * 1. Redistributions of source code must retain the above copyright | |
11 | * notice, this list of conditions and the following disclaimer. | 11 | * notice, this list of conditions and the following disclaimer. | |
12 | * 2. Redistributions in binary form must reproduce the above copyright | 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
13 | * notice, this list of conditions and the following disclaimer in the | 13 | * notice, this list of conditions and the following disclaimer in the | |
14 | * documentation and/or other materials provided with the distribution. | 14 | * documentation and/or other materials provided with the distribution. | |
@@ -55,25 +55,20 @@ struct mdlwp { | @@ -55,25 +55,20 @@ struct mdlwp { | |||
55 | 55 | |||
56 | #define MDL_COMPAT32 0x0008 /* i386, always return via iret */ | 56 | #define MDL_COMPAT32 0x0008 /* i386, always return via iret */ | |
57 | #define MDL_IRET 0x0010 /* force return via iret, not sysret */ | 57 | #define MDL_IRET 0x0010 /* force return via iret, not sysret */ | |
58 | 58 | |||
59 | struct mdproc { | 59 | struct mdproc { | |
60 | int md_flags; | 60 | int md_flags; | |
61 | /* Syscall handling function */ | 61 | /* Syscall handling function */ | |
62 | void (*md_syscall)(struct trapframe *); | 62 | void (*md_syscall)(struct trapframe *); | |
63 | }; | 63 | }; | |
64 | 64 | |||
65 | /* md_flags */ | 65 | /* md_flags */ | |
66 | #define MDP_USEDMTRR 0x0008 /* has set volatile MTRRs */ | 66 | #define MDP_USEDMTRR 0x0008 /* has set volatile MTRRs */ | |
67 | 67 | |||
68 | #define UAREA_PCB_OFFSET (USPACE - ALIGN(sizeof(struct pcb))) | |||
69 | #define KSTACK_LOWEST_ADDR(l) \ | |||
70 | ((void *)((vaddr_t)(l)->l_addr - UAREA_PCB_OFFSET)) | |||
71 | #define KSTACK_SIZE UAREA_PCB_OFFSET | |||
72 | ||||
73 | #else /* __x86_64__ */ | 68 | #else /* __x86_64__ */ | |
74 | 69 | |||
75 | #include <i386/proc.h> | 70 | #include <i386/proc.h> | |
76 | 71 | |||
77 | #endif /* __x86_64__ */ | 72 | #endif /* __x86_64__ */ | |
78 | 73 | |||
79 | #endif /* _AMD64_PROC_H */ | 74 | #endif /* _AMD64_PROC_H */ |
--- src/sys/arch/i386/i386/locore.S 2014/02/02 22:41:20 1.111
+++ src/sys/arch/i386/i386/locore.S 2014/02/20 18:19:10 1.112
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: locore.S,v 1.111 2014/02/02 22:41:20 dsl Exp $ */ | 1 | /* $NetBSD: locore.S,v 1.112 2014/02/20 18:19:10 dsl Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright-o-rama! | 4 | * Copyright-o-rama! | |
5 | */ | 5 | */ | |
6 | 6 | |||
7 | /* | 7 | /* | |
8 | * Copyright (c) 2006 Manuel Bouyer. | 8 | * Copyright (c) 2006 Manuel Bouyer. | |
9 | * | 9 | * | |
10 | * Redistribution and use in source and binary forms, with or without | 10 | * Redistribution and use in source and binary forms, with or without | |
11 | * modification, are permitted provided that the following conditions | 11 | * modification, are permitted provided that the following conditions | |
12 | * are met: | 12 | * are met: | |
13 | * 1. Redistributions of source code must retain the above copyright | 13 | * 1. Redistributions of source code must retain the above copyright | |
14 | * notice, this list of conditions and the following disclaimer. | 14 | * notice, this list of conditions and the following disclaimer. | |
@@ -119,27 +119,27 @@ | @@ -119,27 +119,27 @@ | |||
119 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | 119 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
120 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | 120 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
121 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | 121 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
122 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | 122 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
123 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | 123 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
124 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 124 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
125 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 125 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
126 | * SUCH DAMAGE. | 126 | * SUCH DAMAGE. | |
127 | * | 127 | * | |
128 | * @(#)locore.s 7.3 (Berkeley) 5/13/91 | 128 | * @(#)locore.s 7.3 (Berkeley) 5/13/91 | |
129 | */ | 129 | */ | |
130 | 130 | |||
131 | #include <machine/asm.h> | 131 | #include <machine/asm.h> | |
132 | __KERNEL_RCSID(0, "$NetBSD: locore.S,v 1.111 2014/02/02 22:41:20 dsl Exp $"); | 132 | __KERNEL_RCSID(0, "$NetBSD: locore.S,v 1.112 2014/02/20 18:19:10 dsl Exp $"); | |
133 | 133 | |||
134 | #include "opt_compat_oldboot.h" | 134 | #include "opt_compat_oldboot.h" | |
135 | #include "opt_ddb.h" | 135 | #include "opt_ddb.h" | |
136 | #include "opt_modular.h" | 136 | #include "opt_modular.h" | |
137 | #include "opt_multiboot.h" | 137 | #include "opt_multiboot.h" | |
138 | #include "opt_realmem.h" | 138 | #include "opt_realmem.h" | |
139 | #include "opt_vm86.h" | 139 | #include "opt_vm86.h" | |
140 | #include "opt_xen.h" | 140 | #include "opt_xen.h" | |
141 | 141 | |||
142 | #include "assym.h" | 142 | #include "assym.h" | |
143 | #include "lapic.h" | 143 | #include "lapic.h" | |
144 | #include "ioapic.h" | 144 | #include "ioapic.h" | |
145 | #include "ksyms.h" | 145 | #include "ksyms.h" | |
@@ -717,28 +717,28 @@ begin: | @@ -717,28 +717,28 @@ begin: | |||
717 | movl $0,(%ebx) | 717 | movl $0,(%ebx) | |
718 | addl $PDE_SIZE,%ebx | 718 | addl $PDE_SIZE,%ebx | |
719 | loop 1b | 719 | loop 1b | |
720 | 720 | |||
721 | /* Relocate atdevbase. */ | 721 | /* Relocate atdevbase. */ | |
722 | movl $KERNBASE,%edx | 722 | movl $KERNBASE,%edx | |
723 | addl _C_LABEL(tablesize),%edx | 723 | addl _C_LABEL(tablesize),%edx | |
724 | addl %esi,%edx | 724 | addl %esi,%edx | |
725 | movl %edx,_C_LABEL(atdevbase) | 725 | movl %edx,_C_LABEL(atdevbase) | |
726 | 726 | |||
727 | /* Set up bootstrap stack. */ | 727 | /* Set up bootstrap stack. */ | |
728 | leal (PROC0_STK_OFF+KERNBASE)(%esi),%eax | 728 | leal (PROC0_STK_OFF+KERNBASE)(%esi),%eax | |
729 | movl %eax,_C_LABEL(lwp0uarea) | 729 | movl %eax,_C_LABEL(lwp0uarea) | |
730 | leal (KSTACK_SIZE-FRAMESIZE)(%eax),%esp | 730 | leal (USPACE-FRAMESIZE)(%eax),%esp | |
731 | movl %esi,(KSTACK_SIZE+PCB_CR3)(%eax) # pcb->pcb_cr3 | 731 | movl %esi,PCB_CR3(%eax) # pcb->pcb_cr3 | |
732 | xorl %ebp,%ebp # mark end of frames | 732 | xorl %ebp,%ebp # mark end of frames | |
733 | 733 | |||
734 | #if defined(MULTIBOOT) | 734 | #if defined(MULTIBOOT) | |
735 | /* It is now safe to parse the Multiboot information structure | 735 | /* It is now safe to parse the Multiboot information structure | |
736 | * we saved before from C code. Note that we cannot delay its | 736 | * we saved before from C code. Note that we cannot delay its | |
737 | * parsing any more because initgdt (called below) needs to make | 737 | * parsing any more because initgdt (called below) needs to make | |
738 | * use of this information. */ | 738 | * use of this information. */ | |
739 | call _C_LABEL(multiboot_post_reloc) | 739 | call _C_LABEL(multiboot_post_reloc) | |
740 | #endif | 740 | #endif | |
741 | 741 | |||
742 | subl $NGDT*8, %esp # space for temporary gdt | 742 | subl $NGDT*8, %esp # space for temporary gdt | |
743 | pushl %esp | 743 | pushl %esp | |
744 | call _C_LABEL(initgdt) | 744 | call _C_LABEL(initgdt) | |
@@ -815,27 +815,27 @@ begin: | @@ -815,27 +815,27 @@ begin: | |||
815 | pushl %eax # start of temporary gdt | 815 | pushl %eax # start of temporary gdt | |
816 | call _C_LABEL(initgdt) | 816 | call _C_LABEL(initgdt) | |
817 | addl $4,%esp | 817 | addl $4,%esp | |
818 | 818 | |||
819 | call xen_pmap_bootstrap | 819 | call xen_pmap_bootstrap | |
820 | 820 | |||
821 | /* | 821 | /* | |
822 | * First avail returned by xen_pmap_bootstrap in %eax | 822 | * First avail returned by xen_pmap_bootstrap in %eax | |
823 | */ | 823 | */ | |
824 | movl %eax, %esi; | 824 | movl %eax, %esi; | |
825 | movl %esi, _C_LABEL(lwp0uarea) | 825 | movl %esi, _C_LABEL(lwp0uarea) | |
826 | 826 | |||
827 | /* Set up bootstrap stack. */ | 827 | /* Set up bootstrap stack. */ | |
828 | leal (KSTACK_SIZE-FRAMESIZE)(%eax),%esp | 828 | leal (USPACE-FRAMESIZE)(%eax),%esp | |
829 | xorl %ebp,%ebp # mark end of frames | 829 | xorl %ebp,%ebp # mark end of frames | |
830 | 830 | |||
831 | addl $USPACE, %esi | 831 | addl $USPACE, %esi | |
832 | subl $KERNBASE, %esi #init386 want a physical address | 832 | subl $KERNBASE, %esi #init386 want a physical address | |
833 | 833 | |||
834 | #ifdef PAE | 834 | #ifdef PAE | |
835 | pushl $0 # init386() expects a 64 bits paddr_t with PAE | 835 | pushl $0 # init386() expects a 64 bits paddr_t with PAE | |
836 | #endif | 836 | #endif | |
837 | pushl %esi | 837 | pushl %esi | |
838 | call _C_LABEL(init386) # wire 386 chip for unix operation | 838 | call _C_LABEL(init386) # wire 386 chip for unix operation | |
839 | addl $PDE_SIZE,%esp # pop paddr_t | 839 | addl $PDE_SIZE,%esp # pop paddr_t | |
840 | call _C_LABEL(main) | 840 | call _C_LABEL(main) | |
841 | #endif /* XEN */ | 841 | #endif /* XEN */ |
--- src/sys/arch/i386/i386/machdep.c 2014/02/18 01:00:57 1.749
+++ src/sys/arch/i386/i386/machdep.c 2014/02/20 18:19:10 1.750
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: machdep.c,v 1.749 2014/02/18 01:00:57 christos Exp $ */ | 1 | /* $NetBSD: machdep.c,v 1.750 2014/02/20 18:19:10 dsl Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 1996, 1997, 1998, 2000, 2004, 2006, 2008, 2009 | 4 | * Copyright (c) 1996, 1997, 1998, 2000, 2004, 2006, 2008, 2009 | |
5 | * The NetBSD Foundation, Inc. | 5 | * The NetBSD Foundation, Inc. | |
6 | * All rights reserved. | 6 | * All rights reserved. | |
7 | * | 7 | * | |
8 | * This code is derived from software contributed to The NetBSD Foundation | 8 | * This code is derived from software contributed to The NetBSD Foundation | |
9 | * by Charles M. Hannum, by Jason R. Thorpe of the Numerical Aerospace | 9 | * by Charles M. Hannum, by Jason R. Thorpe of the Numerical Aerospace | |
10 | * Simulation Facility NASA Ames Research Center, by Julio M. Merino Vidal, | 10 | * Simulation Facility NASA Ames Research Center, by Julio M. Merino Vidal, | |
11 | * and by Andrew Doran. | 11 | * and by Andrew Doran. | |
12 | * | 12 | * | |
13 | * Redistribution and use in source and binary forms, with or without | 13 | * Redistribution and use in source and binary forms, with or without | |
14 | * modification, are permitted provided that the following conditions | 14 | * modification, are permitted provided that the following conditions | |
@@ -57,27 +57,27 @@ | @@ -57,27 +57,27 @@ | |||
57 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | 57 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
58 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | 58 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
59 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | 59 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
60 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | 60 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
61 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | 61 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
62 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 62 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
63 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 63 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
64 | * SUCH DAMAGE. | 64 | * SUCH DAMAGE. | |
65 | * | 65 | * | |
66 | * @(#)machdep.c 7.4 (Berkeley) 6/3/91 | 66 | * @(#)machdep.c 7.4 (Berkeley) 6/3/91 | |
67 | */ | 67 | */ | |
68 | 68 | |||
69 | #include <sys/cdefs.h> | 69 | #include <sys/cdefs.h> | |
70 | __KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.749 2014/02/18 01:00:57 christos Exp $"); | 70 | __KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.750 2014/02/20 18:19:10 dsl Exp $"); | |
71 | 71 | |||
72 | #include "opt_beep.h" | 72 | #include "opt_beep.h" | |
73 | #include "opt_compat_ibcs2.h" | 73 | #include "opt_compat_ibcs2.h" | |
74 | #include "opt_compat_freebsd.h" | 74 | #include "opt_compat_freebsd.h" | |
75 | #include "opt_compat_netbsd.h" | 75 | #include "opt_compat_netbsd.h" | |
76 | #include "opt_compat_svr4.h" | 76 | #include "opt_compat_svr4.h" | |
77 | #include "opt_cpureset_delay.h" | 77 | #include "opt_cpureset_delay.h" | |
78 | #include "opt_ddb.h" | 78 | #include "opt_ddb.h" | |
79 | #include "opt_ipkdb.h" | 79 | #include "opt_ipkdb.h" | |
80 | #include "opt_kgdb.h" | 80 | #include "opt_kgdb.h" | |
81 | #include "opt_mtrr.h" | 81 | #include "opt_mtrr.h" | |
82 | #include "opt_modular.h" | 82 | #include "opt_modular.h" | |
83 | #include "opt_multiboot.h" | 83 | #include "opt_multiboot.h" | |
@@ -132,26 +132,27 @@ __KERNEL_RCSID(0, "$NetBSD: machdep.c,v | @@ -132,26 +132,27 @@ __KERNEL_RCSID(0, "$NetBSD: machdep.c,v | |||
132 | #include <machine/cpufunc.h> | 132 | #include <machine/cpufunc.h> | |
133 | #include <machine/cpuvar.h> | 133 | #include <machine/cpuvar.h> | |
134 | #include <machine/gdt.h> | 134 | #include <machine/gdt.h> | |
135 | #include <machine/intr.h> | 135 | #include <machine/intr.h> | |
136 | #include <machine/kcore.h> | 136 | #include <machine/kcore.h> | |
137 | #include <machine/pio.h> | 137 | #include <machine/pio.h> | |
138 | #include <machine/psl.h> | 138 | #include <machine/psl.h> | |
139 | #include <machine/reg.h> | 139 | #include <machine/reg.h> | |
140 | #include <machine/specialreg.h> | 140 | #include <machine/specialreg.h> | |
141 | #include <machine/bootinfo.h> | 141 | #include <machine/bootinfo.h> | |
142 | #include <machine/mtrr.h> | 142 | #include <machine/mtrr.h> | |
143 | #include <x86/x86/tsc.h> | 143 | #include <x86/x86/tsc.h> | |
144 | 144 | |||
145 | #include <x86/fpu.h> | |||
145 | #include <x86/machdep.h> | 146 | #include <x86/machdep.h> | |
146 | 147 | |||
147 | #include <machine/multiboot.h> | 148 | #include <machine/multiboot.h> | |
148 | #ifdef XEN | 149 | #ifdef XEN | |
149 | #include <xen/evtchn.h> | 150 | #include <xen/evtchn.h> | |
150 | #include <xen/xen.h> | 151 | #include <xen/xen.h> | |
151 | #include <xen/hypervisor.h> | 152 | #include <xen/hypervisor.h> | |
152 | 153 | |||
153 | /* #define XENDEBUG */ | 154 | /* #define XENDEBUG */ | |
154 | /* #define XENDEBUG_LOW */ | 155 | /* #define XENDEBUG_LOW */ | |
155 | 156 | |||
156 | #ifdef XENDEBUG | 157 | #ifdef XENDEBUG | |
157 | #define XENPRINTF(x) printf x | 158 | #define XENPRINTF(x) printf x | |
@@ -490,27 +491,27 @@ cpu_startup(void) | @@ -490,27 +491,27 @@ cpu_startup(void) | |||
490 | * Set up proc0's TSS and LDT. | 491 | * Set up proc0's TSS and LDT. | |
491 | */ | 492 | */ | |
492 | void | 493 | void | |
493 | i386_proc0_tss_ldt_init(void) | 494 | i386_proc0_tss_ldt_init(void) | |
494 | { | 495 | { | |
495 | struct lwp *l; | 496 | struct lwp *l; | |
496 | struct pcb *pcb __diagused; | 497 | struct pcb *pcb __diagused; | |
497 | 498 | |||
498 | l = &lwp0; | 499 | l = &lwp0; | |
499 | pcb = lwp_getpcb(l); | 500 | pcb = lwp_getpcb(l); | |
500 | 501 | |||
501 | pmap_kernel()->pm_ldt_sel = GSEL(GLDT_SEL, SEL_KPL); | 502 | pmap_kernel()->pm_ldt_sel = GSEL(GLDT_SEL, SEL_KPL); | |
502 | pcb->pcb_cr0 = rcr0() & ~CR0_TS; | 503 | pcb->pcb_cr0 = rcr0() & ~CR0_TS; | |
503 | pcb->pcb_esp0 = uvm_lwp_getuarea(l) + KSTACK_SIZE - 16; | 504 | pcb->pcb_esp0 = uvm_lwp_getuarea(l) + USPACE - 16; | |
504 | pcb->pcb_iopl = SEL_KPL; | 505 | pcb->pcb_iopl = SEL_KPL; | |
505 | l->l_md.md_regs = (struct trapframe *)pcb->pcb_esp0 - 1; | 506 | l->l_md.md_regs = (struct trapframe *)pcb->pcb_esp0 - 1; | |
506 | memcpy(&pcb->pcb_fsd, &gdt[GUDATA_SEL], sizeof(pcb->pcb_fsd)); | 507 | memcpy(&pcb->pcb_fsd, &gdt[GUDATA_SEL], sizeof(pcb->pcb_fsd)); | |
507 | memcpy(&pcb->pcb_gsd, &gdt[GUDATA_SEL], sizeof(pcb->pcb_gsd)); | 508 | memcpy(&pcb->pcb_gsd, &gdt[GUDATA_SEL], sizeof(pcb->pcb_gsd)); | |
508 | 509 | |||
509 | #ifndef XEN | 510 | #ifndef XEN | |
510 | lldt(pmap_kernel()->pm_ldt_sel); | 511 | lldt(pmap_kernel()->pm_ldt_sel); | |
511 | #else | 512 | #else | |
512 | HYPERVISOR_fpu_taskswitch(1); | 513 | HYPERVISOR_fpu_taskswitch(1); | |
513 | XENPRINTF(("lwp tss sp %p ss %04x/%04x\n", | 514 | XENPRINTF(("lwp tss sp %p ss %04x/%04x\n", | |
514 | (void *)pcb->pcb_esp0, | 515 | (void *)pcb->pcb_esp0, | |
515 | GSEL(GDATA_SEL, SEL_KPL), | 516 | GSEL(GDATA_SEL, SEL_KPL), | |
516 | IDXSEL(GSEL(GDATA_SEL, SEL_KPL)))); | 517 | IDXSEL(GSEL(GDATA_SEL, SEL_KPL)))); |
--- src/sys/arch/i386/include/pcb.h 2014/02/12 23:24:09 1.52
+++ src/sys/arch/i386/include/pcb.h 2014/02/20 18:19:10 1.53
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: pcb.h,v 1.52 2014/02/12 23:24:09 dsl Exp $ */ | 1 | /* $NetBSD: pcb.h,v 1.53 2014/02/20 18:19:10 dsl Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 1998, 2009 The NetBSD Foundation, Inc. | 4 | * Copyright (c) 1998, 2009 The NetBSD Foundation, Inc. | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * This code is derived from software contributed to The NetBSD Foundation | 7 | * This code is derived from software contributed to The NetBSD Foundation | |
8 | * by Charles M. Hannum, and by Andrew Doran. | 8 | * by Charles M. Hannum, and by Andrew Doran. | |
9 | * | 9 | * | |
10 | * Redistribution and use in source and binary forms, with or without | 10 | * Redistribution and use in source and binary forms, with or without | |
11 | * modification, are permitted provided that the following conditions | 11 | * modification, are permitted provided that the following conditions | |
12 | * are met: | 12 | * are met: | |
13 | * 1. Redistributions of source code must retain the above copyright | 13 | * 1. Redistributions of source code must retain the above copyright | |
14 | * notice, this list of conditions and the following disclaimer. | 14 | * notice, this list of conditions and the following disclaimer. | |
@@ -64,44 +64,45 @@ | @@ -64,44 +64,45 @@ | |||
64 | */ | 64 | */ | |
65 | 65 | |||
66 | /* | 66 | /* | |
67 | * Intel 386 process control block | 67 | * Intel 386 process control block | |
68 | */ | 68 | */ | |
69 | 69 | |||
70 | #ifndef _I386_PCB_H_ | 70 | #ifndef _I386_PCB_H_ | |
71 | #define _I386_PCB_H_ | 71 | #define _I386_PCB_H_ | |
72 | 72 | |||
73 | #if defined(_KERNEL_OPT) | 73 | #if defined(_KERNEL_OPT) | |
74 | #include "opt_multiprocessor.h" | 74 | #include "opt_multiprocessor.h" | |
75 | #endif | 75 | #endif | |
76 | 76 | |||
77 | #include <sys/signal.h> | |||
78 | ||||
79 | #include <machine/segments.h> | 77 | #include <machine/segments.h> | |
80 | #include <machine/tss.h> | 78 | #include <x86/cpu_extended_state.h> | |
81 | #include <x86/fpu.h> | |||
82 | #include <i386/sysarch.h> | |||
83 | 79 | |||
84 | struct pcb { | 80 | struct pcb { | |
85 | int pcb_esp0; /* ring0 esp */ | 81 | int pcb_esp0; /* ring0 esp */ | |
86 | int pcb_esp; /* kernel esp */ | 82 | int pcb_esp; /* kernel esp */ | |
87 | int pcb_ebp; /* kernel ebp */ | 83 | int pcb_ebp; /* kernel ebp */ | |
88 | int pcb_unused; /* unused */ | |||
89 | int pcb_cr0; /* saved image of CR0 */ | 84 | int pcb_cr0; /* saved image of CR0 */ | |
90 | int pcb_cr2; /* page fault address (CR2) */ | 85 | int pcb_cr2; /* page fault address (CR2) */ | |
91 | int pcb_cr3; /* page directory pointer */ | 86 | int pcb_cr3; /* page directory pointer */ | |
92 | int pcb_iopl; /* i/o privilege level */ | 87 | int pcb_iopl; /* i/o privilege level */ | |
93 | 88 | |||
94 | /* floating point state for FPU */ | |||
95 | union savefpu pcb_savefpu __aligned(16); | |||
96 | ||||
97 | struct segment_descriptor pcb_fsd; /* %fs descriptor */ | 89 | struct segment_descriptor pcb_fsd; /* %fs descriptor */ | |
98 | struct segment_descriptor pcb_gsd; /* %gs descriptor */ | 90 | struct segment_descriptor pcb_gsd; /* %gs descriptor */ | |
99 | void * pcb_onfault; /* copyin/out fault recovery */ | 91 | void *pcb_onfault; /* copyin/out fault recovery */ | |
100 | int vm86_eflags; /* virtual eflags for vm86 mode */ | 92 | int vm86_eflags; /* virtual eflags for vm86 mode */ | |
101 | int vm86_flagmask; /* flag mask for vm86 mode */ | 93 | int vm86_flagmask; /* flag mask for vm86 mode */ | |
102 | void *vm86_userp; /* XXX performance hack */ | 94 | void *vm86_userp; /* XXX performance hack */ | |
103 | struct cpu_info *pcb_fpcpu; /* cpu holding our fp state. */ | |||
104 | char *pcb_iomap; /* I/O permission bitmap */ | 95 | char *pcb_iomap; /* I/O permission bitmap */ | |
96 | ||||
97 | int not_used[15]; | |||
98 | ||||
99 | /* floating point state */ | |||
100 | struct cpu_info *pcb_fpcpu; /* cpu holding our fp state. */ | |||
101 | union savefpu pcb_savefpu __aligned(64); | |||
102 | /* **** DO NOT ADD ANYTHING HERE **** */ | |||
103 | ||||
105 | }; | 104 | }; | |
105 | /* This doesn't really matter, but there is a lot of implied padding */ | |||
106 | __CTASSERT(sizeof(struct pcb) - sizeof (union savefpu) == 128); | |||
106 | 107 | |||
107 | #endif /* _I386_PCB_H_ */ | 108 | #endif /* _I386_PCB_H_ */ |
--- src/sys/arch/i386/include/proc.h 2014/02/15 10:11:15 1.41
+++ src/sys/arch/i386/include/proc.h 2014/02/20 18:19:10 1.42
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: proc.h,v 1.41 2014/02/15 10:11:15 dsl Exp $ */ | 1 | /* $NetBSD: proc.h,v 1.42 2014/02/20 18:19:10 dsl Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 1991 Regents of the University of California. | 4 | * Copyright (c) 1991 Regents of the University of California. | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * Redistribution and use in source and binary forms, with or without | 7 | * Redistribution and use in source and binary forms, with or without | |
8 | * modification, are permitted provided that the following conditions | 8 | * modification, are permitted provided that the following conditions | |
9 | * are met: | 9 | * are met: | |
10 | * 1. Redistributions of source code must retain the above copyright | 10 | * 1. Redistributions of source code must retain the above copyright | |
11 | * notice, this list of conditions and the following disclaimer. | 11 | * notice, this list of conditions and the following disclaimer. | |
12 | * 2. Redistributions in binary form must reproduce the above copyright | 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
13 | * notice, this list of conditions and the following disclaimer in the | 13 | * notice, this list of conditions and the following disclaimer in the | |
14 | * documentation and/or other materials provided with the distribution. | 14 | * documentation and/or other materials provided with the distribution. | |
@@ -53,20 +53,14 @@ struct mdlwp { | @@ -53,20 +53,14 @@ struct mdlwp { | |||
53 | 53 | |||
54 | /* md_flags */ | 54 | /* md_flags */ | |
55 | #define MDL_IOPL 0x0002 /* XEN: i/o privilege */ | 55 | #define MDL_IOPL 0x0002 /* XEN: i/o privilege */ | |
56 | 56 | |||
57 | struct mdproc { | 57 | struct mdproc { | |
58 | int md_flags; | 58 | int md_flags; | |
59 | void (*md_syscall)(struct trapframe *); | 59 | void (*md_syscall)(struct trapframe *); | |
60 | /* Syscall handling function */ | 60 | /* Syscall handling function */ | |
61 | }; | 61 | }; | |
62 | 62 | |||
63 | /* md_flags */ | 63 | /* md_flags */ | |
64 | #define MDP_USEDMTRR 0x0002 /* has set volatile MTRRs */ | 64 | #define MDP_USEDMTRR 0x0002 /* has set volatile MTRRs */ | |
65 | 65 | |||
66 | /* Kernel stack parameters. */ | |||
67 | #define UAREA_PCB_OFFSET (USPACE - ALIGN(sizeof(struct pcb))) | |||
68 | #define KSTACK_LOWEST_ADDR(l) \ | |||
69 | ((void *)((vaddr_t)(l)->l_addr - UAREA_PCB_OFFSET)) | |||
70 | #define KSTACK_SIZE UAREA_PCB_OFFSET | |||
71 | ||||
72 | #endif /* _I386_PROC_H_ */ | 66 | #endif /* _I386_PROC_H_ */ |
--- src/sys/arch/x86/x86/vm_machdep.c 2014/02/15 10:11:15 1.22
+++ src/sys/arch/x86/x86/vm_machdep.c 2014/02/20 18:19:10 1.23
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: vm_machdep.c,v 1.22 2014/02/15 10:11:15 dsl Exp $ */ | 1 | /* $NetBSD: vm_machdep.c,v 1.23 2014/02/20 18:19:10 dsl Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 1982, 1986 The Regents of the University of California. | 4 | * Copyright (c) 1982, 1986 The Regents of the University of California. | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * This code is derived from software contributed to Berkeley by | 7 | * This code is derived from software contributed to Berkeley by | |
8 | * the Systems Programming Group of the University of Utah Computer | 8 | * the Systems Programming Group of the University of Utah Computer | |
9 | * Science Department, and William Jolitz. | 9 | * Science Department, and William Jolitz. | |
10 | * | 10 | * | |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without | |
12 | * modification, are permitted provided that the following conditions | 12 | * modification, are permitted provided that the following conditions | |
13 | * are met: | 13 | * are met: | |
14 | * 1. Redistributions of source code must retain the above copyright | 14 | * 1. Redistributions of source code must retain the above copyright | |
@@ -70,49 +70,52 @@ | @@ -70,49 +70,52 @@ | |||
70 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | 70 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
71 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 71 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
72 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 72 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
73 | * SUCH DAMAGE. | 73 | * SUCH DAMAGE. | |
74 | * | 74 | * | |
75 | * @(#)vm_machdep.c 7.3 (Berkeley) 5/13/91 | 75 | * @(#)vm_machdep.c 7.3 (Berkeley) 5/13/91 | |
76 | */ | 76 | */ | |
77 | 77 | |||
78 | /* | 78 | /* | |
79 | * Utah $Hdr: vm_machdep.c 1.16.1.1 89/06/23$ | 79 | * Utah $Hdr: vm_machdep.c 1.16.1.1 89/06/23$ | |
80 | */ | 80 | */ | |
81 | 81 | |||
82 | #include <sys/cdefs.h> | 82 | #include <sys/cdefs.h> | |
83 | __KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.22 2014/02/15 10:11:15 dsl Exp $"); | 83 | __KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.23 2014/02/20 18:19:10 dsl Exp $"); | |
84 | 84 | |||
85 | #include "opt_mtrr.h" | 85 | #include "opt_mtrr.h" | |
86 | 86 | |||
87 | #include <sys/param.h> | 87 | #include <sys/param.h> | |
88 | #include <sys/systm.h> | 88 | #include <sys/systm.h> | |
89 | #include <sys/proc.h> | 89 | #include <sys/proc.h> | |
90 | #include <sys/vnode.h> | 90 | #include <sys/vnode.h> | |
91 | #include <sys/buf.h> | 91 | #include <sys/buf.h> | |
92 | #include <sys/core.h> | 92 | #include <sys/core.h> | |
93 | #include <sys/exec.h> | 93 | #include <sys/exec.h> | |
94 | #include <sys/ptrace.h> | 94 | #include <sys/ptrace.h> | |
95 | 95 | |||
96 | #include <uvm/uvm.h> | 96 | #include <uvm/uvm.h> | |
97 | 97 | |||
98 | #include <machine/cpu.h> | 98 | #include <machine/cpu.h> | |
99 | #include <machine/gdt.h> | 99 | #include <machine/gdt.h> | |
100 | #include <machine/reg.h> | 100 | #include <machine/reg.h> | |
101 | #include <machine/specialreg.h> | 101 | #include <machine/specialreg.h> | |
102 | ||||
102 | #ifdef MTRR | 103 | #ifdef MTRR | |
103 | #include <machine/mtrr.h> | 104 | #include <machine/mtrr.h> | |
104 | #endif | 105 | #endif | |
105 | 106 | |||
107 | #include <x86/fpu.h> | |||
108 | ||||
106 | void | 109 | void | |
107 | cpu_proc_fork(struct proc *p1, struct proc *p2) | 110 | cpu_proc_fork(struct proc *p1, struct proc *p2) | |
108 | { | 111 | { | |
109 | 112 | |||
110 | p2->p_md.md_flags = p1->p_md.md_flags; | 113 | p2->p_md.md_flags = p1->p_md.md_flags; | |
111 | } | 114 | } | |
112 | 115 | |||
113 | /* | 116 | /* | |
114 | * cpu_lwp_fork: finish a new LWP (l2) operation. | 117 | * cpu_lwp_fork: finish a new LWP (l2) operation. | |
115 | * | 118 | * | |
116 | * First LWP (l1) is the process being forked. If it is &lwp0, then we | 119 | * First LWP (l1) is the process being forked. If it is &lwp0, then we | |
117 | * are creating a kthread, where return path and argument are specified | 120 | * are creating a kthread, where return path and argument are specified | |
118 | * with `func' and `arg'. | 121 | * with `func' and `arg'. | |
@@ -159,30 +162,30 @@ cpu_lwp_fork(struct lwp *l1, struct lwp | @@ -159,30 +162,30 @@ cpu_lwp_fork(struct lwp *l1, struct lwp | |||
159 | /* | 162 | /* | |
160 | * Set the kernel stack address (from the address to uarea) and | 163 | * Set the kernel stack address (from the address to uarea) and | |
161 | * trapframe address for child. | 164 | * trapframe address for child. | |
162 | * | 165 | * | |
163 | * Rig kernel stack so that it would start out in lwp_trampoline() | 166 | * Rig kernel stack so that it would start out in lwp_trampoline() | |
164 | * and call child_return() with l2 as an argument. This causes the | 167 | * and call child_return() with l2 as an argument. This causes the | |
165 | * newly-created child process to go directly to user level with a | 168 | * newly-created child process to go directly to user level with a | |
166 | * parent return value of 0 from fork(), while the parent process | 169 | * parent return value of 0 from fork(), while the parent process | |
167 | * returns normally. | 170 | * returns normally. | |
168 | */ | 171 | */ | |
169 | uv = uvm_lwp_getuarea(l2); | 172 | uv = uvm_lwp_getuarea(l2); | |
170 | 173 | |||
171 | #ifdef __x86_64__ | 174 | #ifdef __x86_64__ | |
172 | pcb2->pcb_rsp0 = (uv + KSTACK_SIZE - 16) & ~0xf; | 175 | pcb2->pcb_rsp0 = (uv + USPACE - 16) & ~0xf; | |
173 | tf = (struct trapframe *)pcb2->pcb_rsp0 - 1; | 176 | tf = (struct trapframe *)pcb2->pcb_rsp0 - 1; | |
174 | #else | 177 | #else | |
175 | pcb2->pcb_esp0 = (uv + KSTACK_SIZE - 16); | 178 | pcb2->pcb_esp0 = (uv + USPACE - 16); | |
176 | tf = (struct trapframe *)pcb2->pcb_esp0 - 1; | 179 | tf = (struct trapframe *)pcb2->pcb_esp0 - 1; | |
177 | 180 | |||
178 | pcb2->pcb_iomap = NULL; | 181 | pcb2->pcb_iomap = NULL; | |
179 | #endif | 182 | #endif | |
180 | l2->l_md.md_regs = tf; | 183 | l2->l_md.md_regs = tf; | |
181 | 184 | |||
182 | /* | 185 | /* | |
183 | * Copy the trapframe from parent, so that return to userspace | 186 | * Copy the trapframe from parent, so that return to userspace | |
184 | * will be to right address, with correct registers. | 187 | * will be to right address, with correct registers. | |
185 | */ | 188 | */ | |
186 | memcpy(tf, l1->l_md.md_regs, sizeof(struct trapframe)); | 189 | memcpy(tf, l1->l_md.md_regs, sizeof(struct trapframe)); | |
187 | 190 | |||
188 | /* Child LWP might get aston() before returning to userspace. */ | 191 | /* Child LWP might get aston() before returning to userspace. */ |
--- src/sys/sys/param.h 2014/02/07 15:29:23 1.440
+++ src/sys/sys/param.h 2014/02/20 18:19:10 1.441
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: param.h,v 1.440 2014/02/07 15:29:23 hannken Exp $ */ | 1 | /* $NetBSD: param.h,v 1.441 2014/02/20 18:19:10 dsl Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 1982, 1986, 1989, 1993 | 4 | * Copyright (c) 1982, 1986, 1989, 1993 | |
5 | * The Regents of the University of California. All rights reserved. | 5 | * The Regents of the University of California. All rights reserved. | |
6 | * (c) UNIX System Laboratories, Inc. | 6 | * (c) UNIX System Laboratories, Inc. | |
7 | * All or some portions of this file are derived from material licensed | 7 | * All or some portions of this file are derived from material licensed | |
8 | * to the University of California by American Telephone and Telegraph | 8 | * to the University of California by American Telephone and Telegraph | |
9 | * Co. or Unix System Laboratories, Inc. and are reproduced herein with | 9 | * Co. or Unix System Laboratories, Inc. and are reproduced herein with | |
10 | * the permission of UNIX System Laboratories, Inc. | 10 | * the permission of UNIX System Laboratories, Inc. | |
11 | * | 11 | * | |
12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without | |
13 | * modification, are permitted provided that the following conditions | 13 | * modification, are permitted provided that the following conditions | |
14 | * are met: | 14 | * are met: | |
@@ -53,27 +53,27 @@ | @@ -53,27 +53,27 @@ | |||
53 | * m = minor version; a minor number of 99 indicates current. | 53 | * m = minor version; a minor number of 99 indicates current. | |
54 | * r = 0 (*) | 54 | * r = 0 (*) | |
55 | * p = patchlevel | 55 | * p = patchlevel | |
56 | * | 56 | * | |
57 | * When new releases are made, src/gnu/usr.bin/groff/tmac/mdoc.local | 57 | * When new releases are made, src/gnu/usr.bin/groff/tmac/mdoc.local | |
58 | * needs to be updated and the changes sent back to the groff maintainers. | 58 | * needs to be updated and the changes sent back to the groff maintainers. | |
59 | * | 59 | * | |
60 | * (*) Up to 2.0I "release" used to be "",A-Z,Z[A-Z] but numeric | 60 | * (*) Up to 2.0I "release" used to be "",A-Z,Z[A-Z] but numeric | |
61 | * e.g. NetBSD-1.2D = 102040000 ('D' == 4) | 61 | * e.g. NetBSD-1.2D = 102040000 ('D' == 4) | |
62 | * NetBSD-2.0H (200080000) was changed on 20041001 to: | 62 | * NetBSD-2.0H (200080000) was changed on 20041001 to: | |
63 | * 2.99.9 (299000900) | 63 | * 2.99.9 (299000900) | |
64 | */ | 64 | */ | |
65 | 65 | |||
66 | #define __NetBSD_Version__ 699003100 /* NetBSD 6.99.31 */ | 66 | #define __NetBSD_Version__ 699003200 /* NetBSD 6.99.32 */ | |
67 | 67 | |||
68 | #define __NetBSD_Prereq__(M,m,p) (((((M) * 100000000) + \ | 68 | #define __NetBSD_Prereq__(M,m,p) (((((M) * 100000000) + \ | |
69 | (m) * 1000000) + (p) * 100) <= __NetBSD_Version__) | 69 | (m) * 1000000) + (p) * 100) <= __NetBSD_Version__) | |
70 | 70 | |||
71 | /* | 71 | /* | |
72 | * Historical NetBSD #define | 72 | * Historical NetBSD #define | |
73 | * | 73 | * | |
74 | * NetBSD 1.4 was the last release for which this value was incremented. | 74 | * NetBSD 1.4 was the last release for which this value was incremented. | |
75 | * The value is now permanently fixed at 199905. It will never be | 75 | * The value is now permanently fixed at 199905. It will never be | |
76 | * changed again. | 76 | * changed again. | |
77 | * | 77 | * | |
78 | * New code must use __NetBSD_Version__ instead, and should not even | 78 | * New code must use __NetBSD_Version__ instead, and should not even | |
79 | * count on NetBSD being defined. | 79 | * count on NetBSD being defined. |