KestrelComputer / kestrel

The Kestrel is a family of home-made computers, built as much as possible on open-source technology, and supporting as much as possible the open-source philosophy.
http://kestrelcomputer.github.io/kestrel
Mozilla Public License 2.0
185 stars 10 forks source link

Problem: STS needs to provide a jump table to applications which is easily discovered. #162

Closed sam-falvo closed 8 years ago

sam-falvo commented 8 years ago

For ROM-resident programs, I can get away with this kind of really hacky solution, only because the assembler knows where everything is:

            ; call TYPE
    gp0:    auipc   gp, 0
            ld      x16, addr_type-gp0(gp)
            jalr    ra, 0(x16)

            ; ...
    addr_type:
            dword   rombase + type

This works, of course, but is inelegant. It'd be better to use a jump table instead:

            ; call TYPE
            ld      x16, kernel_epv(gvp)
            jalr    ra, EPV_TYPE(x16)

Where EPV_xxx would be in increments of four, since X16 would point to an array of JAL X0, xxx instructions.

sam-falvo commented 8 years ago

Even better still would be if we could express the interface to the kernel as a (set of) COM object(s). But, I think I'll wait for STS V2.0 for that.

sam-falvo commented 8 years ago

Relying on ECALL is perhaps an option here as well. But, this gets somewhat complicated, for now we need to deal with CPU state (saving and restoring CPU registers, etc.).