Go to the source code of this file.
Defines | |
#define | FALSE 0 |
#define | TRUE 1 |
#define | NULL 0 |
#define | EMPTY (-1) |
#define | syscall long |
#define | devcall long |
#define | local static long |
#define | command long |
#define | process long |
#define | interrupt void |
#define | OK 1 |
#define | SYSERR (-1) |
#define | EOF (-2) |
#define | RESCHED_YES 1 |
#define | RESCHED_NO 0 |
#define | RTCLOCK TRUE |
#define | NPROC 50 |
#define | NSEM 100 |
#define | ASSERT(cond) if ( !(cond) ) return SYSERR |
#define | ASSERTFUNC(func_call) ASSERT((func_call) == OK) |
Typedefs | |
typedef unsigned char | uchar |
typedef unsigned short | ushort |
typedef unsigned long | ulong |
typedef unsigned long | irqmask |
typedef char | bool |
Functions | |
int | nulluser (void) |
syscall | kprintf (char *fmt,...) |
irqmask | disable (void) |
irqmask | restore (irqmask) |
irqmask | enable (void) |
irqmask | enable_irq (irqmask) |
syscall | create (void *, ulong, ushort, char *, ulong,...) |
syscall | getpid (void) |
syscall | kill (int) |
syscall | ready (long, bool) |
syscall | resched (void) |
syscall | sleep (int n) |
Definition in file kernel.h.
#define ASSERT | ( | cond | ) | if ( !(cond) ) return SYSERR |
Definition at line 55 of file kernel.h.
Referenced by freemem(), ready(), sleep(), ttyClose(), ttyControl(), ttyOpen(), ttyRead(), ttyWrite(), and uartRead().
#define devcall long |
#define EMPTY (-1) |
null pointer for queues
Definition at line 30 of file kernel.h.
Referenced by dequeue(), fscanf(), getch(), newqueue(), test_deltaQueue(), test_procQueue(), and ungetch().
#define EOF (-2) |
#define FALSE 0 |
boolean false
Definition at line 25 of file kernel.h.
Referenced by receive(), send(), shell(), test_checkProcState(), test_checkResult(), test_checkSemCount(), test_deltaQueue(), test_procQueue(), test_recursion(), test_schedule(), test_semaphore(), test_semaphore2(), test_semaphore3(), and test_semaphore4().
#define NPROC 50 |
#define NSEM 100 |
number of semaphores
Definition at line 52 of file kernel.h.
Referenced by allocsem(), and sysinit().
#define NULL 0 |
null pointer for linked lists
Definition at line 29 of file kernel.h.
Referenced by _innum(), fgets(), freemem(), getmem(), kputc(), nulluser(), receive(), shell(), sysinit(), test_deltaQueue(), test_procQueue(), testItem(), ttyAlloc(), ttyClose(), ttyControl(), ttyInit(), ttyOpen(), ttyRead(), ttyWrite(), uartIntr(), uartRead(), uartWrite(), xsh_memstat(), and xtrap().
#define OK 1 |
system call ok
Definition at line 41 of file kernel.h.
Referenced by fprintf(), freemem(), freesem(), insert(), insertd(), ionull(), kill(), kprintf(), platforminit(), ready(), resched(), send(), shell(), signal(), signaln(), sleep(), sysinit(), test_bigargs(), test_deltaQueue(), test_procQueue(), test_recursion(), test_schedule(), test_semaphore(), test_semaphore2(), test_semaphore3(), test_semaphore4(), testItem(), ttyClose(), ttyInit(), ttyOpen(), uartInit(), uartStat(), wait(), xsh_exit(), xsh_gpiostat(), xsh_help(), xsh_kill(), xsh_led(), xsh_memstat(), xsh_ps(), xsh_reset(), xsh_sleep(), xsh_test(), xsh_testsuite(), and xsh_uartstat().
#define RESCHED_NO 0 |
tell ready not to reschedule
Definition at line 47 of file kernel.h.
Referenced by freesem(), main(), nulluser(), send(), shell(), signaln(), test_semaphore2(), test_semaphore3(), and wakeup().
#define RESCHED_YES 1 |
tell ready to reschedule
Definition at line 46 of file kernel.h.
Referenced by shell(), signal(), test_bigargs(), test_semaphore(), test_semaphore2(), test_semaphore3(), test_semaphore4(), and testItem().
#define syscall long |
#define SYSERR (-1) |
system call failed
Definition at line 42 of file kernel.h.
Referenced by allocsem(), close(), control(), create(), dequeue(), enqueue(), freemem(), freesem(), getc(), getmem(), getstk(), insert(), insertd(), ioerr(), kill(), kputc(), lexan(), newpid(), newsem(), open(), platforminit(), putc(), read(), remove(), scount(), seek(), send(), shell(), signal(), signaln(), sleep(), test_deltaQueue(), test_procQueue(), ttyControl(), ttyRead(), ttyWrite(), uartControl(), uartRead(), uartWrite(), wait(), write(), xsh_exit(), xsh_gpiostat(), xsh_help(), xsh_kill(), xsh_led(), xsh_memstat(), xsh_ps(), xsh_reset(), xsh_sleep(), xsh_testsuite(), and xsh_uartstat().
#define TRUE 1 |
boolean true
Definition at line 26 of file kernel.h.
Referenced by send(), shell(), test_checkProcState(), test_checkResult(), test_checkSemCount(), test_deltaQueue(), test_procQueue(), test_recursion(), test_schedule(), test_semaphore(), test_semaphore2(), test_semaphore3(), and test_semaphore4().
typedef unsigned long irqmask |
Create a process to start running a procedure.
procaddr | procedure address | |
ssize | stack stack size in words | |
priority | process priority, must be > 0 | |
name | name of the process, used for debugging | |
nargs,number | of arguments that follow |
Definition at line 28 of file create.c.
References CONTEXT_WORDS, getmem(), getpid(), INITRET, MINSTK, pentry::name, newpid(), numproc, pentry::parent, PNMLEN, pentry::prio, proctab, PRSUSP, roundew, STACKMAGIC, pentry::state, pentry::stkbase, pentry::stklen, pentry::stkptr, strncpy(), SYSERR, va_arg, va_end, and va_start.
Referenced by main(), nulluser(), shell(), test_bigargs(), test_deltaQueue(), test_procQueue(), test_recursion(), test_schedule(), test_semaphore(), test_semaphore2(), test_semaphore3(), test_semaphore4(), and testItem().
irqmask disable | ( | void | ) |
Referenced by freemem(), freesem(), getmem(), kill(), newsem(), receive(), resched(), send(), signal(), signaln(), sleep(), testItem(), ttyAlloc(), uartRead(), uartWrite(), and wait().
irqmask enable | ( | void | ) |
Referenced by main(), and nulluser().
Referenced by uartInit().
syscall getpid | ( | void | ) |
Get the process id of currently executing process.
Definition at line 16 of file getpid.c.
References currpid.
Referenced by create(), userret(), xsh_exit(), and xsh_kill().
syscall kill | ( | int | ) |
Definition at line 21 of file kill.c.
References BLOCK, sentry::count, disable(), freemem(), isbadpid, numproc, OK, pentry::parent, PRCURR, PRFREE, proctab, PRREADY, PRSLEEP, PRWAIT, resched(), restore(), pentry::sem, semtab, send(), pentry::state, pentry::stkbase, and SYSERR.
Referenced by test_deltaQueue(), test_procQueue(), test_semaphore(), test_semaphore2(), test_semaphore3(), test_semaphore4(), userret(), xsh_exit(), and xsh_kill().
syscall kprintf | ( | char * | fmt, | |
... | ||||
) |
kprintf - kernel printf: formatted, unbuffered output to CONSOLE
*fmt | pointer to string being printed |
Definition at line 55 of file kprintf.c.
Referenced by nulluser(), xdone(), and xtrap().
int nulluser | ( | void | ) |
Intializes the system and becomes the null process. This is where the system begins after the C environment has been established. Interrupts are initially DISABLED, and must eventually be enabled explicitly. This routine turns itself into the null process after initialization. Because the null process must always remain ready to run, it cannot execute code that might cause it to be suspended, wait for a semaphore, or put to sleep, or exit. In particular, it must not do I/O unless it uses kprintf for synchronous output.
Definition at line 64 of file initialize.c.
References _start(), CONSOLE, cpuid, create(), enable(), end, INITPRIO, INITSTK, kprintf(), KSEG0_BASE, main(), minheap, nonempty, NULL, numproc, open(), platforminit(), ready(), readylist, resched(), RESCHED_NO, SERIAL0, sysinit(), and xdone().
syscall ready | ( | long | pid, | |
bool | resch | |||
) |
Make a process eligible for CPU service.
pid | process id of the process to move to the ready state | |
resch | if TRUE, reschedule will be called |
Definition at line 19 of file ready.c.
References ASSERT, insert(), isbadpid, OK, pentry::prio, proctab, PRREADY, readylist, resched(), and pentry::state.
Referenced by freesem(), main(), nulluser(), send(), shell(), signal(), signaln(), test_bigargs(), test_recursion(), test_schedule(), test_semaphore(), test_semaphore2(), test_semaphore3(), test_semaphore4(), testItem(), and wakeup().
syscall resched | ( | void | ) |
Reschedule processor to highest priority ready process. Upon entry, currpid gives current process id. Proctab[currpid].pstate gives correct NEXT state for current process if other than PRREADY.
Definition at line 21 of file resched.c.
Referenced by clockintr(), kill(), nulluser(), ready(), receive(), send(), sleep(), t4(), t5(), test_recursion(), test_schedule(), wait(), and wakeup().
Referenced by freemem(), freesem(), getmem(), kill(), newsem(), receive(), resched(), send(), signal(), signaln(), sleep(), testItem(), ttyAlloc(), uartRead(), uartWrite(), and wait().
syscall sleep | ( | int | ms | ) |
Delay the calling process n milliseconds.
ms | number of milliseconds to sleep |
Definition at line 19 of file sleep.c.
References ASSERT, currpid, disable(), insertd(), OK, proctab, PRSLEEP, resched(), restore(), sleepq, pentry::state, and SYSERR.
Referenced by shell(), testItem(), xsh_exit(), xsh_kill(), and xsh_sleep().