Changeset 13809


Ignore:
Timestamp:
Jun 11, 2010, 7:08:10 AM (9 years ago)
Author:
gb
Message:

Don't use weird Linux function to do cmpxchg; assume that ldrex/strex
are available and use them. (They're not available on <= ARMv5; worry
about that later, if ever.)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/arm/lisp-kernel/arm-macros.s

    r13800 r13809  
    498498        ')               
    499499
    500 /* Linux provides a weird kernel entrypoint to do cmpxchg on hardware
    501    that may not support it natively.  Darwin only runs on ARMv6 hardware,
    502    which can use ldrex/strex instructions to do cmpxchg inline.  On
    503    SMP hardware, the cmpxchg should be followe by a 'dmb' (data memory
    504    barrier) instruction, which is only available on ARMv7.  Confused yet?
    505    The Linux kernel function clobbers some registers, and we may need
    506    some support in pc_luser_xp() to fix things up at interrupt/suspend
    507    time.
    508    Generally, imm1 = mask with exactly one bit set, *imm2 = address of
    509    refbits word. */
    510 
    511 define(`set_ref_bit',`
    512         new_macro_labels()
    513         __ifdef(`LINUX')
    514         .globl set_ref_bit_entry_$1
    515 set_ref_bit_entry_$1:   
    516         __(build_lisp_frame(imm0))  /* we clobber lr */
    517         __(mov temp1,imm1)
    518         __(mov temp2,rcontext)
    519 macro_label(again):     
    520         __(ldr lr,macro_label(linux_kernel_cmpxchg))
    521         __(ldr r0,[r2])
    522         __(orr r1,r0,temp1)
    523         __(blx lr)
    524         .globl set_ref_bit_return_$1
    525 set_ref_bit_return_$1:   
    526         __(mov rcontext,temp2)
    527         __(ldr allocptr,[rcontext,#tcr.save_allocptr])
    528         __(bcc macro_label(again))
    529         __(restore_lisp_frame(imm0))
    530         __(b macro_label(continue))
    531 macro_label(linux_kernel_cmpxchg):
    532         .word 0xffff0fc0        /* magic address */
    533 macro_label(continue):
    534         __endif
    535         __ifdef(`DARWIN')
    536 macro_label(again):     
    537         __(ldrex r0,[r2])
    538         __(orr r0,r0,r1)
    539         __(strex r0,r0,[r2])
    540         __(cmp r0,#0)
    541         __(bne macro_label(again))
    542         __endif
    543         ')
    544                        
Note: See TracChangeset for help on using the changeset viewer.