summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@oarcorp.com>2012-03-27 17:07:19 -0500
committerJoel Sherrill <joel.sherrill@oarcorp.com>2012-03-27 17:07:19 -0500
commit336762e7b21bab81c7ecac3dfa73030e7d0de346 (patch)
tree37836c79d95d3d2b50cc26ca71bd7cb58013d19a
parentAdded empty/defaulted prison methods to for linking RealTek Nic. (diff)
downloadrtems-libbsd-336762e7b21bab81c7ecac3dfa73030e7d0de346.tar.bz2
Remove dummy symbols in link01 test
+ add symbol where needed + use as much as possible from rtems-bsd-symbols.c
-rw-r--r--rtemsbsd/freebsd/machine/rtems-bsd-symbols.h9
-rw-r--r--rtemsbsd/src/rtems-bsd-jail.c34
-rw-r--r--rtemsbsd/src/rtems-bsd-support.c17
-rw-r--r--testsuite/link01/test.c13
4 files changed, 55 insertions, 18 deletions
diff --git a/rtemsbsd/freebsd/machine/rtems-bsd-symbols.h b/rtemsbsd/freebsd/machine/rtems-bsd-symbols.h
index 1eaf3c0f..69dcafb8 100644
--- a/rtemsbsd/freebsd/machine/rtems-bsd-symbols.h
+++ b/rtemsbsd/freebsd/machine/rtems-bsd-symbols.h
@@ -150,6 +150,11 @@
#define cam_status_table _bsd_cam_status_table
#define cam_strmatch _bsd_cam_strmatch
#define cam_strvis _bsd_cam_strvis
+#define cold _bsd_cold
+#define copyin _bsd_copyin
+#define copyout _bsd_copyout
+#define critical_enter _bsd_critical_enter
+#define critical_exit _bsd_critical_exit
#define cv_broadcastpri _bsd_cv_broadcastpri
#define cv_destroy _bsd_cv_destroy
#define cv_init _bsd_cv_init
@@ -236,6 +241,7 @@
#define device_unbusy _bsd_device_unbusy
#define device_verbose _bsd_device_verbose
#define driver_module_handler _bsd_driver_module_handler
+#define dpcpu_off _bsd_dpcpu_off
#define ehci_bus_methods _bsd_ehci_bus_methods
#define ehci_detach _bsd_ehci_detach
#define ehci_device_bulk_methods _bsd_ehci_device_bulk_methods
@@ -280,6 +286,8 @@
#define malloc _bsd_malloc
#define malloc_init _bsd_malloc_init
#define malloc_uninit _bsd_malloc_uninit
+#define maxproc _bsd_maxproc
+#define maxfilesperproc _bsd_maxfilesperproc
#define M_CAMSIM _bsd_M_CAMSIM
#define M_DEVBUF _bsd_M_DEVBUF
#define M_SOCKET _bsd_M_SOCKET
@@ -301,6 +309,7 @@
#define M_USBDEV _bsd_M_USBDEV
#define M_USBHC _bsd_M_USBHC
#define mutex_init _bsd_mutex_init
+#define ngroups_max _bsd_ngroups_max
#define null_class _bsd_null_class
#define num_cam_status_entries _bsd_num_cam_status_entries
#define ohci_bus_methods _bsd_ohci_bus_methods
diff --git a/rtemsbsd/src/rtems-bsd-jail.c b/rtemsbsd/src/rtems-bsd-jail.c
index 10b1c16b..7f978635 100644
--- a/rtemsbsd/src/rtems-bsd-jail.c
+++ b/rtemsbsd/src/rtems-bsd-jail.c
@@ -96,14 +96,19 @@ MTX_SYSINIT(prison0, &prison0.pr_mtx, "jail mutex", MTX_DEF);
int
prison_flag(struct ucred *cred, unsigned flag)
{
-
- /* This is an atomic read, so no locking is necessary. */
- return (cred->cr_prison->pr_flags & flag);
+ /* This is an atomic read, so no locking is necessary. */
+ return (cred->cr_prison->pr_flags & flag);
}
+void
+prison_free(struct prison *pr)
+{
+}
-void prison_free(struct prison *pr) {}
-void prison_hold(struct prison *pr) {}
+void
+prison_hold(struct prison *pr)
+{
+}
/*
* Check if given address belongs to the jail referenced by cred (wrapper to
@@ -118,6 +123,7 @@ prison_if(struct ucred *cred, struct sockaddr *sa)
{
return 0;
}
+
/*
* Return 1 if we should do proper source address selection or are not jailed.
* We will return 0 if we should bypass source address selection in favour
@@ -130,6 +136,7 @@ prison_saddrsel_ip6(struct ucred *cred, struct in6_addr *ia6)
{
return EAFNOSUPPORT;
}
+
/*
* Return true if pr1 and pr2 have the same IPv4 address restrictions.
*/
@@ -139,10 +146,15 @@ prison_equal_ip4(struct prison *pr1, struct prison *pr2)
return 1;
}
+/*
+ * Assuming 0 means no restrictions.
+ *
+ * NOTE: RTEMS does not restrict via a jail so return 0.
+ */
int
prison_check_ip6(struct ucred *cred, struct in6_addr *ia6)
{
- return EAFNOSUPPORT;
+ return 0;
}
/*
@@ -170,6 +182,7 @@ prison_remote_ip4(struct ucred *cred, struct in_addr *ia)
{
return EAFNOSUPPORT;
}
+
/*
* Return true if pr1 and pr2 have the same IPv6 address restrictions.
*/
@@ -178,6 +191,7 @@ prison_equal_ip6(struct prison *pr1, struct prison *pr2)
{
return 1;
}
+
/*
* Make sure our (source) address is set to something meaningful to this jail.
*
@@ -187,20 +201,24 @@ prison_equal_ip6(struct prison *pr1, struct prison *pr2)
* Returns 0 if jail doesn't restrict IPv6 or if address belongs to jail,
* EADDRNOTAVAIL if the address doesn't belong, or EAFNOSUPPORT if the jail
* doesn't allow IPv6.
+ *
+ * NOTE: RTEMS does not restrict via a jail so return 0.
*/
int
prison_local_ip6(struct ucred *cred, struct in6_addr *ia6, int v6only)
{
- return EAFNOSUPPORT;
+ return 0;
}
/*
* Rewrite destination address in case we will connect to loopback address.
*
* Returns 0 on success, EAFNOSUPPORT if the jail doesn't allow IPv6.
+ *
+ * NOTE: RTEMS does not restrict via a jail so return 0.
*/
int
prison_remote_ip6(struct ucred *cred, struct in6_addr *ia6)
{
- return EAFNOSUPPORT;
+ return 0;
}
diff --git a/rtemsbsd/src/rtems-bsd-support.c b/rtemsbsd/src/rtems-bsd-support.c
index e6c9819c..d6a63f59 100644
--- a/rtemsbsd/src/rtems-bsd-support.c
+++ b/rtemsbsd/src/rtems-bsd-support.c
@@ -20,16 +20,22 @@
* http://www.rtems.com/license/LICENSE.
*/
+/*
+ * This violation is specifically for _Thread_Disable_dispatch
+ * and _Thread_Enable_dispatch. Use of the critical_enter()
+ * and critical_exit() routines should be reviewed.
+ */
+#define __RTEMS_VIOLATE_KERNEL_VISIBILITY__
#include <freebsd/machine/rtems-bsd-config.h>
-#include <rtems/score/states.h>
-#include <rtems/score/thread.h>
-#include <rtems/score/threadq.h>
#include <freebsd/sys/types.h>
#include <freebsd/sys/systm.h>
#include <freebsd/sys/malloc.h>
#include <freebsd/sys/uio.h>
+int maxproc = 6; /* XXX Used value of rtems KERN_MAXPROC */
+int ngroups_max = NGROUPS_MAX; /* XXX */
+
int maxfiles = 7; /* XXX sys. wide open files limit */
int maxfilesperproc = 27; /* XXX per-proc open files limit */
int cold = 1; /* XXX Wasn't sure where to put this */
@@ -49,6 +55,10 @@ copyin(const void *udaddr, void *kaddr, size_t len)
return (0);
}
+#if 0
+/*
+ * As of 27 March 2012, use version in kern_subr.c
+ */
int
copyiniov(struct iovec *iovp, u_int iovcnt, struct iovec **iov, int error)
{
@@ -66,6 +76,7 @@ copyiniov(struct iovec *iovp, u_int iovcnt, struct iovec **iov, int error)
}
return (error);
}
+#endif
void
critical_enter(void)
diff --git a/testsuite/link01/test.c b/testsuite/link01/test.c
index 2d483645..42c814a1 100644
--- a/testsuite/link01/test.c
+++ b/testsuite/link01/test.c
@@ -9,13 +9,6 @@
#include <stdio.h>
#include <freebsd/bsd.h>
-int maxproc = 6; /* XXX Used value of rtems KERN_MAXPROC */
-int ngroups_max = NGROUPS_MAX; /* XXX */
-
-/* needed by rtems-bsd-init-with-irq.c */
-void rtems_interrupt_server_initialize(void) { }
-
-
/*
* Methods used to make sure the nic drivers
* are pulled into the executable.
@@ -28,6 +21,12 @@ rtems_task Init(
)
{
printf( "\n\n*** LIBFREEBSD INITIALIZATION TEST ***\n" );
+ /*
+ * BSD must support the new "shared IRQ PIC implementation" at this point.
+ * BSPs must also provide rtems_interrupt_server_initialize() which
+ * just requires including irq-server.[ch] in their build.
+ */
+
rtems_bsd_initialize_with_interrupt_server();
printf("Nic Driver Addresses\n");