Skip to content

debug: Test discontinuous hartid #626

@lz-bro

Description

@lz-bro

Current tests assume hart IDs are contiguous and start at 0, how to support testing discontinuous Hart IDs?

f"-DNHARTS={len(self.harts)}",

# Initialize stack pointer.
la sp, stack_bottom
# Give each hart STACK_SIZE of stack.
# Assume hart IDs are contiguous and start at 0.
li t1, STACK_SIZE
csrr t0, CSR_MHARTID
# Don't use mul instruction because not all harts support it.
addi t0, t0, 1
1:
add sp, sp, t1
addi t0, t0, -1
bnez t0, 1b

stack_bottom:
.fill NHARTS * STACK_SIZE/4, 4, 0x22446688
stack_top:

static unsigned hart_count[NHARTS];
static unsigned interrupt_count[NHARTS];

uint32_t hartid = read_csr(mhartid);
hart_count[hartid] = 0;
interrupt_count[hartid] = 0;

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