Don't include Maxsi:: API in kernel.cpp.

Since kernel.cpp is intended to be an example of the current best coding
practices within the Sortix kernel, and the Maxsi:: API is deprecated and
is being removed, it should rather use the nice C standard library.
This commit is contained in:
Jonas 'Sortie' Termansen 2012-09-22 14:14:58 +02:00
parent 0437d75147
commit b685b7a9eb
3 changed files with 50 additions and 9 deletions

View File

@ -40,6 +40,8 @@
#define ASSERT(invariant) assert(invariant)
#endif
#include <malloc.h>
#define PARANOIA 1
#ifdef SORTIX_KERNEL
@ -431,6 +433,11 @@ namespace Maxsi
#endif
}
extern "C" void _init_heap()
{
Init();
}
// Attempts to expand the wilderness such that it contains at least
// bytesneeded bytes. This is done by mapping new pages onto into the
// virtual address-space.

38
libmaxsi/include/malloc.h Normal file
View File

@ -0,0 +1,38 @@
/*******************************************************************************
Copyright(C) Jonas 'Sortie' Termansen 2012.
This file is part of LibMaxsi.
LibMaxsi is free software: you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License as published by the Free
Software Foundation, either version 3 of the License, or (at your option)
any later version.
LibMaxsi 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 Lesser General Public License for more
details.
You should have received a copy of the GNU Lesser General Public License
along with LibMaxsi. If not, see <http://www.gnu.org/licenses/>.
malloc.h
*******************************************************************************/
/* TODO: POSIX-1.2008 compliance is only partial */
#ifndef _UNISTD_H
#define _UNISTD_H 1
#include <features.h>
__BEGIN_DECLS
extern "C" void _init_heap();
__END_DECLS
#endif

View File

@ -32,19 +32,17 @@
#include <sortix/kernel/textbuffer.h>
#include <sortix/kernel/pci.h>
#include <sortix/kernel/worker.h>
#include <sortix/wait.h>
#include <libmaxsi/error.h>
#include <libmaxsi/memory.h>
#include <libmaxsi/string.h>
#include <libmaxsi/format.h>
#include <sortix/kernel/memorymanagement.h>
#include <sortix/mman.h>
#include <sortix/wait.h>
#include <errno.h>
#include <malloc.h>
#include "kernelinfo.h"
#include "x86-family/gdt.h"
#include "x86-family/float.h"
#include "time.h"
#include "keyboard.h"
#include "multiboot.h"
#include <sortix/kernel/memorymanagement.h>
#include "thread.h"
#include "process.h"
#include "scheduler.h"
@ -70,8 +68,6 @@
#include "interrupt.h"
#include "fs/devfs.h"
using namespace Maxsi;
// Keep the stack size aligned with $CPU/base.s
const size_t STACK_SIZE = 64*1024;
extern "C" { size_t stack[STACK_SIZE / sizeof(size_t)] = {0}; }
@ -180,7 +176,7 @@ extern "C" void KernelInit(unsigned long magic, multiboot_info_t* bootinfo)
Interrupt::Init();
// Initialize the kernel heap.
Maxsi::Memory::Init();
_init_heap();
// Initialize the interrupt worker.
Interrupt::InitWorker();