PERFORCE change 28737 for review
Peter Wemm
peter at FreeBSD.org
Thu Apr 10 14:05:54 PDT 2003
http://perforce.freebsd.org/chv.cgi?CH=28737
Change 28737 by peter at peter_daintree on 2003/04/10 14:05:24
update common_tss.tss.tss_rsp0 on context switch so that we arrive on
the correct stack when entering the kernel from userland.
Affected files ...
.. //depot/projects/hammer/sys/x86_64/include/tss.h#7 edit
.. //depot/projects/hammer/sys/x86_64/x86_64/genassym.c#16 edit
.. //depot/projects/hammer/sys/x86_64/x86_64/swtch.s#17 edit
Differences ...
==== //depot/projects/hammer/sys/x86_64/include/tss.h#7 (text+ko) ====
@@ -70,4 +70,16 @@
};
#pragma pack()
+#ifdef _KERNEL
+/*
+ * Nasty hack to arrange internal alignment.
+ * What were they thinking??
+ */
+struct aligned_tss {
+ u_int32_t pad;
+ struct x86_64tss tss __packed;
+};
+extern struct aligned_tss common_tss;
+#endif
+
#endif /* _MACHINE_TSS_H_ */
==== //depot/projects/hammer/sys/x86_64/x86_64/genassym.c#16 (text+ko) ====
@@ -133,6 +133,8 @@
ASSYM(PCB_SIZE, sizeof(struct pcb));
+ASSYM(COMMON_TSS_RSP0, offsetof(struct aligned_tss, tss.tss_rsp0));
+
ASSYM(TF_TRAPNO, offsetof(struct trapframe, tf_trapno));
ASSYM(TF_ERR, offsetof(struct trapframe, tf_err));
ASSYM(TF_CS, offsetof(struct trapframe, tf_cs));
==== //depot/projects/hammer/sys/x86_64/x86_64/swtch.s#17 (text+ko) ====
@@ -147,6 +147,11 @@
* to load up the rest of the next context.
*/
movq TD_PCB(%rsi),%rdx
+
+ /* Update the TSS_RSP0 pointer for the next interrupt */
+ leaq -16(%rdx), %rbx
+ movq %rbx, common_tss + COMMON_TSS_RSP0
+
/* Restore context. */
movq PCB_RBX(%rdx),%rbx
movq PCB_RSP(%rdx),%rsp
More information about the p4-projects
mailing list