]> git.buserror.net Git - polintos/scott/priv.git/blob - kernel/tests/orb.cc
update
[polintos/scott/priv.git] / kernel / tests / orb.cc
1 // ORB test
2 //
3 // This software is copyright (c) 2007 Scott Wood <scott@buserror.net>.
4 // 
5 // This software is provided 'as-is', without any express or implied warranty.
6 // In no event will the authors or contributors be held liable for any damages
7 // arising from the use of this software.
8 // 
9 // Permission is hereby granted to everyone, free of charge, to use, copy,
10 // modify, prepare derivative works of, publish, distribute, perform,
11 // sublicense, and/or sell copies of the Software, provided that the above
12 // copyright notice and disclaimer of warranty be included in all copies or
13 // substantial portions of this software.
14
15 #include <kern/types.h>
16 #include <kern/libc.h>
17 #include <kern/thread.h>
18 #include <kern/mem.h>
19 #include <kern/orb.h>
20 #include <kern/process.h>
21
22 extern "C" void arch_new_user_thread(void *, void *);
23 extern u32 test_user_ptr;
24 using namespace Threads;
25 using namespace Mem;
26
27 void run_test()
28 {
29         Thread *t = sched.new_thread(arch_new_user_thread, (void *)test_user_ptr,
30                                      (void *)(Arch::stack_top + 1), "thread");
31
32         Object obj;
33         proc_addr_space_factory.create(&obj);
34         IAddrSpace aspace = IAddrSpace::downcast(obj);
35         
36         printf("aspace %p created\n", (void *)aspace);
37         
38         ProcAddrSpace *kaspace = static_cast<ProcAddrSpace *>(AddrSpace::classptr(aspace));
39         
40         printf("kaspace %p\n", kaspace);
41
42         t->set_aspace(kaspace);
43         t->wake();
44 }