Git Product home page Git Product logo

ducky-legacy's People

Contributors

happz avatar quantifiedcode-bot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

pombredanne

ducky-legacy's Issues

FORTH's ACCEPT in testsuite cannot work

When running testsuite, the only input channel FORTH has is the keyboard stream, and this is used for testsuite itself. There's no other way ACCEPT could use to read user's input. Possible solution would be teaching encoding the testsuite as a blob, and kernel would read it directly from memory then, leaving keyboard for ACCEPT.

Memory software interrupt

Allow binaries in privileged mode to modify some memory settings - access attributes of pages/areas/sections, allocation/deallocation of memory pages (heap support), and maybe few others.

Main motivation is to support self-modifying code. One particular use case is my FORTH kernel, in which I'd like to compute checksums of words' names during the boot phase but these words are stored in .text and .rodata sections that are by default read-only, for a good reason.

Implement cache manager

Mostly to provide way to keep all caches (per-core instruction and data caches) coherent, when memory is accessed by many different actors - cores, blockio, and other devices with DMA capability.

Use mmap feature for loading binaries into memory, instead of copying its content

Right now each byte of each section is copied into memory. Using internal mmap feature would be much more efficient, especially for larger binaries and in case of more CPUs/cores.

One issue might arise in case of short binaries - internal mmap needs everything to be PAGE_SIZE-aligned, small binaries have sections of dozens of bytes - all sections, including RO data and data - would be mmap'ed into text section... Will it cause any issues? I don't know yet...

BlockIO should access files in non-blocking mode

Currently all files are open for blocking IO, this - in case of large blocks or files stored on network filesystems - may lead to large time periods spent waiting for IO to finish, and starving other runnable resources (e.g other cores).

Network interface

Provide another kind of device - network card. The easiest way is would be to create new virtual interrupt to access to a full network stack, emulated by machine with standard sockets.

"[ERRR] conio.__read_char: error=[Errno 5] Input/output error" sometimes appears during halt phase of VM

#> [INFO] Loading IRQ routines from file interrupts.bin
[INFO] Section    Address      Size  Flags                                 First page    Last page
[INFO] ---------  ---------  ------  ----------------------------------  ------------  -----------
[INFO] .data      0x010000        2  <SectionFlags: r=1, w=1, x=0, b=0>           256          256
[INFO] .text      0x010100       64  <SectionFlags: r=1, w=1, x=1, b=0>           257          257
[INFO] stack      0x010200      256  <SectionFlags: r=1, w=1, x=0, b=0>           258          258
[INFO] 
[INFO] Loading binary from file examples/hello-world.bin
[INFO] Section    Address      Size  Flags                                 First page    Last page
[INFO] ---------  ---------  ------  ----------------------------------  ------------  -----------
[INFO] .data      0x020000       14  <SectionFlags: r=1, w=1, x=0, b=0>           512          512
[INFO] .text      0x020100       96  <SectionFlags: r=1, w=1, x=1, b=0>           513          513
[INFO] stack      0x020200      256  <SectionFlags: r=1, w=1, x=0, b=0>           514          514
[INFO] 
[INFO] #0: Booting...
[INFO] #0:#0:  Booted
[INFO] #0: Booted
[INFO] Guest terminal available at /dev/pts/10
Hello, world!
[INFO] #0:#0:  Halted
[ERRR] conio.__read_char: error=[Errno 5] Input/output error
[INFO] VM snapshot save in ducky-snapshot.bin
[INFO] Exit codes
[INFO] Core      Exit code
[INFO] ------  -----------
[INFO] #0:#0             0
[INFO] 
[INFO] Instruction caches
[INFO] Core      Reads    Inserts    Hits    Misses    Prunes
[INFO] ------  -------  ---------  ------  --------  --------
[INFO] #0:#0       117         26      91        26         0
[INFO] 
[INFO] Data caches
[INFO] Core      Reads    Inserts    Hits    Misses    Prunes
[INFO] ------  -------  ---------  ------  --------  --------
[INFO] #0:#0       161        193     161         0         0
[INFO] 

Some race condition maybe? Machine console has its own thread for checking input, there is potential for races.

Store all symbols in binary

Only strings are stored now. Extend binary sections to support storage of symbols like functions, to support relocation and debugging.

Honor "x" bit setting of memory pages

Ignored right now. Will require proper flagging of sections in binary file, and additional parameter of read_u32, to inform memory controller that read value will be executed as instruction.

Remove optional '&' in label names

Currently both "foo" and "&foo" are supported, I think leaving ampersand to the history would have nice effect on code complexity - it's one more corner case I have to take care of...

Provide very basic library of common functions

Something similar to C library, accessible via interrupts. Provide common functions like "write string", "read string", "copy memory", etc.

Implemented in C, compiled by ducky's compiler and loaded into memory...

Boot configuration

Implement $SUBJ that would support:

  • fine-grained setting numbers of CPU and cores
  • allow defining which binaries (and routines) are bound to which core
  • mmaping of external files into memory - this would mean routines can save and load their state - in fact it's persistent storage, masked as memory...
  • configuration of IRQ, interrupts and their handlers and binding to CPUs/cores
  • connecting input/output files (or terminals) as IO ports

Fix cmd_snapshot to work even when any of cores is suspended

All cores are asked to suspend but when core is already suspended - e.g. because of triggered breakpoint - it can't even pick up this message, and whoa - deadlock. All live cores - with running thread - are considered recipients, this should change to ignore already suspended ones.

Fix docker image based on Python 3

Since I switched to using scons instead of make, Python 3 docker image cannot be built anymore. I overcame scons' limitations in CI runs, I believe I will work around its "Python 3 not supported" opinion in docker too.

Teach as more directives

... preferably these:

.comm
.data
.section
.text

Especially having more sections, defined by .section, would be beneficial - it would be possible to have more than one data data sections with different RW flags.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.