PERFORCE change 29670 for review
Peter Wemm
peter at FreeBSD.org
Thu Apr 24 22:48:31 PDT 2003
http://perforce.freebsd.org/chv.cgi?CH=29670
Change 29670 by peter at 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, at 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));
More information about the p4-projects
mailing list