L4_buf_desc() {}
- L4_buf_desc(unsigned mem, unsigned io, unsigned obj, unsigned str,
+ L4_buf_desc(unsigned mem, unsigned io, unsigned obj,
unsigned flags = 0)
- : _raw(mem | (io << 5) | (obj << 10) | (str << 15) | flags)
+ : _raw(mem | (io << 5) | (obj << 10) | flags)
{}
unsigned mem() const { return _raw & ((1UL << 5)-1); }
unsigned io() const { return (_raw >> 5) & ((1UL << 5)-1); }
unsigned obj() const { return (_raw >> 10) & ((1UL << 5)-1); }
- unsigned str() const { return (_raw >> 15) & ((1UL << 5)-1); }
Mword flags() const { return _raw; }
Mword raw() const { return _raw; }
enum {
Kip_syscalls = 1,
+
+ One_shot_min_interval_us = 200,
+ One_shot_max_interval_us = 10000,
+
#ifdef CONFIG_ASSEMBLER_IPC_SHORTCUT
Assembler_ipc_shortcut = 1,
#else
else
{
Unsigned64 delta = wakeup - now;
- if (delta < 1000)
- apic = Apic::us_to_apic(1000);
- else if (delta > 10000)
- apic = Apic::us_to_apic(10000);
+ if (delta < Config::One_shot_min_interval_us)
+ apic = Apic::us_to_apic(Config::One_shot_min_interval_us);
+ else if (delta > Config::One_shot_max_interval_us)
+ apic = Apic::us_to_apic(Config::One_shot_max_interval_us);
else
apic = Apic::us_to_apic(delta);
Pf_msg_utcb_saver saved_utcb_fields(utcb);
- utcb->buf_desc = L4_buf_desc(0,0,0,0,L4_buf_desc::Inherit_fpu);
+ utcb->buf_desc = L4_buf_desc(0, 0, 0, L4_buf_desc::Inherit_fpu);
utcb->buffers[0] = L4_msg_item::map(0).raw();
utcb->buffers[1] = L4_fpage::all_spaces().raw();
Utcb *utcb = access_utcb();
Buf_utcb_saver saved_state(utcb);
- utcb->buf_desc = L4_buf_desc(0,0,0,0,L4_buf_desc::Inherit_fpu);
+ utcb->buf_desc = L4_buf_desc(0, 0, 0, L4_buf_desc::Inherit_fpu);
utcb->buffers[0] = L4_msg_item::map(0).raw();
utcb->buffers[1] = L4_fpage::all_spaces().raw();
}
my $nm = 'nm';
+$nm = "$ENV{'SYSTEM_TARGET'}$nm" if defined $ENV{"SYSTEM_TARGET"};
$nm = 'arm-softfloat-elf-nm' if !(system("file -L $img | grep -qw ARM") >> 8);
foreach my $l (split('\n', qx{$nm $img | c++filt}))
qemu: MODULE_SEARCH_PATH += /path/to/fiasco-build
# Optional options for QEMU, but setting '-serial stdio' is recommended
-#QEMU_OPTIONS = -serial stdio -nographic ...
-#QEMU_OPTIONS-arm += -M realview-eb 256
-#QEMU_OPTIONS = $(QEMU_OPTIONS-$(ARCH))
+QEMU_OPTIONS = -serial stdio
+#QEMU_OPTIONS = -nographic
+#QEMU_OPTIONS-arm += -M realview-eb -m 256
+QEMU_OPTIONS += $(QEMU_OPTIONS-$(ARCH))
# The path to the QEMU binary - optional
#QEMU_PATH-x86 = /path/to/qemu
--- /dev/null
+hw-root
+{
+ NIC => new Device()
+ {
+ .hid = "smsc911x";
+ new-res Mmio(0x4e000000 .. 0x4e000fff);
+ new-res Irq(60);
+ }
+}
+
+l4lx => new System_bus()
+{
+ NIC => wrap(hw-root.NIC);
+}
--- /dev/null
+-- vim:set ft=lua:
+
+loader = L4.default_loader;
+
+local lxname = "vmlinuz";
+if L4.Info.arch() == "arm" then
+ lxname = "vmlinuz.arm";
+end
+
+-- Start io
+
+vbus_l4linux = loader:new_channel();
+vbus_input = loader:new_channel();
+vbus_fbdrv = loader:new_channel();
+
+loader:start(
+ {
+ caps = {
+ sigma0 = L4.cast(L4.Proto.Factory, L4.Env.sigma0):create(L4.Proto.Sigma0);
+ icu = L4.Env.icu;
+ input = vbus_input:svr();
+ l4linux = vbus_l4linux:svr();
+ fbdrv = vbus_fbdrv:svr();
+ },
+ }, "rom/io rom/x86-legacy.devs rom/l4lx-x86.io");
+
+-- Start fb-drv (but only if we need to)
+local fb = L4.Env.vesa;
+if (not fb) then
+ fb = loader:new_channel();
+ loader:start({ caps = { fb = fb:svr(), vbus = vbus_fbdrv }},
+ "rom/fb-drv -m 0x117");
+end
+
+local mag_mag = loader:new_channel();
+local mag_svc = loader:new_channel();
+
+-- Start mag
+loader:start(
+ {
+ caps = {
+ vbus = vbus_input;
+ mag = mag_mag:svr();
+ svc = mag_svc:svr();
+ fb = fb;
+ },
+ }, "rom/mag");
+
+
+-- Start Linux
+loader:start(
+ { caps = {
+ log = L4.Env.log:m("rws"),
+ fb = mag_svc:create(L4.Proto.Goos, "640x480");
+ vbus = vbus_l4linux;
+ },
+ l4re_dbg = L4.Dbg.Warn,
+ log = { "l4linux", "yellow" },
+ },
+ "rom/" .. lxname .. " mem=64M console=tty0 l4x_rd=rom/ramdisk-" .. L4.Info.arch() .. ".rd root=1:0 ramdisk_size=4000 init=/bin/sh");
--- /dev/null
+input => new System_bus()
+{
+ ps2dev => wrap(hw-root.match("PNP0303"));
+}
+
+fbdrv => new System_bus()
+{
+ PCI0 => new PCI_bus_ident()
+ {
+ host_bridge_dummy => new PCI_dummy_device();
+
+ pci_gfx[] => wrap(hw-root.match("PCI/CC_03"));
+ }
+
+ x1 => wrap(hw-root.match("BIOS"));
+ x2 => wrap(hw-root.match("PNP0900"));
+ x3 => wrap(hw-root.match("PNP0100"));
+}
+
+l4linux => new System_bus()
+{
+ # Add a new virtual PCI root bridge
+ PCI0 => new PCI_bus()
+ {
+ pci_l4x[] => wrap(hw-root.match("PCI/CC_02,PCI/CC_01,PCI/CC_04"));
+ }
+}
--- /dev/null
+-- vim:set ft=lua:
+
+local lxname = "vmlinuz";
+if L4.Info.arch() == "arm" then
+ lxname = "vmlinuz.arm";
+end
+
+L4.default_loader:start(
+ { caps = {
+ log = L4.Env.log:m("rws"),
+ },
+ l4re_dbg = L4.Dbg.Warn,
+ log = { "l4linux", "yellow" },
+ },
+ "rom/" .. lxname .. " mem=64M console=ttyLv0 l4x_rd=rom/ramdisk-" .. L4.Info.arch() .. ".rd root=1:0 ramdisk_size=4000 init=/bin/sh");
module r/libsupc++.so
module r/libuc_c.so
+entry L4linux ARM
+roottask moe rom/l4lx.cfg
+module l4re
+module ned
+module l4lx.cfg
+module io
+module arm-rv.io
+module vmlinuz.arm
+module ramdisk-arm.rd
+
+entry L4Linux-mag-x86
+roottask moe rom/l4lx-gfx.cfg
+module l4re
+module ned
+module l4lx-gfx.cfg
+module io
+module fb-drv
+module mag
+module x86-legacy.devs
+module l4lx-x86.io
+module vmlinuz
+module ramdisk-x86.rd
+
ifneq ($(SYSTEM),)
L4_SYSTEM = $(ARCH)_$(CPU)
+L4_CC = $(CC)
+L4_CXX = $(CXX)
L4_CRT0_STATIC = $(CRT0)
L4_CRTN_STATIC = $(CRTN)
L4_LDFLAGS_LD = $(filter-out -l%,$(BID_LDFLAGS_FOR_LINKING_LD))
@echo "" >> $(L4DEF_FILE_SH)
@:
@$(call do_output_all,L4_SYSTEM)
+ @$(call do_output_all,L4_CC)
+ @$(call do_output_all,L4_CXX)
@$(call do_output_all,L4_CRT0_STATIC)
@$(call do_output_all,L4_CRTN_STATIC)
@$(call do_output_all,L4_LDFLAGS_LD)
#pragma once
#include <l4/re/util/video/goos_svr>
-#include <l4/re/util/cap_alloc>
#include <l4/re/util/object_registry>
#include <l4/re/util/dataspace_svr>
* GNU General Public License 2.
* Please see the COPYING-GPL-2 file for details.
*/
-#include <l4/re/env>
-#include <l4/re/error_helper>
-#include <l4/re/namespace>
-#include <l4/re/util/cap_alloc>
+
+#include <l4/sys/capability>
+#include <l4/sys/typeinfo_svr>
#include <l4/cxx/ipc_server>
-#include <l4/cxx/l4iostream>
+
#include <cstdio>
#include <getopt.h>
#include <cstdlib>
ios >> tag;
switch (tag.label())
{
+ case L4::Meta::Protocol:
+ return L4::Util::handle_meta_request<L4Re::Video::Goos>(ios);
case L4Re::Protocol::Goos:
return L4Re::Util::Video::Goos_svr::dispatch(obj, ios);
case L4Re::Protocol::Dataspace:
default:
printf("Unknown option '%c'\n", c);
break;
- };
+ }
}
}
if (!fb->obj_cap().is_valid())
{
- printf("Failed to register in namespace, maybe ro?\n");
+ printf("Failed to connect.\n");
return 1;
}
int view_info(L4Re::Video::View::Info *info)
{ return _view.info(info); }
+ L4Re::Video::View const *view() const { return &_view; }
+ L4Re::Video::View *view() { return &_view; }
+
L4::Cap<L4Re::Dataspace> buffer() const { return _buffer; }
void *attach_buffer();
/* Set up the new mode framebuffer */
current->w = width;
current->h = height;
- current->pitch = current->w * (bpp / 8);
- this->hidden->pitch = current->w * (bpp / 8);
+ current->pitch = SDL_CalculatePitch(current);
+ this->hidden->pitch = current->pitch;
current->flags = SDL_PREALLOC | SDL_ASYNCBLIT;
class Input_driver : public Plugin
{
-protected:
- Core_api *_core;
-
-private:
- Input_driver *_next_active;
-
public:
explicit Input_driver(char const *name)
- : Plugin(name), _core(0), _next_active(0)
+ : Plugin(name)
{}
char const *type() const { return "input-driver"; }
- Input_driver *next_active() const { return _next_active; }
- virtual void poll_events() = 0;
- virtual int probe() = 0;
-
- void start(Core_api *core)
- {
- _core = core;
- if (probe() == 0)
- {
- _next_active = core->input_drivers();
- core->add_input_driver(this);
- }
- }
-
virtual ~Input_driver() {}
};
#pragma once
#include <l4/mag/server/object>
+#include <l4/re/video/goos>
namespace Mag_server {
class User_state;
-class Input_driver;
+class Core_api;
+
+class Input_source
+{
+private:
+ friend class Core_api;
+ Input_source *_next_active;
+
+protected:
+ Core_api *_core;
+
+public:
+ explicit Input_source(Core_api *core = 0) : _core(core) {}
+ virtual void poll_events() = 0;
+ Input_source *next() const { return _next_active; }
+};
class Core_api
{
private:
- Input_driver *_input;
+ Input_source *_input;
Registry *_reg;
User_state *_ust;
L4::Cap<void> _rcv_cap;
+ L4::Cap<L4Re::Video::Goos> _fb;
// not instanziatable
Core_api(Core_api const &);
void operator = (Core_api const &);
public:
- Core_api(Registry *r, User_state *u, L4::Cap<void> rcvc)
- : _reg(r), _ust(u), _rcv_cap(rcvc)
+ Core_api(Registry *r, User_state *u, L4::Cap<void> rcvc,
+ L4::Cap<L4Re::Video::Goos> fb)
+ : _reg(r), _ust(u), _rcv_cap(rcvc), _fb(fb)
{}
Registry *registry() const { return _reg; }
User_state *user_state() const { return _ust; }
- Input_driver *input_drivers() const { return _input; }
- void add_input_driver(Input_driver *i) { _input = i; }
+ Input_source *input_sources() const { return _input; }
+ L4::Cap<L4Re::Video::Goos> backend_fb() const { return _fb; }
+ void add_input_source(Input_source *i)
+ {
+ i->_next_active = _input;
+ _input = i;
+ }
+
L4::Cap<void> rcv_cap() const { return _rcv_cap; }
};
#include <l4/mag-gfx/geometry>
#include <l4/mag/server/view_stack>
+#include <l4/re/video/view>
#include <l4/re/event>
namespace Mag_server {
int _pressed_keys;
public:
- User_state(Canvas *screen, View *cursor, View *bg)
- : _vstack(screen, bg), _mouse_pos(0,0),
+ User_state(Canvas *screen, L4Re::Video::View *screen_view,
+ View *cursor, View *bg)
+ : _vstack(screen, screen_view, bg), _mouse_pos(0,0),
_mouse_cursor(cursor), _pointed_view(0), _next_mouse_pos(0,0),
_pressed_keys(0)
{
*/
#pragma once
+#include <l4/re/video/view>
+
#include <l4/mag-gfx/canvas>
#include <l4/mag/server/view>
+
#include <assert.h>
namespace Mag_server {
Mode _mode;
View *_focused;
+ L4Re::Video::View *_canvas_view;
+
Dummy_view _no_stay_top_v;
}
public:
- explicit View_stack(Canvas *canvas, View *bg)
+ explicit View_stack(Canvas *canvas, L4Re::Video::View *canvas_view, View *bg)
: _canvas(canvas), _no_stay_top(&_no_stay_top_v), _top(bg),
- _background(bg), _focused(bg)
+ _background(bg), _focused(bg), _canvas_view(canvas_view)
{
bg->_pn = &_top;
insert_before(_no_stay_top, _top);
namespace {
using Mag_server::Input_driver;
+using Mag_server::Input_source;
+using Mag_server::Core_api;
using Mag_server::User_state;
using Mag_server::Motion_fwd;
{ u->handle_event(e); }
};
-class Input_driver_libinput : public Input_driver
+class Input_driver_libinput : public Input_driver, public Input_source
{
public:
Input_driver_libinput() : Input_driver("libinput") {}
- int probe()
+ void start(Core_api *core)
{
if (l4input_init(0xff, 0) == 0)
- return 0;
-
- return 1;
+ {
+ _core = core;
+ core->add_input_source(this);
+ }
}
void poll_events()
{ u->handle_event(e); }
};
-class Input_driver_lxproxy : public Input_driver
+class Input_driver_lxproxy : public Input_driver, public Input_source
{
private:
Auto_cap<L4Re::Dataspace>::Cap _ev_ds;
public:
Input_driver_lxproxy() : Input_driver("L4Linux Proxy") {}
- int probe()
+ void start(Core_api *core)
{
try
{
_ev_ds.get(), 0, L4_PAGESHIFT));
_ev = L4Re::Event_buffer(_ev_ds_m.get(), _ev_ds->size());
+ _core = core;
+ core->add_input_source(this);
printf("LXDD: buffer @%p\n", _ev_ds_m.get());
- return 0;
}
catch (...)
{
printf("could not find linux proxy input\n");
}
- return 1;
}
void poll_events()
static void
poll_input(Core_api *core)
{
- for (Input_driver *i = core->input_drivers(); i; i = i->next_active())
+ for (Input_source *i = core->input_sources(); i; i = i->next())
i->poll_events();
}
View *cursor = f->create_cursor(big_mouse);
Background bg(screen->size());
- static User_state user_state(screen, cursor, &bg);
- static Core_api core_api(®istry, &user_state, rcv_cap);
+ L4Re::Video::View *screen_view = 0;
+
+ {
+ L4Re::Video::Goos::Info i;
+ goos_fb.goos()->info(&i);
+ if (!i.auto_refresh())
+ screen_view = goos_fb.view();
+ }
+
+ static User_state user_state(screen, screen_view, cursor, &bg);
+ static Core_api core_api(®istry, &user_state, rcv_cap, fb);
Plugin_manager::start_plugins(&core_api);
{
return run(argc, argv);
}
+ catch (L4::Runtime_error const &e)
+ {
+ L4::cerr << "Error: " << e << '\n';
+ }
catch (L4::Base_exception const &e)
{
L4::cerr << "Error: " << e << '\n';
- return -1;
}
catch (std::exception const &e)
{
L4::cerr << "Error: " << e.what() << '\n';
}
- return 0;
+ return -1;
}
draw_recursive(n, dst, border.b);
}
-void flush();
-
-
void
View_stack::refresh_view(View const *v, View const *dst, Rect const &rect) const
{
View_stack::flush()
{
for (Redraw_queue::iterator i = rdq.begin(); i != rdq.end(); ++i)
- draw_recursive(top(), 0, *i);
+ {
+ draw_recursive(top(), 0, *i);
+ if (_canvas_view)
+ _canvas_view->refresh(i->x1(), i->y1(), i->w(), i->h());
+ }
rdq.clear();
}