From: Matthew Dillon Date: Wed, 8 Jul 2009 06:22:45 +0000 (-0700) Subject: AMD64 - Fix trapframe, intrframe, and user mode cpu accounting. X-Git-Tag: v2.3.2~38 X-Git-Url: https://gitweb.dragonflybsd.org/dragonfly.git/commitdiff_plain/061e48458f3a1e4a7fee02318bec186e02d6757f?ds=sidebyside AMD64 - Fix trapframe, intrframe, and user mode cpu accounting. * Fix broken CLKF_USERMODE macro. This was causing the cpu accounting code to mis-detect usermode interrupt frames. * Fix trapframe, it was missing a field and not matching up against intrframe. This caused a bad intrframe to be passed to doreti. * Fix calls to lwkt_process_ipiq_frame from doreti. The intrframe was off by 8 bytes. --- diff --git a/sys/cpu/amd64/include/frame.h b/sys/cpu/amd64/include/frame.h index 59cfd00dcf..8a7472daa6 100644 --- a/sys/cpu/amd64/include/frame.h +++ b/sys/cpu/amd64/include/frame.h @@ -109,6 +109,7 @@ struct intrframe { register_t if_r13; register_t if_r14; register_t if_r15; + register_t :64; /* compat with trap frame - xflags */ register_t :64; /* compat with trap frame - trapno */ register_t :64; /* compat with trap frame - addr */ register_t :64; /* compat with trap frame - flags */ diff --git a/sys/platform/pc64/amd64/ipl.s b/sys/platform/pc64/amd64/ipl.s index 38d6cc72b6..5f28af4185 100644 --- a/sys/platform/pc64/amd64/ipl.s +++ b/sys/platform/pc64/amd64/ipl.s @@ -341,10 +341,10 @@ doreti_ipiq: movl %eax,%r12d /* save cpl (can't use stack) */ incl PCPU(intr_nesting_level) andl $~RQF_IPIQ,PCPU(reqflags) - subq $16,%rsp /* add dummy vec and ppl */ + subq $8,%rsp /* trapframe->intrframe */ movq %rsp,%rdi /* pass frame by ref (C arg) */ call lwkt_process_ipiq_frame - addq $16,%rsp + addq $8,%rsp decl PCPU(intr_nesting_level) movl %r12d,%eax /* restore cpl for loop */ jmp doreti_next diff --git a/sys/platform/pc64/include/cpu.h b/sys/platform/pc64/include/cpu.h index 564101fead..d93b5d436a 100644 --- a/sys/platform/pc64/include/cpu.h +++ b/sys/platform/pc64/include/cpu.h @@ -10,7 +10,7 @@ #include #define CLKF_USERMODE(framep) \ - ((ISPL((framep)->if_cs) == SEL_UPL) || (framep->if_rflags /*& PSL_VM*/)) + (ISPL((framep)->if_cs) == SEL_UPL) #endif