From owner-p4-projects@FreeBSD.ORG Thu Apr 10 14:05:53 2003 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 5AF5037B404; Thu, 10 Apr 2003 14:05:53 -0700 (PDT) Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 0E7AA37B401 for ; Thu, 10 Apr 2003 14:05:53 -0700 (PDT) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id AA07443FAF for ; Thu, 10 Apr 2003 14:05:52 -0700 (PDT) (envelope-from peter@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.12.6/8.12.6) with ESMTP id h3AL5q0U021748 for ; Thu, 10 Apr 2003 14:05:52 -0700 (PDT) (envelope-from peter@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.12.6/8.12.6/Submit) id h3AL5qIq021745 for perforce@freebsd.org; Thu, 10 Apr 2003 14:05:52 -0700 (PDT) Date: Thu, 10 Apr 2003 14:05:52 -0700 (PDT) Message-Id: <200304102105.h3AL5qIq021745@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to peter@freebsd.org using -f From: Peter Wemm To: Perforce Change Reviews Subject: PERFORCE change 28737 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Apr 2003 21:05:54 -0000 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