本文整理汇总了C++中Cpu::set_cs方法的典型用法代码示例。如果您正苦于以下问题:C++ Cpu::set_cs方法的具体用法?C++ Cpu::set_cs怎么用?C++ Cpu::set_cs使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cpu
的用法示例。
在下文中一共展示了Cpu::set_cs方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: volatile
PUBLIC static FIASCO_INIT_CPU
void
Kmem::init_cpu(Cpu &cpu)
{
void *cpu_mem = Kmem_alloc::allocator()->unaligned_alloc(1024);
printf("Allocate cpu_mem @ %p\n", cpu_mem);
// now initialize the global descriptor table
cpu.init_gdt(__alloc(&cpu_mem, Gdt::gdt_max), user_max());
// Allocate the task segment as the last thing from cpu_page_vm
// because with IO protection enabled the task segment includes the
// rest of the page and the following IO bitmap (2 pages).
//
// Allocate additional 256 bytes for emergency stack right beneath
// the tss. It is needed if we get an NMI or debug exception at
// entry_sys_fast_ipc/entry_sys_fast_ipc_c/entry_sys_fast_ipc_log.
Address tss_mem = alloc_tss(sizeof(Tss) + 256);
assert(tss_mem + sizeof(Tss) + 256 < Mem_layout::Io_bitmap);
tss_mem += 256;
// this is actually tss_size + 1, including the io_bitmap_delimiter byte
size_t tss_size;
tss_size = Mem_layout::Io_bitmap + (Mem_layout::Io_port_max / 8) - tss_mem;
assert(tss_size < 0x100000); // must fit into 20 Bits
cpu.init_tss(tss_mem, tss_size);
// force GDT... to memory before loading the registers
asm volatile ( "" : : : "memory" );
// set up the x86 CPU's memory model
cpu.set_gdt();
cpu.set_ldt(0);
cpu.set_ds(Gdt::data_segment());
cpu.set_es(Gdt::data_segment());
cpu.set_ss(Gdt::gdt_data_kernel | Gdt::Selector_kernel);
cpu.set_fs(Gdt::gdt_data_user | Gdt::Selector_user);
cpu.set_gs(Gdt::gdt_data_user | Gdt::Selector_user);
cpu.set_cs();
// and finally initialize the TSS
cpu.set_tss();
init_cpu_arch(cpu, &cpu_mem);
}