From owner-p4-projects@FreeBSD.ORG Thu Apr 24 22:48:30 2003 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id F2A1437B404; Thu, 24 Apr 2003 22:48:29 -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 9211F37B401 for ; Thu, 24 Apr 2003 22:48:29 -0700 (PDT) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 2E81F43F75 for ; Thu, 24 Apr 2003 22:48:29 -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 h3P5mT0U037587 for ; Thu, 24 Apr 2003 22:48:29 -0700 (PDT) (envelope-from peter@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.12.6/8.12.6/Submit) id h3P5mS1Q037581 for perforce@freebsd.org; Thu, 24 Apr 2003 22:48:28 -0700 (PDT) Date: Thu, 24 Apr 2003 22:48:28 -0700 (PDT) Message-Id: <200304250548.h3P5mS1Q037581@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 29670 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: Fri, 25 Apr 2003 05:48:31 -0000 http://perforce.freebsd.org/chv.cgi?CH=29670 Change 29670 by peter@peter_daintree on 2003/04/24 22:48:20 Use a pipeline of movq instead of pushq/popq for trapframes. This is convenient for several reasons. 1) it is more robust, 2) it lets me transparently reorder the trapframe so as to avoid the horrible hacks in the syscall code, and 3) because gcc Really Likes to do it that way, so presumably its for optimization reasons. Affected files ... .. //depot/projects/hammer/sys/x86_64/x86_64/exception.s#21 edit .. //depot/projects/hammer/sys/x86_64/x86_64/genassym.c#20 edit Differences ... ==== //depot/projects/hammer/sys/x86_64/x86_64/exception.s#21 (text+ko) ==== @@ -129,21 +129,22 @@ .globl alltraps .type alltraps,@function alltraps: - pushq %rax - pushq %rcx - pushq %rdx - pushq %rbx - pushq %rbp - pushq %rsi - pushq %rdi - pushq %r8 - pushq %r9 - pushq %r10 - pushq %r11 - pushq %r12 - pushq %r13 - pushq %r14 - pushq %r15 + subq $TF_TRAPNO,%rsp /* tf_err and tf_trapno already pushed */ + movq %rax,TF_RAX(%rsp) + movq %rcx,TF_RCX(%rsp) + movq %rdx,TF_RDX(%rsp) + movq %rbx,TF_RBX(%rsp) + movq %rbp,TF_RBP(%rsp) + movq %rsi,TF_RSI(%rsp) + movq %rdi,TF_RDI(%rsp) + movq %r8,TF_R8(%rsp) + movq %r9,TF_R9(%rsp) + movq %r10,TF_R10(%rsp) + movq %r11,TF_R11(%rsp) + movq %r12,TF_R12(%rsp) + movq %r13,TF_R13(%rsp) + movq %r14,TF_R14(%rsp) + movq %r15,TF_R15(%rsp) alltraps_with_regs_pushed: FAKE_MCOUNT(13*4(%rsp)) calltrap: @@ -169,22 +170,22 @@ SUPERALIGN_TEXT IDTVEC(int0x80_syscall) pushq $2 /* sizeof "int 0x80" */ - subq $8,%rsp /* skip over tf_trapno */ - pushq %rax - pushq %rcx - pushq %rdx - pushq %rbx - pushq %rbp - pushq %rsi - pushq %rdi - pushq %r8 - pushq %r9 - pushq %r10 - pushq %r11 - pushq %r12 - pushq %r13 - pushq %r14 - pushq %r15 + subq $TF_ERR,%rsp /* skip over tf_trapno */ + movq %rax,TF_RAX(%rsp) + movq %rcx,TF_RCX(%rsp) + movq %rdx,TF_RDX(%rsp) + movq %rbx,TF_RBX(%rsp) + movq %rbp,TF_RBP(%rsp) + movq %rsi,TF_RSI(%rsp) + movq %rdi,TF_RDI(%rsp) + movq %r8,TF_R8(%rsp) + movq %r9,TF_R9(%rsp) + movq %r10,TF_R10(%rsp) + movq %r11,TF_R11(%rsp) + movq %r12,TF_R12(%rsp) + movq %r13,TF_R13(%rsp) + movq %r14,TF_R14(%rsp) + movq %r15,TF_R15(%rsp) FAKE_MCOUNT(13*4(%rsp)) call syscall MEXITCOUNT @@ -251,22 +252,22 @@ doreti_exit: MEXITCOUNT - popq %r15 - popq %r14 - popq %r13 - popq %r12 - popq %r11 - popq %r10 - popq %r9 - popq %r8 - popq %rdi - popq %rsi - popq %rbp - popq %rbx - popq %rdx - popq %rcx - popq %rax - addq $16,%rsp + movq TF_R15(%rsp),%r15 + movq TF_R14(%rsp),%r14 + movq TF_R13(%rsp),%r13 + movq TF_R12(%rsp),%r12 + movq TF_R11(%rsp),%r11 + movq TF_R10(%rsp),%r10 + movq TF_R9(%rsp),%r9 + movq TF_R8(%rsp),%r8 + movq TF_RDI(%rsp),%rdi + movq TF_RSI(%rsp),%rsi + movq TF_RBP(%rsp),%rbp + movq TF_RBX(%rsp),%rbx + movq TF_RDX(%rsp),%rdx + movq TF_RCX(%rsp),%rcx + movq TF_RAX(%rsp),%rax + addq $TF_RIP,%rsp /* skip over tf_err, tf_trapno */ .globl doreti_iret doreti_iret: iretq @@ -281,22 +282,22 @@ ALIGN_TEXT .globl doreti_iret_fault doreti_iret_fault: - subq $16,%rsp - pushq %rax - pushq %rcx - pushq %rdx - pushq %rbx - pushq %rbp - pushq %rsi - pushq %rdi - pushq %r8 - pushq %r9 - pushq %r10 - pushq %r11 - pushq %r12 - pushq %r13 - pushq %r14 - pushq %r15 + subq $TF_RIP,%rsp /* space including tf_err, tf_trapno */ + movq %rax,TF_RAX(%rsp) + movq %rcx,TF_RCX(%rsp) + movq %rdx,TF_RDX(%rsp) + movq %rbx,TF_RBX(%rsp) + movq %rbp,TF_RBP(%rsp) + movq %rsi,TF_RSI(%rsp) + movq %rdi,TF_RDI(%rsp) + movq %r8,TF_R8(%rsp) + movq %r9,TF_R9(%rsp) + movq %r10,TF_R10(%rsp) + movq %r11,TF_R11(%rsp) + movq %r12,TF_R12(%rsp) + movq %r13,TF_R13(%rsp) + movq %r14,TF_R14(%rsp) + movq %r15,TF_R15(%rsp) movq $0,TF_ERR(%rsp) /* XXX should be the error code */ movq $T_PROTFLT,TF_TRAPNO(%rsp) jmp alltraps_with_regs_pushed ==== //depot/projects/hammer/sys/x86_64/x86_64/genassym.c#20 (text+ko) ==== @@ -130,10 +130,29 @@ ASSYM(COMMON_TSS_RSP0, offsetof(struct x86_64tss, tss_rsp0)); +ASSYM(TF_R15, offsetof(struct trapframe, tf_r15)); +ASSYM(TF_R14, offsetof(struct trapframe, tf_r14)); +ASSYM(TF_R13, offsetof(struct trapframe, tf_r13)); +ASSYM(TF_R12, offsetof(struct trapframe, tf_r12)); +ASSYM(TF_R11, offsetof(struct trapframe, tf_r11)); +ASSYM(TF_R10, offsetof(struct trapframe, tf_r10)); +ASSYM(TF_R9, offsetof(struct trapframe, tf_r9)); +ASSYM(TF_R8, offsetof(struct trapframe, tf_r8)); +ASSYM(TF_RDI, offsetof(struct trapframe, tf_rdi)); +ASSYM(TF_RSI, offsetof(struct trapframe, tf_rsi)); +ASSYM(TF_RBP, offsetof(struct trapframe, tf_rbp)); +ASSYM(TF_RBX, offsetof(struct trapframe, tf_rbx)); +ASSYM(TF_RDX, offsetof(struct trapframe, tf_rdx)); +ASSYM(TF_RCX, offsetof(struct trapframe, tf_rcx)); +ASSYM(TF_RAX, offsetof(struct trapframe, tf_rax)); ASSYM(TF_TRAPNO, offsetof(struct trapframe, tf_trapno)); ASSYM(TF_ERR, offsetof(struct trapframe, tf_err)); +ASSYM(TF_RIP, offsetof(struct trapframe, tf_rip)); ASSYM(TF_CS, offsetof(struct trapframe, tf_cs)); ASSYM(TF_RFLAGS, offsetof(struct trapframe, tf_rflags)); +ASSYM(TF_RSP, offsetof(struct trapframe, tf_rsp)); +ASSYM(TF_SS, offsetof(struct trapframe, tf_ss)); + ASSYM(SIGF_HANDLER, offsetof(struct sigframe, sf_ahu.sf_handler)); ASSYM(SIGF_UC, offsetof(struct sigframe, sf_uc)); ASSYM(UC_EFLAGS, offsetof(ucontext_t, uc_mcontext.mc_rflags));