~vcs-imports/mammoth-replicator/trunk

« back to all changes in this revision

Viewing changes to src/backend/port/tas/solaris_i386.s

  • Committer: alvherre
  • Date: 2005-12-16 21:24:52 UTC
  • Revision ID: svn-v4:db760fc0-0f08-0410-9d63-cc6633f64896:trunk:1
Initial import of the REL8_0_3 sources from the Pgsql CVS repository.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/=============================================================================
 
2
/ tas.s -- test and set lock for solaris_i386
 
3
/=============================================================================
 
4
 
 
5
        .file   "tas.s"
 
6
        .text
 
7
        .align  16
 
8
.L1.text:
 
9
 
 
10
        .globl  tas
 
11
tas:
 
12
        pushl   %ebp            /save prev base pointer
 
13
        movl    %esp,%ebp       /new base pointer
 
14
        pushl   %ebx            /save prev bx
 
15
        movl    8(%ebp),%ebx    /load bx with address of lock
 
16
        movl    $255,%eax       /put something in ax
 
17
        xchgb   %al,(%ebx)      /swap lock value with "0"
 
18
        cmpb    $0,%al          /did we get the lock?
 
19
        jne     .Locked
 
20
        subl    %eax,%eax       /yes, we got it -- return 0
 
21
        jmp     .Finish
 
22
        .align  4
 
23
.Locked:
 
24
        movl    $1,%eax         /no, we didn't get it - return 1
 
25
.Finish:
 
26
        popl    %ebx            /restore prev bx
 
27
        movl    %ebp,%esp       /restore stack state
 
28
        popl    %ebp
 
29
        ret                     /return
 
30
        .align  4
 
31
        .type   tas,@function
 
32
        .size   tas,.-tas
 
33