{"id":4170,"date":"2022-12-20T17:39:36","date_gmt":"2022-12-20T20:39:36","guid":{"rendered":"http:\/\/lode.uno\/linux-man\/index.php\/2022\/12\/20\/save_flags-man9\/"},"modified":"2022-12-20T17:39:36","modified_gmt":"2022-12-20T20:39:36","slug":"save_flags-man9","status":"publish","type":"post","link":"https:\/\/lode.uno\/linux-man\/2022\/12\/20\/save_flags-man9\/","title":{"rendered":"save_flags (man9)"},"content":{"rendered":"<h1 align=\"center\">save_flags<\/h1>\n<p> <a href=\"#NAME\">NAME<\/a><br \/> <a href=\"#SYNOPSIS\">SYNOPSIS<\/a><br \/> <a href=\"#DESCRIPTION\">DESCRIPTION<\/a><br \/> <a href=\"#RETURN VALUE\">RETURN VALUE<\/a><br \/> <a href=\"#AVAILABILITY\">AVAILABILITY<\/a><br \/> <a href=\"#SEE ALSO\">SEE ALSO<\/a><br \/> <a href=\"#AUTHOR\">AUTHOR<\/a><br \/> <a href=\"#BUGS\">BUGS<\/a> <\/p>\n<hr>\n<h2>NAME <a name=\"NAME\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">save_flags, restore_flags \u2212 save\/restore processor state and irq mask<\/p>\n<h2>SYNOPSIS <a name=\"SYNOPSIS\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>#include <asm\/system.h><\/b><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>unsigned long<\/b> <i>flags<\/i><b>; <br \/> void save_flags(<\/b><i>flags<\/i><b>) <br \/> void restore_flags(<\/b><i>flags<\/i><b>)<\/b><\/p>\n<h2>DESCRIPTION <a name=\"DESCRIPTION\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">The <b>save_flags<\/b> and <b>restore_flags<\/b> macros cooperate with the <b>cli<\/b> function to provide interrupt protection to critical sections of code. The <b>save_flags<\/b> function saves the current processor state, most specifically the interrupt priority level, in the <i>flags<\/i> value (which must be an l-value). The flags must be passed to a subsequent call to <b>restore_flags<\/b> to restore the processor state.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">The <b>save_flags<\/b> macro does not affect the processor state, but drivers may use the <b>cli<\/b>(9) and <b>sti<\/b> functions to disable and enable interrupts after saving the current flags. When the critical section of code is passed, the <b>restore_flags<\/b> returns the processor to its state at the point where the matching <b>save_flags<\/b> was called.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">Only values returned by <b>save_flags<\/b> can be passed to <b>restore_flags.<\/b> Any other values may cause unpredictable results, and are certainly not portable.<\/p>\n<h2>RETURN VALUE <a name=\"RETURN VALUE\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">The <b>restore_flags<\/b> macro saves the processor state in the <i>flags<\/i> parameter, which must be a non-const l-value.<\/p>\n<h2>AVAILABILITY <a name=\"AVAILABILITY\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">Linux 1.0+<\/p>\n<h2>SEE ALSO <a name=\"SEE ALSO\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>cli<\/b>(9)<\/p>\n<h2>AUTHOR <a name=\"AUTHOR\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">Stephen Williams (steve@icarus.com)<\/p>\n<h2>BUGS <a name=\"BUGS\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">How does all this react with symmetric multiprocessor machines?<\/p>\n<hr>\n","protected":false},"excerpt":{"rendered":"<p>  save_flags, restore_flags \u2212 save\/restore processor state and irq mask <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1222],"tags":[1226,1223,1225,1250],"class_list":["post-4170","post","type-post","status-publish","format-standard","hentry","category-9-rutinas-del-nucleo","tag-1226","tag-kernel","tag-man9","tag-save_flags"],"gutentor_comment":0,"_links":{"self":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts\/4170","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/comments?post=4170"}],"version-history":[{"count":0,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts\/4170\/revisions"}],"wp:attachment":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/media?parent=4170"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/categories?post=4170"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/tags?post=4170"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}