mmastrac / bootstrap Goto Github PK
View Code? Open in Web Editor NEWBootstrapping VM for bare metal to trusted C compilation
License: GNU General Public License v3.0
Bootstrapping VM for bare metal to trusted C compilation
License: GNU General Public License v3.0
bootstrap2
assumes that all labels in bootstrap3
are 8 characters long. This makes for a lot of unnecessary underscores in bootstrap3
.
This is probably not a complex bit of work, but #2 might make this easier.
bootstrap2
hardcodes a whole bunch of addresses, and uses a bunch of registers for others. Most (if not all) of these address could be pushed into the jump table at the start of the program (or alternatively, create an aux address table) to make this program easier to modify.
As return values and arguments share the same register (r0), attempting to make a call to another function where the return value is in another position other than the first one causes that argument to get corrupted.
For example:
%call function @foo, @ret
will first clobber @ret
(aka r0
) with @foo
, then attempt to put the clobbered value of r0
into r1
.
Instead, %call
should push the arguments to the stack and then pop them into registers. This is far less efficient, but we're not worried about efficiency in this stage.
This could potentially simplify some argument handling in bootstrap4
/compiler0
as well.
Having a tail call macro in bootstrap3
would simplify a lot of code. This code would need to adjust the stack pointer like %ret
does before making the call to the procedure.
bootstrap3
currently uses an ad-hoc calling convention. After #1 is implemented we could create macros for a function prefix/suffix that would allow us to automatically save and restore a set of registers to the stack on function entry/exit.
There is currently a calling convention in bootstrap4
but that might be too much and too complex for this particular stage. It might be best to just always assume that there are 8 parameters to every function and create the prefix and suffix with that assumption.
This is a pretty big chunk of work as it requires refactoring almost every function in this file.
These macros could be hoisted out of bootstrap2
and defined ad-hoc by bootstrap3
. This is a good first issue to work on.
when I run it I get this
$ sh ./bootstrap/make.sh
open: No such file or directory
Invalid opcode
I tried changing this line
// int r = open((const char*)&program[arg1], arg2, 0777);
int r = open((const char*)&program[arg1], arg2|O_RDWR|O_CREAT, 0777);
and this happens
$ sh ./bootstrap/make.sh
Invalid opcode
Invalid opcode
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.