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; alloc_irq_cap()31 static Irq_cap alloc_irq_cap() 32 { return object_pool.cap_alloc()->alloc<L4::Irq>(); } 33 free_irq_cap(Irq_cap cap)34 static void free_irq_cap(Irq_cap cap) 35 { object_pool.cap_alloc()->free(cap); } 36 37 Sched_proxy(); 38 39 int info(l4_umword_t *cpu_max, l4_sched_cpu_set_t *cpus); 40 41 int run_thread(L4::Cap<L4::Thread> thread, l4_sched_param_t const &sp); 42 43 int idle_time(l4_sched_cpu_set_t const &cpus, l4_kernel_clock_t &us); 44 set_prio(unsigned offs,unsigned limit)45 void set_prio(unsigned offs, unsigned limit) 46 { _prio_offset = offs; _prio_limit = limit; } 47 48 L4::Cap<L4::Thread> received_thread(L4::Ipc::Snd_fpage const &fp); rcv_cap()49 L4::Cap<void> rcv_cap() const 50 { return L4::Cap<L4::Thread>(Rcv_cap << L4_CAP_SHIFT); } 51 52 void restrict_cpus(l4_umword_t cpus); 53 void rescan_cpus(); 54 scheduler_irq()55 Icu::Irq *scheduler_irq() { return &_scheduler_irq; } scheduler_irq()56 Icu::Irq const *scheduler_irq() const { return &_scheduler_irq; } 57 58 private: 59 friend class Cpu_hotplug_server; 60 61 l4_sched_cpu_set_t _cpus, _real_cpus, _cpu_mask; 62 unsigned _max_cpus; 63 unsigned _prio_offset, _prio_limit; 64 Icu::Irq _scheduler_irq; 65 66 typedef cxx::H_list_t_bss<Sched_proxy> List; 67 static List _list; 68 }; 69 70