Skip to content

Need not enable mie.STIE after we have enabled sie.STIE #422

@unicornx

Description

@unicornx

in kernel/start.c, we have following logic:

void
start()
{
  ......
  // delegate all interrupts and exceptions to supervisor mode.
  w_medeleg(0xffff);
  w_mideleg(0xffff);
  w_sie(r_sie() | SIE_SEIE | SIE_STIE);
  ......
  // ask for clock interrupts.
  timerinit();
  ......
}

// ask each hart to generate timer interrupts.
void
timerinit()
{
  // enable supervisor-mode timer interrupts.
  w_mie(r_mie() | MIE_STIE);
  
  ......
}

We have enabled sie.STIE in start() (which will enable mie.STIE implicitly) before calling timerinit(). So I think w_mie(r_mie() | MIE_STIE); in timerinit() is duplicated.

See RISC-V ISA volume II Version 20250508,section 3.1.9 page 44

Restricted views of the mip and mie registers appear as the sip and sie registers for supervisor level. If
an interrupt is delegated to S-mode by setting a bit in the mideleg register, it becomes visible in the sip
register and is maskable using the sie register. Otherwise, the corresponding bits in sip and sie are
read-only zero.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions