public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Rick Hohensee <humbubba@smarty.smart.net>
To: linux-kernel@vger.kernel.org
Subject: Re: inserting a Forth-like language into the Linux kernel
Date: Thu, 10 May 2001 02:12:34 -0400 (EDT)	[thread overview]
Message-ID: <200105100612.CAA16504@smarty.smart.net> (raw)

read() of a tty from the kernel does behave as per the tty settings.
I now have a kernel thread with stdin, out and err, FD's 0, 1 and 2,
open and reading lines of typed input. The "interpreter" adds 0x30 
(ASCII 0) to the return value from read and prints it, which means 
it occurs at the beginning of the next line. Here's what's sitting 
on my tty1 screen right now...
.................................................................
1
1
1
1aaoeutasoeu aoeu oaeusntaoesutoaeut oeuoaeuo uoaeuoaeu
heeee
6e
2
1
1
1
1eeeeee
7ee
3
1onetu euaoeuaoeuoa eu aoeu ao eu ao eu aoeu  aoeu ao eu aoe u aoe u
te e e e e
;e e e e
9e e e e
9e e e
7ee
3
...................................................................

This should simplify hanging an interpreter off this simple little top 
loop. That is, userland H3sm was using cooked mode, so this is nice. 
This is the top loop code, which is x86 assembly and H3sm 
subroutines...

.................................................................
abort_H3sm:
        call buffer

top_loop_of_H3sm:
                                # stick a sleep in here.
                                # Do not melt the CPU, do not slow down
                                #       the test cycle.
        call timespec
        call pdup
        call pplusc
        call pplusc
        call nanosleep
        call twopdrop
        call drop

        HANDOFF

        call zero               # FD
        call read
        call literal
        .byte 4
        .int  0x30
        call plus
        call emit
ELL(                                                    top_loop_of_H3sm)
...................................................................

emit is similar to Forth EMIT. It is a one-byte write().
buffer and timespec put addresses on
the H3sm pointer stack. nanosleep and read are H3sm stack-passing
wrappers for the syscalls. HANDOFF is a macro for a stack-push-wrapped
schedule(). It's a macro because I suspect I'm going to have to sprinkle
it judiciously around H3sm. The nanosleep keeps my load average normal.

Rick Hohensee
www.clienux.com

             reply	other threads:[~2001-05-10 13:02 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-05-10  6:12 Rick Hohensee [this message]
  -- strict thread matches above, loose matches on Subject: below --
2001-05-06 16:32 inserting a Forth-like language into the Linux kernel Dunlap, Randy
2001-05-06 20:33 ` Rick Hohensee
     [not found] <200105060652.f466qwH316756@saturn.cs.uml.edu>
2001-05-06 12:21 ` Rick Hohensee
2001-05-06  3:57 Rick Hohensee
2001-05-06 23:24 ` Jesse Pollard
2001-05-05  6:27 Rick Hohensee
2001-05-02  2:29 Rick Hohensee
2001-05-02  3:26 ` Alexander Viro
2001-05-02 15:44   ` Rick Hohensee

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200105100612.CAA16504@smarty.smart.net \
    --to=humbubba@smarty.smart.net \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox