Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Extending asm

Name: Anonymous 2009-03-16 20:52

So, I'm currently writing a kernel in x86_64 assembly, following in the footsteps of Henry Massalin as I once so neatly put it. I'm just about to start on the queue quaject (multithreading, paging, usermode, etc. is done), but it strikes me that the fasm macro-language is too restricted, and doesn't easily allow for certain advanced code-size reducing and code-speed enhancing features. So I'm considering making my own macro-language for it, and I think this would greatly enhance the maintainability, modularity and awesomeness of the OS. Macros would be written in the source-files in a Literate Haskell-ish fashion.

The most obvious to me would be relocating each modules' initialization code to right after the CPU-initialization, allowing that space to be reused as data-area when stuff is up and running. I would also consider having automated register renaming ('1' => 'd' makes r1 map to rdx, r1d edx, r1w dx, etc), but automated register allocation would be pushing it.

Also, as the preprocessor would know a lot more about the procedures and their register consumption, the task of saving and restoring the registers could be automated for syscall routines, as it becomes some kind of reflection. If I'm really good it could even become type-safe.

Does this sound like a good idea? The reason for not just writing it in some other language is that I'm wholeheartedly convinced that I can make a faster and better system than any compiler. Also, which language would be best to implement this in? Right now I'm leaning towards python.

Name: Anonymous 2009-03-16 21:00

Sounds like a stupid idea.

Name: Anonymous 2009-03-16 21:09

Can't you just use a Python compuler?

Name: Anonymous 2009-03-16 21:15

>>2
Explain why, please.
>>3
Python compiler? Googling python+compiler+x86_64 yields no relevant results.

Name: Anonymous 2009-03-16 22:13

Will your macros need a full blown parser or can you get by with regex?

Name: Anonymous 2009-03-16 22:37

>>5
I was thinking a special syntax, like every line starting with a : specifies a call to a python «macro» that does whatever it's supposed to do on the following code-block (delimited by FIOC). All the definitions are extracted beforehand by the would-be python-preprocessor and loaded before it goes through the transformation phase.

The python-macros would be written on lines starting with >, and maybe take a string or a tokenized stream as an argument, along with any arguments to the macro, that it then returns when done operating on it.

As pure ASM is shit-easy to tokenize this shouldn't be be complicated at all, and if it does get hard I'm armed with my dragon book (that I haven't read yet, so excuse me if that is the wrong usage of the word tokenize).

Name: Anonymous 2009-03-16 22:59

In addition to Python, I strongly suggest using:

http://www.corepy.org/

Name: Anonymous 2009-03-16 23:38

Didn't Henry get a sex change?

So you're going to get a sex change?

Name: Anonymous 2009-03-17 1:37

The reason for not just writing it in some other language is that I'm wholeheartedly convinced that I can make a faster and better system than any compiler
Lol wut? Compilers do not make systems. Language compilers are a system of computer programs that translates human readable computer code into machine executable code.

Name: Anonymous 2009-03-17 1:42

Write it in C like most people who code kernels for OSes. If that is not to your liking, code it in a language you find more suitable and code your own compiler for it, you can add as many code optimizations as you'd like, it will also be more portable, and better usage of your time. Code hardware specific parts ( I don't mean drivers or such, but actual input/output instructions and instructions for manipulating descriptor tables, paging, exception handling ) and parts which need really high speed in asm, you usually don't have too many of these and they can be isolated and linked in easily.

Name: Anonymous 2009-03-17 3:19

>>11
back to /pr/ please

also [b]BBCODE FAILURE[b]

Name: Anonymous 2009-03-17 4:19

>>7
Doesn't do what I need.
>>8
Some day.
>>9
s/system/code/, I guess.
>>10
No, at least not yet. The point of the project is to find better ways to do stuff, and then perhaps later make a language capable of using them. Making something in a boring and done-to-death way is too pointless when combined with making something nobody's going to use beyond booting it up in a virtual machine and thinking “that's neat”.

Name: Anonymous 2009-03-17 4:32

JavaScript

Name: Anonymous 2009-03-17 4:37

... sucks.

Name: Anonymous 2009-03-17 8:31

Ruby

Name: Anonymous 2009-03-17 9:02

>>15
This is a Good Idea

Name: Anonymous 2009-03-17 22:09

Shameless bump.

Name: Anonymous 2009-03-17 22:13

This is the shittiest idea ever.  Don't reinvent the wheel, learn to use it.

Name: Anonymous 2009-03-17 22:21

>>18
Don't reinvent the wheel
I'm making a kernel, too late for that.

The point is to try to make something better. What better macro-language than a programming language?

Name: Anonymous 2009-03-18 0:48

Will ANONIX finally get a kernel?

Name: Anonymous 2009-03-18 0:58

>>19
Either Bit-C or the Limbo language

Name: Anonymous 2010-11-15 11:22

Name: Anonymous 2010-11-27 17:43

Name: Anonymous 2014-01-21 21:14

>>23
>le pedophile sage

Name: Anonymous 2014-01-22 2:29

Write a small bytecode interpreter that can fit in L1 cache in assembly, then write the rest of your OS in the bytecode.

Name: Anonymous 2014-01-27 6:14

How about M4?

>>25
is this even possible?

Name: Anonymous 2014-01-27 12:37

>>26
is this even possible?
Of course. Jonesforth kernel is less than 4k when compiled for x86 and he never tried to optimize it for size. Itsy Forth claims to be 1k.

The really interesting question is, can you write an interpreter kernel that fits into one cacheline?

Name: Anonymous 2014-01-27 14:11

>>27
Optimize your quotes, nigger.

Name: Anonymous 2014-01-27 15:00

>>28
quotes
Shalom!

Name: Anonymous 2014-01-27 15:42

>>29
Go suck Cudder's dick.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List