X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?p=pintos-anon;a=blobdiff_plain;f=src%2Fthreads%2Fswitch.S;h=5b661ec1f1fd88924704dc95c2238987479dc6ab;hp=a7c27fb03eb8fc3cb73ccee19f07ef21438d61ea;hb=76a72158378a6447bb3dbce5bae41db48da0d64f;hpb=a98578bf3b6b5c946713654b404a886a7199dbee diff --git a/src/threads/switch.S b/src/threads/switch.S index a7c27fb..5b661ec 100644 --- a/src/threads/switch.S +++ b/src/threads/switch.S @@ -1,7 +1,4 @@ -#### 0(%esp) - old registers -#### 16(%esp) - return address -#### 20(%esp) - current thread -#### 24(%esp) - new thread +#include "switch.h" .globl thread_switch thread_switch: @@ -18,14 +15,14 @@ thread_switch: mov thread_stack_ofs, %edx # Save current stack pointer to old thread's stack, if any. - movl 20(%esp), %eax + movl SWITCH_CUR(%esp), %eax test %eax, %eax jz 1f movl %esp, (%eax,%edx,1) 1: # Restore stack pointer from new thread's stack. - movl 24(%esp), %ecx + movl SWITCH_NEXT(%esp), %ecx movl (%ecx,%edx,1), %esp # Restore caller's register state.