]> rtime.felk.cvut.cz Git - l4.git/blob - l4/pkg/l4re-core/moe/server/src/sched_proxy.h
Update
[l4.git] / l4 / pkg / l4re-core / moe / server / src / sched_proxy.h
1 /*
2  * (c) 2009 Alexander Warg <warg@os.inf.tu-dresden.de>
3  *     economic rights: Technische Universität Dresden (Germany)
4  *
5  * This file is part of TUD:OS and distributed under the terms of the
6  * GNU General Public License 2.
7  * Please see the COPYING-GPL-2 file for details.
8  */
9 #pragma once
10
11 #include <l4/cxx/hlist>
12 #include <l4/sys/cxx/ipc_epiface>
13 #include <l4/libkproxy/scheduler_svr>
14
15 #include "globals.h"
16 #include "server_obj.h"
17
18 class Sched_proxy :
19   public L4::Epiface_t<Sched_proxy, L4::Scheduler, Moe::Server_object>,
20   public L4kproxy::Scheduler_svr_t<Sched_proxy>,
21   public L4Re::Util::Icu_cap_array_svr<Sched_proxy>,
22   public cxx::H_list_item_t<Sched_proxy>
23 {
24   typedef L4Re::Util::Icu_cap_array_svr<Sched_proxy> Icu;
25
26 public:
27   using L4Re::Util::Icu_cap_array_svr<Sched_proxy>::op_info;
28   using L4kproxy::Scheduler_svr_t<Sched_proxy>::op_info;
29
30   typedef L4::Cap<L4::Irq> Irq_cap;
31   static Irq_cap alloc_irq_cap()
32   { return object_pool.cap_alloc()->alloc<L4::Irq>(); }
33
34   static void free_irq_cap(Irq_cap cap)
35   { object_pool.cap_alloc()->free(cap); }
36
37   Sched_proxy();
38   ~Sched_proxy();
39
40   int info(l4_umword_t *cpu_max, l4_sched_cpu_set_t *cpus);
41
42   int run_thread(L4::Cap<L4::Thread> thread, l4_sched_param_t const &sp);
43
44   int idle_time(l4_sched_cpu_set_t const &cpus, l4_kernel_clock_t &us);
45
46   void set_prio(unsigned offs, unsigned limit)
47   { _prio_offset = offs; _prio_limit = limit; }
48
49   L4::Cap<L4::Thread> received_thread(L4::Ipc::Snd_fpage const &fp);
50   L4::Cap<void> rcv_cap() const
51   { return L4::Cap<L4::Thread>(Rcv_cap << L4_CAP_SHIFT); }
52
53   void restrict_cpus(l4_umword_t cpus);
54   void rescan_cpus();
55
56   Icu::Irq *scheduler_irq() { return &_scheduler_irq; }
57   Icu::Irq const *scheduler_irq() const { return &_scheduler_irq; }
58
59 private:
60   friend class Cpu_hotplug_server;
61
62   l4_sched_cpu_set_t _cpus, _real_cpus, _cpu_mask;
63   unsigned _max_cpus;
64   unsigned _prio_offset, _prio_limit;
65   Icu::Irq _scheduler_irq;
66
67   typedef cxx::H_list_t_bss<Sched_proxy> List;
68   static List _list;
69 };
70