⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 swtch.s

📁 linux的例子,就是下载后到自己的机子上去运行
💻 S
字号:
        .text        .align 2        .globl ThreadRootThreadRoot:        pushl %ebp        movl %esp,%ebp        pushl %edx        call *%ecx        call *%esi        call *%edi        movl %ebp,%esp        popl %ebp        ret        .comm _eax_save,4        .globl SWITCHSWITCH:        movl %eax,_eax_save # save the value of eax        movl 4(%esp),%eax # move pointer to t1 into eax        movl %ebx,8(%eax) # save registers        movl %ecx,12(%eax)        movl %edx,16(%eax)        movl %esi,24(%eax)        movl %edi,28(%eax)        movl %ebp,20(%eax)        movl %esp,0(%eax) # save stack pointer        movl _eax_save,%ebx # get the saved value of eax        movl %ebx,4(%eax) # store it        movl 0(%esp),%ebx # get return address from stack into ebx        movl %ebx,32(%eax) # save it into the pc storage        movl 8(%esp),%eax # move pointer to t2 into eax        movl 4(%eax),%ebx # get new value for eax into ebx        movl %ebx,_eax_save # save it        movl 8(%eax),%ebx # retore old registers        movl 12(%eax),%ecx        movl 16(%eax),%edx        movl 24(%eax),%esi        movl 28(%eax),%edi        movl 20(%eax),%ebp        movl 0(%eax),%esp # restore stack pointer        movl 32(%eax),%eax # restore return address into eax        movl %eax,4(%esp) # copy over the ret address on the stack        movl _eax_save,%eax        ret

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -