Refactored all the sortix headers into a include directory.
Also got rid of trailing white space. That corrupted .git/. Big ass-commit because of recovered .git directory.
This commit is contained in:
parent
e496c07764
commit
db79994e64
2
Makefile
2
Makefile
|
@ -146,7 +146,7 @@ iso: all debsource
|
||||||
cp -r isosrc/. $(ISODIR)
|
cp -r isosrc/. $(ISODIR)
|
||||||
cp sortix/sortix.bin $(ISODIR)/boot
|
cp sortix/sortix.bin $(ISODIR)/boot
|
||||||
cp $(INITRD) $(ISODIR)/boot/sortix.initrd
|
cp $(INITRD) $(ISODIR)/boot/sortix.initrd
|
||||||
cp builds/$(DEBSRCNAME)-src.tar.gz $(ISODIR)
|
cp builds/$(DEBSRCNAME)-src.tar.gz $(ISODIR)
|
||||||
grub-mkrescue -o $(ISOFILE) $(ISODIR)
|
grub-mkrescue -o $(ISOFILE) $(ISODIR)
|
||||||
rm -rf $(ISODIR)
|
rm -rf $(ISODIR)
|
||||||
|
|
||||||
|
|
2
README
2
README
|
@ -38,7 +38,7 @@ A real shell will be added as the system matures and I get around to finish the
|
||||||
work in progress shell.
|
work in progress shell.
|
||||||
|
|
||||||
A number of standard utilities are present such as cat, head, tail, clear, cp,
|
A number of standard utilities are present such as cat, head, tail, clear, cp,
|
||||||
column, kill, ls, rm, pwd, uname, echo, and uptime. There is even a number of
|
column, kill, ls, rm, pwd, uname, echo, and uptime. There is even a number of
|
||||||
non-standard utilities such as calc, help, init, kernelinfo, memstat, and pager.
|
non-standard utilities such as calc, help, init, kernelinfo, memstat, and pager.
|
||||||
This collection of utilities will continue to grow as it matures and third party
|
This collection of utilities will continue to grow as it matures and third party
|
||||||
software is ported. I've currently had some luck partially porting binutils,
|
software is ported. I've currently had some luck partially porting binutils,
|
||||||
|
|
|
@ -17,16 +17,17 @@ ifeq ($(CPU),x64)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
LIBMAXSIROOT=$(OSROOT)/libmaxsi
|
LIBMAXSIROOT=$(OSROOT)/libmaxsi
|
||||||
|
SORTIXROOT=$(OSROOT)/sortix
|
||||||
|
|
||||||
LIBC=$(LIBMAXSIROOT)/start.o $(LIBMAXSIROOT)/libc.a
|
LIBC=$(LIBMAXSIROOT)/start.o $(LIBMAXSIROOT)/libc.a
|
||||||
LIBS=$(LIBC)
|
LIBS=$(LIBC)
|
||||||
|
|
||||||
CPPFLAGS=$(CPUDEFINES) -U_GNU_SOURCE -Ulinux -Dsortix
|
CPPFLAGS=$(CPUDEFINES) -U_GNU_SOURCE -Ulinux -Dsortix
|
||||||
FLAGS=-nostdinc -nostdlib -fno-builtin -nostartfiles -nodefaultlibs
|
FLAGS=-nostdinc -nostdlib -fno-builtin -nostartfiles -nodefaultlibs
|
||||||
INCLUDES=-I $(LIBMAXSIROOT)/preproc -I $(OSROOT)/
|
INCLUDES=-I $(LIBMAXSIROOT)/preproc -I $(SORTIXROOT)/include
|
||||||
|
|
||||||
LD=ld
|
LD=ld
|
||||||
LDFLAGS=$(CPULDFLAGS)
|
LDFLAGS=$(CPULDFLAGS)
|
||||||
CC=gcc
|
CC=gcc
|
||||||
CFLAGS=$(CPUFLAGS) $(FLAGS) $(INCLUDES)
|
CFLAGS=$(CPUFLAGS) $(FLAGS) $(INCLUDES)
|
||||||
CXX=g++
|
CXX=g++
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
Package: SORTIX_PACKAGE_NAME
|
Package: SORTIX_PACKAGE_NAME
|
||||||
Version: SORTIX_VERSION
|
Version: SORTIX_VERSION
|
||||||
Section: kernel
|
Section: kernel
|
||||||
Priority: optional
|
Priority: optional
|
||||||
Architecture: SORTIX_ARCH
|
Architecture: SORTIX_ARCH
|
||||||
Installed-Size: SORTIX_SIZE
|
Installed-Size: SORTIX_SIZE
|
||||||
|
|
|
@ -160,7 +160,7 @@ void Goal(nat player)
|
||||||
System::Sound::SetFrequency(goalfreq);
|
System::Sound::SetFrequency(goalfreq);
|
||||||
soundleft = 50;
|
soundleft = 50;
|
||||||
|
|
||||||
UpdateUI();
|
UpdateUI();
|
||||||
}
|
}
|
||||||
|
|
||||||
void UpdateUI()
|
void UpdateUI()
|
||||||
|
|
|
@ -77,7 +77,7 @@ void Reset()
|
||||||
switch ( rand() % 4 )
|
switch ( rand() % 4 )
|
||||||
{
|
{
|
||||||
case 0: velx = -1; vely = 0; break;
|
case 0: velx = -1; vely = 0; break;
|
||||||
case 1: velx = 1; vely = 0; break;
|
case 1: velx = 1; vely = 0; break;
|
||||||
case 2: velx = 0; vely = -1; break;
|
case 2: velx = 0; vely = -1; break;
|
||||||
case 3: velx = 0; vely = -1; break;
|
case 3: velx = 0; vely = -1; break;
|
||||||
}
|
}
|
||||||
|
@ -168,7 +168,7 @@ void Update()
|
||||||
switch ( direction[taily * width + tailx] )
|
switch ( direction[taily * width + tailx] )
|
||||||
{
|
{
|
||||||
case 0: tailx--; break;
|
case 0: tailx--; break;
|
||||||
case 1: tailx++; break;
|
case 1: tailx++; break;
|
||||||
case 2: taily--; break;
|
case 2: taily--; break;
|
||||||
case 3: taily++; break;
|
case 3: taily++; break;
|
||||||
}
|
}
|
||||||
|
|
6
gpl.html
6
gpl.html
|
@ -4,7 +4,7 @@
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||||
<title>GNU General Public License v3.0 - GNU Project - Free Software Foundation (FSF)</title>
|
<title>GNU General Public License v3.0 - GNU Project - Free Software Foundation (FSF)</title>
|
||||||
<link rel="alternate" type="application/rdf+xml"
|
<link rel="alternate" type="application/rdf+xml"
|
||||||
href="http://www.gnu.org/licenses/gpl-3.0.rdf" />
|
href="http://www.gnu.org/licenses/gpl-3.0.rdf" />
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<h3 style="text-align: center;">GNU GENERAL PUBLIC LICENSE</h3>
|
<h3 style="text-align: center;">GNU GENERAL PUBLIC LICENSE</h3>
|
||||||
|
@ -86,7 +86,7 @@ modification follow.</p>
|
||||||
|
|
||||||
<p>“Copyright” also means copyright-like laws that apply to other kinds of
|
<p>“Copyright” also means copyright-like laws that apply to other kinds of
|
||||||
works, such as semiconductor masks.</p>
|
works, such as semiconductor masks.</p>
|
||||||
|
|
||||||
<p>“The Program” refers to any copyrightable work licensed under this
|
<p>“The Program” refers to any copyrightable work licensed under this
|
||||||
License. Each licensee is addressed as “you”. “Licensees” and
|
License. Each licensee is addressed as “you”. “Licensees” and
|
||||||
“recipients” may be individuals or organizations.</p>
|
“recipients” may be individuals or organizations.</p>
|
||||||
|
@ -525,7 +525,7 @@ actual knowledge that, but for the patent license, your conveying the
|
||||||
covered work in a country, or your recipient's use of the covered work
|
covered work in a country, or your recipient's use of the covered work
|
||||||
in a country, would infringe one or more identifiable patents in that
|
in a country, would infringe one or more identifiable patents in that
|
||||||
country that you have reason to believe are valid.</p>
|
country that you have reason to believe are valid.</p>
|
||||||
|
|
||||||
<p>If, pursuant to or in connection with a single transaction or
|
<p>If, pursuant to or in connection with a single transaction or
|
||||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||||
covered work, and grant a patent license to some of the parties
|
covered work, and grant a patent license to some of the parties
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||||
<title>GNU Lesser General Public License v3.0 - GNU Project - Free Software Foundation (FSF)</title>
|
<title>GNU Lesser General Public License v3.0 - GNU Project - Free Software Foundation (FSF)</title>
|
||||||
<link rel="alternate" type="application/rdf+xml"
|
<link rel="alternate" type="application/rdf+xml"
|
||||||
href="http://www.gnu.org/licenses/lgpl-3.0.rdf" />
|
href="http://www.gnu.org/licenses/lgpl-3.0.rdf" />
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<h3 style="text-align: center;">GNU LESSER GENERAL PUBLIC LICENSE</h3>
|
<h3 style="text-align: center;">GNU LESSER GENERAL PUBLIC LICENSE</h3>
|
||||||
|
|
|
@ -19,7 +19,7 @@ ifeq ($(CPU),x64)
|
||||||
CPUASFLAGS=-64
|
CPUASFLAGS=-64
|
||||||
endif
|
endif
|
||||||
|
|
||||||
CPPINCLUDES=-I preproc -I ..
|
CPPINCLUDES=-I preproc -I ../sortix/include
|
||||||
CPPFLAGS=-DLIBMAXSI_LIBRARY -DSORTIX -U_GNU_SOURCE $(CPUDEFINES) $(CPPINCLUDES)
|
CPPFLAGS=-DLIBMAXSI_LIBRARY -DSORTIX -U_GNU_SOURCE $(CPUDEFINES) $(CPPINCLUDES)
|
||||||
FLAGS=$(CPUFLAGS) -Wall -Wextra -nostdlib -fno-builtin -nostartfiles \
|
FLAGS=$(CPUFLAGS) -Wall -Wextra -nostdlib -fno-builtin -nostartfiles \
|
||||||
-nodefaultlibs -fno-stack-protector -nostdinc
|
-nodefaultlibs -fno-stack-protector -nostdinc
|
||||||
|
@ -85,19 +85,19 @@ libmaxsi-sortix.a: $(SORTIXOBJS)
|
||||||
ar rcs libmaxsi-sortix.a $(SORTIXOBJS)
|
ar rcs libmaxsi-sortix.a $(SORTIXOBJS)
|
||||||
|
|
||||||
libc.a: libmaxsi.a
|
libc.a: libmaxsi.a
|
||||||
ln -sf $< $@
|
ln -sf $< $@
|
||||||
|
|
||||||
libc.so: libmaxsi.so
|
libc.so: libmaxsi.so
|
||||||
ln -sf $< $@
|
ln -sf $< $@
|
||||||
|
|
||||||
libg.a: libc.a
|
libg.a: libc.a
|
||||||
ln -sf $< $@
|
ln -sf $< $@
|
||||||
|
|
||||||
libg.so: libc.so
|
libg.so: libc.so
|
||||||
ln -sf $< $@
|
ln -sf $< $@
|
||||||
|
|
||||||
start.o: $(CPU)/start.o
|
start.o: $(CPU)/start.o
|
||||||
ln -sf $< $@
|
ln -sf $< $@
|
||||||
|
|
||||||
# header preprocessing
|
# header preprocessing
|
||||||
$(HEADERDIRS):
|
$(HEADERDIRS):
|
||||||
|
@ -123,7 +123,7 @@ sortix:
|
||||||
mkdir -p sortix
|
mkdir -p sortix
|
||||||
|
|
||||||
sortix/%.o: %.cpp $(HEADERS) sortix
|
sortix/%.o: %.cpp $(HEADERS) sortix
|
||||||
g++ -c $< -o $@ $(CPPFLAGS) $(SORTIXCPPFLAGS) $(CXXFLAGS)
|
g++ -c $< -o $@ $(CPPFLAGS) $(SORTIXCPPFLAGS) $(CXXFLAGS)
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f *.o sortix/*.o c/*.o x86/*.o x64/*.o *.a *.so
|
rm -f *.o sortix/*.o c/*.o x86/*.o x64/*.o *.a *.so
|
||||||
|
|
|
@ -42,7 +42,7 @@ extern "C" uint64_t __udivdi3(uint64_t a, uint64_t b)
|
||||||
power *= 2;
|
power *= 2;
|
||||||
divisor *= 2;
|
divisor *= 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
while ( divisor <= remainder )
|
while ( divisor <= remainder )
|
||||||
{
|
{
|
||||||
remainder -= divisor;
|
remainder -= divisor;
|
||||||
|
@ -68,7 +68,7 @@ extern "C" uint64_t __umoddi3(uint64_t a, uint64_t b)
|
||||||
power *= 2;
|
power *= 2;
|
||||||
divisor *= 2;
|
divisor *= 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
while ( divisor <= remainder )
|
while ( divisor <= remainder )
|
||||||
{
|
{
|
||||||
remainder -= divisor;
|
remainder -= divisor;
|
||||||
|
|
|
@ -7,7 +7,7 @@ struct dirent;
|
||||||
#define _DIR_EOF (1<<2)
|
#define _DIR_EOF (1<<2)
|
||||||
typedef struct _DIR
|
typedef struct _DIR
|
||||||
{
|
{
|
||||||
void* user;
|
void* user;
|
||||||
int (*read_func)(void* user, struct dirent* dirent, size_t* size);
|
int (*read_func)(void* user, struct dirent* dirent, size_t* size);
|
||||||
int (*rewind_func)(void* user);
|
int (*rewind_func)(void* user);
|
||||||
int (*fd_func)(void* user);
|
int (*fd_func)(void* user);
|
||||||
|
|
|
@ -86,7 +86,7 @@ struct dirent* readdir(DIR* dir)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return dir->entry;
|
return dir->entry;
|
||||||
}
|
}
|
||||||
|
|
||||||
int closedir(DIR* dir)
|
int closedir(DIR* dir)
|
||||||
|
|
|
@ -41,7 +41,7 @@ namespace Maxsi
|
||||||
extern "C" void init_error_functions()
|
extern "C" void init_error_functions()
|
||||||
{
|
{
|
||||||
errno = 0;
|
errno = 0;
|
||||||
SysRegisterErrno(&errno);
|
SysRegisterErrno(&errno);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -196,7 +196,7 @@ namespace Maxsi
|
||||||
#ifdef PLATFORM_X64
|
#ifdef PLATFORM_X64
|
||||||
const nat WORDWIDTH = BIT64;
|
const nat WORDWIDTH = BIT64;
|
||||||
#else
|
#else
|
||||||
const nat WORDWIDTH = 0;
|
const nat WORDWIDTH = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// TODO: Support signed datatypes!
|
// TODO: Support signed datatypes!
|
||||||
|
|
|
@ -37,10 +37,10 @@
|
||||||
#define PARANOIA 1
|
#define PARANOIA 1
|
||||||
|
|
||||||
#ifdef SORTIX_KERNEL
|
#ifdef SORTIX_KERNEL
|
||||||
#include <sortix/platform.h>
|
#include <sortix/kernel/platform.h>
|
||||||
#include <sortix/log.h> // DEBUG
|
#include <sortix/kernel/log.h> // DEBUG
|
||||||
#include <sortix/memorymanagement.h>
|
#include <sortix/kernel/memorymanagement.h>
|
||||||
#include <sortix/panic.h>
|
#include <sortix/kernel/panic.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace Maxsi
|
namespace Maxsi
|
||||||
|
@ -649,7 +649,7 @@ namespace Maxsi
|
||||||
{
|
{
|
||||||
size_t total = nmemb * size;
|
size_t total = nmemb * size;
|
||||||
void* result = Allocate(total);
|
void* result = Allocate(total);
|
||||||
if ( !result ) { return NULL; }
|
if ( !result ) { return NULL; }
|
||||||
Memory::Set(result, 0, total);
|
Memory::Set(result, 0, total);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,7 @@ namespace Maxsi
|
||||||
namespace Format
|
namespace Format
|
||||||
{
|
{
|
||||||
typedef size_t (*Callback)(void* user, const char* string, size_t stringlen);
|
typedef size_t (*Callback)(void* user, const char* string, size_t stringlen);
|
||||||
|
|
||||||
size_t Virtual(Callback callback, void* user, const char* format, va_list parameters);
|
size_t Virtual(Callback callback, void* user, const char* format, va_list parameters);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,7 @@ namespace Maxsi
|
||||||
{
|
{
|
||||||
namespace IO
|
namespace IO
|
||||||
{
|
{
|
||||||
// TODO:
|
// TODO:
|
||||||
|
|
||||||
enum Seek_t { SEEK_SET, SEEK_CUR, SEEK_END };
|
enum Seek_t { SEEK_SET, SEEK_CUR, SEEK_END };
|
||||||
|
|
||||||
|
|
|
@ -68,7 +68,7 @@
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
|
||||||
#define ASSERT(invariant)
|
#define ASSERT(invariant)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -80,8 +80,8 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef SORTIX_KERNEL
|
#ifdef SORTIX_KERNEL
|
||||||
#include <sortix/platform.h>
|
#include <sortix/kernel/platform.h>
|
||||||
#include <sortix/log.h>
|
#include <sortix/kernel/log.h>
|
||||||
#include <sortix/panic.h>
|
#include <sortix/kernel/panic.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -108,7 +108,7 @@ namespace Maxsi
|
||||||
{
|
{
|
||||||
if ( buf[i] == c ) { return (void*) (buf + i); }
|
if ( buf[i] == c ) { return (void*) (buf + i); }
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,10 +29,10 @@ namespace Maxsi
|
||||||
namespace Random
|
namespace Random
|
||||||
{
|
{
|
||||||
unsigned random_seed = 1337;
|
unsigned random_seed = 1337;
|
||||||
extern "C" int rand()
|
extern "C" int rand()
|
||||||
{
|
{
|
||||||
random_seed = random_seed + 37 * 1103515245 + 12345;
|
random_seed = random_seed + 37 * 1103515245 + 12345;
|
||||||
return random_seed >> 16;
|
return random_seed >> 16;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -73,7 +73,7 @@ namespace Maxsi
|
||||||
|
|
||||||
extern "C" void SIG_IGN(int /*signum*/)
|
extern "C" void SIG_IGN(int /*signum*/)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" void SIG_ERR(int /*signum*/)
|
extern "C" void SIG_ERR(int /*signum*/)
|
||||||
|
@ -107,7 +107,7 @@ namespace Maxsi
|
||||||
// Tell the kernel which function we want called upon signals.
|
// Tell the kernel which function we want called upon signals.
|
||||||
SysRegisterSignalHandler(&SignalHandlerAssembly);
|
SysRegisterSignalHandler(&SignalHandlerAssembly);
|
||||||
}
|
}
|
||||||
|
|
||||||
Handler RegisterHandler(int signum, Handler handler)
|
Handler RegisterHandler(int signum, Handler handler)
|
||||||
{
|
{
|
||||||
if ( signum < 0 || MAX_SIGNALS <= signum ) { return SIG_ERR; }
|
if ( signum < 0 || MAX_SIGNALS <= signum ) { return SIG_ERR; }
|
||||||
|
|
|
@ -38,7 +38,7 @@ namespace Maxsi
|
||||||
size_t Result = 0;
|
size_t Result = 0;
|
||||||
|
|
||||||
while ( String[Result] != '\0' )
|
while ( String[Result] != '\0' )
|
||||||
{
|
{
|
||||||
Result++;
|
Result++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ namespace Maxsi
|
||||||
char* OriginalDest = Dest;
|
char* OriginalDest = Dest;
|
||||||
|
|
||||||
while ( *Src != '\0' )
|
while ( *Src != '\0' )
|
||||||
{
|
{
|
||||||
*Dest = *Src;
|
*Dest = *Src;
|
||||||
Dest++; Src++;
|
Dest++; Src++;
|
||||||
}
|
}
|
||||||
|
@ -82,7 +82,7 @@ namespace Maxsi
|
||||||
while ( *Dest != '\0' ) { Dest++; }
|
while ( *Dest != '\0' ) { Dest++; }
|
||||||
|
|
||||||
while ( *Src != '\0' )
|
while ( *Src != '\0' )
|
||||||
{
|
{
|
||||||
*Dest = *Src;
|
*Dest = *Src;
|
||||||
Dest++; Src++;
|
Dest++; Src++;
|
||||||
}
|
}
|
||||||
|
@ -164,7 +164,7 @@ namespace Maxsi
|
||||||
DUAL_FUNCTION(size_t, strspn, Accept, (const char* str, const char* accept))
|
DUAL_FUNCTION(size_t, strspn, Accept, (const char* str, const char* accept))
|
||||||
{
|
{
|
||||||
size_t acceptlen = 0;
|
size_t acceptlen = 0;
|
||||||
while ( accept[acceptlen] ) { acceptlen++; }
|
while ( accept[acceptlen] ) { acceptlen++; }
|
||||||
for ( size_t result = 0; true; result++ )
|
for ( size_t result = 0; true; result++ )
|
||||||
{
|
{
|
||||||
char c = str[result];
|
char c = str[result];
|
||||||
|
@ -183,7 +183,7 @@ namespace Maxsi
|
||||||
DUAL_FUNCTION(size_t, strcspn, Reject, (const char* str, const char* reject))
|
DUAL_FUNCTION(size_t, strcspn, Reject, (const char* str, const char* reject))
|
||||||
{
|
{
|
||||||
size_t rejectlen = 0;
|
size_t rejectlen = 0;
|
||||||
while ( reject[rejectlen] ) { rejectlen++; }
|
while ( reject[rejectlen] ) { rejectlen++; }
|
||||||
for ( size_t result = 0; true; result++ )
|
for ( size_t result = 0; true; result++ )
|
||||||
{
|
{
|
||||||
char c = str[result];
|
char c = str[result];
|
||||||
|
@ -339,7 +339,7 @@ namespace Maxsi
|
||||||
va_list param_pt;
|
va_list param_pt;
|
||||||
|
|
||||||
va_start(param_pt, NumParameters);
|
va_start(param_pt, NumParameters);
|
||||||
|
|
||||||
// First calculate the string length.
|
// First calculate the string length.
|
||||||
size_t ResultLength = 0;
|
size_t ResultLength = 0;
|
||||||
const char* TMP = 0;
|
const char* TMP = 0;
|
||||||
|
@ -372,7 +372,7 @@ namespace Maxsi
|
||||||
ResultOffset += TMPLength;
|
ResultOffset += TMPLength;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return Result;
|
return Result;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -66,7 +66,7 @@ namespace Maxsi
|
||||||
// Sortix will never run for that long time, and shouldn't it be unsigned long?
|
// Sortix will never run for that long time, and shouldn't it be unsigned long?
|
||||||
void Sleep(long Seconds)
|
void Sleep(long Seconds)
|
||||||
{
|
{
|
||||||
SysSleep(Seconds);
|
SysSleep(Seconds);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
along with LibMaxsi. If not, see <http://www.gnu.org/licenses/>.
|
along with LibMaxsi. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
start.s
|
start.s
|
||||||
A stub for linking to the C runtime on Sortix.
|
A stub for linking to the C runtime on Sortix.
|
||||||
|
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
along with LibMaxsi. If not, see <http://www.gnu.org/licenses/>.
|
along with LibMaxsi. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
start.s
|
start.s
|
||||||
A stub for linking to the C runtime on Sortix.
|
A stub for linking to the C runtime on Sortix.
|
||||||
|
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
CPPFLAGS=-I..
|
CPPFLAGS=-I../sortix/include
|
||||||
CXXFLAGS=-Wall
|
CXXFLAGS=-Wall
|
||||||
|
|
||||||
BINARIES=mkinitrd lsinitrd catinitrd
|
BINARIES=mkinitrd lsinitrd catinitrd
|
||||||
|
@ -12,4 +12,4 @@ clean:
|
||||||
rm -f $(BINARIES)
|
rm -f $(BINARIES)
|
||||||
|
|
||||||
install:
|
install:
|
||||||
|
|
||||||
|
|
|
@ -100,22 +100,22 @@ int main(int argc, char* argv[])
|
||||||
verbose = false;
|
verbose = false;
|
||||||
argv[i] = NULL;
|
argv[i] = NULL;
|
||||||
}
|
}
|
||||||
else if ( strcmp(argv[i], "-v") == 0 )
|
else if ( strcmp(argv[i], "-v") == 0 )
|
||||||
{
|
{
|
||||||
verbose = true;
|
verbose = true;
|
||||||
argv[i] = NULL;
|
argv[i] = NULL;
|
||||||
}
|
}
|
||||||
else if ( strcmp(argv[i], "--usage") == 0 )
|
else if ( strcmp(argv[i], "--usage") == 0 )
|
||||||
{
|
{
|
||||||
usage(argc, argv);
|
usage(argc, argv);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else if ( strcmp(argv[i], "--help") == 0 )
|
else if ( strcmp(argv[i], "--help") == 0 )
|
||||||
{
|
{
|
||||||
usage(argc, argv);
|
usage(argc, argv);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else if ( strcmp(argv[i], "--version") == 0 )
|
else if ( strcmp(argv[i], "--version") == 0 )
|
||||||
{
|
{
|
||||||
version();
|
version();
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -184,7 +184,7 @@ int main(int argc, char* argv[])
|
||||||
|
|
||||||
const size_t BUFFER_SIZE = 16384UL;
|
const size_t BUFFER_SIZE = 16384UL;
|
||||||
uint8_t buffer[BUFFER_SIZE];
|
uint8_t buffer[BUFFER_SIZE];
|
||||||
|
|
||||||
uint32_t filesize = fileheader.size;
|
uint32_t filesize = fileheader.size;
|
||||||
uint32_t readsofar = 0;
|
uint32_t readsofar = 0;
|
||||||
while ( readsofar < filesize )
|
while ( readsofar < filesize )
|
||||||
|
|
|
@ -120,22 +120,22 @@ int main(int argc, char* argv[])
|
||||||
verbose = false;
|
verbose = false;
|
||||||
argv[i] = NULL;
|
argv[i] = NULL;
|
||||||
}
|
}
|
||||||
else if ( strcmp(argv[i], "-v") == 0 )
|
else if ( strcmp(argv[i], "-v") == 0 )
|
||||||
{
|
{
|
||||||
verbose = true;
|
verbose = true;
|
||||||
argv[i] = NULL;
|
argv[i] = NULL;
|
||||||
}
|
}
|
||||||
else if ( strcmp(argv[i], "--usage") == 0 )
|
else if ( strcmp(argv[i], "--usage") == 0 )
|
||||||
{
|
{
|
||||||
usage(argc, argv);
|
usage(argc, argv);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else if ( strcmp(argv[i], "--help") == 0 )
|
else if ( strcmp(argv[i], "--help") == 0 )
|
||||||
{
|
{
|
||||||
usage(argc, argv);
|
usage(argc, argv);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else if ( strcmp(argv[i], "--version") == 0 )
|
else if ( strcmp(argv[i], "--version") == 0 )
|
||||||
{
|
{
|
||||||
version();
|
version();
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -107,22 +107,22 @@ int main(int argc, char* argv[])
|
||||||
verbose = false;
|
verbose = false;
|
||||||
argv[i] = NULL;
|
argv[i] = NULL;
|
||||||
}
|
}
|
||||||
else if ( strcmp(argv[i], "-v") == 0 )
|
else if ( strcmp(argv[i], "-v") == 0 )
|
||||||
{
|
{
|
||||||
verbose = true;
|
verbose = true;
|
||||||
argv[i] = NULL;
|
argv[i] = NULL;
|
||||||
}
|
}
|
||||||
else if ( strcmp(argv[i], "--usage") == 0 )
|
else if ( strcmp(argv[i], "--usage") == 0 )
|
||||||
{
|
{
|
||||||
usage(argc, argv);
|
usage(argc, argv);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else if ( strcmp(argv[i], "--help") == 0 )
|
else if ( strcmp(argv[i], "--help") == 0 )
|
||||||
{
|
{
|
||||||
usage(argc, argv);
|
usage(argc, argv);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else if ( strcmp(argv[i], "--version") == 0 )
|
else if ( strcmp(argv[i], "--version") == 0 )
|
||||||
{
|
{
|
||||||
version();
|
version();
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -69,7 +69,7 @@ ifdef VERSION
|
||||||
DEFINES:=$(DEFINES) -DVERSIONSTR=\"$(VERSION)\"
|
DEFINES:=$(DEFINES) -DVERSIONSTR=\"$(VERSION)\"
|
||||||
endif
|
endif
|
||||||
|
|
||||||
INCLUDES=-I../libmaxsi/preproc -I.. -I.
|
INCLUDES=-I. -Iinclude -I../libmaxsi/preproc
|
||||||
CPPFLAGS=$(INCLUDES) $(DEFINES)
|
CPPFLAGS=$(INCLUDES) $(DEFINES)
|
||||||
FLAGSRELEASE=-s $(O)
|
FLAGSRELEASE=-s $(O)
|
||||||
FLAGSDEBUG=
|
FLAGSDEBUG=
|
||||||
|
@ -83,17 +83,8 @@ NASMFLAGS=$(CPUNASMFLAGS)
|
||||||
STATICLIBS=\
|
STATICLIBS=\
|
||||||
../libmaxsi/libmaxsi-sortix.a \
|
../libmaxsi/libmaxsi-sortix.a \
|
||||||
|
|
||||||
PUBLICHEADERS=\
|
HEADERDIRS:=$(shell find include -type d)
|
||||||
$(CPU)/bits.h \
|
HEADERS:=$(shell find include -type f)
|
||||||
fcntl.h \
|
|
||||||
initrd.h \
|
|
||||||
seek.h \
|
|
||||||
keycodes.h \
|
|
||||||
termmode.h \
|
|
||||||
syscallnum.h \
|
|
||||||
stat.h \
|
|
||||||
timeval.h \
|
|
||||||
unistd.h \
|
|
||||||
|
|
||||||
OBJS=$(CPUOBJS) \
|
OBJS=$(CPUOBJS) \
|
||||||
kernel.o \
|
kernel.o \
|
||||||
|
@ -185,8 +176,10 @@ clean:
|
||||||
|
|
||||||
# Installation into sysroot
|
# Installation into sysroot
|
||||||
install:
|
install:
|
||||||
mkdir -p $(SYSROOT)/usr/include/sortix
|
for DIR in $(HEADERDIRS); do \
|
||||||
for FILE in $(PUBLICHEADERS); do \
|
mkdir -p $(SYSROOT)/usr/$$DIR; \
|
||||||
cp $$FILE $(SYSROOT)/usr/include/sortix/`basename $$FILE`; \
|
done
|
||||||
|
for FILE in $(HEADERS); do \
|
||||||
|
cp $$FILE $(SYSROOT)/usr/$$FILE; \
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,8 @@
|
||||||
|
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
#include "platform.h"
|
#include <sortix/kernel/platform.h>
|
||||||
|
#include "cpu.h"
|
||||||
#include <libmaxsi/error.h>
|
#include <libmaxsi/error.h>
|
||||||
#include <libmaxsi/memory.h>
|
#include <libmaxsi/memory.h>
|
||||||
#include "ata.h"
|
#include "ata.h"
|
||||||
|
@ -344,13 +345,13 @@ namespace Sortix
|
||||||
if ( !WriteSector(byteoffset/sectorsize, src + sofar) ) { return sofar; }
|
if ( !WriteSector(byteoffset/sectorsize, src + sofar) ) { return sofar; }
|
||||||
sofar += sectorsize;
|
sofar += sectorsize;
|
||||||
numbytes -= sectorsize;
|
numbytes -= sectorsize;
|
||||||
byteoffset += sectorsize;
|
byteoffset += sectorsize;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( numbytes ) { return sofar + Write(byteoffset, src + sofar, numbytes); }
|
if ( numbytes ) { return sofar + Write(byteoffset, src + sofar, numbytes); }
|
||||||
return sofar;
|
return sofar;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ATADrive::Initialize()
|
void ATADrive::Initialize()
|
||||||
{
|
{
|
||||||
bus->SelectDrive(driveid);
|
bus->SelectDrive(driveid);
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
#include "platform.h"
|
#include <sortix/kernel/platform.h>
|
||||||
#include "calltrace.h"
|
#include "calltrace.h"
|
||||||
|
|
||||||
namespace Sortix {
|
namespace Sortix {
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
#include "platform.h"
|
#include <sortix/kernel/platform.h>
|
||||||
#include <libmaxsi/error.h>
|
#include <libmaxsi/error.h>
|
||||||
#include "interrupt.h"
|
#include "interrupt.h"
|
||||||
#include "event.h"
|
#include "event.h"
|
||||||
|
|
|
@ -0,0 +1,38 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
|
||||||
|
COPYRIGHT(C) JONAS 'SORTIE' TERMANSEN 2011, 2012.
|
||||||
|
|
||||||
|
This file is part of Sortix.
|
||||||
|
|
||||||
|
Sortix is free software: you can redistribute it and/or modify it under the
|
||||||
|
terms of the GNU General Public License as published by the Free Software
|
||||||
|
Foundation, either version 3 of the License, or (at your option) any later
|
||||||
|
version.
|
||||||
|
|
||||||
|
Sortix is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
|
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||||
|
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||||
|
details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License along with
|
||||||
|
Sortix. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
cpu.h
|
||||||
|
Includes CPU-specific headers.
|
||||||
|
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
|
#ifndef SORTIX_CPU_H
|
||||||
|
#define SORTIX_CPU_H
|
||||||
|
|
||||||
|
// Include some x86 headers.
|
||||||
|
#ifdef PLATFORM_X86
|
||||||
|
#include "x86/x86.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Include some x64 headers.
|
||||||
|
#ifdef PLATFORM_X64
|
||||||
|
#include "x64/x64.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
#include "platform.h"
|
#include <sortix/kernel/platform.h>
|
||||||
#include <libmaxsi/memory.h>
|
#include <libmaxsi/memory.h>
|
||||||
#include "descriptors.h"
|
#include "descriptors.h"
|
||||||
#include "device.h"
|
#include "device.h"
|
||||||
|
|
|
@ -42,7 +42,7 @@ namespace Sortix
|
||||||
~DescriptorTable();
|
~DescriptorTable();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int numdevices;
|
int numdevices;
|
||||||
DescriptorEntry* devices;
|
DescriptorEntry* devices;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
#include "platform.h"
|
#include <sortix/kernel/platform.h>
|
||||||
#include <libmaxsi/memory.h>
|
#include <libmaxsi/memory.h>
|
||||||
#include "device.h"
|
#include "device.h"
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ namespace Sortix
|
||||||
|
|
||||||
Device::~Device()
|
Device::~Device()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Device::Unref()
|
void Device::Unref()
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
#include "platform.h"
|
#include <sortix/kernel/platform.h>
|
||||||
#include <libmaxsi/error.h>
|
#include <libmaxsi/error.h>
|
||||||
#include <libmaxsi/memory.h>
|
#include <libmaxsi/memory.h>
|
||||||
#include <libmaxsi/string.h>
|
#include <libmaxsi/string.h>
|
||||||
|
|
|
@ -22,12 +22,12 @@
|
||||||
|
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
#include "platform.h"
|
#include <sortix/kernel/platform.h>
|
||||||
#include <libmaxsi/error.h>
|
#include <libmaxsi/error.h>
|
||||||
#include <libmaxsi/memory.h>
|
#include <libmaxsi/memory.h>
|
||||||
#include "elf.h"
|
#include "elf.h"
|
||||||
#include "memorymanagement.h"
|
#include <sortix/kernel/memorymanagement.h>
|
||||||
#include "panic.h"
|
#include <sortix/kernel/panic.h>
|
||||||
#include "process.h"
|
#include "process.h"
|
||||||
|
|
||||||
using namespace Maxsi;
|
using namespace Maxsi;
|
||||||
|
@ -232,7 +232,7 @@ namespace Sortix
|
||||||
return Construct64(process, file, filelen);
|
return Construct64(process, file, filelen);
|
||||||
default:
|
default:
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
|
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
#include "platform.h"
|
#include <sortix/kernel/platform.h>
|
||||||
|
|
||||||
namespace Sortix
|
namespace Sortix
|
||||||
{
|
{
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
#include "platform.h"
|
#include <sortix/kernel/platform.h>
|
||||||
#include "thread.h"
|
#include "thread.h"
|
||||||
#include "syscall.h"
|
#include "syscall.h"
|
||||||
#include "event.h"
|
#include "event.h"
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
#include "platform.h"
|
#include <sortix/kernel/platform.h>
|
||||||
#include <libmaxsi/error.h>
|
#include <libmaxsi/error.h>
|
||||||
#include <libmaxsi/memory.h>
|
#include <libmaxsi/memory.h>
|
||||||
#include <libmaxsi/string.h>
|
#include <libmaxsi/string.h>
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
#include "../platform.h"
|
#include <sortix/kernel/platform.h>
|
||||||
#include <libmaxsi/error.h>
|
#include <libmaxsi/error.h>
|
||||||
#include <libmaxsi/string.h>
|
#include <libmaxsi/string.h>
|
||||||
#include <libmaxsi/memory.h>
|
#include <libmaxsi/memory.h>
|
||||||
|
|
|
@ -34,7 +34,7 @@ namespace Sortix
|
||||||
|
|
||||||
class DevDevFS : public DevFileSystem
|
class DevDevFS : public DevFileSystem
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
DevDevFS();
|
DevDevFS();
|
||||||
virtual ~DevDevFS();
|
virtual ~DevDevFS();
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
#include "../platform.h"
|
#include <sortix/kernel/platform.h>
|
||||||
#include <libmaxsi/error.h>
|
#include <libmaxsi/error.h>
|
||||||
#include <libmaxsi/string.h>
|
#include <libmaxsi/string.h>
|
||||||
#include <libmaxsi/memory.h>
|
#include <libmaxsi/memory.h>
|
||||||
|
@ -66,7 +66,7 @@ namespace Sortix
|
||||||
virtual bool IsWritable();
|
virtual bool IsWritable();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
DevInitFSFile::DevInitFSFile(char* name, const byte* buffer, size_t buffersize)
|
DevInitFSFile::DevInitFSFile(char* name, const byte* buffer, size_t buffersize)
|
||||||
{
|
{
|
||||||
this->name = name;
|
this->name = name;
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
#include "../platform.h"
|
#include <sortix/kernel/platform.h>
|
||||||
#include <libmaxsi/error.h>
|
#include <libmaxsi/error.h>
|
||||||
#include <libmaxsi/string.h>
|
#include <libmaxsi/string.h>
|
||||||
#include <libmaxsi/memory.h>
|
#include <libmaxsi/memory.h>
|
||||||
|
@ -66,7 +66,7 @@ namespace Sortix
|
||||||
virtual bool IsWritable();
|
virtual bool IsWritable();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
DevRAMFSFile::DevRAMFSFile(char* name)
|
DevRAMFSFile::DevRAMFSFile(char* name)
|
||||||
{
|
{
|
||||||
this->name = name;
|
this->name = name;
|
||||||
|
|
|
@ -34,7 +34,7 @@ namespace Sortix
|
||||||
|
|
||||||
class DevRAMFS : public DevFileSystem
|
class DevRAMFS : public DevFileSystem
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
DevRAMFS();
|
DevRAMFS();
|
||||||
virtual ~DevRAMFS();
|
virtual ~DevRAMFS();
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,59 @@
|
||||||
|
/******************************************************************************
|
||||||
|
|
||||||
|
COPYRIGHT(C) JONAS 'SORTIE' TERMANSEN 2011.
|
||||||
|
|
||||||
|
This file is part of Sortix.
|
||||||
|
|
||||||
|
Sortix is free software: you can redistribute it and/or modify it under the
|
||||||
|
terms of the GNU General Public License as published by the Free Software
|
||||||
|
Foundation, either version 3 of the License, or (at your option) any later
|
||||||
|
version.
|
||||||
|
|
||||||
|
Sortix is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
|
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||||
|
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||||
|
details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License along
|
||||||
|
with Sortix. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
initrd.h
|
||||||
|
Declares the structure of the Sortix ramdisk.
|
||||||
|
|
||||||
|
******************************************************************************/
|
||||||
|
|
||||||
|
#ifndef SORTIX_INITRD_H
|
||||||
|
#define SORTIX_INITRD_H
|
||||||
|
|
||||||
|
namespace Sortix
|
||||||
|
{
|
||||||
|
namespace InitRD
|
||||||
|
{
|
||||||
|
struct Header;
|
||||||
|
struct FileHeader;
|
||||||
|
|
||||||
|
struct Header
|
||||||
|
{
|
||||||
|
char magic[16]; // Contains "sortix-initrd-1"
|
||||||
|
uint32_t numfiles;
|
||||||
|
// FileHeader[numfiles];
|
||||||
|
};
|
||||||
|
|
||||||
|
struct FileHeader
|
||||||
|
{
|
||||||
|
mode_t permissions;
|
||||||
|
uid_t owner;
|
||||||
|
gid_t group;
|
||||||
|
uint32_t size;
|
||||||
|
uint32_t offset; // where the physical data is located.
|
||||||
|
char name[128];
|
||||||
|
};
|
||||||
|
|
||||||
|
struct Trailer
|
||||||
|
{
|
||||||
|
uint8_t sum; // sum of all bytes but the trailer.
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
|
@ -36,7 +36,7 @@ namespace Sortix
|
||||||
extern void* devicePointer;
|
extern void* devicePointer;
|
||||||
|
|
||||||
void Init(Maxsi::Format::Callback callback, void* user);
|
void Init(Maxsi::Format::Callback callback, void* user);
|
||||||
|
|
||||||
inline void Flush()
|
inline void Flush()
|
||||||
{
|
{
|
||||||
if ( deviceCallback ) { deviceCallback(devicePointer, NULL, 0); }
|
if ( deviceCallback ) { deviceCallback(devicePointer, NULL, 0); }
|
||||||
|
@ -52,7 +52,7 @@ namespace Sortix
|
||||||
inline size_t PrintData(const void* ptr, size_t size)
|
inline size_t PrintData(const void* ptr, size_t size)
|
||||||
{
|
{
|
||||||
if ( !deviceCallback ) { return 0; }
|
if ( !deviceCallback ) { return 0; }
|
||||||
return deviceCallback(devicePointer, (const char*) ptr, size);
|
return deviceCallback(devicePointer, (const char*) ptr, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline size_t PrintF(const char* format, ...)
|
inline size_t PrintF(const char* format, ...)
|
|
@ -68,15 +68,5 @@
|
||||||
|
|
||||||
#define USER
|
#define USER
|
||||||
|
|
||||||
// Include some x86 headers.
|
|
||||||
#ifdef PLATFORM_X86
|
|
||||||
#include "x86/x86.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Include some x64 headers.
|
|
||||||
#ifdef PLATFORM_X64
|
|
||||||
#include "x64/x64.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -22,14 +22,15 @@
|
||||||
|
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
#include "platform.h"
|
#include <sortix/kernel/platform.h>
|
||||||
|
#include <sortix/initrd.h>
|
||||||
#include "initrd.h"
|
#include "initrd.h"
|
||||||
#include <libmaxsi/memory.h>
|
#include <libmaxsi/memory.h>
|
||||||
#include <libmaxsi/string.h>
|
#include <libmaxsi/string.h>
|
||||||
#include "syscall.h"
|
#include "syscall.h"
|
||||||
#include "memorymanagement.h"
|
#include <sortix/kernel/memorymanagement.h>
|
||||||
|
|
||||||
#include "log.h" // DEBUG
|
#include <sortix/kernel/log.h> // DEBUG
|
||||||
|
|
||||||
using namespace Maxsi;
|
using namespace Maxsi;
|
||||||
|
|
||||||
|
|
|
@ -22,44 +22,17 @@
|
||||||
|
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
#ifndef SORTIX_INITRD_H
|
#ifndef SORTIX_INITRD_KERNEL_H
|
||||||
#define SORTIX_INITRD_H
|
#define SORTIX_INITRD_KERNEL_H
|
||||||
|
|
||||||
namespace Sortix
|
namespace Sortix
|
||||||
{
|
{
|
||||||
namespace InitRD
|
namespace InitRD
|
||||||
{
|
{
|
||||||
struct Header;
|
|
||||||
struct FileHeader;
|
|
||||||
|
|
||||||
struct Header
|
|
||||||
{
|
|
||||||
char magic[16]; // Contains "sortix-initrd-1"
|
|
||||||
uint32_t numfiles;
|
|
||||||
// FileHeader[numfiles];
|
|
||||||
};
|
|
||||||
|
|
||||||
struct FileHeader
|
|
||||||
{
|
|
||||||
mode_t permissions;
|
|
||||||
uid_t owner;
|
|
||||||
gid_t group;
|
|
||||||
uint32_t size;
|
|
||||||
uint32_t offset; // where the physical data is located.
|
|
||||||
char name[128];
|
|
||||||
};
|
|
||||||
|
|
||||||
struct Trailer
|
|
||||||
{
|
|
||||||
uint8_t sum; // sum of all bytes but the trailer.
|
|
||||||
};
|
|
||||||
|
|
||||||
#ifdef SORTIX_KERNEL
|
|
||||||
void Init(addr_t phys, size_t size);
|
void Init(addr_t phys, size_t size);
|
||||||
byte* Open(const char* filepath, size_t* size);
|
byte* Open(const char* filepath, size_t* size);
|
||||||
const char* GetFilename(size_t index);
|
const char* GetFilename(size_t index);
|
||||||
size_t GetNumFiles();
|
size_t GetNumFiles();
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
#include "platform.h"
|
#include <sortix/kernel/platform.h>
|
||||||
#include "x86-family/idt.h"
|
#include "x86-family/idt.h"
|
||||||
#include "interrupt.h"
|
#include "interrupt.h"
|
||||||
|
|
||||||
|
@ -251,7 +251,7 @@ void IRQHandler(Sortix::CPU::InterruptRegisters* regs)
|
||||||
unsigned int_no = regs->int_no;
|
unsigned int_no = regs->int_no;
|
||||||
|
|
||||||
// Send an EOI (end of interrupt) signal to the PICs.
|
// Send an EOI (end of interrupt) signal to the PICs.
|
||||||
if ( IRQ8 <= int_no ) { CPU::OutPortB(PIC_SLAVE, PIC_CMD_ENDINTR); }
|
if ( IRQ8 <= int_no ) { CPU::OutPortB(PIC_SLAVE, PIC_CMD_ENDINTR); }
|
||||||
CPU::OutPortB(PIC_MASTER, PIC_CMD_ENDINTR);
|
CPU::OutPortB(PIC_MASTER, PIC_CMD_ENDINTR);
|
||||||
|
|
||||||
if ( interrupthandlers[int_no] )
|
if ( interrupthandlers[int_no] )
|
||||||
|
|
|
@ -25,6 +25,8 @@
|
||||||
#ifndef SORTIX_INTERRUPT_H
|
#ifndef SORTIX_INTERRUPT_H
|
||||||
#define SORTIX_INTERRUPT_H
|
#define SORTIX_INTERRUPT_H
|
||||||
|
|
||||||
|
#include "cpu.h"
|
||||||
|
|
||||||
namespace Sortix {
|
namespace Sortix {
|
||||||
namespace Interrupt {
|
namespace Interrupt {
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
#include "platform.h"
|
#include <sortix/kernel/platform.h>
|
||||||
#include <libmaxsi/error.h>
|
#include <libmaxsi/error.h>
|
||||||
#include <sortix/seek.h>
|
#include <sortix/seek.h>
|
||||||
#include "thread.h"
|
#include "thread.h"
|
||||||
|
@ -115,7 +115,7 @@ namespace Sortix
|
||||||
|
|
||||||
// Now go do something else.
|
// Now go do something else.
|
||||||
Syscall::Incomplete();
|
Syscall::Incomplete();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SysSeek(int fd, off_t* offset, int whence)
|
void SysSeek(int fd, off_t* offset, int whence)
|
||||||
|
|
|
@ -22,9 +22,9 @@
|
||||||
|
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
#include "../../platform.h"
|
#include <sortix/kernel/platform.h>
|
||||||
#include "../../keyboard.h"
|
#include "../../keyboard.h"
|
||||||
#include "../../keycodes.h"
|
#include <sortix/keycodes.h>
|
||||||
#include "us.h"
|
#include "us.h"
|
||||||
|
|
||||||
namespace Sortix
|
namespace Sortix
|
||||||
|
|
|
@ -35,7 +35,7 @@ namespace Sortix
|
||||||
KBLayoutUS();
|
KBLayoutUS();
|
||||||
virtual ~KBLayoutUS();
|
virtual ~KBLayoutUS();
|
||||||
virtual uint32_t Translate(int kbkey);
|
virtual uint32_t Translate(int kbkey);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
bool ProcessModifier(int kbkey, int modkey, unsigned flag);
|
bool ProcessModifier(int kbkey, int modkey, unsigned flag);
|
||||||
|
|
||||||
|
|
|
@ -22,11 +22,11 @@
|
||||||
|
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
#include "../platform.h"
|
#include <sortix/kernel/platform.h>
|
||||||
#include <libmaxsi/memory.h>
|
#include <libmaxsi/memory.h>
|
||||||
#include "../interrupt.h"
|
#include "../interrupt.h"
|
||||||
#include "../keyboard.h"
|
#include "../keyboard.h"
|
||||||
#include "../keycodes.h"
|
#include <sortix/keycodes.h>
|
||||||
#include "ps2.h"
|
#include "ps2.h"
|
||||||
|
|
||||||
using namespace Maxsi;
|
using namespace Maxsi;
|
||||||
|
|
|
@ -19,22 +19,22 @@
|
||||||
|
|
||||||
kernel.cpp
|
kernel.cpp
|
||||||
The main kernel initialization routine. Configures hardware and starts an
|
The main kernel initialization routine. Configures hardware and starts an
|
||||||
initial process from the init ramdisk, allowing a full operating system.
|
initial process from the init ramdisk, allowing a full operating system.
|
||||||
|
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
#include "platform.h"
|
#include <sortix/kernel/platform.h>
|
||||||
#include <libmaxsi/memory.h>
|
#include <libmaxsi/memory.h>
|
||||||
#include <libmaxsi/string.h>
|
#include <libmaxsi/string.h>
|
||||||
#include <libmaxsi/format.h>
|
#include <libmaxsi/format.h>
|
||||||
#include "log.h"
|
#include <sortix/kernel/log.h>
|
||||||
#include "panic.h"
|
#include <sortix/kernel/panic.h>
|
||||||
#include "kernelinfo.h"
|
#include "kernelinfo.h"
|
||||||
#include "x86-family/gdt.h"
|
#include "x86-family/gdt.h"
|
||||||
#include "time.h"
|
#include "time.h"
|
||||||
#include "keyboard.h"
|
#include "keyboard.h"
|
||||||
#include "multiboot.h"
|
#include "multiboot.h"
|
||||||
#include "memorymanagement.h"
|
#include <sortix/kernel/memorymanagement.h>
|
||||||
#include "thread.h"
|
#include "thread.h"
|
||||||
#include "process.h"
|
#include "process.h"
|
||||||
#include "scheduler.h"
|
#include "scheduler.h"
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
#include "platform.h"
|
#include <sortix/kernel/platform.h>
|
||||||
#include <libmaxsi/error.h>
|
#include <libmaxsi/error.h>
|
||||||
#include <libmaxsi/string.h>
|
#include <libmaxsi/string.h>
|
||||||
#include "syscall.h"
|
#include "syscall.h"
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
#include "platform.h"
|
#include <sortix/kernel/platform.h>
|
||||||
#include "interrupt.h"
|
#include "interrupt.h"
|
||||||
#include "syscall.h"
|
#include "syscall.h"
|
||||||
#include "keyboard.h"
|
#include "keyboard.h"
|
||||||
|
|
|
@ -47,14 +47,14 @@ namespace Sortix
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual ~KeyboardOwner() { }
|
virtual ~KeyboardOwner() { }
|
||||||
virtual void OnKeystroke(Keyboard* keyboard, void* user) = 0;
|
virtual void OnKeystroke(Keyboard* keyboard, void* user) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
class KeyboardLayout
|
class KeyboardLayout
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual ~KeyboardLayout() { }
|
virtual ~KeyboardLayout() { }
|
||||||
virtual uint32_t Translate(int kbkey) = 0;
|
virtual uint32_t Translate(int kbkey) = 0;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
#include "platform.h"
|
#include <sortix/kernel/platform.h>
|
||||||
#include <libmaxsi/memory.h>
|
#include <libmaxsi/memory.h>
|
||||||
#include "linebuffer.h"
|
#include "linebuffer.h"
|
||||||
|
|
||||||
|
|
|
@ -22,10 +22,10 @@
|
||||||
|
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
#include "platform.h"
|
#include <sortix/kernel/platform.h>
|
||||||
#include <libmaxsi/string.h>
|
#include <libmaxsi/string.h>
|
||||||
#include <libmaxsi/memory.h>
|
#include <libmaxsi/memory.h>
|
||||||
#include "log.h"
|
#include <sortix/kernel/log.h>
|
||||||
#include "syscall.h"
|
#include "syscall.h"
|
||||||
|
|
||||||
using namespace Maxsi;
|
using namespace Maxsi;
|
||||||
|
|
|
@ -22,13 +22,13 @@
|
||||||
|
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
#include "platform.h"
|
#include <sortix/kernel/platform.h>
|
||||||
#include <libmaxsi/error.h>
|
#include <libmaxsi/error.h>
|
||||||
#include <libmaxsi/memory.h>
|
#include <libmaxsi/memory.h>
|
||||||
#include "utf8.h"
|
#include "utf8.h"
|
||||||
#include "keyboard.h"
|
#include "keyboard.h"
|
||||||
#include "scheduler.h"
|
#include "scheduler.h"
|
||||||
#include "keycodes.h"
|
#include <sortix/keycodes.h>
|
||||||
#include "terminal.h"
|
#include "terminal.h"
|
||||||
#include "logterminal.h"
|
#include "logterminal.h"
|
||||||
|
|
||||||
|
|
|
@ -22,10 +22,10 @@
|
||||||
|
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
#include "platform.h"
|
#include <sortix/kernel/platform.h>
|
||||||
#include <libmaxsi/memory.h>
|
#include <libmaxsi/memory.h>
|
||||||
#include <libmaxsi/string.h>
|
#include <libmaxsi/string.h>
|
||||||
#include "panic.h"
|
#include <sortix/kernel/panic.h>
|
||||||
#include "mount.h"
|
#include "mount.h"
|
||||||
#include "fs/ramfs.h"
|
#include "fs/ramfs.h"
|
||||||
#include "fs/initfs.h"
|
#include "fs/initfs.h"
|
||||||
|
|
|
@ -22,12 +22,12 @@
|
||||||
|
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
#include "platform.h"
|
#include <sortix/kernel/platform.h>
|
||||||
#include <libmaxsi/string.h>
|
#include <libmaxsi/string.h>
|
||||||
#include <libmaxsi/memory.h>
|
#include <libmaxsi/memory.h>
|
||||||
#include "log.h"
|
#include <sortix/kernel/log.h>
|
||||||
#include "calltrace.h"
|
#include "calltrace.h"
|
||||||
#include "panic.h"
|
#include <sortix/kernel/panic.h>
|
||||||
|
|
||||||
using namespace Maxsi;
|
using namespace Maxsi;
|
||||||
|
|
||||||
|
|
|
@ -22,10 +22,11 @@
|
||||||
|
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
#include "platform.h"
|
#include <sortix/kernel/platform.h>
|
||||||
|
#include "cpu.h"
|
||||||
#include <libmaxsi/error.h>
|
#include <libmaxsi/error.h>
|
||||||
#include "pci.h"
|
#include "pci.h"
|
||||||
#include "log.h"
|
#include <sortix/kernel/log.h>
|
||||||
#include "ata.h"
|
#include "ata.h"
|
||||||
|
|
||||||
using namespace Maxsi;
|
using namespace Maxsi;
|
||||||
|
@ -36,7 +37,7 @@ namespace Sortix
|
||||||
{
|
{
|
||||||
const uint16_t Config_Address = 0xCF8;
|
const uint16_t Config_Address = 0xCF8;
|
||||||
const uint16_t Config_Data = 0xCFC;
|
const uint16_t Config_Data = 0xCFC;
|
||||||
|
|
||||||
uint32_t SwapBytes(uint32_t I)
|
uint32_t SwapBytes(uint32_t I)
|
||||||
{
|
{
|
||||||
return (I >> 24) | ((I >> 8) & 0x0000FF00) | ((I << 8) & 0x00FF0000) | (I << 24);
|
return (I >> 24) | ((I >> 8) & 0x0000FF00) | ((I << 8) & 0x00FF0000) | (I << 24);
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
#include "platform.h"
|
#include <sortix/kernel/platform.h>
|
||||||
#include <libmaxsi/error.h>
|
#include <libmaxsi/error.h>
|
||||||
#include <libmaxsi/memory.h>
|
#include <libmaxsi/memory.h>
|
||||||
#include "event.h"
|
#include "event.h"
|
||||||
|
@ -247,7 +247,7 @@ namespace Sortix
|
||||||
int SysPipe(int pipefd[2])
|
int SysPipe(int pipefd[2])
|
||||||
{
|
{
|
||||||
// TODO: Validate that pipefd is a valid user-space array!
|
// TODO: Validate that pipefd is a valid user-space array!
|
||||||
|
|
||||||
size_t buffersize = BUFFER_SIZE;
|
size_t buffersize = BUFFER_SIZE;
|
||||||
byte* buffer = new byte[buffersize];
|
byte* buffer = new byte[buffersize];
|
||||||
if ( !buffer ) { return -1; /* TODO: ENOMEM */ }
|
if ( !buffer ) { return -1; /* TODO: ENOMEM */ }
|
||||||
|
@ -271,7 +271,7 @@ namespace Sortix
|
||||||
if ( 0 <= readfd ) { process->descriptors.Free(readfd); } else { delete reading; }
|
if ( 0 <= readfd ) { process->descriptors.Free(readfd); } else { delete reading; }
|
||||||
if ( 0 <= writefd ) { process->descriptors.Free(writefd); } else { delete writing; }
|
if ( 0 <= writefd ) { process->descriptors.Free(writefd); } else { delete writing; }
|
||||||
|
|
||||||
return -1; /* TODO: ENOMEM/EMFILE/ENFILE */
|
return -1; /* TODO: ENOMEM/EMFILE/ENFILE */
|
||||||
}
|
}
|
||||||
|
|
||||||
pipefd[0] = readfd;
|
pipefd[0] = readfd;
|
||||||
|
|
|
@ -33,7 +33,7 @@ namespace Sortix
|
||||||
namespace Pipe
|
namespace Pipe
|
||||||
{
|
{
|
||||||
void Init();
|
void Init();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
#include "platform.h"
|
#include <sortix/kernel/platform.h>
|
||||||
#include <libmaxsi/error.h>
|
#include <libmaxsi/error.h>
|
||||||
#include <libmaxsi/memory.h>
|
#include <libmaxsi/memory.h>
|
||||||
#include <libmaxsi/string.h>
|
#include <libmaxsi/string.h>
|
||||||
|
@ -34,7 +34,7 @@
|
||||||
#include "filesystem.h"
|
#include "filesystem.h"
|
||||||
#include "directory.h"
|
#include "directory.h"
|
||||||
#include "scheduler.h"
|
#include "scheduler.h"
|
||||||
#include "memorymanagement.h"
|
#include <sortix/kernel/memorymanagement.h>
|
||||||
#include "initrd.h"
|
#include "initrd.h"
|
||||||
#include "elf.h"
|
#include "elf.h"
|
||||||
#include "syscall.h"
|
#include "syscall.h"
|
||||||
|
@ -116,7 +116,7 @@ namespace Sortix
|
||||||
|
|
||||||
// Avoid memory leaks.
|
// Avoid memory leaks.
|
||||||
ASSERT(segments == NULL);
|
ASSERT(segments == NULL);
|
||||||
|
|
||||||
delete[] workingdir;
|
delete[] workingdir;
|
||||||
|
|
||||||
// TODO: Delete address space!
|
// TODO: Delete address space!
|
||||||
|
@ -220,7 +220,7 @@ namespace Sortix
|
||||||
{
|
{
|
||||||
Thread* result = NULL;
|
Thread* result = NULL;
|
||||||
Thread* tmpclone = NULL;
|
Thread* tmpclone = NULL;
|
||||||
|
|
||||||
for ( Thread* tmp = firstthread; tmp != NULL; tmp = tmp->nextsibling )
|
for ( Thread* tmp = firstthread; tmp != NULL; tmp = tmp->nextsibling )
|
||||||
{
|
{
|
||||||
Thread* clonethread = tmp->Fork();
|
Thread* clonethread = tmp->Fork();
|
||||||
|
@ -324,7 +324,7 @@ namespace Sortix
|
||||||
for ( int i = 0; i < argc; i++ ) { delete[] argv[i]; }
|
for ( int i = 0; i < argc; i++ ) { delete[] argv[i]; }
|
||||||
delete[] argv;
|
delete[] argv;
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
int SysExevVEStage2(SysExecVEState* state)
|
int SysExevVEStage2(SysExecVEState* state)
|
||||||
|
@ -672,7 +672,7 @@ namespace Sortix
|
||||||
// The process needs to have children, otherwise we are waiting for
|
// The process needs to have children, otherwise we are waiting for
|
||||||
// nothing to happen.
|
// nothing to happen.
|
||||||
if ( !process->firstchild ) { Error::Set(ECHILD); return -1; }
|
if ( !process->firstchild ) { Error::Set(ECHILD); return -1; }
|
||||||
|
|
||||||
// Resumes this system call when the wait condition has been met.
|
// Resumes this system call when the wait condition has been met.
|
||||||
thread->onchildprocessexit = SysWaitCallback;
|
thread->onchildprocessexit = SysWaitCallback;
|
||||||
|
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
#define SORTIX_PROCESS_H
|
#define SORTIX_PROCESS_H
|
||||||
|
|
||||||
#include "descriptors.h"
|
#include "descriptors.h"
|
||||||
|
#include "cpu.h"
|
||||||
|
|
||||||
namespace Sortix
|
namespace Sortix
|
||||||
{
|
{
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
#include "platform.h"
|
#include <sortix/kernel/platform.h>
|
||||||
#include "refcount.h"
|
#include "refcount.h"
|
||||||
|
|
||||||
namespace Sortix
|
namespace Sortix
|
||||||
|
|
|
@ -22,14 +22,14 @@
|
||||||
|
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
#include "platform.h"
|
#include <sortix/kernel/platform.h>
|
||||||
#include <libmaxsi/memory.h>
|
#include <libmaxsi/memory.h>
|
||||||
#include "panic.h"
|
#include <sortix/kernel/panic.h>
|
||||||
#include "thread.h"
|
#include "thread.h"
|
||||||
#include "process.h"
|
#include "process.h"
|
||||||
#include "time.h"
|
#include "time.h"
|
||||||
#include "scheduler.h"
|
#include "scheduler.h"
|
||||||
#include "memorymanagement.h"
|
#include <sortix/kernel/memorymanagement.h>
|
||||||
#include "syscall.h"
|
#include "syscall.h"
|
||||||
#include "sound.h" // HACK FOR SIGINT
|
#include "sound.h" // HACK FOR SIGINT
|
||||||
#include "x86-family/gdt.h"
|
#include "x86-family/gdt.h"
|
||||||
|
|
|
@ -22,9 +22,9 @@
|
||||||
|
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
#include "platform.h"
|
#include <sortix/kernel/platform.h>
|
||||||
#include <libmaxsi/string.h>
|
#include <libmaxsi/string.h>
|
||||||
#include "log.h"
|
#include <sortix/kernel/log.h>
|
||||||
#include "vga.h"
|
#include "vga.h"
|
||||||
#include "keyboard.h"
|
#include "keyboard.h"
|
||||||
#include "uart.h"
|
#include "uart.h"
|
||||||
|
@ -102,10 +102,10 @@ namespace Sortix
|
||||||
}
|
}
|
||||||
|
|
||||||
Keyboard::QueueKeystroke(CTRL);
|
Keyboard::QueueKeystroke(CTRL);
|
||||||
Keyboard::QueueKeystroke('A' + sigpending - 1);
|
Keyboard::QueueKeystroke('A' + sigpending - 1);
|
||||||
Keyboard::QueueKeystroke(CTRL | DEPRESSED);
|
Keyboard::QueueKeystroke(CTRL | DEPRESSED);
|
||||||
sigpending = -1;
|
sigpending = -1;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if ( c < 32 ) { sigpending = c; } else { sigpending = -1; }
|
if ( c < 32 ) { sigpending = c; } else { sigpending = -1; }
|
||||||
switch ( c )
|
switch ( c )
|
||||||
|
|
|
@ -22,9 +22,9 @@
|
||||||
|
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
#include "platform.h"
|
#include <sortix/kernel/platform.h>
|
||||||
#include <libmaxsi/memory.h>
|
#include <libmaxsi/memory.h>
|
||||||
#include "panic.h"
|
#include <sortix/kernel/panic.h>
|
||||||
#include "signal.h"
|
#include "signal.h"
|
||||||
|
|
||||||
using namespace Maxsi;
|
using namespace Maxsi;
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
#define SORTIX_SIGNAL_H
|
#define SORTIX_SIGNAL_H
|
||||||
|
|
||||||
#include <libmaxsi/signalnum.h>
|
#include <libmaxsi/signalnum.h>
|
||||||
|
#include "cpu.h"
|
||||||
|
|
||||||
namespace Sortix
|
namespace Sortix
|
||||||
{
|
{
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
#include "platform.h"
|
#include <sortix/kernel/platform.h>
|
||||||
#include "sound.h"
|
#include "sound.h"
|
||||||
#include "syscall.h"
|
#include "syscall.h"
|
||||||
|
|
||||||
|
@ -33,10 +33,10 @@ namespace Sortix
|
||||||
void Mute()
|
void Mute()
|
||||||
{
|
{
|
||||||
uint8_t TMP = (CPU::InPortB(0x61)) & 0xFC;
|
uint8_t TMP = (CPU::InPortB(0x61)) & 0xFC;
|
||||||
|
|
||||||
CPU::OutPortB(0x61, TMP);
|
CPU::OutPortB(0x61, TMP);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Play(nat Frequency)
|
void Play(nat Frequency)
|
||||||
{
|
{
|
||||||
//Set the PIT to the desired frequency
|
//Set the PIT to the desired frequency
|
||||||
|
|
|
@ -22,11 +22,11 @@
|
||||||
|
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
#include "platform.h"
|
#include <sortix/kernel/platform.h>
|
||||||
#include <libmaxsi/error.h>
|
#include <libmaxsi/error.h>
|
||||||
#include "syscall.h"
|
#include "syscall.h"
|
||||||
#include "syscallnum.h"
|
#include <sortix/syscallnum.h>
|
||||||
#include "panic.h"
|
#include <sortix/kernel/panic.h>
|
||||||
#include "process.h"
|
#include "process.h"
|
||||||
#include "thread.h"
|
#include "thread.h"
|
||||||
#include "scheduler.h"
|
#include "scheduler.h"
|
||||||
|
@ -68,7 +68,7 @@ namespace Sortix
|
||||||
"SYSCALL_MAX_NYN = %zu", funcptr, index, SYSCALL_MAX_NUM);
|
"SYSCALL_MAX_NYN = %zu", funcptr, index, SYSCALL_MAX_NUM);
|
||||||
}
|
}
|
||||||
|
|
||||||
syscall_list[index] = funcptr;
|
syscall_list[index] = funcptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Incomplete()
|
void Incomplete()
|
||||||
|
|
|
@ -25,7 +25,8 @@
|
||||||
#ifndef SORTIX_SYSCALL_H
|
#ifndef SORTIX_SYSCALL_H
|
||||||
#define SORTIX_SYSCALL_H
|
#define SORTIX_SYSCALL_H
|
||||||
|
|
||||||
#include "syscallnum.h"
|
#include <sortix/syscallnum.h>
|
||||||
|
#include "cpu.h"
|
||||||
|
|
||||||
namespace Sortix
|
namespace Sortix
|
||||||
{
|
{
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
#include "platform.h"
|
#include <sortix/kernel/platform.h>
|
||||||
#include <libmaxsi/error.h>
|
#include <libmaxsi/error.h>
|
||||||
#include "syscall.h"
|
#include "syscall.h"
|
||||||
#include "process.h"
|
#include "process.h"
|
||||||
|
@ -51,7 +51,7 @@ namespace Sortix
|
||||||
DevTerminal* term = (DevTerminal*) dev;
|
DevTerminal* term = (DevTerminal*) dev;
|
||||||
// TODO: Check that mode is a valid user-space pointer.
|
// TODO: Check that mode is a valid user-space pointer.
|
||||||
*mode = term->GetMode();
|
*mode = term->GetMode();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int SysIsATTY(int fd)
|
int SysIsATTY(int fd)
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
|
|
||||||
#include "device.h"
|
#include "device.h"
|
||||||
#include "stream.h"
|
#include "stream.h"
|
||||||
#include "termmode.h"
|
#include <sortix/termmode.h>
|
||||||
|
|
||||||
namespace Sortix
|
namespace Sortix
|
||||||
{
|
{
|
||||||
|
|
|
@ -22,14 +22,14 @@
|
||||||
|
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
#include "platform.h"
|
#include <sortix/kernel/platform.h>
|
||||||
#include <libmaxsi/error.h>
|
#include <libmaxsi/error.h>
|
||||||
#include <libmaxsi/memory.h>
|
#include <libmaxsi/memory.h>
|
||||||
#include "event.h"
|
#include "event.h"
|
||||||
#include "process.h"
|
#include "process.h"
|
||||||
#include "thread.h"
|
#include "thread.h"
|
||||||
#include "scheduler.h"
|
#include "scheduler.h"
|
||||||
#include "memorymanagement.h"
|
#include <sortix/kernel/memorymanagement.h>
|
||||||
#include "time.h"
|
#include "time.h"
|
||||||
#include "syscall.h"
|
#include "syscall.h"
|
||||||
|
|
||||||
|
@ -120,7 +120,7 @@ namespace Sortix
|
||||||
{
|
{
|
||||||
clonesignal = currentsignal->Fork();
|
clonesignal = currentsignal->Fork();
|
||||||
if ( !clonesignal ) { return NULL; }
|
if ( !clonesignal ) { return NULL; }
|
||||||
}
|
}
|
||||||
|
|
||||||
Thread* clone = new Thread(this);
|
Thread* clone = new Thread(this);
|
||||||
if ( !clone )
|
if ( !clone )
|
||||||
|
@ -214,9 +214,9 @@ namespace Sortix
|
||||||
|
|
||||||
if ( override->signum == SIGKILL )
|
if ( override->signum == SIGKILL )
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
override->nextsignal = currentsignal;
|
override->nextsignal = currentsignal;
|
||||||
Maxsi::Memory::Copy(&override->regs, regs, sizeof(override->regs));
|
Maxsi::Memory::Copy(&override->regs, regs, sizeof(override->regs));
|
||||||
|
@ -232,7 +232,7 @@ namespace Sortix
|
||||||
|
|
||||||
CPU::InterruptRegisters* dest = Syscall::InterruptRegs();
|
CPU::InterruptRegisters* dest = Syscall::InterruptRegs();
|
||||||
CPU::InterruptRegisters* src = &thread->currentsignal->regs;
|
CPU::InterruptRegisters* src = &thread->currentsignal->regs;
|
||||||
|
|
||||||
Maxsi::Memory::Copy(dest, src, sizeof(CPU::InterruptRegisters));
|
Maxsi::Memory::Copy(dest, src, sizeof(CPU::InterruptRegisters));
|
||||||
thread->currentsignal = thread->currentsignal->nextsignal;
|
thread->currentsignal = thread->currentsignal->nextsignal;
|
||||||
Syscall::AsIs();
|
Syscall::AsIs();
|
||||||
|
|
|
@ -116,7 +116,7 @@ namespace Sortix
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void (*onchildprocessexit)(Thread*, Process*);
|
void (*onchildprocessexit)(Thread*, Process*);
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,12 +23,12 @@
|
||||||
|
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
#include "platform.h"
|
#include <sortix/kernel/platform.h>
|
||||||
#include "time.h"
|
#include "time.h"
|
||||||
#include "interrupt.h"
|
#include "interrupt.h"
|
||||||
#include "process.h"
|
#include "process.h"
|
||||||
#include "scheduler.h"
|
#include "scheduler.h"
|
||||||
#include "log.h"
|
#include <sortix/kernel/log.h>
|
||||||
#include "sound.h"
|
#include "sound.h"
|
||||||
#include "syscall.h"
|
#include "syscall.h"
|
||||||
|
|
||||||
|
@ -112,9 +112,9 @@ namespace Sortix
|
||||||
Scheduler::Switch(Regs);
|
Scheduler::Switch(Regs);
|
||||||
|
|
||||||
// TODO: There is a horrible bug that causes Sortix to only receive
|
// TODO: There is a horrible bug that causes Sortix to only receive
|
||||||
// one IRQ0 on my laptop, but it works in virtual machines. But
|
// one IRQ0 on my laptop, but it works in virtual machines. But
|
||||||
// re-requesting an addtional time seems to work. Hacky and ugly.
|
// re-requesting an addtional time seems to work. Hacky and ugly.
|
||||||
if ( !didUglyIRQ0Hack ) { RequestIQR0(); didUglyIRQ0Hack = true; }
|
if ( !didUglyIRQ0Hack ) { RequestIQR0(); didUglyIRQ0Hack = true; }
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Implement all the other useful functions regarding time.
|
// TODO: Implement all the other useful functions regarding time.
|
||||||
|
|
|
@ -26,12 +26,14 @@
|
||||||
#ifndef SORTIX_TIME_H
|
#ifndef SORTIX_TIME_H
|
||||||
#define SORTIX_TIME_H
|
#define SORTIX_TIME_H
|
||||||
|
|
||||||
|
#include "cpu.h"
|
||||||
|
|
||||||
namespace Sortix
|
namespace Sortix
|
||||||
{
|
{
|
||||||
namespace Time
|
namespace Time
|
||||||
{
|
{
|
||||||
void Init();
|
void Init();
|
||||||
void OnIRQ0(CPU::InterruptRegisters* Registers, void* user);
|
void OnIRQ0(CPU::InterruptRegisters* Registers, void* user);
|
||||||
float GetTimeSinceBoot();
|
float GetTimeSinceBoot();
|
||||||
uintmax_t MicrosecondsSinceBoot();
|
uintmax_t MicrosecondsSinceBoot();
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,8 @@
|
||||||
|
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
#include "platform.h"
|
#include <sortix/kernel/platform.h>
|
||||||
|
#include "cpu.h"
|
||||||
#include <libmaxsi/string.h>
|
#include <libmaxsi/string.h>
|
||||||
#include <libmaxsi/memory.h>
|
#include <libmaxsi/memory.h>
|
||||||
#include "vga.h"
|
#include "vga.h"
|
||||||
|
@ -36,14 +37,14 @@ namespace Sortix
|
||||||
{
|
{
|
||||||
const nat TXR = 0; // Transmit register
|
const nat TXR = 0; // Transmit register
|
||||||
const nat RXR = 0; // Receive register
|
const nat RXR = 0; // Receive register
|
||||||
const nat IER = 1; // Interrupt Enable
|
const nat IER = 1; // Interrupt Enable
|
||||||
const nat IIR = 2; // Interrupt ID
|
const nat IIR = 2; // Interrupt ID
|
||||||
const nat FCR = 2; // FIFO control
|
const nat FCR = 2; // FIFO control
|
||||||
const nat LCR = 3; // Line control
|
const nat LCR = 3; // Line control
|
||||||
const nat MCR = 4; // Modem control
|
const nat MCR = 4; // Modem control
|
||||||
const nat LSR = 5; // Line Status
|
const nat LSR = 5; // Line Status
|
||||||
const nat MSR = 6; // Modem Status
|
const nat MSR = 6; // Modem Status
|
||||||
const nat DLL = 0; // Divisor Latch Low
|
const nat DLL = 0; // Divisor Latch Low
|
||||||
const nat DLM = 1; // Divisor latch High
|
const nat DLM = 1; // Divisor latch High
|
||||||
|
|
||||||
const nat LCR_DLAB = 0x80; // Divisor latch access bit
|
const nat LCR_DLAB = 0x80; // Divisor latch access bit
|
||||||
|
@ -181,7 +182,7 @@ namespace Sortix
|
||||||
CPU::OutPortB(Port + IER, 0);
|
CPU::OutPortB(Port + IER, 0);
|
||||||
|
|
||||||
int Result = -1;
|
int Result = -1;
|
||||||
|
|
||||||
if ( CPU::InPortB(Port + LSR) & LSR_READY )
|
if ( CPU::InPortB(Port + LSR) & LSR_READY )
|
||||||
{
|
{
|
||||||
Result = CPU::InPortB(Port);
|
Result = CPU::InPortB(Port);
|
||||||
|
@ -207,7 +208,7 @@ namespace Sortix
|
||||||
|
|
||||||
void InvalidateVGA()
|
void InvalidateVGA()
|
||||||
{
|
{
|
||||||
for ( nat I = 0; I < FrameWidth * FrameHeight; I++ ) { VGALastFrame[I] = 0; }
|
for ( nat I = 0; I < FrameWidth * FrameHeight; I++ ) { VGALastFrame[I] = 0; }
|
||||||
}
|
}
|
||||||
|
|
||||||
void RenderVGA(const uint16_t* Frame)
|
void RenderVGA(const uint16_t* Frame)
|
||||||
|
@ -265,7 +266,7 @@ namespace Sortix
|
||||||
OldElement = VGALastFrame[Pos];
|
OldElement = VGALastFrame[Pos];
|
||||||
|
|
||||||
nat NewColor = (ConversionTable[ (Element >> 12) & 0xF ] << 3) | (ConversionTable[ (Element >> 8) & 0xF ]);
|
nat NewColor = (ConversionTable[ (Element >> 12) & 0xF ] << 3) | (ConversionTable[ (Element >> 8) & 0xF ]);
|
||||||
|
|
||||||
// Change the color if we need to.
|
// Change the color if we need to.
|
||||||
if ( LastColor != NewColor )
|
if ( LastColor != NewColor )
|
||||||
{
|
{
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue