diff options
author | jkim <jkim@FreeBSD.org> | 2010-12-22 00:18:42 +0000 |
---|---|---|
committer | jkim <jkim@FreeBSD.org> | 2010-12-22 00:18:42 +0000 |
commit | 24b08bca030970592bc5241517b0462f603b05b1 (patch) | |
tree | 38bd55300c4f19ade4f88947688e903fcf6ef97c /sys/amd64/amd64/cpu_switch.S | |
parent | f4e75b41ae7145e275808cc561d4cacf0f9a51a7 (diff) | |
download | FreeBSD-src-24b08bca030970592bc5241517b0462f603b05b1.zip FreeBSD-src-24b08bca030970592bc5241517b0462f603b05b1.tar.gz |
Improve PCB flags handling and make it more robust. Add two new functions
for manipulating pcb_flags. These inline functions are very similar to
atomic_set_char(9) and atomic_clear_char(9) but without unnecessary LOCK
prefix for SMP. Add comments about the rationale[1]. Use these functions
wherever possible. Although there are some places where it is not strictly
necessary (e.g., a PCB is copied to create a new PCB), it is done across
the board for sake of consistency. Turn pcb_full_iret into a PCB flag as
it is safe now. Move rarely used fields before pcb_flags and reduce size
of pcb_flags to one byte. Fix some style(9) nits in pcb.h while I am in
the neighborhood.
Reviewed by: kib
Submitted by: kib[1]
MFC after: 2 months
Diffstat (limited to 'sys/amd64/amd64/cpu_switch.S')
-rw-r--r-- | sys/amd64/amd64/cpu_switch.S | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/amd64/amd64/cpu_switch.S b/sys/amd64/amd64/cpu_switch.S index 3ad0ef7..8161fa4 100644 --- a/sys/amd64/amd64/cpu_switch.S +++ b/sys/amd64/amd64/cpu_switch.S @@ -94,7 +94,7 @@ END(cpu_throw) ENTRY(cpu_switch) /* Switch to new thread. First, save context. */ movq TD_PCB(%rdi),%r8 - movb $1,PCB_FULL_IRET(%r8) + orb $PCB_FULL_IRET,PCB_FLAGS(%r8) movq (%rsp),%rax /* Hardware registers */ movq %r15,PCB_R15(%r8) @@ -106,7 +106,7 @@ ENTRY(cpu_switch) movq %rbx,PCB_RBX(%r8) movq %rax,PCB_RIP(%r8) - testl $PCB_DBREGS,PCB_FLAGS(%r8) + testb $PCB_DBREGS,PCB_FLAGS(%r8) jnz store_dr /* static predict not taken */ done_store_dr: @@ -210,7 +210,7 @@ done_tss: movq %rsi,PCPU(CURTHREAD) /* into next thread */ /* Test if debug registers should be restored. */ - testl $PCB_DBREGS,PCB_FLAGS(%r8) + testb $PCB_DBREGS,PCB_FLAGS(%r8) jnz load_dr /* static predict not taken */ done_load_dr: |