l4re-base-25.08.0

This commit is contained in:
2025-09-12 15:55:45 +02:00
commit d959eaab98
37938 changed files with 9382688 additions and 0 deletions

View File

@@ -0,0 +1,2 @@
requires: stdlibs
Maintainer: adam@os.inf.tu-dresden.de

View File

@@ -0,0 +1,7 @@
PKGDIR ?= .
L4DIR ?= $(PKGDIR)/../../..
TARGET = src configs
include $(L4DIR)/mk/subdir.mk

View File

@@ -0,0 +1,9 @@
PKGDIR ?= ../..
L4DIR ?= $(PKGDIR)/../..
PKGNAME = ex_clntsrv
SRC_ASSETS_NED = clntsrv.cfg
SRC_ASSETS_MODLIST = modules.list
include $(L4DIR)/mk/assets.mk

View File

@@ -0,0 +1,21 @@
-- vim:set ft=lua:
-- Include L4 functionality
local L4 = require("L4");
-- Some shortcut for less typing
local ld = L4.default_loader;
-- Channel for the two programs to talk to each other.
local calc_server = ld:new_channel();
-- The server program, getting the channel in server mode.
ld:start({ caps = { calc_server = calc_server:svr() },
log = { "server", "blue" } },
"rom/ex_clntsrv-server");
-- The client program, getting the 'calc_server' channel to be able to talk
-- to the server. The client will be started with a green log output.
ld:start({ caps = { calc_server = calc_server },
log = { "client", "green" } },
"rom/ex_clntsrv-client");

View File

@@ -0,0 +1,8 @@
entry ex_clntsrv
roottask moe rom/clntsrv.cfg
module l4re
module ned
module ex_clntsrv-server
module ex_clntsrv-client
module ned/ex_clntsrv/clntsrv.cfg

View File

@@ -0,0 +1,9 @@
PKGDIR ?= ..
L4DIR ?= $(PKGDIR)/../../..
TARGET = ex_clntsrv-server ex_clntsrv-client
SRC_CC_ex_clntsrv-server = server.cc
SRC_CC_ex_clntsrv-client = client.cc
include $(L4DIR)/mk/prog.mk

View File

@@ -0,0 +1,48 @@
/*
* (c) 2008-2009 Adam Lackorzynski <adam@os.inf.tu-dresden.de>,
* Alexander Warg <warg@os.inf.tu-dresden.de>
* economic rights: Technische Universität Dresden (Germany)
*
* This file is part of TUD:OS and distributed under the terms of the
* GNU General Public License 2.
* Please see the COPYING-GPL-2 file for details.
*/
#include <l4/sys/err.h>
#include <l4/sys/types.h>
#include <l4/re/env>
#include <l4/re/util/cap_alloc>
#include <stdio.h>
#include "shared.h"
int
main()
{
L4::Cap<Calc> server = L4Re::Env::env()->get_cap<Calc>("calc_server");
if (!server.is_valid())
{
printf("Could not get server capability!\n");
return 1;
}
l4_uint32_t val1 = 8;
l4_uint32_t val2 = 5;
printf("Asking for %d - %d\n", val1, val2);
if (server->sub(val1, val2, &val1))
{
printf("Error talking to server\n");
return 1;
}
printf("Result of subtract call: %d\n", val1);
printf("Asking for -%d\n", val1);
if (server->neg(val1, &val1))
{
printf("Error talking to server\n");
return 1;
}
printf("Result of negate call: %d\n", val1);
return 0;
}

View File

@@ -0,0 +1,57 @@
/*
* (c) 2008-2009 Adam Lackorzynski <adam@os.inf.tu-dresden.de>,
* Alexander Warg <warg@os.inf.tu-dresden.de>
* economic rights: Technische Universität Dresden (Germany)
*
* This file is part of TUD:OS and distributed under the terms of the
* GNU General Public License 2.
* Please see the COPYING-GPL-2 file for details.
*/
#include <stdio.h>
#include <l4/re/env>
#include <l4/re/util/cap_alloc>
#include <l4/re/util/object_registry>
#include <l4/re/util/br_manager>
#include <l4/sys/cxx/ipc_epiface>
#include "shared.h"
static L4Re::Util::Registry_server<> server;
class Calculation_server : public L4::Epiface_t<Calculation_server, Calc>
{
public:
int op_sub(Calc::Rights, l4_uint32_t a, l4_uint32_t b, l4_uint32_t &res)
{
res = a - b;
return 0;
}
int op_neg(Calc::Rights, l4_uint32_t a, l4_uint32_t &res)
{
res = -a;
return 0;
}
};
int
main()
{
static Calculation_server calc;
// Register calculation server
if (!server.registry()->register_obj(&calc, "calc_server").is_valid())
{
printf("Could not register my service, is there a 'calc_server' in the caps table?\n");
return 1;
}
printf("Welcome to the calculation server!\n"
"I can do subtractions and negations.\n");
// Wait for client requests
server.loop();
return 0;
}

View File

@@ -0,0 +1,20 @@
/*
* (c) 2008-2009 Adam Lackorzynski <adam@os.inf.tu-dresden.de>
* economic rights: Technische Universität Dresden (Germany)
*
* This file is part of TUD:OS and distributed under the terms of the
* GNU General Public License 2.
* Please see the COPYING-GPL-2 file for details.
*/
#pragma once
#include <l4/sys/capability>
#include <l4/sys/cxx/ipc_iface>
struct Calc : L4::Kobject_t<Calc, L4::Kobject, 0x44>
{
L4_INLINE_RPC(int, sub, (l4_uint32_t a, l4_uint32_t b, l4_uint32_t *res));
L4_INLINE_RPC(int, neg, (l4_uint32_t a, l4_uint32_t *res));
typedef L4::Typeid::Rpcs<sub_t, neg_t> Rpcs;
};