Skip to content

Commit

Permalink
import last known source tree
Browse files Browse the repository at this point in the history
  • Loading branch information
podusowski committed Dec 23, 2013
0 parents commit 218557a
Show file tree
Hide file tree
Showing 90 changed files with 5,399 additions and 0 deletions.
43 changes: 43 additions & 0 deletions include/drax.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#ifndef __DRAX__H__
#define __DRAX__H__

typedef struct {
unsigned long
type,
lparam,
hparam,
from;
} message_t;

typedef int bool;

#define PROC_CLASS_A 1
#define PROC_CLASS_B 2

#define PROC_STATE_READY 1
#define PROC_STATE_SLEEPING 2
#define PROC_STATE_SLAVE 4
#define PROC_STATE_KILLED 5

/* te wartosci musza byc stale */
#define SLEEP_IRQ1 (1 << 1)
#define SLEEP_IRQ2 (1 << 2)
#define SLEEP_IRQ3 (1 << 3)
#define SLEEP_IRQ4 (1 << 4)
#define SLEEP_IRQ5 (1 << 5)
#define SLEEP_IRQ6 (1 << 6)
#define SLEEP_IRQ7 (1 << 7)
#define SLEEP_IRQ8 (1 << 8)
#define SLEEP_IRQ9 (1 << 9)
#define SLEEP_IRQ10 (1 << 10)
#define SLEEP_IRQ11 (1 << 11)
#define SLEEP_IRQ12 (1 << 12)
#define SLEEP_IRQ13 (1 << 13)
#define SLEEP_IRQ14 (1 << 14)
#define SLEEP_IRQ15 (1 << 15)
#define SLEEP_IRQ16 (1 << 16)

#define SLEEP_MESSAGE (1 << 17)
#define SLEEP_SLAVE (1 << 18)

#endif // __DRAX__H__
16 changes: 16 additions & 0 deletions include/libc.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#ifndef __LIBC__H
#define __LIBC__H

#include "limits.h"

char * ultoa( unsigned long val , int base );
int strlen( char * str );
void * memcpy( void * dest , const void * src , unsigned long num );
int sprintf( char * dest , const char * fmt , ... );
void printf(const char * fmt, ...);
void * memset( void * buffer , int c , unsigned long num );
int strcmp( const char * s1, const char * s2 );
char * strchr( const char * s, char c );

#endif

56 changes: 56 additions & 0 deletions include/limits.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#ifndef _LIMITS_H
#define _LIMITS_H

/* Number of bits in a `char'. */
#define CHAR_BIT 8

/* Maximum length of any multibyte character in any locale.
Locale-writers should change this as necessary. */
#define MB_LEN_MAX 1

/* Minimum and maximum values a `signed char' can hold. */
#define SCHAR_MIN (-128)
#define SCHAR_MAX 127

/* Maximum value an `unsigned char' can hold. (Minimum is 0.) */
#ifdef __STDC__
#define UCHAR_MAX 255U
#else
#define UCHAR_MAX 255
#endif

/* Minimum and maximum values a `char' can hold. */
#ifdef __CHAR_UNSIGNED__
#define CHAR_MIN 0
#define CHAR_MAX UCHAR_MAX
#else
#define CHAR_MIN SCHAR_MIN
#define CHAR_MAX SCHAR_MAX
#endif

/* Minimum and maximum values a `signed short int' can hold. */
#define SHRT_MIN (-32768)
#define SHRT_MAX 32767

/* Maximum value an `unsigned short int' can hold. (Minimum is 0.) */
#define USHRT_MAX 65535

/* Minimum and maximum values a `signed int' can hold. */
#define INT_MIN (- INT_MAX - 1)
#define INT_MAX 2147483647

/* Maximum value an `unsigned int' can hold. (Minimum is 0.) */
#ifdef __STDC__
#define UINT_MAX 4294967295U
#else
#define UINT_MAX 4294967295
#endif

/* Minimum and maximum values a `signed long int' can hold. */
#define LONG_MIN INT_MIN
#define LONG_MAX INT_MAX

/* Maximum value an `unsigned long int' can hold. (Minimum is 0.) */
#define ULONG_MAX UINT_MAX

#endif /* limits.h */
15 changes: 15 additions & 0 deletions include/stdarg.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#ifndef _STDARG_H
#define _STDARG_H

typedef char *va_list;

/* only correct for i386 */
#define va_start(ap,last) ap = ((char *)&(last)) + ((sizeof(last)+3)&~3)
#define va_arg(ap,type) (ap += (sizeof(type)+3)&~3, *(type *)(ap - ((sizeof(type)+3)&~3)))
#define va_end(ap)

/* fix a buggy dependency on GCC in libio.h */
typedef va_list __gnuc_va_list;
#define _VA_LIST_DEFINED

#endif
53 changes: 53 additions & 0 deletions include/syscall.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#ifndef __SYSCALL__H
#define __SYSCALL__H

#define SYSCALL_EXIT 0x00000000

#define SYSCALL_GET_HEAP_SIZE 0x00000001
#define SYSCALL_SET_HEAP_SIZE 0x00000002

#define SYSCALL_GET_PID 0x00000003
#define SYSCALL_GET_PROCESS_NAME 0x00000007
#define SYSCALL_GET_PROCESS_COUNT 0x00000100
#define SYSCALL_GET_MEMORY_USAGE 0x00000101
#define SYSCALL_IS_PROCESS 0x00000102
#define SYSCALL_GET_TICKS 0x00000103
#define SYSCALL_FIND_PROCESS 0x00000104
#define SYSCALL_SET_MY_NAME 0x00000105
#define SYSCALL_GET_PROCESS_STATE 0x00000106

#define SYSCALL_STI 0x00000106
#define SYSCALL_CLI 0x00000107

#define SYSCALL_PUTS 0x00000005
#define SYSCALL_PUTC 0x00000006
#define SYSCALL_SET_CARRET_POS 0x00000200
#define SYSCALL_GET_CARRET_POS 0x00000201
#define SYSCALL_SET_CONSOLE_ATTRIBUTE 0x00000202
#define SYSCALL_GET_CONSOLE_ATTRIBUTE 0x00000203

#define SYSCALL_SEND_MESSAGE 0x00000010
#define SYSCALL_GET_MESSAGE 0x00000011

#define SYSCALL_CREATE_SHARED_FRAME 0x00000012
#define SYSCALL_FREE_SHARED_FRAME 0x00000013

#define SYSCALL_REGISTER_CALLBACK 0x00000014
#define SYSCALL_FREE_CALLBACK 0x00000015

/* kontrola IRQ */
#define SYSCALL_CLEAR_IRQ_STATUS 0xA0000001
#define SYSCALL_GET_IRQ_STATUS 0xA0000002

#define SYSCALL_IRQ_ENABLE 0xA0000003
#define SYSCALL_IRQ_DISABLE 0xA0000004

#define SYSCALL_SLEEP 0xA0000005
#define SYSCALL_SET_PROCESS_STATE 0xA0000006

#define SYSCALL_UNAME 0xA0000007
#define SYSCALL_GET_BOOT_DEVICE 0xA0000008

unsigned long do_syscall(unsigned long eax, unsigned long ebx, unsigned long ecx, unsigned long edx);

#endif
30 changes: 30 additions & 0 deletions include/system.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#ifndef __SYSTEM__H
#define __SYSTEM__H

#include "drax.h"

void uname(char * s);
void * createsharedframe(int pid);
bool freesharedframe();
int findprocess(char * name);
bool getmessage(message_t * msg);
int getpid();
int getprocesscount();
bool getprocessname(int pid, char * buf);
void setprocessstate(int pid, int state);
int getprocessstate(int pid);
unsigned long gettickcount();
bool isprocess(int pid);
bool sendmessage(int pid, message_t * msg);
void setmyname(char * name);
void puts(char * s);
void putc(char c);
void gets(char * s);
void sleep(unsigned long flags);
void enableirq(int irq);
void disableirq(int irq);
unsigned int getirqstatus(int irq);
void clearirqstatus(int irq);
int getbootdevice();

#endif /* __SYSTEM__H */
2 changes: 2 additions & 0 deletions src/crt0/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
all:
nasm crt0.asm -o crt0.o -f elf
Empty file added src/crt0/compile.log
Empty file.
6 changes: 6 additions & 0 deletions src/crt0/crt0.asm
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
section .text
extern main
call main
xor eax, eax
int 0x80
jmp $
10 changes: 10 additions & 0 deletions src/floppyd/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
NAME = floppyd

OBJS = ../../lib/libc.o \
../../lib/libsys.o \

CFLAGS = -O2 -fomit-frame-pointer -I ../kernel/include -I ../../include -nostdinc -fno-builtin -DDEBUG

all:
/usr/cross/i586-elf/bin/gcc -c $(CFLAGS) -o $(NAME).o $(NAME).c
ld -T /usr/cross/i586-elf/lib/ldscripts/elf_i386.x -o ../../bin/$(NAME).dri ../crt0/crt0.o $(NAME).o $(OBJS)
11 changes: 11 additions & 0 deletions src/floppyd/compile.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
floppyd.c: In function `fdc_init':
floppyd.c:247: warning: assignment makes integer from pointer without a cast
floppyd.c:249: warning: assignment makes integer from pointer without a cast
floppyd.c:251: warning: assignment makes integer from pointer without a cast
floppyd.c: In function `main':
floppyd.c:282: warning: passing arg 1 of `memcpy' makes pointer from integer without a cast
floppyd.c:282: warning: passing arg 2 of `memcpy' makes pointer from integer without a cast
floppyd.c:296: warning: passing arg 1 of `memcpy' makes pointer from integer without a cast
floppyd.c:296: warning: passing arg 2 of `memcpy' makes pointer from integer without a cast
floppyd.c:262: warning: return type of 'main' is not `int'
ld: warning: cannot find entry symbol _start; defaulting to 0000000001000080
Loading

0 comments on commit 218557a

Please sign in to comment.