Skip to content

Commit 08e0b28

Browse files
committed
no commit message given
1 parent 9c3f782 commit 08e0b28

File tree

4 files changed

+98
-10
lines changed

4 files changed

+98
-10
lines changed

README.md

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,23 @@
1+
## kcpp
2+
3+
version: 0.0.1
4+
5+
description: C++ framework for the linux kernel
6+
7+
website: https://veltzer.github.io/kcpp
8+
9+
## build
10+
11+
![build](https://github.com/veltzer/kcpp/workflows/build/badge.svg)
12+
13+
14+
## contact
15+
16+
chat with me at [![gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/veltzer/mark.veltzer)
17+
118
POC for writing C++ modules for the Linux kernel
219
================================================
320

4-
The problem:
5-
------------
621
C++ has lots of issues which are not dealt with in the kernel.
722
* Problems in linking.
823
* Exception handling that needs to be turned off.
@@ -11,8 +26,6 @@ C++ has lots of issues which are not dealt with in the kernel.
1126
since they conflict with many C++ constructs ('class' for instance and more).
1227
* The kernel build system does not compile C++ correctly, or even at all.
1328

14-
The idea:
15-
---------
1629
* separate the "top part" - the one that is getting called by Linux, like driver
1730
entry and exit points, interrupt functions, tasklets, whatever and handle them in a C layer.
1831
expose APIs for all of these facilities and other low level facilities (printk, hardware access
@@ -22,8 +35,6 @@ not include the kernel headers and are C++ friendly. In the top part write a fra
2235
device driver writing based on OO concepts (inherit from Device and implement the relevant
2336
methods).
2437

25-
Future ideas:
26-
-------------
2738
* Add ability to include header files directly in C++ code.
2839
Progress: have 'copy_headers' target in makefile
2940
which also applies patch but headers are still hard to
@@ -32,12 +43,10 @@ This is to be developed as a patch to the linux kernel (big project - watch out!
3243
may never happen...)
3344
* add a framework for writing char drivers
3445

35-
Related projects:
36-
-----------------
3746
* http://code.google.com/p/kernelcpp/
3847
They do not have a buffer layer but instead do "extern C" before kernel headers.
3948
Try to see if this works for a big example.
4049
They have all kinds of other ideas about constructors for global object and so on.
4150
* http://www.drdobbs.com/cpp/c-exceptions-the-linux-kernel/229100146
42-
43-
Mark Veltzer <[email protected]>, 2011-2020
51+
52+
Mark Veltzer, Copyright © 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023

config/version.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
""" version of this software """
2+
tup = (0, 0, 1)

snipplets/main.md.mako

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
POC for writing C++ modules for the Linux kernel
2+
================================================
3+
4+
## The problem:
5+
C++ has lots of issues which are not dealt with in the kernel.
6+
* Problems in linking.
7+
* Exception handling that needs to be turned off.
8+
* Memory management functions (like new and delete) which need to be implemented.
9+
* The kernel headers are not suitable for inclusion for a C++ compiler
10+
since they conflict with many C++ constructs ('class' for instance and more).
11+
* The kernel build system does not compile C++ correctly, or even at all.
12+
13+
## The idea:
14+
* separate the "top part" - the one that is getting called by Linux, like driver
15+
entry and exit points, interrupt functions, tasklets, whatever and handle them in a C layer.
16+
expose APIs for all of these facilities and other low level facilities (printk, hardware access
17+
and more) via C functions.
18+
* write a top part that only accesses these services by well controlled C functions which do
19+
not include the kernel headers and are C++ friendly. In the top part write a framework for
20+
device driver writing based on OO concepts (inherit from Device and implement the relevant
21+
methods).
22+
23+
## Future ideas:
24+
* Add ability to include header files directly in C++ code.
25+
Progress: have 'copy_headers' target in makefile
26+
which also applies patch but headers are still hard to
27+
work with...
28+
This is to be developed as a patch to the linux kernel (big project - watch out!
29+
may never happen...)
30+
* add a framework for writing char drivers
31+
32+
## Related projects:
33+
* http://code.google.com/p/kernelcpp/
34+
They do not have a buffer layer but instead do "extern C" before kernel headers.
35+
Try to see if this works for a big example.
36+
They have all kinds of other ideas about constructors for global object and so on.
37+
* http://www.drdobbs.com/cpp/c-exceptions-the-linux-kernel/229100146

templates/README.md.mako

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<%!
2+
import pydmt.helpers.project
3+
import pydmt.helpers.misc
4+
import pydmt.helpers.signature
5+
import pydmt.helpers.urls
6+
import config.project
7+
import config.personal
8+
import os.path
9+
import glob
10+
import yaml
11+
%>## ${pydmt.helpers.project.get_name()}
12+
13+
version: ${pydmt.helpers.misc.get_version_str()}
14+
15+
description: ${config.project.description_short}
16+
17+
website: ${pydmt.helpers.urls.get_website()}
18+
19+
${"##"} build
20+
21+
<%
22+
action_files = glob.glob(".github/workflows/*.yml")
23+
for action_file in action_files:
24+
with open(action_file, "r") as stream:
25+
action_name=yaml.safe_load(stream)["name"]
26+
context.write(f"![{action_name}](https://github.com/{config.personal.github_username}/{pydmt.helpers.project.get_name()}/workflows/{action_name}/badge.svg)")
27+
%>
28+
29+
% if hasattr(config.project, "description_long"):
30+
${config.project.description_long}
31+
% endif
32+
33+
${"##"} contact
34+
35+
chat with me at [![gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/veltzer/mark.veltzer)
36+
37+
% if os.path.isfile("snipplets/main.md.mako"):
38+
<%include file="../snipplets/main.md.mako" />
39+
% endif
40+
${config.personal.fullname}, Copyright © ${pydmt.helpers.signature.get_copyright_years_long()}

0 commit comments

Comments
 (0)