fix some issues.

This commit is contained in:
fengbojiang 2021-09-16 15:30:22 +08:00
parent 22ce4aff4f
commit d9ca4c12cf
5 changed files with 17 additions and 1 deletions

View File

@ -80,9 +80,11 @@ int64_t counter_ratecheck(struct counter_rate *, int64_t);
SYSUNINIT(c##_counter_sysuninit, SI_SUB_COUNTER, \
SI_ORDER_ANY, counter_u64_sysuninit, &c)
#ifndef FSTACK
#define COUNTER_U64_DEFINE_EARLY(c) \
counter_u64_t __read_mostly c = EARLY_COUNTER; \
COUNTER_U64_SYSINIT(c)
#endif
void counter_u64_sysinit(void *);
void counter_u64_sysuninit(void *);

View File

@ -96,6 +96,7 @@ ff_freebsd_init(void)
pcpup = malloc(sizeof(struct pcpu), M_DEVBUF, M_ZERO);
pcpu_init(pcpup, 0, sizeof(struct pcpu));
PCPU_SET(prvspace, pcpup);
CPU_SET(0, &all_cpus);
ff_init_thread0();

View File

@ -29,7 +29,11 @@
#include <sys/pcpu.h>
#define EARLY_COUNTER (void *)__offsetof(struct pcpu, pc_early_dummy_counter)
#define EARLY_COUNTER &pcpup->pc_early_dummy_counter
#define COUNTER_U64_DEFINE_EARLY(c) \
counter_u64_t __read_mostly c = (void *)__offsetof(struct pcpu, pc_early_dummy_counter); \
COUNTER_U64_SYSINIT(c)
#define counter_enter() do {} while (0)
#define counter_exit() do {} while (0)

View File

@ -31,6 +31,7 @@
#include_next <machine/pcpu.h>
#undef __curthread
#undef get_pcpu
#undef PCPU_GET
#undef PCPU_ADD
#undef PCPU_INC
@ -40,6 +41,8 @@
extern __thread struct thread *pcurthread;
extern struct pcpu *pcpup;
#define get_pcpu() (pcpup->pc_ ## prvspace)
#define PCPU_GET(member) (pcpup->pc_ ## member)
#define PCPU_ADD(member, val) (pcpup->pc_ ## member += (val))
#define PCPU_INC(member) PCPU_ADD(member, 1)

View File

@ -51,6 +51,9 @@
#undef mtx_destroy
#undef mtx_owned
#undef DROP_GIANT
#undef PICKUP_GIANT
#define DO_NOTHING do {} while(0)
#define __mtx_lock(mp, tid, opts, file, line) DO_NOTHING
@ -81,4 +84,7 @@ void ff_mtx_init(struct lock_object *lo, const char *name, const char *type, int
#define mtx_owned(m) (1)
#define DROP_GIANT() DO_NOTHING
#define PICKUP_GIANT() DO_NOTHING
#endif /* _FSTACK_SYS_MUTEX_H_ */