Bare C++ library

327 views
Skip to first unread message

Sergei Lodyagin

unread,
Nov 17, 2013, 3:17:44 PM11/17/13
to bareme...@googlegroups.com
Hi.

I just pushed to github my C++ library designed expecially for Bare
Metal OS.
https://github.com/lodyagin/bare_cxx

It has hellocpp.cpp application and installation instruction to try.

The main goal of writing this library is providing an alternative to
hardware memory protection used in classical OSes on a library level
with a help of carefully designed classes. It should wok in the ring 0
level without problems.

I will appreciate your questions.

--
Sergei


Ian Seyler

unread,
Nov 19, 2013, 9:56:26 AM11/19/13
to bareme...@googlegroups.com
This is pretty amazing work! Are there any issues with the app running in BareMetal?

-Ian

Sergei Lodyagin

unread,
Nov 21, 2013, 12:50:28 PM11/21/13
to bareme...@googlegroups.com
Hi.

On 11/19/2013 04:56 PM, Ian Seyler wrote:
> This is pretty amazing work! Are there any issues with the app running
> in BareMetal?
>
> -Ian
>

Nothing in the small hellocpp demo.
But I found that the word with address 0 can be overwriten without any
trap.

xor rax, rax
mov [rax], rbx


It is inappropriate both for C and C++ because dereferencing of NULL
pointer
is a very frequent error. Usually the first few hundred of bytes should
be protected
(because we need also catch the case when we write to a member of a
struct referenced
by a null pointer).

I have less experience with OSDev, but I think it should be possible set
"read only" state for the first page even in the ring 0 (and also we
have -1 and -2 rings on Intel). If it is not possible we should use some
trap/debug registers.

(I just have no much time dig in CPU doc now).

--
Sergei

alexandru...@gmail.com

unread,
Dec 6, 2014, 3:42:24 AM12/6/14
to bareme...@googlegroups.com
Hi Sergei,

i followed the steps to compile c++ lib and i got the following error during compilation

In file included from /home/solaris/BM/BareMetal/bare_cxx/lib/../include/new:19:0,
                 from /home/solaris/BM/BareMetal/bare_cxx/lib/iostream.cpp:15:
/home/solaris/BM/BareMetal/bare_cxx/lib/../include/exception:18:26: fatal error: types/string.h: No such file or directory
 #include <types/string.h>
                          ^
compilation terminated.
lib/CMakeFiles/bare_c++lib.dir/build.make:92: recipe for target 'lib/CMakeFiles/bare_c++lib.dir/iostream.cpp.o' failed
make[2]: *** [lib/CMakeFiles/bare_c++lib.dir/iostream.cpp.o] Error 1
CMakeFiles/Makefile2:110: recipe for target 'lib/CMakeFiles/bare_c++lib.dir/all' failed
make[1]: *** [lib/CMakeFiles/bare_c++lib.dir/all] Error 2
Makefile:76: recipe for target 'all' failed
make: *** [all] Error 2


However i look into git clone and i think there are some missing files.. could it be a broken link in Git ?

linux-n6ee:/home/solaris/BM/BareMetal/bare_cxx/include # ls
algorithm  bits     config.bare  cstdexcept  cwchar     fstream           iostream  locale  ostream    typeinfo     utility
array      bitset   csetjmp      cstdint     dynarray   initializer_list  iterator  memory  streambuf  types
bare       cassert  cstddef      cstdlib     exception  ios               limits    new     string     type_traits
linux-n6ee:/home/solaris/BM/BareMetal/bare_cxx/include # cd types
linux-n6ee:/home/solaris/BM/BareMetal/bare_cxx/include/types # ls
linux-n6ee:/home/solaris/BM/BareMetal/bare_cxx/include/types # 

Can you help me fix this issue ?

Thanks,
Alex.
Reply all
Reply to author
Forward
0 new messages