Skip to content

Instantly share code, notes, and snippets.

@ldunn
Created August 8, 2010 22:53
Show Gist options
  • Select an option

  • Save ldunn/514659 to your computer and use it in GitHub Desktop.

Select an option

Save ldunn/514659 to your computer and use it in GitHub Desktop.
void switch_page_directory(page_directory_t *dir)
{
current_directory = dir;
__asm__ __volatile__("mov %0, %%cr3":: "r"(dir->physical_address));
unsigned int cr0;
__asm__ __volatile__("mov %%cr0, %0": "=r"(cr0));
cr0 |= 0x80000000; // Enable paging!
panic("ohi");
__asm__ __volatile__("mov %0, %%cr0":: "r"(cr0));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment