Skip to content

Commit b4691b7

Browse files
author
Shane J Gianelli
committed
Initial commit
1 parent 4b55cf4 commit b4691b7

38 files changed

+44564
-0
lines changed

Diff for: Makefile

+65
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
#
2+
# This is a makefile for the DLX OS projects.
3+
#
4+
5+
CC = gcc-dlx
6+
AS = dlxasm
7+
CFLAGS = -mtraps -O3
8+
9+
#INCS = $(wildcard *.h)
10+
#SRCS = $(wildcard *.c)
11+
#OBJS = $(addsuffix .o, $(basename $(wildcard *.c))) \
12+
# $(addsuffix .o, $(basename $(wildcard *.s)))
13+
INCS = dlxos.h traps.h filesys.h memory.h misc.h process.h queue.h \
14+
syscall.h share_memory.h
15+
SRCS = filesys.c memory.c misc.c process.c queue.c traps.c sysproc.c
16+
OBJS = $(addsuffix .o, $(basename $(SRCS)))
17+
18+
all: os.dlx.obj userprog3 userprog4
19+
20+
part2: os.dlx.obj userprog3 userprog4
21+
22+
os.dlx.obj: os.dlx
23+
$(AS) -i _osinit -l os.lst os.dlx
24+
mv os.dlx.obj ../execs
25+
26+
os.dlx: $(OBJS) dlxos.o trap_random.o osend.o share_memory.o synch.o
27+
$(CC) -mtraps -O3 dlxos.o trap_random.o share_memory.o synch.o $(OBJS) osend.o -o os.dlx
28+
29+
share_memory.o: share_memory.api
30+
cp share_memory.api share_memory.o
31+
32+
synch.o: synch.bin
33+
cp synch.bin synch.o
34+
35+
osend.o: osend.s
36+
$(CC) -c osend.s
37+
38+
trap_random.o: trap_random.s
39+
$(CC) -c trap_random.s
40+
41+
dlxos.o: dlxos.s
42+
$(CC) -c dlxos.s
43+
44+
usertraps.o: usertraps.s
45+
$(CC) -c usertraps.s
46+
47+
userprog3 : userprog3.o usertraps.o misc.o
48+
$(CC) -mtraps -O3 userprog3.o usertraps.o misc.o -o userprog3.dlx
49+
$(AS) -l userprog3.lst userprog3.dlx
50+
mv userprog3.dlx.obj ../execs
51+
52+
userprog4 : userprog4.o usertraps.o misc.o
53+
$(CC) -mtraps -O3 userprog4.o usertraps.o misc.o -o userprog4.dlx
54+
$(AS) -l userprog4.lst userprog4.dlx
55+
mv userprog4.dlx.obj ../execs
56+
57+
Makefile.depend: depend
58+
59+
depend: $(SRCS) $(INCS)
60+
$(CC) -MM $(SRCS) > Makefile.depend
61+
62+
clean:
63+
/bin/rm -f *.o *.dlx *.lst ../execs/*.obj Makefile.depend ../execs/vm
64+
65+
include Makefile.depend

Diff for: Makefile.depend

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
filesys.o: filesys.c dlxos.h misc.h process.h queue.h filesys.h
2+
memory.o: memory.c dlxos.h misc.h memory.h process.h queue.h
3+
misc.o: misc.c misc.h
4+
process.o: process.c dlxos.h misc.h process.h queue.h memory.h \
5+
filesys.h
6+
queue.o: queue.c dlxos.h misc.h queue.h
7+
traps.o: traps.c dlx.h dlxos.h misc.h traps.h process.h queue.h
8+
sysproc.o: sysproc.c process.h dlxos.h misc.h queue.h

Diff for: dlx.h

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
//
2+
// Definitions of flags and other things defined by the DLX processor.
3+
//
4+
5+
#ifndef _dlx_h_
6+
#define _dlx_h_
7+
8+
#define DLX_STATUS_INTRMASK 0x0f // up to 16 interrupt levels
9+
#define DLX_STATUS_FPTRUE 0x20 // Set if last FP comparison was true
10+
#define DLX_STATUS_SYSMODE 0x40 // Set if CPU is in system mode
11+
#define DLX_STATUS_PAGE_TABLE 0x100 // Set -> use a page table
12+
#define DLX_STATUS_TLB 0x200 // Set -> use a software-loaded TLB
13+
14+
#endif // _dlx_h_

Diff for: dlxos.h

+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
//
2+
// Routines used by the entire operating system.
3+
//
4+
5+
#ifndef _dlxos_h_
6+
#define _dlxos_h_
7+
8+
#include "misc.h"
9+
10+
typedef unsigned int uint32;
11+
12+
#define DLX_PROCESS_QUANTUM 100000 // in microseconds
13+
14+
extern void SetTimer (int);
15+
16+
extern char debugstr[];
17+
18+
#define ASSERT(cond,s) (cond ? 0 : printf ("%s: %s\n", __FUNCTION__,s))
19+
20+
// dbprintf() is a VERY useful macro. It gets used as follows:
21+
// dbprintf ('x', "This prints %d and %x\n", val1, val2);
22+
// This will print the expected string only if the debugging options contain
23+
// the letter 'x'. This allows users to turn on different debugging
24+
// statements at different times by using different letters. For example,
25+
// process debugging statements could use 'p', and memory 'm'. Specifying
26+
// a '+' in the debugging string will turn on all debugging printfs.
27+
#define dbprintf(flag, format, args...) \
28+
if ((dindex(debugstr,flag)!=(char *)0) || \
29+
(dindex(debugstr,'+')!=(char *)0)) { \
30+
printf (format, ## args); \
31+
}
32+
33+
extern int CurrentIntrs ();
34+
extern int SetIntrs (int);
35+
extern void KbdModuleInit ();
36+
extern void intrreturn ();
37+
38+
inline int
39+
DisableIntrs ()
40+
{
41+
return (SetIntrs (0xf));
42+
}
43+
44+
inline int
45+
EnableIntrs ()
46+
{
47+
return (SetIntrs (0x0));
48+
}
49+
50+
inline int
51+
RestoreIntrs (int intrs)
52+
{
53+
return (SetIntrs (intrs));
54+
}
55+
56+
57+
#endif // _dlxos_h_
58+

0 commit comments

Comments
 (0)