Date: Thu, 10 Apr 2003 14:05:52 -0700 (PDT) From: Peter Wemm <peter@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 28737 for review Message-ID: <200304102105.h3AL5qIq021745@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=28737 Change 28737 by peter@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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200304102105.h3AL5qIq021745>