Skip to content

多核系统TSS配置错误 #4

Description

@Excutioner

在做lab4的Part A 的 Exercise 4 时,trap.c的trap_init_percpu中:

gdt[GD_TSS0 >> 3] = SEG16(STS_T32A, (uint32_t) (&thiscpu->cpu_ts), sizeof(struct Taskstate) - 1, 0);

gdt[GD_TSS0 >> 3].sd_s = 0;

ltr(GD_TSS0);

应改为:

int i = thiscpu->cpu_id;

gdt[(GD_TSS0 >> 3) + i] = SEG16(STS_T32A, (uint32_t) (&thiscpu->cpu_ts), sizeof(struct Taskstate) - 1, 0);

gdt[(GD_TSS0 >> 3) + i].sd_s = 0;

ltr(GD_TSS0+(i << 3));

否则,多核共用一个异常栈,报错

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions