diff options
author | Neal H. Walfield <neal@gnu.org> | 2008-12-17 13:11:52 +0100 |
---|---|---|
committer | Neal H. Walfield <neal@gnu.org> | 2008-12-17 13:11:52 +0100 |
commit | ca828476fdb64ad4615bc6f580c2a451e78fcc1c (patch) | |
tree | 320c2e89e34bbcd0ba82b64728f831b8536cc286 /libviengoos/t-addr.c | |
parent | f0d7e0e0ee0cb0362ee79739922a76faef17917c (diff) |
Move viengoos header files to libviengoos.
/
2008-12-17 Neal H. Walfield <neal@gnu.org>
* libviengoos: New directory.
* Makefile.am (SUBDIRS): Add libviengoos.
* configure.ac: Include libviengoos/headers.m4. Generate
libviengoos/Makefile.
hurd/
2008-12-17 Neal H. Walfield <neal@gnu.org>
* activity.h: Move to ../libviengoos/viengoos. Update references.
* addr-trans.h: Likewise.
* addr.h: Likewise.
* cap.h: Likewise.
* folio.h: Likewise.
* futex.h: Likewise.
* ipc.h: Likewise.
* message.h: Likewise.
* messenger.h: Likewise.
* rpc.h: Likewise.
* thread.h: Move viengoos specific bits...
* ../libviengoos/viengoos/thread.h: ... to this new file.
* thread.h (struct hurd_utcb): New structure.
* exceptions.h (hurd_utcb): Use a struct hurd_utcb *, not a
struct vg_utcb *. Update users.
(hurd_activation_state_alloc): Likewise.
(hurd_activation_state_free): Likewise.
(hurd_activation_handler_activated): Likewise.
(hurd_activation_handler_normal): Likewise.
* t-addr-trans.c: Move to ../libviengoos.
* t-addr.c: Likewise.
* t-rpc.c: Likewise.
* Makefile.am (TESTS, check_PROGRAMS, t_addr_CPPFLAGS)
(t_addr_SOURCES, t_addr_trans_CPPFLAGS, t_addr_trans_SOURCES)
(t_rpc_CPPFLAGS, t_rpc_SOURCES): Move from this file...
* ../libviengoos/Makefile.am.
* Makefile.am (includehurd_HEADERS): Don't mention activity.h,
addr-trans.h, addr.h, cap.h, folio.h, futex.h, ipc.h, message.h or
messenger.h.
* headers.m4: Don't create a link to hurd/addr.h,
hurd/addr-trans.h, hurd/cap.h, hurd/folio.h, hurd/rpc.h,
hurd/activity.h, hurd/futex.h, hurd/message.h, hurd/messenger.h or
hurd/ipc.h.
libviengoos/
2008-12-17 Neal H. Walfield <neal@gnu.org>
* Makefile.am: New file.
* headers.m4: Likewise.
* t-addr-trans.c: Move from ../hurd.
* t-addr.c: Likewise.
* t-rpc.c: Likewise.
* viengoos.h: Likewise.
* viengoos/activity.h: Likewise.
* viengoos/addr-trans.h: Likewise.
* viengoos/addr.h: Likewise.
* viengoos/cap.h: Likewise.
* viengoos/folio.h: Likewise.
* viengoos/futex.h: Likewise.
* viengoos/ipc.h: Likewise.
* viengoos/message.h: Likewise.
* viengoos/messenger.h: Likewise.
* viengoos/rpc.h: Likewise.
* viengoos/misc.h: Moved from ../viengoos/rm.h.
* viengoos/thread.h: New file split from ../hurd/thread.h.
libpthread/
2008-12-17 Neal H. Walfield <neal@gnu.org>
* Makefile.am: New file.
* headers.m4: Likewise.
* t-addr-trans.c: Move from ../hurd.
* t-addr.c: Likewise.
* t-rpc.c: Likewise.
* viengoos.h: Likewise.
* viengoos/activity.h: Likewise.
* viengoos/addr-trans.h: Likewise.
* viengoos/addr.h: Likewise.
* viengoos/cap.h: Likewise.
* viengoos/folio.h: Likewise.
* viengoos/futex.h: Likewise.
* viengoos/ipc.h: Likewise.
* viengoos/message.h: Likewise.
* viengoos/messenger.h: Likewise.
* viengoos/rpc.h: Likewise.
* viengoos/misc.h: Moved from ../viengoos/rm.h.
* viengoos/thread.h: New file split from ../hurd/thread.h.
viengoos/
2008-12-17 Neal H. Walfield <neal@gnu.org>
* rm.h: Move from here...
* ../libviengoos/viengoos/misc.h: ... to here. Update users.
* headers.m4: Don't link rm.h to hurd/rm.h.
* Makefile.am (viengoos_SOURCES): Remove rm.h.
Diffstat (limited to 'libviengoos/t-addr.c')
-rw-r--r-- | libviengoos/t-addr.c | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/libviengoos/t-addr.c b/libviengoos/t-addr.c new file mode 100644 index 0000000..1c2494d --- /dev/null +++ b/libviengoos/t-addr.c @@ -0,0 +1,74 @@ +/* t-addr.c - Test the implementation of the various addr functions. + Copyright (C) 2007 Free Software Foundation, Inc. + Written by Neal H. Walfield <neal@gnu.org>. + + This file is part of the GNU Hurd. + + The GNU Hurd is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 3 of the + License, or (at your option) any later version. + + The GNU Hurd is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see + <http://www.gnu.org/licenses/>. */ + +#include <hurd/stddef.h> +#include <hurd/types.h> +#include <viengoos/addr.h> +#include <assert.h> +#include <l4/math.h> + +char *program_name = "t-addr"; +int output_debug = 0; + +int +main (int argc, char *argv[]) +{ + addr_t addr; + int i, j; + + printf ("Checking ADDR... "); + for (i = 0; i < ADDR_BITS; i ++) + { + addr = ADDR (1ULL << i, ADDR_BITS - i); + debug (1, "%llx/%d =? %llx/%d\n", + 1ULL << i, ADDR_BITS - i, + addr_prefix (addr), addr_depth (addr)); + assert (addr_depth (addr) == ADDR_BITS - i); + assert (addr_prefix (addr) == 1ull << i); + } + printf ("ok.\n"); + + printf ("Checking addr_extend... "); + addr = ADDR (0, 0); + for (i = 1; i < ADDR_BITS; i ++) + { + addr = addr_extend (addr, 1, 1); + assert (addr_depth (addr) == i); + assert (l4_msb64 (addr_prefix (addr)) == ADDR_BITS); + assert (l4_lsb64 (addr_prefix (addr)) == ADDR_BITS - i + 1); + } + printf ("ok.\n"); + + printf ("Checking addr_extract... "); + addr = ADDR (0, 0); + for (i = 0; i < ADDR_BITS; i ++) + { + addr = ADDR (((1ULL << i) - 1) << (ADDR_BITS - i), i); + + for (j = 0; j <= i; j ++) + { + l4_uint64_t idx = addr_extract (addr, j); + assert (idx == (1ULL << j) - 1); + } + } + printf ("ok.\n"); + + return 0; +} |