Browse Source

Remove num_harts; use hart_mask exclusively

pull/53/head
Andrew Waterman 9 years ago
parent
commit
a2c8937e63
  1. 6
      machine/fdt.c
  2. 1
      machine/minit.c
  3. 3
      machine/mtrap.c
  4. 1
      machine/mtrap.h

6
machine/fdt.c

@ -239,7 +239,6 @@ static void hart_done(const struct fdt_scan_node *node, void *extra)
if (scan->hart < MAX_HARTS) {
hart_phandles[scan->hart] = scan->phandle;
hart_mask |= 1 << scan->hart;
if (scan->hart >= num_harts) num_harts = scan->hart + 1;
hls_init(scan->hart);
}
}
@ -266,9 +265,10 @@ void query_harts(uintptr_t fdt)
cb.close= hart_close;
cb.extra = &scan;
num_harts = 0;
fdt_scan(fdt, &cb);
assert (num_harts > 0);
// The current hart should have been detected
assert ((hart_mask >> read_csr(mhartid)) != 0);
}
///////////////////////////////////////////// CLINT SCAN /////////////////////////////////////////

1
machine/minit.c

@ -9,7 +9,6 @@
pte_t* root_page_table;
uintptr_t mem_size;
uintptr_t num_harts;
volatile uint64_t* mtime;
volatile uint32_t* plic_priorities;
size_t plic_ndevs;

3
machine/mtrap.c

@ -5,6 +5,7 @@
#include "bits.h"
#include "vm.h"
#include "uart.h"
#include "fdt.h"
#include "unprivileged_memory.h"
#include <errno.h>
#include <stdarg.h>
@ -86,7 +87,7 @@ static uintptr_t mcall_set_timer(uint64_t when)
static void send_ipi_many(uintptr_t* pmask, int event)
{
_Static_assert(MAX_HARTS <= 8 * sizeof(*pmask), "# harts > uintptr_t bits");
uintptr_t mask = ((uintptr_t)1 << num_harts) - 1;
uintptr_t mask = hart_mask;
if (pmask)
mask &= load_uintptr_t(pmask, read_csr(mepc));

1
machine/mtrap.h

@ -32,7 +32,6 @@ static inline int xlen()
}
extern uintptr_t mem_size;
extern uintptr_t num_harts;
extern volatile uint64_t* mtime;
extern volatile uint32_t* plic_priorities;
extern size_t plic_ndevs;

Loading…
Cancel
Save