//------------------------------------------------------------------------- // Disassembly of a portion of 'vmlinux' kernel 2.6.22.5cslabs - Fall 2007 //------------------------------------------------------------------------- //----------------------------------------------------------------- // External data-references: // // %ds:0xc030993c 'cmos_lock' type 'int' // %fs:0xc0302008 'per_cpu__cpu_number' type 'int' // //----------------------------------------------------------------- c0105574 : # # This function is called with its argument in register AL # # preserve the caller's EBX c0105574: 53 push %ebx # transfer EFLAGS into EBX c0105575: 9c pushf c0105576: 5b pop %ebx # turn off interrupts to this CPU c0105577: fa cli # get this processor's cpu-number in EDX c0105578: 64 8b 15 08 20 30 c0 mov %fs:0xc0302008,%edx # save copy of function-argument in ECX c010557f: 0f b6 c8 movzbl %al,%ecx # prepare the 'cmos_lock' value in EDX c0105582: 42 inc %edx c0105583: c1 e2 08 shl $0x8,%edx c0105586: 09 ca or %ecx,%edx #-------------------------------------------- #-- Acquire the mutual exclusion semaphore -- #-------------------------------------------- # spin: c0105588: a1 3c 99 30 c0 mov 0xc030993c,%eax c010558d: 85 c0 test %eax,%eax c010558f: 75 f7 jne c0105588 c0105591: f0 0f b1 15 3c 99 30 lock cmpxchg %edx,0xc030993c c0105598: c0 c0105599: 85 c0 test %eax,%eax c010559b: 75 eb jne c0105588 # Enter the "Critical Section" c010559d: 88 c8 mov %cl,%al c010559f: e6 70 out %al,$0x70 c01055a1: e6 80 out %al,$0x80 c01055a3: e4 71 in $0x71,%al c01055a5: e6 80 out %al,$0x80 # Leave the "Critical Section" #------------------------------------------ #-- Release the mutual exclusion semaphore -- #-------------------------------------------- c01055a7: c7 05 3c 99 30 c0 00 movl $0x0,0xc030993c c01055ae: 00 00 00 # restore EFLAGS from EBX c01055b1: 53 push %ebx c01055b2: 9d popf # return function's value in EAX c01055b3: 0f b6 c0 movzbl %al,%eax # restore the caller's EBX c01055b6: 5b pop %ebx # return control to the caller c01055b7: c3 ret