Skip to content

Commit

Permalink
2024-05-22
Browse files Browse the repository at this point in the history
  • Loading branch information
yshurik committed May 22, 2024
1 parent 0d8c8c7 commit d5cb0b9
Show file tree
Hide file tree
Showing 24 changed files with 1,092 additions and 23 deletions.
8 changes: 4 additions & 4 deletions categories/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -154,28 +154,28 @@ <h1 class="list-title">Tags</h1>
<li class="post-tag">
<a href="/tags/blog/">
<div class="tag-name">blog</div>
<div class="tag-posts-count">14</div>
<div class="tag-posts-count">15</div>
</a>
</li>

<li class="post-tag">
<a href="/tags/inferno-os/">
<div class="tag-name">inferno-os</div>
<div class="tag-posts-count">14</div>
<div class="tag-posts-count">15</div>
</a>
</li>

<li class="post-tag">
<a href="/tags/raspberry-pi/">
<div class="tag-name">raspberry-pi</div>
<div class="tag-posts-count">14</div>
<div class="tag-posts-count">15</div>
</a>
</li>

<li class="post-tag">
<a href="/tags/research/">
<div class="tag-name">research</div>
<div class="tag-posts-count">14</div>
<div class="tag-posts-count">15</div>
</a>
</li>

Expand Down
7 changes: 7 additions & 0 deletions index.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,13 @@
<guid>https://lynxline.com/posts/first_post/</guid>
<description>init</description>
</item>
<item>
<title>Lab 15, Eve, Hello World from Limbo!</title>
<link>https://lynxline.com/posts/lab-15-eve-hello-world-from-limbo/</link>
<pubDate>Wed, 17 Apr 2013 10:18:04 +0200</pubDate>
<guid>https://lynxline.com/posts/lab-15-eve-hello-world-from-limbo/</guid>
<description>It is our 15-th Lab and it is the time came to make birth of the process Eve, run Dis virtual machine and our first Limbo program!&#xA;First create file archrpi.c where we all R-Pi platform specific code. We need to implement kprocchild() call:&#xA;1static void 2linkproc(void) 3{ 4&#x9;spllo(); 5&#x9;if (waserror()) 6&#x9;print(&amp;#34;error() underflow: %r\n&amp;#34;); 7&#x9;else (*up-&amp;gt;kpfun)(up-&amp;gt;arg); 8&#x9;pexit(&amp;#34;end proc&amp;#34;, 1); 9} 10 11void 12kprocchild(Proc *p, void (*func)(void*), void *arg) 13{ 14&#x9;p-&amp;gt;sched.</description>
</item>
<item>
<title>Lab 14, interrupts, part 3</title>
<link>https://lynxline.com/posts/lab-14-interrupts-part-3/</link>
Expand Down
10 changes: 10 additions & 0 deletions lab-15-eve-hello-world-from-limbo/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<!DOCTYPE html>
<html lang="en-us">
<head>
<title>https://lynxline.com/posts/lab-15-eve-hello-world-from-limbo/</title>
<link rel="canonical" href="https://lynxline.com/posts/lab-15-eve-hello-world-from-limbo/">
<meta name="robots" content="noindex">
<meta charset="utf-8">
<meta http-equiv="refresh" content="0; url=https://lynxline.com/posts/lab-15-eve-hello-world-from-limbo/">
</head>
</html>
5 changes: 5 additions & 0 deletions posts/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,11 @@ <h2 class="posts-year">2024</h2><article class="post-title">


<h2 class="posts-year">2013</h2><article class="post-title">
<a href="https://lynxline.com/posts/lab-15-eve-hello-world-from-limbo/" class="post-link">Lab 15, Eve, Hello World from Limbo!</a>
<div class="flex-break"></div>
<span class="post-date">April 17, 2013</span>
</article>
<article class="post-title">
<a href="https://lynxline.com/posts/lab-14-interrupts-part-3/" class="post-link">Lab 14, interrupts, part 3</a>
<div class="flex-break"></div>
<span class="post-date">April 16, 2013</span>
Expand Down
7 changes: 7 additions & 0 deletions posts/index.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@
<guid>https://lynxline.com/posts/first_post/</guid>
<description>init</description>
</item>
<item>
<title>Lab 15, Eve, Hello World from Limbo!</title>
<link>https://lynxline.com/posts/lab-15-eve-hello-world-from-limbo/</link>
<pubDate>Wed, 17 Apr 2013 10:18:04 +0200</pubDate>
<guid>https://lynxline.com/posts/lab-15-eve-hello-world-from-limbo/</guid>
<description>It is our 15-th Lab and it is the time came to make birth of the process Eve, run Dis virtual machine and our first Limbo program!&#xA;First create file archrpi.c where we all R-Pi platform specific code. We need to implement kprocchild() call:&#xA;1static void 2linkproc(void) 3{ 4&#x9;spllo(); 5&#x9;if (waserror()) 6&#x9;print(&amp;#34;error() underflow: %r\n&amp;#34;); 7&#x9;else (*up-&amp;gt;kpfun)(up-&amp;gt;arg); 8&#x9;pexit(&amp;#34;end proc&amp;#34;, 1); 9} 10 11void 12kprocchild(Proc *p, void (*func)(void*), void *arg) 13{ 14&#x9;p-&amp;gt;sched.</description>
</item>
<item>
<title>Lab 14, interrupts, part 3</title>
<link>https://lynxline.com/posts/lab-14-interrupts-part-3/</link>
Expand Down
24 changes: 24 additions & 0 deletions posts/lab-15-eve-hello-world-from-limbo/archrpi.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#include "u.h"
#include "../port/lib.h"
#include "mem.h"
#include "dat.h"
#include "fns.h"

static void
linkproc(void)
{
spllo();
if (waserror())
print("error() underflow: %r\n");
else (*up->kpfun)(up->arg);
pexit("end proc", 1);
}

void
kprocchild(Proc *p, void (*func)(void*), void *arg)
{
p->sched.pc = (ulong)linkproc;
p->sched.sp = (ulong)p->kstack+KSTACK-8;
p->kpfun = func;
p->arg = arg;
}
85 changes: 85 additions & 0 deletions posts/lab-15-eve-hello-world-from-limbo/dat.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@

#define HZ (100) /*! clock frequency */
#define MS2HZ (1000/HZ) /*! millisec per clock tick */
#define TK2SEC(t) ((t)/HZ) /*! ticks to seconds */
#define MS2TK(t) ((t)/MS2HZ) /*! milliseconds to ticks */

#define MACHP(n) (n == 0 ? (Mach*)(MACHADDR) : (Mach*)0)

typedef struct Lock Lock;
typedef struct Ureg Ureg;
typedef struct Label Label;
typedef struct FPenv FPenv;
typedef struct Mach Mach;
typedef struct FPU FPU;
typedef ulong Instr;
typedef struct Conf Conf;

struct Lock
{
ulong key;
ulong sr;
ulong pc;
int pri;
};

struct Label
{
ulong sp;
ulong pc;
};

enum
{
FPINIT,
FPACTIVE,
FPINACTIVE
};

struct FPenv
{
ulong status;
ulong control;
ushort fpistate; /* emulated fp */
ulong regs[8][3]; /* emulated fp */
};

struct FPU
{
FPenv env;
};

struct Conf
{
ulong nmach; /* processors */
ulong nproc; /* processes */
ulong npage; /* total physical pages of memory */
ulong npage0; /* total physical pages of memory */
ulong npage1; /* total physical pages of memory */
ulong base0; /* base of bank 0 */
ulong base1; /* base of bank 1 */
ulong ialloc; /* max interrupt time allocation in bytes */
ulong topofmem; /* top addr of memory */
};

#include "../port/portdat.h"

struct Mach
{
ulong splpc; /* pc of last caller to splhi */
int machno; /* physical id of processor */
ulong ticks; /* of the clock since boot time */
Proc* proc; /* current process on this processor */
Label sched; /* scheduler wakeup */
ulong cpuhz;

/* stacks for exceptions */
ulong fiqstack[4];
ulong irqstack[4];
ulong abtstack[4];
ulong undstack[4];
int stack[1];
};

extern Mach *m;
extern Proc *up;
Loading

0 comments on commit d5cb0b9

Please sign in to comment.