diff --git a/headers/build/os/kernel/OS.h b/headers/build/os/kernel/OS.h index dade7c1958..319a136d81 100644 --- a/headers/build/os/kernel/OS.h +++ b/headers/build/os/kernel/OS.h @@ -1 +1,9 @@ +// Some platforms (Linux) don't define PAGESIZE, set a default value in that +// case. +#include + +#ifndef PAGESIZE +#define PAGESIZE 4096 +#endif + #include <../os/kernel/OS.h> diff --git a/headers/os/kernel/OS.h b/headers/os/kernel/OS.h index 887726b7c4..c4178425ad 100644 --- a/headers/os/kernel/OS.h +++ b/headers/os/kernel/OS.h @@ -7,6 +7,7 @@ /** Kernel specific structures and functions */ +#include #include #include @@ -21,9 +22,10 @@ extern "C" { /* System constants */ #define B_OS_NAME_LENGTH 32 -#define B_PAGE_SIZE 4096 #define B_INFINITE_TIMEOUT (9223372036854775807LL) +#define B_PAGE_SIZE PAGESIZE + enum { B_TIMEOUT = 0x8, /* relative timeout */ B_RELATIVE_TIMEOUT = 0x8, /* fails after a relative timeout diff --git a/headers/posix/arch/arm/limits.h b/headers/posix/arch/arm/limits.h new file mode 100644 index 0000000000..9034754429 --- /dev/null +++ b/headers/posix/arch/arm/limits.h @@ -0,0 +1,11 @@ +/* + * Copyright 2020, Haiku, inc. All rights reserved. + * Distributed under the terms of the MIT License. + */ +#ifndef _ARM_LIMITS_H +#define _ARM_LIMITS_H + +#define PAGESIZE 4096 + +#endif + diff --git a/headers/posix/arch/arm64/limits.h b/headers/posix/arch/arm64/limits.h new file mode 100644 index 0000000000..d02bd8c690 --- /dev/null +++ b/headers/posix/arch/arm64/limits.h @@ -0,0 +1,11 @@ +/* + * Copyright 2020, Haiku, inc. All rights reserved. + * Distributed under the terms of the MIT License. + */ +#ifndef _ARM64_LIMITS_H +#define _ARM64_LIMITS_H + +#define PAGESIZE 4096 + +#endif + diff --git a/headers/posix/arch/m68k/limits.h b/headers/posix/arch/m68k/limits.h new file mode 100644 index 0000000000..35113355e0 --- /dev/null +++ b/headers/posix/arch/m68k/limits.h @@ -0,0 +1,11 @@ +/* + * Copyright 2020, Haiku, inc. All rights reserved. + * Distributed under the terms of the MIT License. + */ +#ifndef _M68K_LIMITS_H +#define _M68K_LIMITS_H + +#define PAGESIZE 4096 + +#endif + diff --git a/headers/posix/arch/mipsel/limits.h b/headers/posix/arch/mipsel/limits.h new file mode 100644 index 0000000000..57f65d7bbb --- /dev/null +++ b/headers/posix/arch/mipsel/limits.h @@ -0,0 +1,11 @@ +/* + * Copyright 2020, Haiku, inc. All rights reserved. + * Distributed under the terms of the MIT License. + */ +#ifndef _MIPS_LIMITS_H +#define _MIPS_LIMITS_H + +#define PAGESIZE 4096 + +#endif + diff --git a/headers/posix/arch/ppc/limits.h b/headers/posix/arch/ppc/limits.h new file mode 100644 index 0000000000..6c8a8767c7 --- /dev/null +++ b/headers/posix/arch/ppc/limits.h @@ -0,0 +1,11 @@ +/* + * Copyright 2020, Haiku, inc. All rights reserved. + * Distributed under the terms of the MIT License. + */ +#ifndef _PPC_LIMITS_H +#define _PPC_LIMITS_H + +#define PAGESIZE 4096 + +#endif + diff --git a/headers/posix/arch/riscv64/limits.h b/headers/posix/arch/riscv64/limits.h new file mode 100644 index 0000000000..3f34291a81 --- /dev/null +++ b/headers/posix/arch/riscv64/limits.h @@ -0,0 +1,11 @@ +/* + * Copyright 2020, Haiku, inc. All rights reserved. + * Distributed under the terms of the MIT License. + */ +#ifndef _RISCV64_LIMITS_H +#define _RISCV64_LIMITS_H + +#define PAGESIZE 4096 + +#endif + diff --git a/headers/posix/arch/sparc64/limits.h b/headers/posix/arch/sparc64/limits.h new file mode 100644 index 0000000000..5d516d20df --- /dev/null +++ b/headers/posix/arch/sparc64/limits.h @@ -0,0 +1,11 @@ +/* + * Copyright 2020, Haiku, inc. All rights reserved. + * Distributed under the terms of the MIT License. + */ +#ifndef _SPARC_LIMITS_H +#define _SPARC_LIMITS_H + +#define PAGESIZE 8192 + +#endif + diff --git a/headers/posix/arch/x86/limits.h b/headers/posix/arch/x86/limits.h new file mode 100644 index 0000000000..af2329daa3 --- /dev/null +++ b/headers/posix/arch/x86/limits.h @@ -0,0 +1,11 @@ +/* + * Copyright 2020, Haiku, inc. All rights reserved. + * Distributed under the terms of the MIT License. + */ +#ifndef _X86_LIMITS_H +#define _X86_LIMITS_H + +#define PAGESIZE 4096 + +#endif + diff --git a/headers/posix/arch/x86_64/limits.h b/headers/posix/arch/x86_64/limits.h new file mode 100644 index 0000000000..abd0f04506 --- /dev/null +++ b/headers/posix/arch/x86_64/limits.h @@ -0,0 +1,11 @@ +/* + * Copyright 2020, Haiku, inc. All rights reserved. + * Distributed under the terms of the MIT License. + */ +#ifndef _X86_64_LIMITS_H +#define _X86_64_LIMITS_H + +#define PAGESIZE 4096 + +#endif + diff --git a/headers/posix/limits.h b/headers/posix/limits.h index ea59ad9840..fe96563d4d 100644 --- a/headers/posix/limits.h +++ b/headers/posix/limits.h @@ -1,5 +1,5 @@ /* - * Copyright 2001-2012 Haiku, Inc. All rights reserved. + * Copyright 2001-2020 Haiku, Inc. All rights reserved. * Distributed under the terms of the MIT License. */ #ifndef _LIBC_LIMITS_H_ @@ -11,6 +11,9 @@ #include /* for DBL_DIG, FLT_DIG, etc */ +#include __HAIKU_ARCH_HEADER(limits.h) + + #define LONGLONG_MIN (-9223372036854775807LL - 1) /* these are Be specific */ #define LONGLONG_MAX (9223372036854775807LL) #define ULONGLONG_MAX (0xffffffffffffffffULL) @@ -38,7 +41,6 @@ #define NAME_MAX (256) #define NGROUPS_MAX (32) #define OPEN_MAX (128) -#define PAGESIZE (4096) #define PATH_MAX (1024) #define PIPE_BUF (4 * 1024) #define PIPE_MAX (512) diff --git a/headers/private/kernel/arch/alpha/cpu.h b/headers/private/kernel/arch/alpha/cpu.h deleted file mode 100644 index ccaaf312b1..0000000000 --- a/headers/private/kernel/arch/alpha/cpu.h +++ /dev/null @@ -1,11 +0,0 @@ -/* -** Copyright 2001, Travis Geiselbrecht. All rights reserved. -** Distributed under the terms of the NewOS License. -*/ -#ifndef _ALPHA_CPU_H -#define _ALPHA_CPU_H - -#define PAGE_SIZE 8192 - -#endif - diff --git a/headers/private/kernel/arch/m68k/cpu.h b/headers/private/kernel/arch/m68k/cpu.h deleted file mode 100644 index 6414589249..0000000000 --- a/headers/private/kernel/arch/m68k/cpu.h +++ /dev/null @@ -1,11 +0,0 @@ -/* -** Copyright 2001, Travis Geiselbrecht. All rights reserved. -** Distributed under the terms of the NewOS License. -*/ -#ifndef _M68K_CPU_H -#define _M68K_CPU_H - -#define PAGE_SIZE 4096 - -#endif - diff --git a/headers/private/kernel/arch/mipsel/cpu.h b/headers/private/kernel/arch/mipsel/cpu.h deleted file mode 100644 index 06fe7d2b0d..0000000000 --- a/headers/private/kernel/arch/mipsel/cpu.h +++ /dev/null @@ -1,11 +0,0 @@ -/* - * Copyright 2009 Haiku Inc. - * All rights reserved. Distributed under the terms of the MIT License. - */ -#ifndef _KERNEL_ARCH_MIPSEL_CPU_H -#define _KERNEL_ARCH_MIPSEL_CPU_H - -#define PAGE_SIZE 4096 - -#endif /* _KERNEL_ARCH_MIPSEL_CPU_H */ - diff --git a/headers/private/kernel/arch/ppc/arch_cpu.h b/headers/private/kernel/arch/ppc/arch_cpu.h index 563f04ddfe..ccabe92da9 100644 --- a/headers/private/kernel/arch/ppc/arch_cpu.h +++ b/headers/private/kernel/arch/ppc/arch_cpu.h @@ -7,7 +7,6 @@ #include -#include #include diff --git a/headers/private/kernel/arch/ppc/cpu.h b/headers/private/kernel/arch/ppc/cpu.h deleted file mode 100644 index 7724f24f8b..0000000000 --- a/headers/private/kernel/arch/ppc/cpu.h +++ /dev/null @@ -1,11 +0,0 @@ -/* -** Copyright 2001, Travis Geiselbrecht. All rights reserved. -** Distributed under the terms of the NewOS License. -*/ -#ifndef _PPC_CPU_H -#define _PPC_CPU_H - -#define PAGE_SIZE 4096 - -#endif - diff --git a/headers/private/kernel/arch/riscv64/arch_cpu.h b/headers/private/kernel/arch/riscv64/arch_cpu.h index 610059b607..e5efc8ac63 100644 --- a/headers/private/kernel/arch/riscv64/arch_cpu.h +++ b/headers/private/kernel/arch/riscv64/arch_cpu.h @@ -8,7 +8,6 @@ #include -//#include #include diff --git a/headers/private/kernel/arch/sh4/cpu.h b/headers/private/kernel/arch/sh4/cpu.h deleted file mode 100644 index 6a30111da1..0000000000 --- a/headers/private/kernel/arch/sh4/cpu.h +++ /dev/null @@ -1,24 +0,0 @@ -/* -** Copyright 2001-2002, Travis Geiselbrecht. All rights reserved. -** Distributed under the terms of the NewOS License. -*/ -#ifndef _NEWOS_KERNEL_ARCH_SH4_CPU_H -#define _NEWOS_KERNEL_ARCH_SH4_CPU_H - -#include -#include - -unsigned int get_fpscr(); -unsigned int get_sr(); -void sh4_context_switch(unsigned int **old_sp, unsigned int *new_sp); -void sh4_function_caller(); -void sh4_set_kstack(addr kstack); -void sh4_enter_uspace(addr entry, void *args, addr ustack_top); -void sh4_set_user_pgdir(addr pgdir); -void sh4_invl_page(addr va); -#define PAGE_SIZE 4096 - -#define _BIG_ENDIAN 0 -#define _LITTLE_ENDIAN 1 -#endif - diff --git a/headers/private/kernel/arch/sh4/sh4.h b/headers/private/kernel/arch/sh4/sh4.h deleted file mode 100644 index b3c32443c2..0000000000 --- a/headers/private/kernel/arch/sh4/sh4.h +++ /dev/null @@ -1,152 +0,0 @@ -/* -** Copyright 2001, Travis Geiselbrecht. All rights reserved. -** Distributed under the terms of the NewOS License. -*/ -#ifndef _SH4_H -#define _SH4_H - -#define P4_AREA 0xe0000000 -#define P4_AREA_LEN 0x20000000 -#define P3_AREA 0xc0000000 -#define P3_AREA_LEN (P4_AREA - P3_AREA) -#define P2_AREA 0xa0000000 -#define P2_AREA_LEN (P3_AREA - P2_AREA) -#define P1_AREA 0x80000000 -#define P1_AREA_LEN (P2_AREA - P1_AREA) -#define P0_AREA 0 -#define P0_AREA_LEN (P1_AREA - P0_AREA) -#define U0_AREA P0_AREA -#define U0_AREA_LEN P0_AREA_LEN - -#define PHYS_MEM_START 0x0c000000 -#define PHYS_MEM_LEN 0x01000000 -#define PHYS_MEM_END (PHYS_MEM_START + PHYS_MEM_LEN) -#define P1_PHYS_MEM_START (P1_AREA + PHYS_MEM_START) -#define P1_PHYS_MEM_LEN PHYS_MEM_LEN -#define P1_PHYS_MEM_END (P1_PHYS_MEM_START + P1_PHYS_MEM_LEN) - -#define PHYS_ADDR_TO_P1(x) (((unsigned int)(x)) + P1_AREA) -#define PHYS_ADDR_TO_P2(x) (((unsigned int)(x)) + P2_AREA) -#define P1_TO_PHYS_ADDR(x) (((unsigned int)(x)) - P1_AREA) - -#define PHYS_ADDR_SIZE (0x1fffffff+1) - -//#define PAGE_SIZE 4096 -#define PAGE_SIZE_1K 0 -#define PAGE_SIZE_4K 1 -#define PAGE_SIZE_64K 2 -#define PAGE_SIZE_1M 3 - -#define PTEH 0xff000000 -#define PTEL 0xff000004 -#define PTEA 0xff000034 -#define TTB 0xff000008 -#define TEA 0xff00000c -#define MMUCR 0xff000010 - -#define UTLB 0xf6000000 -#define UTLB1 0xf7000000 -#define UTLB2 0xf3800000 -#define UTLB_ADDR_SHIFT 0x8 -#define UTLB_COUNT 64 - -struct utlb_addr_array { - unsigned int asid: 8; - unsigned int valid: 1; - unsigned int dirty: 1; - unsigned int vpn: 22; -}; - -struct utlb_data_array_1 { - unsigned int wt: 1; - unsigned int sh: 1; - unsigned int dirty: 1; - unsigned int cacheability: 1; - unsigned int psize0: 1; - unsigned int prot_key: 2; - unsigned int psize1: 1; - unsigned int valid: 1; - unsigned int unused: 1; - unsigned int ppn: 19; - unsigned int unused2: 3; -}; - -struct utlb_data_array_2 { - unsigned int sa: 2; - unsigned int tc: 1; - unsigned int unused: 29; -}; - -struct utlb_data { - struct utlb_addr_array a; - struct utlb_data_array_1 da1; - struct utlb_data_array_2 da2; -}; - -#define ITLB 0xf2000000 -#define ITLB1 0xf3000000 -#define ITLB2 0xf3800000 -#define ITLB_ADDR_SHIFT 0x8 -#define ITLB_COUNT 4 - -struct itlb_addr_array { - unsigned int asid: 8; - unsigned int valid: 1; - unsigned int unused: 1; - unsigned int vpn: 22; -}; - -struct itlb_data_array_1 { - unsigned int unused1: 1; - unsigned int sh: 1; - unsigned int unused2: 1; - unsigned int cacheability: 1; - unsigned int psize0: 1; - unsigned int unused3: 1; - unsigned int prot_key: 1; - unsigned int psize1: 1; - unsigned int valid: 1; - unsigned int unused4: 1; - unsigned int ppn: 19; - unsigned int unused5: 3; -}; - -struct itlb_data_array_2 { - unsigned int sa: 2; - unsigned int tc: 1; - unsigned int unused: 29; -}; - -struct itlb_data { - struct itlb_addr_array a; - struct itlb_data_array_1 da1; - struct itlb_data_array_2 da2; -}; - -// timer stuff -#define TOCR 0xffd80000 -#define TSTR 0xffd80004 -#define TCOR0 0xffd80008 -#define TCNT0 0xffd8000c -#define TCR0 0xffd80010 -#define TCOR1 0xffd80014 -#define TCNT1 0xffd80018 -#define TCR1 0xffd8001c -#define TCOR2 0xffd80020 -#define TCNT2 0xffd80024 -#define TCR2 0xffd80028 -#define TCPR2 0xffd8002c - -// interrupt controller stuff -#define ICR 0xffd00000 -#define IPRA 0xffd00004 -#define IPRB 0xffd00008 -#define IPRC 0xffd0000c - -// cache stuff -#define CCR 0xff00001c -#define QACR0 0xff000038 -#define QACR1 0xff00003c - -#endif - diff --git a/headers/private/kernel/arch/sparc/arch_cpu.h b/headers/private/kernel/arch/sparc/arch_cpu.h index 750a46c0ff..3223ada418 100644 --- a/headers/private/kernel/arch/sparc/arch_cpu.h +++ b/headers/private/kernel/arch/sparc/arch_cpu.h @@ -8,7 +8,6 @@ #include -#include #include diff --git a/headers/private/kernel/arch/sparc/cpu.h b/headers/private/kernel/arch/sparc/cpu.h deleted file mode 100644 index e1ef9e31d1..0000000000 --- a/headers/private/kernel/arch/sparc/cpu.h +++ /dev/null @@ -1,11 +0,0 @@ -/* -** Copyright 2001, Travis Geiselbrecht. All rights reserved. -** Distributed under the terms of the NewOS License. -*/ -#ifndef _SPARC64_CPU_H -#define _SPARC64_CPU_H - -#define PAGE_SIZE 8192 - -#endif - diff --git a/headers/private/kernel/arch/sparc/sparc.h b/headers/private/kernel/arch/sparc/sparc.h deleted file mode 100644 index 0a9a4cd79c..0000000000 --- a/headers/private/kernel/arch/sparc/sparc.h +++ /dev/null @@ -1,12 +0,0 @@ -/* -** Copyright 2001, Travis Geiselbrecht. All rights reserved. -** Distributed under the terms of the NewOS License. -*/ -#ifndef _SPARC_H -#define _SPARC_H - -#define PAGE_SIZE 4096 -#define PAGE_ALIGN(x) (((x) + (PAGE_SIZE-1)) & ~(PAGE_SIZE-1)) - -#endif - diff --git a/headers/private/kernel/arch/x86/arch_cpu.h b/headers/private/kernel/arch/x86/arch_cpu.h index 2ba90b0551..b2f3975056 100644 --- a/headers/private/kernel/arch/x86/arch_cpu.h +++ b/headers/private/kernel/arch/x86/arch_cpu.h @@ -21,10 +21,6 @@ #include #include -#ifdef __x86_64__ -# include -#endif - #endif // !_ASSEMBLER diff --git a/src/system/boot/platform/bios_ia32/debug.cpp b/src/system/boot/platform/bios_ia32/debug.cpp index 4fc67738ac..4df7424eaf 100644 --- a/src/system/boot/platform/bios_ia32/debug.cpp +++ b/src/system/boot/platform/bios_ia32/debug.cpp @@ -6,6 +6,7 @@ #include "debug.h" +#include #include #include