gdt初始化

来源:互联网 发布:node.js实战 第1季 编辑:程序博客网 时间:2024/05/28 05:13
//desc_struct 是内核的描述段的结构体struct gdt_page {    struct desc_struct gdt[GDT_ENTRIES];} __attribute__((aligned(PAGE_SIZE)));#ifdef CONFIG_SMP#define PER_CPU_BASE_SECTION ".data.percpu"#else#define PER_CPU_BASE_SECTION ".data"#endif#define __PCPU_ATTRS(sec)\    __attribute__((section(PER_CPU_BASE_SECTION sec)))  \    PER_CPU_ATTRIBUTES#define DECLARE_PER_CPU_SECTION(type, name, sec)\    extern __PCPU_ATTRS(sec) __typeof__(type) per_cpu__##name#define DEFINE_PER_CPU_SECTION(type, name, sec) \    __PCPU_ATTRS(sec) PER_CPU_DEF_ATTRIBUTES    \    __typeof__(type) per_cpu__##name#define DEFINE_PER_CPU_PAGE_ALIGNED(type, name)         \    DEFINE_PER_CPU_SECTION(type, name, ".page_aligned") \    __aligned(PAGE_SIZE)//common.c line 87DEFINE_PER_CPU_PAGE_ALIGNED//这里定义了每个cpu的gdt_pageDEFINE_PER_CPU_PAGE_ALIGNED(struct gdt_page, gdt_page) = { .gdt = {} };EXPORT_PER_CPU_SYMBOL_GPL(gdt_page);

gdt_page是一个per cpu变量

switch_to_new_gdt

0 0
原创粉丝点击