{"id":8,"date":"2006-04-17T14:31:52","date_gmt":"2006-04-17T22:31:52","guid":{"rendered":"http:\/\/www.pagetable.com\/?p=8"},"modified":"2006-04-17T14:31:52","modified_gmt":"2006-04-17T22:31:52","slug":"why-does-pusha-also-push-the-stack-pointer","status":"publish","type":"post","link":"https:\/\/www.pagetable.com\/?p=8","title":{"rendered":"Why does PUSHA also push the stack pointer?"},"content":{"rendered":"<p>This puzzle is actually a quite easy one &#8211; but when I asked it in a university course, it kept some people busy for some time to find out the answer, so I thought it might be a good idea to ask you nevertheless:<\/p>\n<p>The 8086 &#8220;PUSHA&#8221; instruction saves the following registers on the stack:<br \/>\nAX, CX, DX, BX, SP, BP, SI, DI<br \/>\nIn i386+ 32 bit mode, these registers are EAX etc., and in x86_64 64 bit mode, it is RAX etc., but all of them always also save the stack pointer.<\/p>\n<p>Why do x86 CPUs do this? Isn&#8217;t it true that it makes no sense to save the stack pointer, as the stack pointer is needed to retrieve these values anyway?<\/p>\n<p>In a few days, I&#8217;ll post some trivia on this topic&#8230;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This puzzle is actually a quite easy one &#8211; but when I asked it in a university course, it kept some people busy for some time to find out the answer, so I thought it might be a good idea to ask you nevertheless: The 8086 &#8220;PUSHA&#8221; instruction saves the following registers on the stack: &#8230; <a title=\"Why does PUSHA also push the stack pointer?\" class=\"read-more\" href=\"https:\/\/www.pagetable.com\/?p=8\" aria-label=\"Read more about Why does PUSHA also push the stack pointer?\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[26,38],"tags":[],"class_list":["post-8","post","type-post","status-publish","format-standard","hentry","category-puzzle","category-x86"],"_links":{"self":[{"href":"https:\/\/www.pagetable.com\/index.php?rest_route=\/wp\/v2\/posts\/8","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.pagetable.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.pagetable.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.pagetable.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.pagetable.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=8"}],"version-history":[{"count":0,"href":"https:\/\/www.pagetable.com\/index.php?rest_route=\/wp\/v2\/posts\/8\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.pagetable.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=8"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.pagetable.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=8"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.pagetable.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=8"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}