{"id":140,"date":"2009-04-23T00:01:46","date_gmt":"2009-04-23T08:01:46","guid":{"rendered":"http:\/\/www.pagetable.com\/?p=140"},"modified":"2009-04-23T00:01:46","modified_gmt":"2009-04-23T08:01:46","slug":"the-easiest-way-to-reset-an-i386x86_64-system","status":"publish","type":"post","link":"https:\/\/www.pagetable.com\/?p=140","title":{"rendered":"The Easiest Way to Reset an i386\/x86_64 System"},"content":{"rendered":"<p>Try this in kernel mode:<\/p>\n<pre>uint64_t null_idtr = 0;\nasm(\"xor %%eax, %%eax; lidt %0; int3\" :: \"m\" (null_idtr));<\/pre>\n<p>This can be quite helpful when doing operating system development on an i386\/x86_64 system. You can use this for the regular restart case or when a kernel panic is supposed to restart immediately and you cannot make any assumptions on what is still working in the system.<\/p>\n<p>You can also use this for debugging very low-level code if you don&#8217;t have a serial port or even an LED to report the most basic information: First make sure your code is reached by putting the reset code there. Then remove it again and put this code in:<\/p>\n<pre>if (condition)\n    reset();\nelse\n    for(;;);\n<\/pre>\n<p>The system will either hang or reset, depending on the condition.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Try this in kernel mode: uint64_t null_idtr = 0; asm(&#8220;xor %%eax, %%eax; lidt %0; int3&#8221; :: &#8220;m&#8221; (null_idtr)); This can be quite helpful when doing operating system development on an i386\/x86_64 system. You can use this for the regular restart case or when a kernel panic is supposed to restart immediately and you cannot make &#8230; <a title=\"The Easiest Way to Reset an i386\/x86_64 System\" class=\"read-more\" href=\"https:\/\/www.pagetable.com\/?p=140\" aria-label=\"Read more about The Easiest Way to Reset an i386\/x86_64 System\">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":[17,33,38],"tags":[],"class_list":["post-140","post","type-post","status-publish","format-standard","hentry","category-hacks","category-trivia","category-x86"],"_links":{"self":[{"href":"https:\/\/www.pagetable.com\/index.php?rest_route=\/wp\/v2\/posts\/140","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=140"}],"version-history":[{"count":0,"href":"https:\/\/www.pagetable.com\/index.php?rest_route=\/wp\/v2\/posts\/140\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.pagetable.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=140"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.pagetable.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=140"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.pagetable.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=140"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}