chikuwait / bitvisor_mruby Goto Github PK
View Code? Open in Web Editor NEWmruby running inside the bare-metal hypervisor
License: Other
mruby running inside the bare-metal hypervisor
License: Other
Currently, mruby's build and script compilation must be done manually. This is very inefficient, so I need to integrate it.
If I execute floating point arithmetic like 1.0 + 1.0, the script operation ends there. So, I need to review for process of floating number arithmetic.
The pow function existing in math.h in libC is 2.0 when passed as 4.0 and 0.5 as arguments. However, in my implementation there is a problem that the values do not match because the value of the second argument is cast to an integer type.
I want to check whether each pull request or repository go through the build by performing continuous integration.
mruby-1.2(最新安定版)で試した範囲なんですが
ことを考慮して、mruby自体には極力変更を加えず、BitVisorの標準ライブラリを充実させてく方向で諸々やってみました。
結果としては
strtod
などの関数)といった風です。
x86_64のABIの都合で浮動小数点数を取り扱うのがつらいので32bitでコンパイルしています。
なので、BitVisorも32bitでビルドしないといけないかと思います。
浮動小数点数を必要としないmrubyのオプションなどを模索中なので@miura1729さんとわたしの会話を追っていただければと...。
組み込み向けを名乗るなら、整数演算だけでもなんとかできないとまずいので...。(こんな反応もありましたし)
一応、64bitでどうなるのか知りたいのでしたら下のbuild_config.rb
の64
のコメントアウトを外してみてください...。
bitvisorの標準ライブラリ関連はこんな風です:
https://gist.github.com/take-cheeze/62f9984354aa78fc5704c702b6d989d2
(足りないのを補ったり、例のパッチを統合した感じです)
build_config.rb
は環境変数MRUBY_CONFIG
で上書きできるので割と自由にやってます。
MRuby::Build.new do |conf|
# load specific toolchain settings
# Gets set by the VS command prompts.
if ENV['VisualStudioVersion'] || ENV['VSINSTALLDIR']
toolchain :visualcpp
else
toolchain :gcc
end
enable_debug
end
MRuby::CrossBuild.new('bitvisor') do |conf|
toolchain :gcc
cc.command = linker.command = 'x86_64-elf-gcc' # 'clang -target x86_64-elf'
cc.include_paths << '../include'
bits = 32 # 64
backtrace = true
cc.flags <<
"-m#{bits} -mno-red-zone -nostdinc -g -O" <<
" -ffreestanding -fno-builtin -fno-stack-protector" <<
" -fno-strict-aliasing -Wall"
cc.flags << (backtrace ? '-fno-omit-frame-pointer' : '-fomit-frame-pointer')
# FPU settings
cc.flags << '-mno-sse -mno-sse2 -mfpmath=387 -msoft-float -mno-mmx -mno-3dnow'
conf.cc.defines << %w(MRB_DISABLE_STDIO BITVISOR_KERNEL)
# conf.cc.defines << %w(MRB_INT64)
conf.bins = []
# gembox 'full-core'
end
mrubyの変更自体は1行で(abort
は<stdlib.h>なのでこれはmrubyにパッチ送れますね):
1 file changed, 1 insertion(+)
src/vm.c | 1 +
modified src/vm.c
@@ -6,6 +6,7 @@
#include <stddef.h>
#include <stdarg.h>
+#include <stdlib.h>
#include <math.h>
#include "mruby.h"
#include "mruby/array.h"
本当は本家に言ったほうがいい気はするんですが、
99eb76c みたいなコミットが起きないように、.gitignoreファイルを定義してあげた方がいいかなーと。
最低でも:
*.o
*.s
*.d
.depends
.flags
/.config
ですかねー。あと細々と生成されるファイルもちゃんと入れてあげた方がいいかと。
In the current implementation, mruby script is running on thread. So, if there are some problems with the mruby scripts, the OS and BitVisor will crash. In order to solve this problem, I think that mruby should be done as a process of VM/Ring3.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.