clobbering ebx and edx ==> Page Fault:
asm volatile(" \
cli; \
mov %0, %%ecx; \
mov %1, %%esp; \
mov %2, %%ebp; \
mov %3, %%cr3; \
mov $0x12345, %%eax; \
sti; \
jmp %%ecx; "
: : "r"(eip), "r"(esp), "r"(ebp), "r"(current_directory->physicalAddr)
: "ebx","edx" );
objdump task.o -D > task.txt
35f: fa cli
360: 89 f1 mov %esi,%ecx
362: 89 fc mov %edi,%esp
364: 89 cd mov %ecx,%ebp
366: 0f 22 d8 mov %eax,%cr3
369: b8 45 23 01 00 mov $0x12345,%eax
36e: fb sti
36f: ff e1 jmp *%ecx
Man sieht hier, warum man edi und esi nicht clobbern kann.
Leere clobber list:
351: fa cli
352: 89 d9 mov %ebx,%ecx
354: 89 f4 mov %esi,%esp
356: 89 fd mov %edi,%ebp
358: 0f 22 d8 mov %eax,%cr3
35b: b8 45 23 01 00 mov $0x12345,%eax
360: fb sti
361: ff e1 jmp *%ecx
clobbert man ebx:
35f: fa cli
360: 89 f1 mov %esi,%ecx
362: 89 fc mov %edi,%esp
364: 89 d5 mov %edx,%ebp
366: 0f 22 d8 mov %eax,%cr3
369: b8 45 23 01 00 mov $0x12345,%eax
36e: fb sti
36f: ff e1 jmp *%ecx
clobbering edx:
351: fa cli
352: 89 d9 mov %ebx,%ecx
354: 89 f4 mov %esi,%esp
356: 89 fd mov %edi,%ebp
358: 0f 22 d8 mov %eax,%cr3
35b: b8 45 23 01 00 mov $0x12345,%eax
360: fb sti
361: ff e1 jmp *%ecx