PERFORCE change 107822 for review
Oleksandr Tymoshenko
gonzo at FreeBSD.org
Fri Oct 13 07:26:47 PDT 2006
http://perforce.freebsd.org/chv.cgi?CH=107822
Change 107822 by gonzo at gonzo_hq on 2006/10/13 14:25:55
o Keep realstack pointer and pte0, pte1 for this pointer in
machine-dependant fields of thread struct for further use.
Affected files ...
.. //depot/projects/mips2/src/sys/mips/include/proc.h#4 edit
.. //depot/projects/mips2/src/sys/mips/mips/vm_machdep.c#9 edit
Differences ...
==== //depot/projects/mips2/src/sys/mips/include/proc.h#4 (text+ko) ====
@@ -33,14 +33,18 @@
#ifndef _MACHINE_PROC_H_
#define _MACHINE_PROC_H_
+#include <machine/pte.h>
+
/*
* Machine-dependent part of the proc structure for AMD64.
*/
struct mdthread {
- int md_flags; /* machine-dependent flags */
- void *md_regs; /* registers on current frame */
- __register_t md_saved_sr; /* critical section saved SR */
- int md_spinlock_count;
+ int md_flags; /* machine-dependent flags */
+ void *md_regs; /* registers on current frame */
+ __register_t md_saved_sr; /* critical section saved SR */
+ vm_offset_t md_realstack;
+ pt_entry_t md_stack_pte[2];
+ int md_spinlock_count;
};
struct mdproc {
==== //depot/projects/mips2/src/sys/mips/mips/vm_machdep.c#9 (text+ko) ====
@@ -40,6 +40,7 @@
#include <machine/cpu.h>
#include <machine/pcb.h>
#include <machine/sysarch.h>
+#include <machine/tlb.h>
#include <vm/vm.h>
#include <vm/pmap.h>
#include <sys/lock.h>
@@ -178,8 +179,31 @@
void
cpu_thread_setup(struct thread *td)
{
+ pt_entry_t *pte;
+ /*
+ * To use wired TLB we should have even-aligned virtual address
+ * Since there is no way to specify alignment for td_kstack we
+ * drop KSTACK_GUARD support and request 3 pages for kstack.
+ * And use first even-aligned page number.
+ */
+ if(td->td_kstack & (1 << PAGE_SHIFT))
+ td->td_md.md_realstack = td->td_kstack + PAGE_SIZE;
+ else
+ td->td_md.md_realstack = td->td_kstack;
+
+ /*
+ * Fill out PTEs to be wired then
+ */
+ pte = tlb_kern_pte_find(kptmap, td->td_md.md_realstack);
+ td->td_md.md_stack_pte[0] = *pte;
+
+ pte = tlb_kern_pte_find(kptmap, td->td_md.md_realstack + PAGE_SIZE);
+ td->td_md.md_stack_pte[1] = *pte;
+
+
td->td_pcb =
- (struct pcb *)(td->td_kstack + KSTACK_PAGES * PAGE_SIZE) - 1;
+ (struct pcb *)(td->td_md.md_realstack \
+ + (KSTACK_PAGES - 1) * PAGE_SIZE) - 1;
td->td_frame = (struct trapframe *)td->td_pcb - 1;
/*
More information about the p4-projects
mailing list