From b88853de81bad82ac6f103b318413b5a14770526 Mon Sep 17 00:00:00 2001 From: Jonas 'Sortie' Termansen Date: Thu, 20 Jun 2013 14:35:40 +0200 Subject: [PATCH] Remove obsolete PLATFORM_X86 and PLATFORM_X64 macros. --- libc/include/features.h | 3 --- sortix/elf.cpp | 2 +- sortix/include/sortix/bits.h | 31 -------------------------- sortix/include/sortix/fork.h | 4 ++-- sortix/include/sortix/kernel/decl.h | 18 ++------------- sortix/interrupt.cpp | 4 ++-- sortix/kernel.cpp | 4 ++-- sortix/x86-family/memorymanagement.cpp | 2 +- sortix/x86-family/memorymanagement.h | 6 ++--- 9 files changed, 12 insertions(+), 62 deletions(-) delete mode 100644 sortix/include/sortix/bits.h diff --git a/libc/include/features.h b/libc/include/features.h index 58fcfd10..b7c1bc32 100644 --- a/libc/include/features.h +++ b/libc/include/features.h @@ -109,10 +109,7 @@ /*#define __SORTIX_SHOW_UNIMPLEMENTED*/ #if !defined(_LIBC_HACK_FEATURE_NO_DECLARATIONS) - -#include #include - #endif #undef _LIBC_HACK_FEATURE_NO_DECLARATIONS diff --git a/sortix/elf.cpp b/sortix/elf.cpp index 480112bf..236e0b85 100644 --- a/sortix/elf.cpp +++ b/sortix/elf.cpp @@ -216,7 +216,7 @@ addr_t Construct32(Process* process, const uint8_t* file, size_t filelen) addr_t Construct64(Process* process, const uint8_t* file, size_t filelen) { -#ifndef PLATFORM_X64 +#if !defined(__x86_64__) (void) process; (void) file; (void) filelen; diff --git a/sortix/include/sortix/bits.h b/sortix/include/sortix/bits.h deleted file mode 100644 index fdbb9dc4..00000000 --- a/sortix/include/sortix/bits.h +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - - 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 . - - sortix/bits.h - Declares the current platform macro. - -*******************************************************************************/ - -#if !defined(PLATFORM_X86) && !defined(PLATFORM_X64) - #if defined(__x86_64__) - #define PLATFORM_X64 - #else - #define PLATFORM_X86 - #endif -#endif diff --git a/sortix/include/sortix/fork.h b/sortix/include/sortix/fork.h index bfd2f52c..4e701d62 100644 --- a/sortix/include/sortix/fork.h +++ b/sortix/include/sortix/fork.h @@ -82,9 +82,9 @@ __BEGIN_DECLS own state into such a structure and calling tfork. Note that this structure is highly platform specific, portable code should use the standard threading facilities combined with sfork if possible. */ -#ifdef PLATFORM_X86 +#if defined(__i386__) typedef struct tforkregs_x86 tforkregs_t; -#elif defined(PLATFORM_X64) +#elif defined(__x86_64__) typedef struct tforkregs_x64 tforkregs_t; #else #warning No tforkregs_cpu structure declared diff --git a/sortix/include/sortix/kernel/decl.h b/sortix/include/sortix/kernel/decl.h index cff511cf..ba31a366 100644 --- a/sortix/include/sortix/kernel/decl.h +++ b/sortix/include/sortix/kernel/decl.h @@ -38,26 +38,12 @@ typedef uintptr_t addr_t; #define unlikely(x) __builtin_expect((x),0) #define STATIC_ASSERT(condition) static_assert(condition, #condition) -// The following declarations should not be used if possible. They were part of -// what libmaxsi's old platform.h header declared and the kernel continues to -// depend on it. -#if !defined(PLATFORM_X64) && defined(__x86_64__) - #define PLATFORM_X64 -#elif !defined(PLATFORM_X86) && defined(__i386__) - #define PLATFORM_X86 -#endif - -#if !defined(CPU) && defined(PLATFORM_X86) +#if !defined(CPU) && defined(__i386__) #define CPU X86 #endif -#if !defined(CPU) && defined(PLATFORM_X64) +#if !defined(CPU) && defined(__x86_64__) #define CPU X64 #endif -#if !defined(CPU_FAMILY) && defined(PLATFORM_X86) || defined(PLATFORM_X64) - #define PLATFORM_X86_FAMILY - #define CPU_FAMILY X86_FAMILY -#endif - #endif diff --git a/sortix/interrupt.cpp b/sortix/interrupt.cpp index e11967eb..a5093a93 100644 --- a/sortix/interrupt.cpp +++ b/sortix/interrupt.cpp @@ -229,9 +229,9 @@ void CrashHandler(CPU::InterruptRegisters* regs) Log::Print("\n"); } -#ifdef PLATFORM_X64 +#if defined(__x86_64__) addr_t ip = regs->rip; -#else +#elif defined(__i386__) addr_t ip = regs->eip; #endif diff --git a/sortix/kernel.cpp b/sortix/kernel.cpp index eb2a34e2..901b40b9 100644 --- a/sortix/kernel.cpp +++ b/sortix/kernel.cpp @@ -618,9 +618,9 @@ static void BootThread(void* /*user*/) } } -#if defined(PLATFORM_X86) +#if defined(__i386__) #define CPUTYPE_STR "i486-sortix" -#elif defined(PLATFORM_X64) +#elif defined(__x86_64__) #define CPUTYPE_STR "x86_64-sortix" #else #error No cputype environmental variable provided here. diff --git a/sortix/x86-family/memorymanagement.cpp b/sortix/x86-family/memorymanagement.cpp index 11bff8bb..f4fd8ce6 100644 --- a/sortix/x86-family/memorymanagement.cpp +++ b/sortix/x86-family/memorymanagement.cpp @@ -128,7 +128,7 @@ namespace Sortix addr_t base = (addr_t) mmap->addr; size_t length = Page::AlignDown(mmap->len); - #ifdef PLATFORM_X86 + #if defined(__i386__) // Figure out if the memory area is addressable (are our pointers big enough?) if ( 0xFFFFFFFFULL < mmap->addr ) { continue; } if ( 0xFFFFFFFFULL < mmap->addr + mmap->len ) { length = 0x100000000ULL - mmap->addr; } diff --git a/sortix/x86-family/memorymanagement.h b/sortix/x86-family/memorymanagement.h index 4267128d..07d6c07f 100644 --- a/sortix/x86-family/memorymanagement.h +++ b/sortix/x86-family/memorymanagement.h @@ -92,11 +92,9 @@ namespace Sortix } } -#ifdef PLATFORM_X86 +#if defined(__i386__) #include "../x86/memorymanagement.h" -#endif - -#ifdef PLATFORM_X64 +#elif defined(__x86_64__) #include "../x64/memorymanagement.h" #endif