mirror of
https://git.rtems.org/rtems-libbsd/
synced 2025-07-03 03:48:28 +08:00
parent
9800a0f9fa
commit
e56b5cb135
@ -222,6 +222,15 @@ configure with:
|
||||
The LibBSD Waf support splits the options and converts them to uppercase and
|
||||
adds them -D options on the compiler command line.
|
||||
|
||||
The list is:
|
||||
|
||||
bootverbose: Verbose boot of the kernel
|
||||
verbose_sysinit: Verbose printing of all the SYSINIT calls
|
||||
bus_debug: Bus debugging support
|
||||
ktr: Kernel trace
|
||||
ktr_verbose: Verbose kernel trace
|
||||
invariants: Invariants build of the kernel
|
||||
|
||||
SMP Requirements
|
||||
----------------
|
||||
|
||||
|
@ -189,7 +189,9 @@ ithread_update(struct intr_thread *ithd)
|
||||
_Thread_Set_name(td->td_thread, ie->ie_fullname);
|
||||
#endif /* __rtems__ */
|
||||
#ifdef KTR
|
||||
#ifndef __rtems__
|
||||
sched_clear_tdname(td);
|
||||
#endif /* __rtems__ */
|
||||
#endif
|
||||
thread_lock(td);
|
||||
#ifndef __rtems__
|
||||
@ -1242,11 +1244,7 @@ ithread_loop(void *arg)
|
||||
int wake;
|
||||
|
||||
td = curthread;
|
||||
#ifndef __rtems__
|
||||
p = td->td_proc;
|
||||
#else /* __rtems__ */
|
||||
p = NULL;
|
||||
#endif /* __rtems__ */
|
||||
ithd = (struct intr_thread *)arg;
|
||||
KASSERT(ithd->it_thread == td,
|
||||
("%s: ithread and proc linkage out of sync", __func__));
|
||||
|
@ -1,3 +1,5 @@
|
||||
#include <machine/rtems-bsd-kernel-space.h>
|
||||
|
||||
/*-
|
||||
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
|
||||
*
|
||||
@ -34,13 +36,15 @@
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include "opt_ddb.h"
|
||||
#include "opt_ktr.h"
|
||||
#include "opt_alq.h"
|
||||
#include <rtems/bsd/local/opt_ddb.h>
|
||||
#include <rtems/bsd/local/opt_ktr.h>
|
||||
#include <rtems/bsd/local/opt_alq.h>
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/queue.h>
|
||||
#ifndef __rtems__
|
||||
#include <sys/alq.h>
|
||||
#endif /* __rtems__ */
|
||||
#include <sys/cons.h>
|
||||
#include <sys/cpuset.h>
|
||||
#include <sys/kdb.h>
|
||||
@ -111,6 +115,7 @@ SYSCTL_INT(_debug_ktr, OID_AUTO, version, CTLFLAG_RD,
|
||||
SYSCTL_UQUAD(_debug_ktr, OID_AUTO, compile, CTLFLAG_RD,
|
||||
&ktr_compile, 0, "Bitmask of KTR event classes compiled into the kernel");
|
||||
|
||||
#ifndef __rtems__
|
||||
static int
|
||||
sysctl_debug_ktr_cpumask(SYSCTL_HANDLER_ARGS)
|
||||
{
|
||||
@ -133,6 +138,7 @@ SYSCTL_PROC(_debug_ktr, OID_AUTO, cpumask,
|
||||
CTLFLAG_RWTUN | CTLFLAG_MPSAFE | CTLTYPE_STRING, NULL, 0,
|
||||
sysctl_debug_ktr_cpumask, "S",
|
||||
"Bitmask of CPUs on which KTR logging is enabled");
|
||||
#endif /* __rtems__ */
|
||||
|
||||
static int
|
||||
sysctl_debug_ktr_clear(SYSCTL_HANDLER_ARGS)
|
||||
@ -221,11 +227,13 @@ sysctl_debug_ktr_entries(SYSCTL_HANDLER_ARGS)
|
||||
/* Disable ktr temporarily. */
|
||||
mask = ktr_mask;
|
||||
ktr_mask = 0;
|
||||
#ifndef __rtems__
|
||||
/* Wait for threads to go idle. */
|
||||
if ((error = quiesce_all_cpus("ktrent", PCATCH)) != 0) {
|
||||
ktr_mask = mask;
|
||||
return (error);
|
||||
}
|
||||
#endif /* __rtems__ */
|
||||
if (ktr_buf != ktr_buf_init)
|
||||
oldbuf = ktr_buf;
|
||||
else
|
||||
|
@ -138,9 +138,7 @@ int
|
||||
_sleep(void *ident, struct lock_object *lock, int priority,
|
||||
const char *wmesg, sbintime_t sbt, sbintime_t pr, int flags)
|
||||
{
|
||||
#ifndef __rtems__
|
||||
struct thread *td;
|
||||
#endif /* __rtems__ */
|
||||
struct lock_class *class;
|
||||
uintptr_t lock_state;
|
||||
#ifndef __rtems__
|
||||
@ -150,9 +148,7 @@ _sleep(void *ident, struct lock_object *lock, int priority,
|
||||
#endif /* __rtems__ */
|
||||
WITNESS_SAVE_DECL(lock_witness);
|
||||
|
||||
#ifndef __rtems__
|
||||
td = curthread;
|
||||
#endif /* __rtems__ */
|
||||
#ifdef KTRACE
|
||||
if (KTRPOINT(td, KTR_CSW))
|
||||
ktrcsw(1, 0, wmesg);
|
||||
@ -165,10 +161,10 @@ _sleep(void *ident, struct lock_object *lock, int priority,
|
||||
#ifndef __rtems__
|
||||
KASSERT(TD_IS_RUNNING(td), ("_sleep: curthread not running"));
|
||||
KASSERT(td->td_epochnest == 0, ("sleeping in an epoch section"));
|
||||
#endif /* __rtems__ */
|
||||
if (priority & PDROP)
|
||||
KASSERT(lock != NULL && lock != &Giant.lock_object,
|
||||
("PDROP requires a non-Giant lock"));
|
||||
#endif /* __rtems__ */
|
||||
if (lock != NULL)
|
||||
class = LOCK_CLASS(lock);
|
||||
else
|
||||
@ -181,10 +177,8 @@ _sleep(void *ident, struct lock_object *lock, int priority,
|
||||
return (0);
|
||||
}
|
||||
catch = priority & PCATCH;
|
||||
pri = priority & PRIMASK;
|
||||
#else /* __rtems__ */
|
||||
pri = priority;
|
||||
#endif /* __rtems__ */
|
||||
pri = priority & PRIMASK;
|
||||
|
||||
#ifndef __rtems__
|
||||
KASSERT(!TD_ON_SLEEPQ(td), ("recursive sleep"));
|
||||
|
@ -218,6 +218,7 @@ uprintf(const char *fmt, ...)
|
||||
va_end(ap);
|
||||
return (retval);
|
||||
}
|
||||
#endif /* __rtems__ */
|
||||
|
||||
/*
|
||||
* tprintf and vtprintf print on the controlling terminal associated with the
|
||||
@ -236,6 +237,7 @@ tprintf(struct proc *p, int pri, const char *fmt, ...)
|
||||
void
|
||||
vtprintf(struct proc *p, int pri, const char *fmt, va_list ap)
|
||||
{
|
||||
#ifndef __rtems__
|
||||
struct tty *tp = NULL;
|
||||
int flags = 0;
|
||||
struct putchar_arg pca;
|
||||
@ -271,8 +273,12 @@ vtprintf(struct proc *p, int pri, const char *fmt, va_list ap)
|
||||
if (sess != NULL)
|
||||
sess_release(sess);
|
||||
msgbuftrigger = 1;
|
||||
#else /* __rtems__ */
|
||||
vprintf(fmt, ap);
|
||||
#endif /* __rtems__ */
|
||||
}
|
||||
|
||||
#ifndef __rtems__
|
||||
/*
|
||||
* Ttyprintf displays a message on a tty; it should be used only by
|
||||
* the tty driver, or anything that knows the underlying tty will not
|
||||
|
@ -83,7 +83,8 @@ extern int boothowto; /* reboot flags, from console subsystem */
|
||||
extern int bootverbose; /* nonzero to print verbose messages */
|
||||
#else /* __rtems__ */
|
||||
#ifdef BOOTVERBOSE
|
||||
extern int bootverbose; /* nonzero to print verbose messages */
|
||||
extern int rtems_bsd_bootverbose; /* nonzero to print verbose messages */
|
||||
#define bootverbose rtems_bsd_bootverbose
|
||||
#else
|
||||
#define bootverbose 0 /* Remove all verbose code for the standard RTEMS build */
|
||||
#endif /* BOOTVERBOSE */
|
||||
@ -407,6 +408,20 @@ int copyout_nofault(const void * _Nonnull __restrict kaddr,
|
||||
void * __restrict udaddr, size_t len);
|
||||
|
||||
#else /* __rtems__ */
|
||||
static inline int
|
||||
copystr(const void * _Nonnull __restrict kfaddr,
|
||||
void * _Nonnull __restrict kdaddr, size_t len,
|
||||
size_t * __restrict lencopied)
|
||||
{
|
||||
if (lencopied != NULL) {
|
||||
*lencopied = len;
|
||||
}
|
||||
|
||||
memcpy(kdaddr, kfaddr, len);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
static inline int
|
||||
copyinstr(const void * __restrict udaddr, void * __restrict kaddr,
|
||||
size_t len, size_t * __restrict lencopied)
|
||||
|
@ -2609,8 +2609,10 @@ uma_zalloc_arg(uma_zone_t zone, void *udata, int flags)
|
||||
random_harvest_fast_uma(&zone, sizeof(zone), RANDOM_UMA);
|
||||
|
||||
/* This is the fast path allocation */
|
||||
#ifndef __rtems__
|
||||
CTR4(KTR_UMA, "uma_zalloc_arg thread %x zone %s(%p) flags %d",
|
||||
curthread, zone->uz_name, zone, flags);
|
||||
#endif /* __rtems__ */
|
||||
|
||||
if (flags & M_WAITOK) {
|
||||
WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL,
|
||||
@ -2698,9 +2700,11 @@ zalloc_start:
|
||||
*/
|
||||
bucket = cache->uc_freebucket;
|
||||
if (bucket != NULL && bucket->ub_cnt > 0) {
|
||||
#ifndef __rtems__
|
||||
CTR2(KTR_UMA,
|
||||
"uma_zalloc: zone %s(%p) swapping empty with alloc",
|
||||
zone->uz_name, zone);
|
||||
#endif /* __rtems__ */
|
||||
cache->uc_freebucket = cache->uc_allocbucket;
|
||||
cache->uc_allocbucket = bucket;
|
||||
goto zalloc_start;
|
||||
@ -2784,8 +2788,10 @@ zalloc_start:
|
||||
* will use the just filled bucket.
|
||||
*/
|
||||
bucket = zone_alloc_bucket(zone, udata, domain, flags);
|
||||
#ifndef __rtems__
|
||||
CTR3(KTR_UMA, "uma_zalloc: zone %s(%p) bucket zone returned %p",
|
||||
zone->uz_name, zone, bucket);
|
||||
#endif /* __rtems__ */
|
||||
if (bucket != NULL) {
|
||||
ZONE_LOCK(zone);
|
||||
critical_enter();
|
||||
@ -2835,9 +2841,11 @@ uma_zalloc_domain(uma_zone_t zone, void *udata, int domain, int flags)
|
||||
random_harvest_fast_uma(&zone, sizeof(zone), RANDOM_UMA);
|
||||
|
||||
/* This is the fast path allocation */
|
||||
#ifndef __rtems__
|
||||
CTR5(KTR_UMA,
|
||||
"uma_zalloc_domain thread %x zone %s(%p) domain %d flags %d",
|
||||
curthread, zone->uz_name, zone, domain, flags);
|
||||
#endif /* __rtems__ */
|
||||
|
||||
if (flags & M_WAITOK) {
|
||||
WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL,
|
||||
|
@ -195,6 +195,7 @@ class rtems(builder.Module):
|
||||
'rtems/rtems-kernel-init.c',
|
||||
'rtems/rtems-kernel-irqs.c',
|
||||
'rtems/rtems-kernel-jail.c',
|
||||
'rtems/rtems-kernel-lockmgr.c',
|
||||
'rtems/rtems-kernel-malloc.c',
|
||||
'rtems/rtems-kernel-mbuf.c',
|
||||
'rtems/rtems-kernel-mtxpool.c',
|
||||
@ -498,6 +499,7 @@ class base(builder.Module):
|
||||
'sys/kern/kern_event.c',
|
||||
'sys/kern/kern_hhook.c',
|
||||
'sys/kern/kern_intr.c',
|
||||
'sys/kern/kern_ktr.c',
|
||||
'sys/kern/kern_khelp.c',
|
||||
'sys/kern/kern_linker.c',
|
||||
'sys/kern/kern_mbuf.c',
|
||||
|
0
rtemsbsd/include/rtems/bsd/local/opt_alq.h
Normal file
0
rtemsbsd/include/rtems/bsd/local/opt_alq.h
Normal file
0
rtemsbsd/include/rtems/bsd/local/opt_ktr.h
Normal file
0
rtemsbsd/include/rtems/bsd/local/opt_ktr.h
Normal file
@ -44,6 +44,7 @@
|
||||
#include <sys/types.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/ktr.h>
|
||||
#include <sys/sysctl.h>
|
||||
#include <sys/lock.h>
|
||||
#include <sys/mutex.h>
|
||||
@ -187,5 +188,11 @@ rtems_bsd_initialize(void)
|
||||
mutex_init();
|
||||
mi_startup();
|
||||
|
||||
#ifdef KTR
|
||||
ktr_verbose = 10;
|
||||
ktr_mask = KTR_ALL;
|
||||
ktr_mask = KTR_GEN | KTR_LOCK | KTR_VFS | KTR_VOP | KTR_BUF | KTR_MALLOC | KTR_SYSC | KTR_RUNQ;
|
||||
#endif
|
||||
|
||||
return RTEMS_SUCCESSFUL;
|
||||
}
|
||||
|
@ -260,6 +260,9 @@ rtems_bsd_thread_start(struct thread **td_ptr, void (*func)(void *), void *arg,
|
||||
BSD_ASSERT(td != NULL);
|
||||
|
||||
_Thread_Set_name(thread, name);
|
||||
#ifdef KTR
|
||||
strlcpy(td->td_name, name, sizeof(td->td_name));
|
||||
#endif
|
||||
|
||||
if (rtems_bsd_thread_ready_to_start) {
|
||||
sc = rtems_task_start(task_id, (rtems_task_entry) func,
|
||||
|
Loading…
x
Reference in New Issue
Block a user