LOCK LOCK THE BUS LOCK

Operation:

None

Description:

LOCK is a one-byte prefix that causes the 8088 (configured in maximum mode) to assert its bus LOCK signal while the following instruc- tion executes. LOCK does not affect any flags.

The instruction most useful in this context is an exchange register with memory. A simple software lock may be implemented with the following code sequence:

Encoding:

11110000

Flags Affected:

None

Check:

MOV

AL,1

;set AL to 1 (implies locked)

LOCK

XCHG

Sema,AL

;test and set lock

 

TEST

AL,AL

;set flags based on AL

 

JNZ

Check

;retry if lock already set

 

MOV

Sema,O

;clear the lock when done

The LOCK prefix may be combined with the segment override and/or REP prefixes.

LOCK Operands Clocks Transfers Bytes LOCK Coding Example

(no operands)

2

-

1

LOCK XCHG FLAG,AL

2-111

Page 146
Image 146
Intel 210200-002 manual Lock Lock the BUS Lock