X-Git-Url: http://git.buserror.net/cgi-bin/gitweb.cgi?p=polintos%2Fscott%2Fpriv.git;a=blobdiff_plain;f=kernel%2Ftests%2Forb.cc;fp=kernel%2Ftests%2Forb.cc;h=68e0dfcb18f98c8370fe64a87e33899c055e30ad;hp=0000000000000000000000000000000000000000;hb=1ac390fe1e18444008857b056c947710be9621a8;hpb=6e64b28821757af60447c790ae52a91831a9d4f0 diff --git a/kernel/tests/orb.cc b/kernel/tests/orb.cc new file mode 100644 index 0000000..68e0dfc --- /dev/null +++ b/kernel/tests/orb.cc @@ -0,0 +1,44 @@ +// ORB test +// +// This software is copyright (c) 2007 Scott Wood . +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors or contributors be held liable for any damages +// arising from the use of this software. +// +// Permission is hereby granted to everyone, free of charge, to use, copy, +// modify, prepare derivative works of, publish, distribute, perform, +// sublicense, and/or sell copies of the Software, provided that the above +// copyright notice and disclaimer of warranty be included in all copies or +// substantial portions of this software. + +#include +#include +#include +#include +#include +#include + +extern "C" void arch_new_user_thread(void *, void *); +extern u32 test_user_ptr; +using namespace Threads; +using namespace Mem; + +void run_test() +{ + Thread *t = sched.new_thread(arch_new_user_thread, (void *)test_user_ptr, + (void *)(Arch::stack_top + 1), "thread"); + + Object obj; + proc_addr_space_factory.create(&obj); + IAddrSpace aspace = IAddrSpace::downcast(obj); + + printf("aspace %p created\n", (void *)aspace); + + ProcAddrSpace *kaspace = static_cast(AddrSpace::classptr(aspace)); + + printf("kaspace %p\n", kaspace); + + t->set_aspace(kaspace); + t->wake(); +}