“Copyright” also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
-
+
“The Program” refers to any copyrightable work licensed under this
License. Each licensee is addressed as “you”. “Licensees” and
“recipients” may be individuals or organizations.
@@ -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
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
-
+
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
diff --git a/lgpl.html b/lgpl.html
index 4aa33736..9a4cb51e 100644
--- a/lgpl.html
+++ b/lgpl.html
@@ -4,7 +4,7 @@
GNU Lesser General Public License v3.0 - GNU Project - Free Software Foundation (FSF)
+ href="http://www.gnu.org/licenses/lgpl-3.0.rdf" />
GNU LESSER GENERAL PUBLIC LICENSE
diff --git a/libmaxsi/Makefile b/libmaxsi/Makefile
index c99cfee7..8ab7a061 100644
--- a/libmaxsi/Makefile
+++ b/libmaxsi/Makefile
@@ -19,7 +19,7 @@ ifeq ($(CPU),x64)
CPUASFLAGS=-64
endif
-CPPINCLUDES=-I preproc -I ..
+CPPINCLUDES=-I preproc -I ../sortix/include
CPPFLAGS=-DLIBMAXSI_LIBRARY -DSORTIX -U_GNU_SOURCE $(CPUDEFINES) $(CPPINCLUDES)
FLAGS=$(CPUFLAGS) -Wall -Wextra -nostdlib -fno-builtin -nostartfiles \
-nodefaultlibs -fno-stack-protector -nostdinc
@@ -85,19 +85,19 @@ libmaxsi-sortix.a: $(SORTIXOBJS)
ar rcs libmaxsi-sortix.a $(SORTIXOBJS)
libc.a: libmaxsi.a
- ln -sf $< $@
+ ln -sf $< $@
libc.so: libmaxsi.so
- ln -sf $< $@
+ ln -sf $< $@
libg.a: libc.a
- ln -sf $< $@
+ ln -sf $< $@
libg.so: libc.so
- ln -sf $< $@
+ ln -sf $< $@
start.o: $(CPU)/start.o
- ln -sf $< $@
+ ln -sf $< $@
# header preprocessing
$(HEADERDIRS):
@@ -123,7 +123,7 @@ sortix:
mkdir -p sortix
sortix/%.o: %.cpp $(HEADERS) sortix
- g++ -c $< -o $@ $(CPPFLAGS) $(SORTIXCPPFLAGS) $(CXXFLAGS)
+ g++ -c $< -o $@ $(CPPFLAGS) $(SORTIXCPPFLAGS) $(CXXFLAGS)
clean:
rm -f *.o sortix/*.o c/*.o x86/*.o x64/*.o *.a *.so
diff --git a/libmaxsi/c++.cpp b/libmaxsi/c++.cpp
index a27e5fef..6e743f2e 100644
--- a/libmaxsi/c++.cpp
+++ b/libmaxsi/c++.cpp
@@ -42,7 +42,7 @@ extern "C" uint64_t __udivdi3(uint64_t a, uint64_t b)
power *= 2;
divisor *= 2;
}
-
+
while ( divisor <= remainder )
{
remainder -= divisor;
@@ -68,7 +68,7 @@ extern "C" uint64_t __umoddi3(uint64_t a, uint64_t b)
power *= 2;
divisor *= 2;
}
-
+
while ( divisor <= remainder )
{
remainder -= divisor;
diff --git a/libmaxsi/decl/DIR.h b/libmaxsi/decl/DIR.h
index f33630ec..f1578e48 100644
--- a/libmaxsi/decl/DIR.h
+++ b/libmaxsi/decl/DIR.h
@@ -7,7 +7,7 @@ struct dirent;
#define _DIR_EOF (1<<2)
typedef struct _DIR
{
- void* user;
+ void* user;
int (*read_func)(void* user, struct dirent* dirent, size_t* size);
int (*rewind_func)(void* user);
int (*fd_func)(void* user);
diff --git a/libmaxsi/dir.c b/libmaxsi/dir.c
index 3e3d0027..932c04f7 100644
--- a/libmaxsi/dir.c
+++ b/libmaxsi/dir.c
@@ -86,7 +86,7 @@ struct dirent* readdir(DIR* dir)
return NULL;
}
- return dir->entry;
+ return dir->entry;
}
int closedir(DIR* dir)
diff --git a/libmaxsi/error.cpp b/libmaxsi/error.cpp
index a68beb7d..e8b39c47 100644
--- a/libmaxsi/error.cpp
+++ b/libmaxsi/error.cpp
@@ -41,7 +41,7 @@ namespace Maxsi
extern "C" void init_error_functions()
{
errno = 0;
- SysRegisterErrno(&errno);
+ SysRegisterErrno(&errno);
}
#endif
diff --git a/libmaxsi/format.cpp b/libmaxsi/format.cpp
index 7f430611..7ad0b342 100644
--- a/libmaxsi/format.cpp
+++ b/libmaxsi/format.cpp
@@ -196,7 +196,7 @@ namespace Maxsi
#ifdef PLATFORM_X64
const nat WORDWIDTH = BIT64;
#else
- const nat WORDWIDTH = 0;
+ const nat WORDWIDTH = 0;
#endif
// TODO: Support signed datatypes!
diff --git a/libmaxsi/heap.cpp b/libmaxsi/heap.cpp
index aa3eb9cf..54ec7cb8 100644
--- a/libmaxsi/heap.cpp
+++ b/libmaxsi/heap.cpp
@@ -37,10 +37,10 @@
#define PARANOIA 1
#ifdef SORTIX_KERNEL
-#include
-#include // DEBUG
-#include
-#include
+#include
+#include // DEBUG
+#include
+#include
#endif
namespace Maxsi
@@ -649,7 +649,7 @@ namespace Maxsi
{
size_t total = nmemb * size;
void* result = Allocate(total);
- if ( !result ) { return NULL; }
+ if ( !result ) { return NULL; }
Memory::Set(result, 0, total);
return result;
}
diff --git a/libmaxsi/include/libmaxsi/format.h b/libmaxsi/include/libmaxsi/format.h
index 2240288e..ac8c8055 100644
--- a/libmaxsi/include/libmaxsi/format.h
+++ b/libmaxsi/include/libmaxsi/format.h
@@ -30,7 +30,7 @@ namespace Maxsi
namespace Format
{
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);
}
}
diff --git a/libmaxsi/include/libmaxsi/io.h b/libmaxsi/include/libmaxsi/io.h
index 9193e7bc..ffab28b2 100644
--- a/libmaxsi/include/libmaxsi/io.h
+++ b/libmaxsi/include/libmaxsi/io.h
@@ -29,7 +29,7 @@ namespace Maxsi
{
namespace IO
{
- // TODO:
+ // TODO:
enum Seek_t { SEEK_SET, SEEK_CUR, SEEK_END };
diff --git a/libmaxsi/include/libmaxsi/platform.h b/libmaxsi/include/libmaxsi/platform.h
index d003eb83..0a5cec82 100644
--- a/libmaxsi/include/libmaxsi/platform.h
+++ b/libmaxsi/include/libmaxsi/platform.h
@@ -68,7 +68,7 @@
}
#else
- #define ASSERT(invariant)
+ #define ASSERT(invariant)
#endif
@@ -80,8 +80,8 @@
#endif
#ifdef SORTIX_KERNEL
-#include
-#include
-#include
+#include
+#include
+#include
#endif
diff --git a/libmaxsi/memory.cpp b/libmaxsi/memory.cpp
index 357f51fc..0e8e2396 100644
--- a/libmaxsi/memory.cpp
+++ b/libmaxsi/memory.cpp
@@ -108,7 +108,7 @@ namespace Maxsi
{
if ( buf[i] == c ) { return (void*) (buf + i); }
}
- return NULL;
+ return NULL;
}
}
}
diff --git a/libmaxsi/random.cpp b/libmaxsi/random.cpp
index 3f4aef37..2ed980b6 100644
--- a/libmaxsi/random.cpp
+++ b/libmaxsi/random.cpp
@@ -29,10 +29,10 @@ namespace Maxsi
namespace Random
{
unsigned random_seed = 1337;
- extern "C" int rand()
+ extern "C" int rand()
{
random_seed = random_seed + 37 * 1103515245 + 12345;
- return random_seed >> 16;
+ return random_seed >> 16;
}
}
}
diff --git a/libmaxsi/signal.cpp b/libmaxsi/signal.cpp
index 12d7e9b5..24a8b99d 100644
--- a/libmaxsi/signal.cpp
+++ b/libmaxsi/signal.cpp
@@ -73,7 +73,7 @@ namespace Maxsi
extern "C" void SIG_IGN(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.
SysRegisterSignalHandler(&SignalHandlerAssembly);
}
-
+
Handler RegisterHandler(int signum, Handler handler)
{
if ( signum < 0 || MAX_SIGNALS <= signum ) { return SIG_ERR; }
diff --git a/libmaxsi/string.cpp b/libmaxsi/string.cpp
index c72dddda..1b638f30 100644
--- a/libmaxsi/string.cpp
+++ b/libmaxsi/string.cpp
@@ -38,7 +38,7 @@ namespace Maxsi
size_t Result = 0;
while ( String[Result] != '\0' )
- {
+ {
Result++;
}
@@ -57,7 +57,7 @@ namespace Maxsi
char* OriginalDest = Dest;
while ( *Src != '\0' )
- {
+ {
*Dest = *Src;
Dest++; Src++;
}
@@ -82,7 +82,7 @@ namespace Maxsi
while ( *Dest != '\0' ) { Dest++; }
while ( *Src != '\0' )
- {
+ {
*Dest = *Src;
Dest++; Src++;
}
@@ -164,7 +164,7 @@ namespace Maxsi
DUAL_FUNCTION(size_t, strspn, Accept, (const char* str, const char* accept))
{
size_t acceptlen = 0;
- while ( accept[acceptlen] ) { acceptlen++; }
+ while ( accept[acceptlen] ) { acceptlen++; }
for ( size_t result = 0; true; result++ )
{
char c = str[result];
@@ -183,7 +183,7 @@ namespace Maxsi
DUAL_FUNCTION(size_t, strcspn, Reject, (const char* str, const char* reject))
{
size_t rejectlen = 0;
- while ( reject[rejectlen] ) { rejectlen++; }
+ while ( reject[rejectlen] ) { rejectlen++; }
for ( size_t result = 0; true; result++ )
{
char c = str[result];
@@ -339,7 +339,7 @@ namespace Maxsi
va_list param_pt;
va_start(param_pt, NumParameters);
-
+
// First calculate the string length.
size_t ResultLength = 0;
const char* TMP = 0;
@@ -372,7 +372,7 @@ namespace Maxsi
ResultOffset += TMPLength;
}
}
-
+
return Result;
}
#endif
diff --git a/libmaxsi/thread.cpp b/libmaxsi/thread.cpp
index 82d7675c..5d5fb507 100644
--- a/libmaxsi/thread.cpp
+++ b/libmaxsi/thread.cpp
@@ -66,7 +66,7 @@ namespace Maxsi
// Sortix will never run for that long time, and shouldn't it be unsigned long?
void Sleep(long Seconds)
{
- SysSleep(Seconds);
+ SysSleep(Seconds);
}
diff --git a/libmaxsi/x64/start.s b/libmaxsi/x64/start.s
index bb2a5b48..bb2bb21f 100644
--- a/libmaxsi/x64/start.s
+++ b/libmaxsi/x64/start.s
@@ -18,7 +18,7 @@
along with LibMaxsi. If not, see .
start.s
- A stub for linking to the C runtime on Sortix.
+ A stub for linking to the C runtime on Sortix.
******************************************************************************/
diff --git a/libmaxsi/x86/start.s b/libmaxsi/x86/start.s
index 567757ab..b1b1c20a 100644
--- a/libmaxsi/x86/start.s
+++ b/libmaxsi/x86/start.s
@@ -18,7 +18,7 @@
along with LibMaxsi. If not, see .
start.s
- A stub for linking to the C runtime on Sortix.
+ A stub for linking to the C runtime on Sortix.
******************************************************************************/
diff --git a/mkinitrd/Makefile b/mkinitrd/Makefile
index a008f0eb..7cf1b6e5 100644
--- a/mkinitrd/Makefile
+++ b/mkinitrd/Makefile
@@ -1,4 +1,4 @@
-CPPFLAGS=-I..
+CPPFLAGS=-I../sortix/include
CXXFLAGS=-Wall
BINARIES=mkinitrd lsinitrd catinitrd
@@ -12,4 +12,4 @@ clean:
rm -f $(BINARIES)
install:
-
+
diff --git a/mkinitrd/catinitrd.cpp b/mkinitrd/catinitrd.cpp
index ed9c1005..b0df228b 100644
--- a/mkinitrd/catinitrd.cpp
+++ b/mkinitrd/catinitrd.cpp
@@ -100,22 +100,22 @@ int main(int argc, char* argv[])
verbose = false;
argv[i] = NULL;
}
- else if ( strcmp(argv[i], "-v") == 0 )
+ else if ( strcmp(argv[i], "-v") == 0 )
{
verbose = true;
argv[i] = NULL;
}
- else if ( strcmp(argv[i], "--usage") == 0 )
+ else if ( strcmp(argv[i], "--usage") == 0 )
{
usage(argc, argv);
return 0;
}
- else if ( strcmp(argv[i], "--help") == 0 )
+ else if ( strcmp(argv[i], "--help") == 0 )
{
usage(argc, argv);
return 0;
}
- else if ( strcmp(argv[i], "--version") == 0 )
+ else if ( strcmp(argv[i], "--version") == 0 )
{
version();
return 0;
@@ -184,7 +184,7 @@ int main(int argc, char* argv[])
const size_t BUFFER_SIZE = 16384UL;
uint8_t buffer[BUFFER_SIZE];
-
+
uint32_t filesize = fileheader.size;
uint32_t readsofar = 0;
while ( readsofar < filesize )
diff --git a/mkinitrd/lsinitrd.cpp b/mkinitrd/lsinitrd.cpp
index 3c523bce..002c6efe 100644
--- a/mkinitrd/lsinitrd.cpp
+++ b/mkinitrd/lsinitrd.cpp
@@ -120,22 +120,22 @@ int main(int argc, char* argv[])
verbose = false;
argv[i] = NULL;
}
- else if ( strcmp(argv[i], "-v") == 0 )
+ else if ( strcmp(argv[i], "-v") == 0 )
{
verbose = true;
argv[i] = NULL;
}
- else if ( strcmp(argv[i], "--usage") == 0 )
+ else if ( strcmp(argv[i], "--usage") == 0 )
{
usage(argc, argv);
return 0;
}
- else if ( strcmp(argv[i], "--help") == 0 )
+ else if ( strcmp(argv[i], "--help") == 0 )
{
usage(argc, argv);
return 0;
}
- else if ( strcmp(argv[i], "--version") == 0 )
+ else if ( strcmp(argv[i], "--version") == 0 )
{
version();
return 0;
diff --git a/mkinitrd/mkinitrd.cpp b/mkinitrd/mkinitrd.cpp
index d14a9548..fdef0037 100644
--- a/mkinitrd/mkinitrd.cpp
+++ b/mkinitrd/mkinitrd.cpp
@@ -107,22 +107,22 @@ int main(int argc, char* argv[])
verbose = false;
argv[i] = NULL;
}
- else if ( strcmp(argv[i], "-v") == 0 )
+ else if ( strcmp(argv[i], "-v") == 0 )
{
verbose = true;
argv[i] = NULL;
}
- else if ( strcmp(argv[i], "--usage") == 0 )
+ else if ( strcmp(argv[i], "--usage") == 0 )
{
usage(argc, argv);
return 0;
}
- else if ( strcmp(argv[i], "--help") == 0 )
+ else if ( strcmp(argv[i], "--help") == 0 )
{
usage(argc, argv);
return 0;
}
- else if ( strcmp(argv[i], "--version") == 0 )
+ else if ( strcmp(argv[i], "--version") == 0 )
{
version();
return 0;
diff --git a/sortix/Makefile b/sortix/Makefile
index bf17150c..ba217d87 100644
--- a/sortix/Makefile
+++ b/sortix/Makefile
@@ -69,7 +69,7 @@ ifdef VERSION
DEFINES:=$(DEFINES) -DVERSIONSTR=\"$(VERSION)\"
endif
-INCLUDES=-I../libmaxsi/preproc -I.. -I.
+INCLUDES=-I. -Iinclude -I../libmaxsi/preproc
CPPFLAGS=$(INCLUDES) $(DEFINES)
FLAGSRELEASE=-s $(O)
FLAGSDEBUG=
@@ -83,17 +83,8 @@ NASMFLAGS=$(CPUNASMFLAGS)
STATICLIBS=\
../libmaxsi/libmaxsi-sortix.a \
-PUBLICHEADERS=\
-$(CPU)/bits.h \
-fcntl.h \
-initrd.h \
-seek.h \
-keycodes.h \
-termmode.h \
-syscallnum.h \
-stat.h \
-timeval.h \
-unistd.h \
+HEADERDIRS:=$(shell find include -type d)
+HEADERS:=$(shell find include -type f)
OBJS=$(CPUOBJS) \
kernel.o \
@@ -185,8 +176,10 @@ clean:
# Installation into sysroot
install:
- mkdir -p $(SYSROOT)/usr/include/sortix
- for FILE in $(PUBLICHEADERS); do \
- cp $$FILE $(SYSROOT)/usr/include/sortix/`basename $$FILE`; \
+ for DIR in $(HEADERDIRS); do \
+ mkdir -p $(SYSROOT)/usr/$$DIR; \
+ done
+ for FILE in $(HEADERS); do \
+ cp $$FILE $(SYSROOT)/usr/$$FILE; \
done
diff --git a/sortix/ata.cpp b/sortix/ata.cpp
index ca36131c..30b95923 100644
--- a/sortix/ata.cpp
+++ b/sortix/ata.cpp
@@ -22,7 +22,8 @@
******************************************************************************/
-#include "platform.h"
+#include
+#include "cpu.h"
#include
#include
#include "ata.h"
@@ -344,13 +345,13 @@ namespace Sortix
if ( !WriteSector(byteoffset/sectorsize, src + sofar) ) { return sofar; }
sofar += sectorsize;
numbytes -= sectorsize;
- byteoffset += sectorsize;
+ byteoffset += sectorsize;
}
if ( numbytes ) { return sofar + Write(byteoffset, src + sofar, numbytes); }
return sofar;
}
-
+
void ATADrive::Initialize()
{
bus->SelectDrive(driveid);
diff --git a/sortix/calltrace.cpp b/sortix/calltrace.cpp
index 46ab1c73..325d6d89 100644
--- a/sortix/calltrace.cpp
+++ b/sortix/calltrace.cpp
@@ -22,7 +22,7 @@
*******************************************************************************/
-#include "platform.h"
+#include
#include "calltrace.h"
namespace Sortix {
diff --git a/sortix/com.cpp b/sortix/com.cpp
index 70a483e3..fa279758 100644
--- a/sortix/com.cpp
+++ b/sortix/com.cpp
@@ -22,7 +22,7 @@
*******************************************************************************/
-#include "platform.h"
+#include
#include
#include "interrupt.h"
#include "event.h"
diff --git a/sortix/cpu.h b/sortix/cpu.h
new file mode 100644
index 00000000..1aa6cd5d
--- /dev/null
+++ b/sortix/cpu.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 .
+
+ 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
diff --git a/sortix/descriptors.cpp b/sortix/descriptors.cpp
index 2360a820..4fece4bb 100644
--- a/sortix/descriptors.cpp
+++ b/sortix/descriptors.cpp
@@ -22,7 +22,7 @@
*******************************************************************************/
-#include "platform.h"
+#include
#include
#include "descriptors.h"
#include "device.h"
diff --git a/sortix/descriptors.h b/sortix/descriptors.h
index 086d35db..62389116 100644
--- a/sortix/descriptors.h
+++ b/sortix/descriptors.h
@@ -42,7 +42,7 @@ namespace Sortix
~DescriptorTable();
private:
- int numdevices;
+ int numdevices;
DescriptorEntry* devices;
public:
diff --git a/sortix/device.cpp b/sortix/device.cpp
index 65b0961b..4e76025d 100644
--- a/sortix/device.cpp
+++ b/sortix/device.cpp
@@ -22,7 +22,7 @@
******************************************************************************/
-#include "platform.h"
+#include
#include
#include "device.h"
@@ -35,7 +35,7 @@ namespace Sortix
Device::~Device()
{
-
+
}
void Device::Unref()
diff --git a/sortix/directory.cpp b/sortix/directory.cpp
index 664d1a31..084d9aa3 100644
--- a/sortix/directory.cpp
+++ b/sortix/directory.cpp
@@ -22,7 +22,7 @@
******************************************************************************/
-#include "platform.h"
+#include
#include
#include
#include
diff --git a/sortix/elf.cpp b/sortix/elf.cpp
index 34014be3..988d40e1 100644
--- a/sortix/elf.cpp
+++ b/sortix/elf.cpp
@@ -22,12 +22,12 @@
******************************************************************************/
-#include "platform.h"
+#include
#include
#include
#include "elf.h"
-#include "memorymanagement.h"
-#include "panic.h"
+#include
+#include
#include "process.h"
using namespace Maxsi;
@@ -232,7 +232,7 @@ namespace Sortix
return Construct64(process, file, filelen);
default:
return 0;
- }
+ }
}
}
}
diff --git a/sortix/end.cpp b/sortix/end.cpp
index 2f620704..471089f3 100644
--- a/sortix/end.cpp
+++ b/sortix/end.cpp
@@ -24,7 +24,7 @@
******************************************************************************/
-#include "platform.h"
+#include
namespace Sortix
{
diff --git a/sortix/event.cpp b/sortix/event.cpp
index b1614176..41f12c6f 100644
--- a/sortix/event.cpp
+++ b/sortix/event.cpp
@@ -22,7 +22,7 @@
******************************************************************************/
-#include "platform.h"
+#include
#include "thread.h"
#include "syscall.h"
#include "event.h"
diff --git a/sortix/filesystem.cpp b/sortix/filesystem.cpp
index cd4838e0..c55a49d1 100644
--- a/sortix/filesystem.cpp
+++ b/sortix/filesystem.cpp
@@ -22,7 +22,7 @@
******************************************************************************/
-#include "platform.h"
+#include
#include
#include
#include
diff --git a/sortix/fs/devfs.cpp b/sortix/fs/devfs.cpp
index 90e8bc7c..d3c2701d 100644
--- a/sortix/fs/devfs.cpp
+++ b/sortix/fs/devfs.cpp
@@ -22,7 +22,7 @@
******************************************************************************/
-#include "../platform.h"
+#include
#include
#include
#include
diff --git a/sortix/fs/devfs.h b/sortix/fs/devfs.h
index 57aec69f..e76ea433 100644
--- a/sortix/fs/devfs.h
+++ b/sortix/fs/devfs.h
@@ -34,7 +34,7 @@ namespace Sortix
class DevDevFS : public DevFileSystem
{
- public:
+ public:
DevDevFS();
virtual ~DevDevFS();
diff --git a/sortix/fs/initfs.cpp b/sortix/fs/initfs.cpp
index b69e2d22..c5bc0558 100644
--- a/sortix/fs/initfs.cpp
+++ b/sortix/fs/initfs.cpp
@@ -22,7 +22,7 @@
******************************************************************************/
-#include "../platform.h"
+#include
#include
#include
#include
@@ -66,7 +66,7 @@ namespace Sortix
virtual bool IsWritable();
};
-
+
DevInitFSFile::DevInitFSFile(char* name, const byte* buffer, size_t buffersize)
{
this->name = name;
diff --git a/sortix/fs/ramfs.cpp b/sortix/fs/ramfs.cpp
index 4a6a2138..a3da0adb 100644
--- a/sortix/fs/ramfs.cpp
+++ b/sortix/fs/ramfs.cpp
@@ -22,7 +22,7 @@
******************************************************************************/
-#include "../platform.h"
+#include
#include
#include
#include
@@ -66,7 +66,7 @@ namespace Sortix
virtual bool IsWritable();
};
-
+
DevRAMFSFile::DevRAMFSFile(char* name)
{
this->name = name;
diff --git a/sortix/fs/ramfs.h b/sortix/fs/ramfs.h
index 9bff9972..f0cc66a2 100644
--- a/sortix/fs/ramfs.h
+++ b/sortix/fs/ramfs.h
@@ -34,7 +34,7 @@ namespace Sortix
class DevRAMFS : public DevFileSystem
{
- public:
+ public:
DevRAMFS();
virtual ~DevRAMFS();
diff --git a/sortix/bits.h b/sortix/include/sortix/bits.h
similarity index 100%
rename from sortix/bits.h
rename to sortix/include/sortix/bits.h
diff --git a/sortix/fcntl.h b/sortix/include/sortix/fcntl.h
similarity index 100%
rename from sortix/fcntl.h
rename to sortix/include/sortix/fcntl.h
diff --git a/sortix/include/sortix/initrd.h b/sortix/include/sortix/initrd.h
new file mode 100644
index 00000000..6176995b
--- /dev/null
+++ b/sortix/include/sortix/initrd.h
@@ -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 .
+
+ 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
diff --git a/sortix/log.h b/sortix/include/sortix/kernel/log.h
similarity index 99%
rename from sortix/log.h
rename to sortix/include/sortix/kernel/log.h
index ac7ed601..447ffcab 100644
--- a/sortix/log.h
+++ b/sortix/include/sortix/kernel/log.h
@@ -36,7 +36,7 @@ namespace Sortix
extern void* devicePointer;
void Init(Maxsi::Format::Callback callback, void* user);
-
+
inline void Flush()
{
if ( deviceCallback ) { deviceCallback(devicePointer, NULL, 0); }
@@ -52,7 +52,7 @@ namespace Sortix
inline size_t PrintData(const void* ptr, size_t size)
{
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, ...)
diff --git a/sortix/memorymanagement.h b/sortix/include/sortix/kernel/memorymanagement.h
similarity index 100%
rename from sortix/memorymanagement.h
rename to sortix/include/sortix/kernel/memorymanagement.h
diff --git a/sortix/panic.h b/sortix/include/sortix/kernel/panic.h
similarity index 100%
rename from sortix/panic.h
rename to sortix/include/sortix/kernel/panic.h
diff --git a/sortix/platform.h b/sortix/include/sortix/kernel/platform.h
similarity index 91%
rename from sortix/platform.h
rename to sortix/include/sortix/kernel/platform.h
index 04ab90de..524df8ed 100644
--- a/sortix/platform.h
+++ b/sortix/include/sortix/kernel/platform.h
@@ -68,15 +68,5 @@
#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
diff --git a/sortix/keycodes.h b/sortix/include/sortix/keycodes.h
similarity index 100%
rename from sortix/keycodes.h
rename to sortix/include/sortix/keycodes.h
diff --git a/sortix/seek.h b/sortix/include/sortix/seek.h
similarity index 100%
rename from sortix/seek.h
rename to sortix/include/sortix/seek.h
diff --git a/sortix/stat.h b/sortix/include/sortix/stat.h
similarity index 100%
rename from sortix/stat.h
rename to sortix/include/sortix/stat.h
diff --git a/sortix/syscallnum.h b/sortix/include/sortix/syscallnum.h
similarity index 100%
rename from sortix/syscallnum.h
rename to sortix/include/sortix/syscallnum.h
diff --git a/sortix/termmode.h b/sortix/include/sortix/termmode.h
similarity index 100%
rename from sortix/termmode.h
rename to sortix/include/sortix/termmode.h
diff --git a/sortix/timeval.h b/sortix/include/sortix/timeval.h
similarity index 100%
rename from sortix/timeval.h
rename to sortix/include/sortix/timeval.h
diff --git a/sortix/unistd.h b/sortix/include/sortix/unistd.h
similarity index 100%
rename from sortix/unistd.h
rename to sortix/include/sortix/unistd.h
diff --git a/sortix/x64/bits.h b/sortix/include/sortix/x64/bits.h
similarity index 100%
rename from sortix/x64/bits.h
rename to sortix/include/sortix/x64/bits.h
diff --git a/sortix/x86/bits.h b/sortix/include/sortix/x86/bits.h
similarity index 100%
rename from sortix/x86/bits.h
rename to sortix/include/sortix/x86/bits.h
diff --git a/sortix/initrd.cpp b/sortix/initrd.cpp
index 426d2756..527acfd3 100644
--- a/sortix/initrd.cpp
+++ b/sortix/initrd.cpp
@@ -22,14 +22,15 @@
******************************************************************************/
-#include "platform.h"
+#include
+#include
#include "initrd.h"
#include
#include
#include "syscall.h"
-#include "memorymanagement.h"
+#include
-#include "log.h" // DEBUG
+#include // DEBUG
using namespace Maxsi;
diff --git a/sortix/initrd.h b/sortix/initrd.h
index a1ee26f1..a3d9826d 100644
--- a/sortix/initrd.h
+++ b/sortix/initrd.h
@@ -22,44 +22,17 @@
******************************************************************************/
-#ifndef SORTIX_INITRD_H
-#define SORTIX_INITRD_H
+#ifndef SORTIX_INITRD_KERNEL_H
+#define SORTIX_INITRD_KERNEL_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.
- };
-
-#ifdef SORTIX_KERNEL
void Init(addr_t phys, size_t size);
byte* Open(const char* filepath, size_t* size);
const char* GetFilename(size_t index);
size_t GetNumFiles();
-#endif
}
}
diff --git a/sortix/interrupt.cpp b/sortix/interrupt.cpp
index bc5ccf8e..00a419ac 100644
--- a/sortix/interrupt.cpp
+++ b/sortix/interrupt.cpp
@@ -22,7 +22,7 @@
*******************************************************************************/
-#include "platform.h"
+#include
#include "x86-family/idt.h"
#include "interrupt.h"
@@ -251,7 +251,7 @@ void IRQHandler(Sortix::CPU::InterruptRegisters* regs)
unsigned int_no = regs->int_no;
// 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);
if ( interrupthandlers[int_no] )
diff --git a/sortix/interrupt.h b/sortix/interrupt.h
index 9b4ba1f7..e214c365 100644
--- a/sortix/interrupt.h
+++ b/sortix/interrupt.h
@@ -25,6 +25,8 @@
#ifndef SORTIX_INTERRUPT_H
#define SORTIX_INTERRUPT_H
+#include "cpu.h"
+
namespace Sortix {
namespace Interrupt {
diff --git a/sortix/io.cpp b/sortix/io.cpp
index 2246ddad..d9db489b 100644
--- a/sortix/io.cpp
+++ b/sortix/io.cpp
@@ -22,7 +22,7 @@
******************************************************************************/
-#include "platform.h"
+#include
#include
#include
#include "thread.h"
@@ -115,7 +115,7 @@ namespace Sortix
// Now go do something else.
Syscall::Incomplete();
- return 0;
+ return 0;
}
void SysSeek(int fd, off_t* offset, int whence)
diff --git a/sortix/kb/layout/us.cpp b/sortix/kb/layout/us.cpp
index 751a475c..4182b6f7 100644
--- a/sortix/kb/layout/us.cpp
+++ b/sortix/kb/layout/us.cpp
@@ -22,9 +22,9 @@
******************************************************************************/
-#include "../../platform.h"
+#include
#include "../../keyboard.h"
-#include "../../keycodes.h"
+#include
#include "us.h"
namespace Sortix
diff --git a/sortix/kb/layout/us.h b/sortix/kb/layout/us.h
index cd72a5ec..18d31353 100644
--- a/sortix/kb/layout/us.h
+++ b/sortix/kb/layout/us.h
@@ -35,7 +35,7 @@ namespace Sortix
KBLayoutUS();
virtual ~KBLayoutUS();
virtual uint32_t Translate(int kbkey);
-
+
public:
bool ProcessModifier(int kbkey, int modkey, unsigned flag);
diff --git a/sortix/kb/ps2.cpp b/sortix/kb/ps2.cpp
index a6db9ce0..b867d821 100644
--- a/sortix/kb/ps2.cpp
+++ b/sortix/kb/ps2.cpp
@@ -22,11 +22,11 @@
******************************************************************************/
-#include "../platform.h"
+#include
#include
#include "../interrupt.h"
#include "../keyboard.h"
-#include "../keycodes.h"
+#include
#include "ps2.h"
using namespace Maxsi;
diff --git a/sortix/kernel.cpp b/sortix/kernel.cpp
index 6bb88fc1..50b1bb1a 100644
--- a/sortix/kernel.cpp
+++ b/sortix/kernel.cpp
@@ -19,22 +19,22 @@
kernel.cpp
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
#include
#include
#include
-#include "log.h"
-#include "panic.h"
+#include
+#include
#include "kernelinfo.h"
-#include "x86-family/gdt.h"
+#include "x86-family/gdt.h"
#include "time.h"
#include "keyboard.h"
#include "multiboot.h"
-#include "memorymanagement.h"
+#include
#include "thread.h"
#include "process.h"
#include "scheduler.h"
diff --git a/sortix/kernelinfo.cpp b/sortix/kernelinfo.cpp
index 858bcff6..9b9bc9be 100644
--- a/sortix/kernelinfo.cpp
+++ b/sortix/kernelinfo.cpp
@@ -22,7 +22,7 @@
*******************************************************************************/
-#include "platform.h"
+#include
#include
#include
#include "syscall.h"
diff --git a/sortix/keyboard.cpp b/sortix/keyboard.cpp
index 245e8536..90c2d06a 100644
--- a/sortix/keyboard.cpp
+++ b/sortix/keyboard.cpp
@@ -22,7 +22,7 @@
******************************************************************************/
-#include "platform.h"
+#include
#include "interrupt.h"
#include "syscall.h"
#include "keyboard.h"
diff --git a/sortix/keyboard.h b/sortix/keyboard.h
index 1feb2b66..da8e4b36 100644
--- a/sortix/keyboard.h
+++ b/sortix/keyboard.h
@@ -47,14 +47,14 @@ namespace Sortix
{
public:
virtual ~KeyboardOwner() { }
- virtual void OnKeystroke(Keyboard* keyboard, void* user) = 0;
+ virtual void OnKeystroke(Keyboard* keyboard, void* user) = 0;
};
class KeyboardLayout
{
public:
virtual ~KeyboardLayout() { }
- virtual uint32_t Translate(int kbkey) = 0;
+ virtual uint32_t Translate(int kbkey) = 0;
};
}
diff --git a/sortix/linebuffer.cpp b/sortix/linebuffer.cpp
index 583e35cb..f62bbc09 100644
--- a/sortix/linebuffer.cpp
+++ b/sortix/linebuffer.cpp
@@ -22,7 +22,7 @@
******************************************************************************/
-#include "platform.h"
+#include
#include
#include "linebuffer.h"
diff --git a/sortix/log.cpp b/sortix/log.cpp
index b69c01ec..8779908c 100644
--- a/sortix/log.cpp
+++ b/sortix/log.cpp
@@ -22,10 +22,10 @@
******************************************************************************/
-#include "platform.h"
+#include
#include
#include
-#include "log.h"
+#include
#include "syscall.h"
using namespace Maxsi;
diff --git a/sortix/logterminal.cpp b/sortix/logterminal.cpp
index c8285b44..8f806b84 100644
--- a/sortix/logterminal.cpp
+++ b/sortix/logterminal.cpp
@@ -22,13 +22,13 @@
******************************************************************************/
-#include "platform.h"
+#include
#include
#include
#include "utf8.h"
#include "keyboard.h"
#include "scheduler.h"
-#include "keycodes.h"
+#include
#include "terminal.h"
#include "logterminal.h"
diff --git a/sortix/mount.cpp b/sortix/mount.cpp
index f009ee79..044ad7d5 100644
--- a/sortix/mount.cpp
+++ b/sortix/mount.cpp
@@ -22,10 +22,10 @@
******************************************************************************/
-#include "platform.h"
+#include
#include
#include
-#include "panic.h"
+#include
#include "mount.h"
#include "fs/ramfs.h"
#include "fs/initfs.h"
diff --git a/sortix/panic.cpp b/sortix/panic.cpp
index e19f43c3..0dd4f961 100644
--- a/sortix/panic.cpp
+++ b/sortix/panic.cpp
@@ -22,12 +22,12 @@
******************************************************************************/
-#include "platform.h"
+#include
#include
#include
-#include "log.h"
+#include
#include "calltrace.h"
-#include "panic.h"
+#include
using namespace Maxsi;
diff --git a/sortix/pci.cpp b/sortix/pci.cpp
index 91315dd9..db902ed6 100644
--- a/sortix/pci.cpp
+++ b/sortix/pci.cpp
@@ -22,10 +22,11 @@
******************************************************************************/
-#include "platform.h"
+#include
+#include "cpu.h"
#include
#include "pci.h"
-#include "log.h"
+#include
#include "ata.h"
using namespace Maxsi;
@@ -36,7 +37,7 @@ namespace Sortix
{
const uint16_t Config_Address = 0xCF8;
const uint16_t Config_Data = 0xCFC;
-
+
uint32_t SwapBytes(uint32_t I)
{
return (I >> 24) | ((I >> 8) & 0x0000FF00) | ((I << 8) & 0x00FF0000) | (I << 24);
diff --git a/sortix/pipe.cpp b/sortix/pipe.cpp
index 3464ca18..5e6dd1f1 100644
--- a/sortix/pipe.cpp
+++ b/sortix/pipe.cpp
@@ -22,7 +22,7 @@
******************************************************************************/
-#include "platform.h"
+#include
#include
#include
#include "event.h"
@@ -247,7 +247,7 @@ namespace Sortix
int SysPipe(int pipefd[2])
{
// TODO: Validate that pipefd is a valid user-space array!
-
+
size_t buffersize = BUFFER_SIZE;
byte* buffer = new byte[buffersize];
if ( !buffer ) { return -1; /* TODO: ENOMEM */ }
@@ -271,7 +271,7 @@ namespace Sortix
if ( 0 <= readfd ) { process->descriptors.Free(readfd); } else { delete reading; }
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;
diff --git a/sortix/pipe.h b/sortix/pipe.h
index 3f7587ac..b8197b7b 100644
--- a/sortix/pipe.h
+++ b/sortix/pipe.h
@@ -33,7 +33,7 @@ namespace Sortix
namespace Pipe
{
void Init();
- }
+ }
}
#endif
diff --git a/sortix/process.cpp b/sortix/process.cpp
index 2d063c72..b79061b5 100644
--- a/sortix/process.cpp
+++ b/sortix/process.cpp
@@ -22,7 +22,7 @@
******************************************************************************/
-#include "platform.h"
+#include
#include
#include
#include
@@ -34,7 +34,7 @@
#include "filesystem.h"
#include "directory.h"
#include "scheduler.h"
-#include "memorymanagement.h"
+#include
#include "initrd.h"
#include "elf.h"
#include "syscall.h"
@@ -116,7 +116,7 @@ namespace Sortix
// Avoid memory leaks.
ASSERT(segments == NULL);
-
+
delete[] workingdir;
// TODO: Delete address space!
@@ -220,7 +220,7 @@ namespace Sortix
{
Thread* result = NULL;
Thread* tmpclone = NULL;
-
+
for ( Thread* tmp = firstthread; tmp != NULL; tmp = tmp->nextsibling )
{
Thread* clonethread = tmp->Fork();
@@ -324,7 +324,7 @@ namespace Sortix
for ( int i = 0; i < argc; i++ ) { delete[] argv[i]; }
delete[] argv;
}
-
+
};
int SysExevVEStage2(SysExecVEState* state)
@@ -672,7 +672,7 @@ namespace Sortix
// The process needs to have children, otherwise we are waiting for
// nothing to happen.
if ( !process->firstchild ) { Error::Set(ECHILD); return -1; }
-
+
// Resumes this system call when the wait condition has been met.
thread->onchildprocessexit = SysWaitCallback;
diff --git a/sortix/process.h b/sortix/process.h
index 24f3237a..2e1cf69d 100644
--- a/sortix/process.h
+++ b/sortix/process.h
@@ -26,6 +26,7 @@
#define SORTIX_PROCESS_H
#include "descriptors.h"
+#include "cpu.h"
namespace Sortix
{
diff --git a/sortix/refcount.cpp b/sortix/refcount.cpp
index 29cecd43..4cb32683 100644
--- a/sortix/refcount.cpp
+++ b/sortix/refcount.cpp
@@ -22,7 +22,7 @@
*******************************************************************************/
-#include "platform.h"
+#include
#include "refcount.h"
namespace Sortix
diff --git a/sortix/scheduler.cpp b/sortix/scheduler.cpp
index c050a3d4..2672a497 100644
--- a/sortix/scheduler.cpp
+++ b/sortix/scheduler.cpp
@@ -22,14 +22,14 @@
******************************************************************************/
-#include "platform.h"
+#include
#include
-#include "panic.h"
+#include
#include "thread.h"
#include "process.h"
#include "time.h"
#include "scheduler.h"
-#include "memorymanagement.h"
+#include
#include "syscall.h"
#include "sound.h" // HACK FOR SIGINT
#include "x86-family/gdt.h"
diff --git a/sortix/serialterminal.cpp b/sortix/serialterminal.cpp
index 0a74f71d..d7471444 100644
--- a/sortix/serialterminal.cpp
+++ b/sortix/serialterminal.cpp
@@ -22,9 +22,9 @@
******************************************************************************/
-#include "platform.h"
+#include
#include
-#include "log.h"
+#include
#include "vga.h"
#include "keyboard.h"
#include "uart.h"
@@ -102,10 +102,10 @@ namespace Sortix
}
Keyboard::QueueKeystroke(CTRL);
- Keyboard::QueueKeystroke('A' + sigpending - 1);
+ Keyboard::QueueKeystroke('A' + sigpending - 1);
Keyboard::QueueKeystroke(CTRL | DEPRESSED);
sigpending = -1;
- continue;
+ continue;
}
if ( c < 32 ) { sigpending = c; } else { sigpending = -1; }
switch ( c )
diff --git a/sortix/signal.cpp b/sortix/signal.cpp
index ce18013b..94d869dd 100644
--- a/sortix/signal.cpp
+++ b/sortix/signal.cpp
@@ -22,9 +22,9 @@
******************************************************************************/
-#include "platform.h"
+#include
#include
-#include "panic.h"
+#include
#include "signal.h"
using namespace Maxsi;
diff --git a/sortix/signal.h b/sortix/signal.h
index 557b8092..c8683957 100644
--- a/sortix/signal.h
+++ b/sortix/signal.h
@@ -26,6 +26,7 @@
#define SORTIX_SIGNAL_H
#include
+#include "cpu.h"
namespace Sortix
{
diff --git a/sortix/sound.cpp b/sortix/sound.cpp
index 7e2d2241..c5edb2e4 100644
--- a/sortix/sound.cpp
+++ b/sortix/sound.cpp
@@ -22,7 +22,7 @@
******************************************************************************/
-#include "platform.h"
+#include
#include "sound.h"
#include "syscall.h"
@@ -33,10 +33,10 @@ namespace Sortix
void Mute()
{
uint8_t TMP = (CPU::InPortB(0x61)) & 0xFC;
-
+
CPU::OutPortB(0x61, TMP);
}
-
+
void Play(nat Frequency)
{
//Set the PIT to the desired frequency
diff --git a/sortix/syscall.cpp b/sortix/syscall.cpp
index 09698464..a47b04ea 100644
--- a/sortix/syscall.cpp
+++ b/sortix/syscall.cpp
@@ -22,11 +22,11 @@
******************************************************************************/
-#include "platform.h"
+#include
#include
#include "syscall.h"
-#include "syscallnum.h"
-#include "panic.h"
+#include
+#include
#include "process.h"
#include "thread.h"
#include "scheduler.h"
@@ -68,7 +68,7 @@ namespace Sortix
"SYSCALL_MAX_NYN = %zu", funcptr, index, SYSCALL_MAX_NUM);
}
- syscall_list[index] = funcptr;
+ syscall_list[index] = funcptr;
}
void Incomplete()
diff --git a/sortix/syscall.h b/sortix/syscall.h
index e7fa5b6a..c0dffef8 100644
--- a/sortix/syscall.h
+++ b/sortix/syscall.h
@@ -25,7 +25,8 @@
#ifndef SORTIX_SYSCALL_H
#define SORTIX_SYSCALL_H
-#include "syscallnum.h"
+#include
+#include "cpu.h"
namespace Sortix
{
diff --git a/sortix/terminal.cpp b/sortix/terminal.cpp
index 9349e398..f780cd09 100644
--- a/sortix/terminal.cpp
+++ b/sortix/terminal.cpp
@@ -22,7 +22,7 @@
******************************************************************************/
-#include "platform.h"
+#include
#include
#include "syscall.h"
#include "process.h"
@@ -51,7 +51,7 @@ namespace Sortix
DevTerminal* term = (DevTerminal*) dev;
// TODO: Check that mode is a valid user-space pointer.
*mode = term->GetMode();
- return 0;
+ return 0;
}
int SysIsATTY(int fd)
diff --git a/sortix/terminal.h b/sortix/terminal.h
index 7acae271..9d672145 100644
--- a/sortix/terminal.h
+++ b/sortix/terminal.h
@@ -28,7 +28,7 @@
#include "device.h"
#include "stream.h"
-#include "termmode.h"
+#include
namespace Sortix
{
diff --git a/sortix/thread.cpp b/sortix/thread.cpp
index 579acbac..6ff772a5 100644
--- a/sortix/thread.cpp
+++ b/sortix/thread.cpp
@@ -22,14 +22,14 @@
******************************************************************************/
-#include "platform.h"
+#include
#include
#include
#include "event.h"
#include "process.h"
#include "thread.h"
#include "scheduler.h"
-#include "memorymanagement.h"
+#include
#include "time.h"
#include "syscall.h"
@@ -120,7 +120,7 @@ namespace Sortix
{
clonesignal = currentsignal->Fork();
if ( !clonesignal ) { return NULL; }
- }
+ }
Thread* clone = new Thread(this);
if ( !clone )
@@ -214,9 +214,9 @@ namespace Sortix
if ( override->signum == SIGKILL )
{
-
+
}
-
+
override->nextsignal = currentsignal;
Maxsi::Memory::Copy(&override->regs, regs, sizeof(override->regs));
@@ -232,7 +232,7 @@ namespace Sortix
CPU::InterruptRegisters* dest = Syscall::InterruptRegs();
CPU::InterruptRegisters* src = &thread->currentsignal->regs;
-
+
Maxsi::Memory::Copy(dest, src, sizeof(CPU::InterruptRegisters));
thread->currentsignal = thread->currentsignal->nextsignal;
Syscall::AsIs();
diff --git a/sortix/thread.h b/sortix/thread.h
index 5ff62eb3..14f0b25d 100644
--- a/sortix/thread.h
+++ b/sortix/thread.h
@@ -116,7 +116,7 @@ namespace Sortix
public:
void (*onchildprocessexit)(Thread*, Process*);
-
+
};
}
diff --git a/sortix/time.cpp b/sortix/time.cpp
index fdf6b592..cd4c86e5 100644
--- a/sortix/time.cpp
+++ b/sortix/time.cpp
@@ -23,12 +23,12 @@
******************************************************************************/
-#include "platform.h"
+#include
#include "time.h"
#include "interrupt.h"
#include "process.h"
#include "scheduler.h"
-#include "log.h"
+#include
#include "sound.h"
#include "syscall.h"
@@ -112,9 +112,9 @@ namespace Sortix
Scheduler::Switch(Regs);
// 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.
- if ( !didUglyIRQ0Hack ) { RequestIQR0(); didUglyIRQ0Hack = true; }
+ if ( !didUglyIRQ0Hack ) { RequestIQR0(); didUglyIRQ0Hack = true; }
}
// TODO: Implement all the other useful functions regarding time.
diff --git a/sortix/time.h b/sortix/time.h
index 8ea3b509..f2167697 100644
--- a/sortix/time.h
+++ b/sortix/time.h
@@ -26,12 +26,14 @@
#ifndef SORTIX_TIME_H
#define SORTIX_TIME_H
+#include "cpu.h"
+
namespace Sortix
{
namespace Time
{
void Init();
- void OnIRQ0(CPU::InterruptRegisters* Registers, void* user);
+ void OnIRQ0(CPU::InterruptRegisters* Registers, void* user);
float GetTimeSinceBoot();
uintmax_t MicrosecondsSinceBoot();
}
diff --git a/sortix/uart.cpp b/sortix/uart.cpp
index b367947f..19d960f3 100644
--- a/sortix/uart.cpp
+++ b/sortix/uart.cpp
@@ -22,7 +22,8 @@
******************************************************************************/
-#include "platform.h"
+#include
+#include "cpu.h"
#include
#include
#include "vga.h"
@@ -36,14 +37,14 @@ namespace Sortix
{
const nat TXR = 0; // Transmit 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 FCR = 2; // FIFO control
const nat LCR = 3; // Line control
const nat MCR = 4; // Modem control
const nat LSR = 5; // Line 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 LCR_DLAB = 0x80; // Divisor latch access bit
@@ -181,7 +182,7 @@ namespace Sortix
CPU::OutPortB(Port + IER, 0);
int Result = -1;
-
+
if ( CPU::InPortB(Port + LSR) & LSR_READY )
{
Result = CPU::InPortB(Port);
@@ -207,7 +208,7 @@ namespace Sortix
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)
@@ -265,7 +266,7 @@ namespace Sortix
OldElement = VGALastFrame[Pos];
nat NewColor = (ConversionTable[ (Element >> 12) & 0xF ] << 3) | (ConversionTable[ (Element >> 8) & 0xF ]);
-
+
// Change the color if we need to.
if ( LastColor != NewColor )
{
diff --git a/sortix/utf8.cpp b/sortix/utf8.cpp
index ee9e96b0..efd22eba 100644
--- a/sortix/utf8.cpp
+++ b/sortix/utf8.cpp
@@ -22,7 +22,7 @@
******************************************************************************/
-#include "platform.h"
+#include
#include
#include "utf8.h"
diff --git a/sortix/vga.cpp b/sortix/vga.cpp
index c1d13275..ad068ee3 100644
--- a/sortix/vga.cpp
+++ b/sortix/vga.cpp
@@ -22,11 +22,10 @@
******************************************************************************/
-#include "platform.h"
+#include
#include
#include
#include "vga.h"
-#include "memorymanagement.h"
#include "scheduler.h"
#include "syscall.h"
#include "process.h"
@@ -60,7 +59,7 @@ namespace Sortix
CPU::OutPortB(0x3D5, (value >> 8) & 0xFF);
CPU::OutPortB(0x3D4, 15);
CPU::OutPortB(0x3D5, (value >> 0) & 0xFF);
- }
+ }
}
DevVGA::DevVGA()
diff --git a/sortix/vgaterminal.cpp b/sortix/vgaterminal.cpp
index 3ae2462e..e0a4b969 100644
--- a/sortix/vgaterminal.cpp
+++ b/sortix/vgaterminal.cpp
@@ -22,8 +22,8 @@
******************************************************************************/
-#include "platform.h"
-#include "log.h"
+#include
+#include
#include "vga.h"
#include "vgaterminal.h"
@@ -222,7 +222,7 @@ namespace Sortix
{
if ( column == width ) { Newline(); }
nat until = 4 - (column % 4);
-
+
vgaattr[line * width + (column)] |= VGAATTR_CHAR;
while ( (until--) != 0 )
{
@@ -537,7 +537,7 @@ namespace Sortix
// Left for future standardization, so discard this sequence.
else if ( c == ':' )
- {
+ {
ignoresequence = true;
}
diff --git a/sortix/x64/boot.s b/sortix/x64/boot.s
index 53286351..7ebb80f9 100644
--- a/sortix/x64/boot.s
+++ b/sortix/x64/boot.s
@@ -46,7 +46,7 @@ multiboot_header:
.long -(0x1BADB002 + 0x00000003)
multiboot_entry:
-
+
# We got our multiboot information in various registers. But we are going
# to need these registers. But where can we store them then? Oh hey, let's
# store then in the code already run!
@@ -165,7 +165,7 @@ GDT64: # Global Descriptor Table (64-bit).
.word GDTPointer - GDT64 - 1 # Limit.
.long GDT64 # Base.
.long 0
-
+
Main:
# Copy the character B onto the screen so we know it works.
movq $0x242, %r15
diff --git a/sortix/x64/gdt.s b/sortix/x64/gdt.s
index f3dd053a..8a4eee30 100644
--- a/sortix/x64/gdt.s
+++ b/sortix/x64/gdt.s
@@ -50,7 +50,7 @@ tss_flush:
# Load the index of our TSS structure - The index is 0x28, as it is the 5th
# selector and each is 8 bytes long, but we set the bottom two bits (making
# 0x2B) so that it has an RPL of 3, not zero.
- mov $0x2B, %ax
+ mov $0x2B, %ax
# Load the task state register.
ltr %ax
diff --git a/sortix/x64/memorymanagement.cpp b/sortix/x64/memorymanagement.cpp
index 97eb28aa..61d53f9f 100644
--- a/sortix/x64/memorymanagement.cpp
+++ b/sortix/x64/memorymanagement.cpp
@@ -22,11 +22,11 @@
******************************************************************************/
-#include "platform.h"
+#include
#include
#include "multiboot.h"
-#include "panic.h"
-#include "../memorymanagement.h"
+#include
+#include
#include "x86-family/memorymanagement.h"
namespace Sortix
@@ -79,7 +79,7 @@ namespace Sortix
// Add some predefined room for forking address spaces.
PML* const FORKPML2 = (PML* const) 0x29000UL;
PML* const FORKPML1 = (PML* const) 0x2A000UL;
-
+
BOOTPML3->entry[0] = (addr_t) FORKPML2 | flags | PML_FORK;
BOOTPML2->entry[0] = (addr_t) FORKPML1 | flags | PML_FORK;
diff --git a/sortix/x64/process.cpp b/sortix/x64/process.cpp
index 701f2421..f9518dc7 100644
--- a/sortix/x64/process.cpp
+++ b/sortix/x64/process.cpp
@@ -22,7 +22,7 @@
******************************************************************************/
-#include "platform.h"
+#include
#include "process.h"
namespace Sortix
diff --git a/sortix/x64/scheduler.cpp b/sortix/x64/scheduler.cpp
index 56cc8921..c6cc76a4 100644
--- a/sortix/x64/scheduler.cpp
+++ b/sortix/x64/scheduler.cpp
@@ -22,9 +22,9 @@
******************************************************************************/
-#include "platform.h"
+#include
+#include
#include "scheduler.h"
-#include "../memorymanagement.h"
namespace Sortix
{
diff --git a/sortix/x64/syscall.s b/sortix/x64/syscall.s
index c164a54a..e97a9730 100644
--- a/sortix/x64/syscall.s
+++ b/sortix/x64/syscall.s
@@ -153,7 +153,7 @@ resume_syscall:
movq 40(%r11), %r9
callq *%rax
-
+
leaveq
retq
diff --git a/sortix/x64/thread.cpp b/sortix/x64/thread.cpp
index 9c63a9fc..c973e444 100644
--- a/sortix/x64/thread.cpp
+++ b/sortix/x64/thread.cpp
@@ -22,7 +22,7 @@
******************************************************************************/
-#include "platform.h"
+#include
#include "thread.h"
namespace Sortix
diff --git a/sortix/x64/x64.cpp b/sortix/x64/x64.cpp
index f102075e..f82a8fbe 100644
--- a/sortix/x64/x64.cpp
+++ b/sortix/x64/x64.cpp
@@ -24,7 +24,7 @@
#include
#include "x64.h"
-#include "log.h"
+#include
namespace Sortix
{
diff --git a/sortix/x64/x64.h b/sortix/x64/x64.h
index b7ad489b..49a37827 100644
--- a/sortix/x64/x64.h
+++ b/sortix/x64/x64.h
@@ -39,7 +39,7 @@ namespace Sortix
uint64_t r8, r9, r10, r11, r12, r13, r14, r15;
uint64_t int_no, err_code; // Interrupt number and error code (if applicable)
uint64_t rip, cs, rflags, userrsp, ss; // Pushed by the processor automatically.
-
+
public:
void LogRegisters() const;
};
diff --git a/sortix/x86-family/gdt.cpp b/sortix/x86-family/gdt.cpp
index 437cfce8..2c591d54 100644
--- a/sortix/x86-family/gdt.cpp
+++ b/sortix/x86-family/gdt.cpp
@@ -22,7 +22,7 @@
*******************************************************************************/
-#include "../platform.h"
+#include
#include
#include "gdt.h"
diff --git a/sortix/x86-family/gdt.h b/sortix/x86-family/gdt.h
index a3ec78e5..ed8b934d 100644
--- a/sortix/x86-family/gdt.h
+++ b/sortix/x86-family/gdt.h
@@ -115,7 +115,7 @@ namespace Sortix
} __attribute__((packed));
#endif
- typedef struct tss_entry_struct tss_entry_t;
+ typedef struct tss_entry_struct tss_entry_t;
void Init();
void SetGate(int32_t num, uint32_t base, uint32_t limit, uint8_t access, uint8_t gran);
diff --git a/sortix/x86-family/idt.cpp b/sortix/x86-family/idt.cpp
index e31fbd71..d255a528 100644
--- a/sortix/x86-family/idt.cpp
+++ b/sortix/x86-family/idt.cpp
@@ -22,7 +22,7 @@
*******************************************************************************/
-#include "../platform.h"
+#include
#include
#include "idt.h"
diff --git a/sortix/x86-family/memorymanagement.cpp b/sortix/x86-family/memorymanagement.cpp
index cb591a0a..75d7cff7 100644
--- a/sortix/x86-family/memorymanagement.cpp
+++ b/sortix/x86-family/memorymanagement.cpp
@@ -22,12 +22,12 @@
******************************************************************************/
-#include "platform.h"
+#include
#include
#include
#include "multiboot.h"
-#include "panic.h"
-#include "../memorymanagement.h"
+#include
+#include
#include "memorymanagement.h"
#include "syscall.h"
diff --git a/sortix/x86/idt.asm b/sortix/x86/idt.asm
index 249ac96e..99a6c7c3 100644
--- a/sortix/x86/idt.asm
+++ b/sortix/x86/idt.asm
@@ -7,7 +7,7 @@
[GLOBAL idt_flush] ; Allows the C code to call idt_flush().
idt_flush:
- mov eax, [esp+4] ; Get the pointer to the IDT, passed as a parameter.
+ mov eax, [esp+4] ; Get the pointer to the IDT, passed as a parameter.
lidt [eax] ; Load the IDT pointer.
ret
diff --git a/sortix/x86/interrupt.asm b/sortix/x86/interrupt.asm
index fc1ac5b7..84623ee0 100644
--- a/sortix/x86/interrupt.asm
+++ b/sortix/x86/interrupt.asm
@@ -34,7 +34,7 @@
push long %2
jmp irq_common_stub
%endmacro
-
+
ISR_NOERRCODE 0
ISR_NOERRCODE 1
ISR_NOERRCODE 2
@@ -153,7 +153,7 @@ irq_common_stub:
;sti
iret ; pops 5 things at once: CS, EIP, EFLAGS, SS, and ESP
-global
+global
global interrupt_handler_null
interrupt_handler_null:
diff --git a/sortix/x86/memorymanagement.cpp b/sortix/x86/memorymanagement.cpp
index 18d0c0e7..55aecf09 100644
--- a/sortix/x86/memorymanagement.cpp
+++ b/sortix/x86/memorymanagement.cpp
@@ -22,11 +22,11 @@
******************************************************************************/
-#include "platform.h"
+#include
#include
#include "multiboot.h"
-#include "panic.h"
-#include "../memorymanagement.h"
+#include
+#include
#include "x86-family/memorymanagement.h"
namespace Sortix
diff --git a/sortix/x86/process.cpp b/sortix/x86/process.cpp
index 0095e841..b5e4cf7d 100644
--- a/sortix/x86/process.cpp
+++ b/sortix/x86/process.cpp
@@ -22,7 +22,7 @@
******************************************************************************/
-#include "platform.h"
+#include
#include "process.h"
namespace Sortix
diff --git a/sortix/x86/scheduler.cpp b/sortix/x86/scheduler.cpp
index 6ac68e84..8a736bca 100644
--- a/sortix/x86/scheduler.cpp
+++ b/sortix/x86/scheduler.cpp
@@ -22,9 +22,9 @@
******************************************************************************/
-#include "platform.h"
+#include
#include "scheduler.h"
-#include "../memorymanagement.h"
+#include
namespace Sortix
{
diff --git a/sortix/x86/syscall.s b/sortix/x86/syscall.s
index 87b7ad4f..f482a84a 100644
--- a/sortix/x86/syscall.s
+++ b/sortix/x86/syscall.s
@@ -136,7 +136,7 @@ resume_syscall:
call *%eax
addl $32, %esp
-
+
leavel
retl
diff --git a/sortix/x86/thread.cpp b/sortix/x86/thread.cpp
index 988b13da..657d25be 100644
--- a/sortix/x86/thread.cpp
+++ b/sortix/x86/thread.cpp
@@ -22,7 +22,7 @@
******************************************************************************/
-#include "platform.h"
+#include
#include "thread.h"
namespace Sortix
diff --git a/sortix/x86/x86.cpp b/sortix/x86/x86.cpp
index f855ac0a..48b85b12 100644
--- a/sortix/x86/x86.cpp
+++ b/sortix/x86/x86.cpp
@@ -24,7 +24,7 @@
#include
#include "x86.h"
-#include "log.h"
+#include
namespace Sortix
{
diff --git a/sortix/x86/x86.h b/sortix/x86/x86.h
index 04c0d8ab..27056614 100644
--- a/sortix/x86/x86.h
+++ b/sortix/x86/x86.h
@@ -38,7 +38,7 @@ namespace Sortix
uint32_t edi, esi, ebp, esp, ebx, edx, ecx, eax; // Pushed by pusha.
uint32_t int_no, err_code; // Interrupt number and error code (if applicable)
uint32_t eip, cs, eflags, useresp, ss; // Pushed by the processor automatically.
-
+
public:
void LogRegisters() const;
diff --git a/utils/cat.cpp b/utils/cat.cpp
index 33f2c7b9..502f59bf 100644
--- a/utils/cat.cpp
+++ b/utils/cat.cpp
@@ -98,7 +98,7 @@ int main(int argc, char* argv[])
result = 1;
continue;
}
-
+
result |= docat(argv[i], fd);
close(fd);
}
diff --git a/utils/column.cpp b/utils/column.cpp
index 8bd9b5df..5f9ba72d 100644
--- a/utils/column.cpp
+++ b/utils/column.cpp
@@ -133,7 +133,7 @@ int main(int argc, char* argv[])
usage(argv0);
return 1;
}
-
+
bool hadany = false;
for ( int i = 1; i < argc; i++ )
{
diff --git a/utils/editor.cpp b/utils/editor.cpp
index 25fc6bcd..6d09d378 100644
--- a/utils/editor.cpp
+++ b/utils/editor.cpp
@@ -149,7 +149,7 @@ unsigned textmode()
ssize_t numbytes = read(0, &codepoint, sizeof(codepoint));
if ( !numbytes ) { break; }
if ( numbytes < 0 ) { error(1, errno, "read stdin"); }
- if ( numbytes < sizeof(codepoint) ) {
+ if ( numbytes < sizeof(codepoint) ) {
printf("unexpectedly got %zi bytes\n", numbytes);
printf("bytes: %x\n", codepoint);
@@ -180,13 +180,13 @@ fprintf(stderr, "bad stdin data\n"); exit(1); }
if ( cursorx < WIDTH-1 ) { cursorx++; }
break;
case KBKEY_O:
- if ( ctrl ) { dectrlmode = MODE_SAVE; }
+ if ( ctrl ) { dectrlmode = MODE_SAVE; }
break;
case KBKEY_R:
- if ( ctrl ) { dectrlmode = MODE_LOAD; }
+ if ( ctrl ) { dectrlmode = MODE_LOAD; }
break;
case KBKEY_X:
- if ( ctrl ) { dectrlmode = MODE_CONFIRM_QUIT; }
+ if ( ctrl ) { dectrlmode = MODE_CONFIRM_QUIT; }
break;
}
continue;
@@ -364,8 +364,8 @@ bool loadfromfile(const char* path)
cursorx = 0;
continue;
}
-
- if ( WIDTH <= cursorx ) { continue; }
+
+ if ( WIDTH <= cursorx ) { continue; }
buffers[cursory][cursorx++] = buffer[i];
}
}
@@ -455,7 +455,7 @@ int main(int argc, char* argv[])
cursorx = 0;
cursory = 0;
}
-
+
run();
return 0;
diff --git a/utils/init.cpp b/utils/init.cpp
index 4451237d..ea5edeb1 100644
--- a/utils/init.cpp
+++ b/utils/init.cpp
@@ -56,7 +56,7 @@ int main(int argc, char* argv[])
printf("\r\e[m\e[J");
fflush(stdout);
- pid_t childpid = fork();
+ pid_t childpid = fork();
if ( childpid < 0 ) { perror("fork"); return 2; }
return ( childpid == 0 ) ? child() : parent(childpid);
diff --git a/utils/pager.cpp b/utils/pager.cpp
index 6d11442d..e5b09b55 100644
--- a/utils/pager.cpp
+++ b/utils/pager.cpp
@@ -97,7 +97,7 @@ int main(int argc, char* argv[])
if ( !(kbkey = KBKEY_DECODE(codepoint)) ) { continue; }
if ( kbkey == KBKEY_DOWN ) { break; }
if ( kbkey == KBKEY_PGDOWN ) { linesleft = HEIGHT-1; break; }
- if ( kbkey == -KBKEY_Q ) { doexit = true; break; }
+ if ( kbkey == -KBKEY_Q ) { doexit = true; break; }
} while ( kbkey != KBKEY_ENTER );
printf("\r\e[J");
if ( doexit ) { exit(result); }