[Dropped [email protected] from Cc:]

Hi Srayan,

On Sun, Oct 12 2025, Srayan Jana wrote:

> A couple of other languages [...] have a "dialect" embedded within
> their language for "unsafe" operations.

> It would be nice to have similar functionality in Guile so you could
> do a lot more low level stuff.  It would be fun to be able to use as
> little C as possible while still creating stuff that's super close to
> the metal!

I get closer to the metal with an inline assembler I wrote for GNU
Guile. [1] I use it in a syscall library for Linux. [2]

I publish opcodes for four common processors [3] and am working on
another four: the three missing Debian ports [4] and loong64.

It's all alpha stuff, so there are no API guarantees.  Plus, with
executable bytevectors [5] it's about as unsafe as it gets!

You are probably looking for something else, but who knows?

Kind regards
Felix

P.S. I would keep memory management in Guile.  Itt does a great job!

[1] https://codeberg.org/lechner/guile-assembler
[2] https://codeberg.org/lechner/guile-syscall
[3] https://codeberg.org/lechner/guile-instructions
[4] https://www.debian.org/ports/
[5] 
https://codeberg.org/lechner/guile-syscall/src/commit/52106870056f419e0da6ab603138cab12e3b99ad/scm/syscall/linux.scm#L93-L99

* * *

(define (make-basic-syscall-6-bv-for-x86-64 start-address)
  (receive (machine-code address-labels)
      (assemble start-address
                (label 'basic_syscall_6_to_scm:
                       (x86:mov #:pointer 'rsp
                                #:offset 8
                                #:to 'rax)

                       (x86:mov #:from 'rcx
                                #:to 'r10)

                       (x86:syscall)

                       (x86:ret)))

    (values machine-code uint64)))

Reply via email to