{"id":4893,"date":"2013-03-20T07:00:00","date_gmt":"2013-03-20T07:00:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/oldnewthing\/2013\/03\/20\/the-x86-architecture-is-the-weirdo-structured-exception-handling\/"},"modified":"2013-03-20T07:00:00","modified_gmt":"2013-03-20T07:00:00","slug":"the-x86-architecture-is-the-weirdo-structured-exception-handling","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/oldnewthing\/20130320-00\/?p=4893","title":{"rendered":"The x86 architecture is the weirdo: Structured exception handling"},"content":{"rendered":"<p>If your reference architecture is x86, then you will think that everything it does is normal and the rest of the world is weird. Except it&#8217;s the other way around: <a href=\"http:\/\/blogs.msdn.com\/b\/oldnewthing\/archive\/2004\/09\/14\/229387.aspx\"> The x86 architecture is the weirdo<\/a>.<\/p>\n<p> I was reminded of this when commenter 640k complained, on the subject of what I think is table-based structured exception handling, &#8220;It would be interesting to know why this &#8216;invention&#8217; <a href=\"http:\/\/blogs.msdn.com\/b\/oldnewthing\/archive\/2011\/12\/01\/10243095.aspx#10243967\"> was introduced in 64-bit Windows<\/a> when no other version of Windows requires it.&#8221; (The original text was &#8220;when no other OS requires it&#8221;, but I&#8217;m assuming that this was in the context of Windows-based OS, since unix doesn&#8217;t have structured exception handling in the first place.) <\/p>\n<p> This has a very narrow definition of &#8220;no other OS&#8221;, because it really means &#8220;No other non-x86-based version of Windows.&#8221; In this world, the color of the sky is x86. <\/p>\n<p> In fact, x86 is the <i>only<\/i> architecture for which Windows uses stack-based exception chaining. All other architectures use table-based exception unwinding. The prologue and epilogue of each function must follow a particular format so that the actions performed therein can be unwound during exception handling. At the very introduction of Win32, it was only the x86 which used stack-based unwinding. The Alpha AXP, MIPS, and PowerPC all used used table-based exception unwinding. And as new architectures were added by Windows, they all used table-based exception unwinding as well. Itanium? Table-based. <a href=\"http:\/\/technet.microsoft.com\/en-us\/magazine\/2008.08.windowsconfidential.aspx\"> Alpha AXP 64-bit<\/a>? Table-based. ARM? Table-based. <\/p>\n<p> The use of table-based exception handling was not &#8220;introduced&#8221; with x64. It was introduced back in 1992, and has in fact been the exception unwinding mechanism for all architectures. <\/p>\n<p> Well, almost all. Not the x86, because the x86 is the weirdo. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>If your reference architecture is x86, then you will think that everything it does is normal and the rest of the world is weird. Except it&#8217;s the other way around: The x86 architecture is the weirdo. I was reminded of this when commenter 640k complained, on the subject of what I think is table-based structured [&hellip;]<\/p>\n","protected":false},"author":1069,"featured_media":111744,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[26],"class_list":["post-4893","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-oldnewthing","tag-other"],"acf":[],"blog_post_summary":"<p>If your reference architecture is x86, then you will think that everything it does is normal and the rest of the world is weird. Except it&#8217;s the other way around: The x86 architecture is the weirdo. I was reminded of this when commenter 640k complained, on the subject of what I think is table-based structured [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/4893","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/users\/1069"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/comments?post=4893"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/4893\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/media\/111744"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/media?parent=4893"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/categories?post=4893"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/tags?post=4893"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}