1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
.global switch_thread .type switch_thread, @function switch_thread: pushl %ebp movl %esp, %ebp pushl %ebx pushl %esi pushl %edi pushl %ebp movl 8(%ebp), %esi movl 12(%ebp), %edi movl %esp, (%edi); movl %cr3, %ecx movl %ecx, 4(%edi) movl (%esi), %esp movl 4(%esi), %ecx movl %ecx, %cr3 popl %ebp popl %edi popl %esi popl %ebx popl %ebp ret