Skip to content
Snippets Groups Projects
Commit cc624f9e authored by antnh6@gmail.com's avatar antnh6@gmail.com
Browse files

second commit

parent 1f55a830
No related branches found
No related tags found
1 merge request!16Withtime
{
"files.associations": {
"task-descriptor.h": "c"
"task-descriptor.h": "c",
"bwio.h": "c"
}
}
\ No newline at end of file
......@@ -11,6 +11,7 @@ typedef struct kernel {
// a free list of pointers to free TDs. This might take the form of bits set in a couple of words. WHAT?
// a structure for keeping the request currently being serviced, including its arguments.
Request syscalReq;
TD* Active;
} KernelStruct;
......
......@@ -2,8 +2,8 @@
#include "syscall.h"
int Create (int priority, void (*code)()) {
// assemble args into a Request
// then call syscallHandler
// assemble args into a Request struct
// then call syscallHandler and pass it that Request struct whih will invoke the appropriate kernel handler
// return TaskID of new Task
}
......
......@@ -19,56 +19,51 @@ ARFLAGS = rcs
LDFLAGS = -init main -Map first.map -N -T orex.ld -L/u/wbcowan/gnuarm-4.0.2/lib/gcc/arm-elf/4.0.2 -L../lib
all: startup.elf
all: main.elf
startup.s: startup.c
$(XCC) -S $(CFLAGS) startup.c
startup.o: startup.s
$(AS) $(ASFLAGS) -o startup.o startup.s
startup.elf: startup.o
$(LD) $(LDFLAGS) -o $@ startup.o -lmycanvas -lmyclock -lcmd -lmyio -lbuffer -lbwio -lgcc
clocktest.s: clocktest.c
$(XCC) -S $(CFLAGS) clocktest.c
main.s: main.c
$(XCC) -S $(CFLAGS) main.c
clocktest.o: clocktest.s
$(AS) $(ASFLAGS) -o clocktest.o clocktest.s
main.o: main.s
$(AS) $(ASFLAGS) -o main.o main.s
clocktest.elf: clocktest.o
$(LD) $(LDFLAGS) -o $@ clocktest.o -lbwio -lgcc
main.elf: main.o
$(LD) $(LDFLAGS) -o $@ main.o -ltaskdescriptor -lscheduler -lbwio -lgcc
scheduler.s: scheduler.c
$(XCC) -S $(CFLAGS) scheduler.c
getc.s: getc.c
$(XCC) -S $(CFLAGS) getc.c
taskdescriptor.s: taskdescriptor.c
$(XCC) -S $(CFLAGS) taskdescriptor.c
getc.o: getc.s
$(AS) $(ASFLAGS) -o getc.o getc.s
getc.elf: getc.o
$(LD) $(LDFLAGS) -o $@ getc.o -lbwio -lgcc
bwio.s: bwio.c
$(XCC) -S $(CFLAGS) bwio.c
scheduler.o: scheduler.s
$(AS) $(ASFLAGS) -o scheduler.o scheduler.s
stop.s: stop.c
$(XCC) -S $(CFLAGS) stop.c
taskdescriptor.o: taskdescriptor.s
$(AS) $(ASFLAGS) -o taskdescriptor.o taskdescriptor.s
stop.o: stop.s
$(AS) $(ASFLAGS) -o stop.o stop.s
bwio.o: bwio.s
$(AS) $(ASFLAGS) -o bwio.o bwio.s
stop.elf: stop.o
$(LD) $(LDFLAGS) -o $@ stop.o -lbwio -lgcc
tr.s: tr.c
$(XCC) -S $(CFLAGS) tr.c
scheduler.a: scheduler.o
$(AR) $(ARFLAGS) $@ scheduler.o
tr.o: tr.s
$(AS) $(ASFLAGS) -o tr.o tr.s
taskdescriptor.a: taskdescriptor.o
$(AR) $(ARFLAGS) $@ taskdescriptor.o
tr.elf: tr.o
$(LD) $(LDFLAGS) -o $@ tr.o -lmyio -lbuffer -lbwio -lgcc
bwio.a: bwio.o
$(AR) $(ARFLAGS) $@ bwio.o
install: bwio.a taskdescriptor.a scheduler.a
mv bwio.a ../../lib/libbwio.a
mv taskdescriptor.a ../../lib/libtaskdescriptor.a
mv scheduler.a ../../lib/libscheduler.a
clean:
-rm -f *.elf *.s *.o startup.map *.a *~
-rm -f *.elf *.s *.o main.map *.a *~ ../../lib/*.a
/* Entering Kernel */
kernel-entry:
//- save users lr in r3
//- switch to system mode to find users SP
//- push r4-r12 onto users stack
......@@ -14,7 +15,7 @@
/* exiting kernel */
stmfd sp!, {r0, r4-r12, r14}
CPSR[4:0] = 0b10011
CPSR[4:0] = 0b10011 // supervisor
// TODO ??
movs pc, lr // jump outta kernel
......
#include "kernel.h"
// #include "kernel.h"
#include "task-descriptor.h"
#include "scheduler.h"
#include "error.h"
// #include "error.h"
#include "bwio.h"
#include "request.h"
#define FOREVER while(1)
void kerxit( TD *active, Request *req ) {
bwprintf( COM2, kerxit.c: Hello.\n\r );
bwprintf( COM2, kerxit.c: Activating.\n\r );
kerent( );
bwprintf( COM2, kerxit.c: Good-bye.\n\r );
}
void initialize()
void handle(TD* Active, Request* req) {
}
int main(int argc, char const *argv[])
{
KernelStruct Colonel;
TD* Active;
Request* syscallReq;
int Status, TaskID;
// TODO turn off interrupts so it won't mess up RedBoot stuff
disableInterrupts();
// KernelStruct Colonel;
TD* Active; // TODO moved to kernel struct now
Request* req;
// int Status, TaskID;
initialize( tds );
// tds is an array of TDs
for( i = 0; i < 4; i++ ) {
// active = schedule( tds );
kerxit( active, req );
// req is a pointer to a Request
handle( tds, req );
}
return 0;
// // TODO turn off interrupts so it won't mess up RedBoot stuff
// disableInterrupts();
kernelInit(&Colonel);
// kernelInit(&Colonel);
status = schedulerInit();
if (status) return FAILURE;
// status = schedulerInit();
// if (status) return FAILURE;
firstUserTaskChildren();
// firstUserTaskChildren();
return 0;
// return 0;
// FOREVER {
// Active = getNextTaskScheduler(&Colonel);
// if (Active == NULL) break; // no tasks to run
// syscallReq = activate(&Colonel, Active);
// syscallReq = activate(&Colonel, Active); // restoring tasks registers
// handle(&Colonel, Active, syscallReq);
// }
// declare kernel data structures
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment