Merge 422c160db1 into 4db99f4012
This commit is contained in:
commit
75850c4914
17
README.md
Normal file
17
README.md
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
# Build MINIX/arm with clang
|
||||
|
||||
It is now possible to build a full minix distribution for BeaglBone White/Black and BeagleBoardxM using clang instead of GCC.
|
||||
|
||||
This also add support to run the Kuya tests on ARM, which was not possible when GCC was used, because of problems in the C++ exception handling.
|
||||
|
||||
## Known Bugs
|
||||
|
||||
The following tests still fails:
|
||||
1. 53: Division by zero does not trigger exceptions
|
||||
2. 75: ru.tv_secs can't be zero (and is zero)
|
||||
3. 85: hangs
|
||||
4. isofs: Fails because of an out of memory condition
|
||||
5. vnd: crash
|
||||
6. Running two times the kyua tests in a row, without rebooting in between will lead to a mostly failed second run because of copy-on-write errors.
|
||||
|
||||
|
||||
|
|
@ -81,6 +81,9 @@
|
|||
./usr/include/arm/vm.h minix-comp
|
||||
./usr/include/arm/vmparam.h minix-comp
|
||||
./usr/include/arm/wchar_limits.h minix-comp
|
||||
./usr/include/clang-3.6/arm_acle.h minix-comp llvm,llvmcmds
|
||||
./usr/include/clang-3.6/arm_neon.h minix-comp llvm,llvmcmds
|
||||
./usr/include/clang-3.6/stdatomic.h minix-comp llvm,llvmcmds
|
||||
./usr/include/evbarm minix-comp
|
||||
./usr/include/evbarm/disklabel.h minix-comp
|
||||
./usr/include/evbarm/intr.h minix-comp
|
||||
|
|
|
|||
|
|
@ -3816,6 +3816,7 @@ class ARMTargetInfo : public TargetInfo {
|
|||
SizeType = UnsignedInt;
|
||||
|
||||
switch (T.getOS()) {
|
||||
case llvm::Triple::Minix:
|
||||
case llvm::Triple::NetBSD:
|
||||
WCharType = SignedInt;
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -275,7 +275,7 @@ std::string ToolChain::ComputeLLVMTriple(const ArgList &Args,
|
|||
// FIXME: Thumb should just be another -target-feaure, not in the triple.
|
||||
#if defined(__minix) || 1
|
||||
// Minix/ARM-specific force to ARMv7 and EABI.
|
||||
StringRef Suffix = "v7";
|
||||
StringRef Suffix = "v7a";
|
||||
Triple.setEnvironment(llvm::Triple::EABI);
|
||||
#else
|
||||
StringRef Suffix = Triple.isOSBinFormatMachO()
|
||||
|
|
|
|||
|
|
@ -665,6 +665,10 @@ StringRef tools::arm::getARMFloatABI(const Driver &D, const ArgList &Args,
|
|||
}
|
||||
break;
|
||||
|
||||
case llvm::Triple::Minix:
|
||||
FloatABI = "softfp";
|
||||
break;
|
||||
|
||||
default:
|
||||
switch(Triple.getEnvironment()) {
|
||||
case llvm::Triple::GNUEABIHF:
|
||||
|
|
@ -796,6 +800,9 @@ void Clang::AddARMTargetArgs(const ArgList &Args,
|
|||
ABIName = "aapcs";
|
||||
break;
|
||||
default:
|
||||
if (Triple.getOS() == llvm::Triple::Minix)
|
||||
ABIName = "apcs-gnu";
|
||||
|
||||
if (Triple.getOS() == llvm::Triple::NetBSD)
|
||||
ABIName = "apcs-gnu";
|
||||
else
|
||||
|
|
@ -7733,6 +7740,11 @@ void minix::Link::ConstructJob(Compilation &C, const JobAction &JA,
|
|||
// Many NetBSD architectures support more than one ABI.
|
||||
// Determine the correct emulation for ld.
|
||||
switch (getToolChain().getArch()) {
|
||||
case llvm::Triple::arm:
|
||||
case llvm::Triple::thumb:
|
||||
CmdArgs.push_back("-m");
|
||||
CmdArgs.push_back("armelf_minix");
|
||||
break;
|
||||
case llvm::Triple::x86:
|
||||
CmdArgs.push_back("-m");
|
||||
CmdArgs.push_back("elf_i386_minix");
|
||||
|
|
|
|||
|
|
@ -638,6 +638,8 @@ llvm::Optional<ProgramStateRef> MallocChecker::performKernelMalloc(
|
|||
if (!KernelZeroFlagVal.hasValue()) {
|
||||
if (OS == llvm::Triple::FreeBSD)
|
||||
KernelZeroFlagVal = 0x0100;
|
||||
else if (OS == llvm::Triple::Minix)
|
||||
KernelZeroFlagVal = 0x0002;
|
||||
else if (OS == llvm::Triple::NetBSD)
|
||||
KernelZeroFlagVal = 0x0002;
|
||||
else if (OS == llvm::Triple::OpenBSD)
|
||||
|
|
|
|||
|
|
@ -1074,6 +1074,8 @@ const char *Triple::getARMCPUForArch(StringRef MArch) const {
|
|||
// supported by LLVM.
|
||||
// FIXME: Should warn once that we're falling back.
|
||||
switch (getOS()) {
|
||||
case llvm::Triple::Minix:
|
||||
return "cortex-a8";
|
||||
case llvm::Triple::NetBSD:
|
||||
switch (getEnvironment()) {
|
||||
case llvm::Triple::GNUEABIHF:
|
||||
|
|
|
|||
|
|
@ -59,6 +59,7 @@ ARMELFMCAsmInfo::ARMELFMCAsmInfo(StringRef TT) {
|
|||
|
||||
// Exceptions handling
|
||||
switch (TheTriple.getOS()) {
|
||||
case Triple::Minix:
|
||||
case Triple::NetBSD:
|
||||
ExceptionsType = ExceptionHandling::DwarfCFI;
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -5,11 +5,6 @@ PROG= kernel
|
|||
BINDIR= /usr/sbin
|
||||
MAN=
|
||||
|
||||
.if ${MACHINE_ARCH} == "earm" && ${MKLLVM:Uno} == "yes"
|
||||
# BJG - problems with optimisation of the kernel by llvm
|
||||
DBG=-O0
|
||||
.endif
|
||||
|
||||
.include "arch/${MACHINE_ARCH}/Makefile.inc"
|
||||
|
||||
SRCS+= clock.c cpulocals.c interrupt.c main.c proc.c system.c \
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@
|
|||
#include <machine/vm.h>
|
||||
#include <machine/signal.h>
|
||||
#include <arm/armreg.h>
|
||||
#include <arm/vfpreg.h>
|
||||
|
||||
#include <minix/u64.h>
|
||||
|
||||
|
|
@ -26,16 +27,36 @@
|
|||
|
||||
void * k_stacks;
|
||||
|
||||
|
||||
#define VFP_COPROC 10
|
||||
#define VFP_COPROC2 11
|
||||
void fpu_init(void)
|
||||
{
|
||||
const char *model = NULL;
|
||||
uint32_t cpu_media_and_vfp_features[2];
|
||||
|
||||
const uint32_t cpacr_vfp = CPACR_CPn(VFP_COPROC);
|
||||
const uint32_t cpacr_vfp2 = CPACR_CPn(VFP_COPROC2);
|
||||
|
||||
/*
|
||||
* We first need to enable access to the coprocessors.
|
||||
*/
|
||||
uint32_t cpacr = armreg_cpacr_read();
|
||||
cpacr |= __SHIFTIN(CPACR_ALL, cpacr_vfp);
|
||||
cpacr |= __SHIFTIN(CPACR_ALL, cpacr_vfp2);
|
||||
armreg_cpacr_write(cpacr);
|
||||
|
||||
isb();
|
||||
|
||||
/* Enable vfp/neon unit */
|
||||
armreg_fpexc_write(VFP_FPEXC_EN);
|
||||
}
|
||||
|
||||
void save_local_fpu(struct proc *pr, int retain)
|
||||
{
|
||||
}
|
||||
|
||||
void save_fpu(struct proc *pr)
|
||||
void
|
||||
save_fpu(struct proc *pr)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -8,10 +8,6 @@ SRCS= main.c alloc.c utility.c exit.c fork.c break.c \
|
|||
mem_anon.c mem_directphys.c mem_anon_contig.c mem_shared.c \
|
||||
mem_cache.c cache.c vfs.c mem_file.c fdref.c acl.c
|
||||
|
||||
.if ${MACHINE_ARCH} == "earm"
|
||||
LDFLAGS+= -T ${.CURDIR}/arch/${MACHINE_ARCH}/vm.lds
|
||||
.endif
|
||||
|
||||
.if ${MKPAE:Uno} != "no"
|
||||
CPPFLAGS+= -DPAE=1
|
||||
.endif
|
||||
|
|
|
|||
|
|
@ -1,249 +0,0 @@
|
|||
/* Script for -z combreloc: combine and sort reloc sections */
|
||||
OUTPUT_FORMAT("elf32-littlearm", "elf32-bigarm",
|
||||
"elf32-littlearm")
|
||||
OUTPUT_ARCH(arm)
|
||||
ENTRY(_start)
|
||||
SEARCH_DIR("=/usr/local/lib"); SEARCH_DIR("=/lib"); SEARCH_DIR("=/usr/lib");
|
||||
SECTIONS
|
||||
{
|
||||
/* Read-only sections, merged into text segment: */
|
||||
PROVIDE (__executable_start = SEGMENT_START("text-segment", 0x8000)); . = SEGMENT_START("text-segment", 0x8000);
|
||||
.interp : { *(.interp) }
|
||||
.note.gnu.build-id : { *(.note.gnu.build-id) }
|
||||
.hash : { *(.hash) }
|
||||
.gnu.hash : { *(.gnu.hash) }
|
||||
.dynsym : { *(.dynsym) }
|
||||
.dynstr : { *(.dynstr) }
|
||||
.gnu.version : { *(.gnu.version) }
|
||||
.gnu.version_d : { *(.gnu.version_d) }
|
||||
.gnu.version_r : { *(.gnu.version_r) }
|
||||
.rel.dyn :
|
||||
{
|
||||
*(.rel.init)
|
||||
*(.rel.text .rel.text.* .rel.gnu.linkonce.t.*)
|
||||
*(.rel.fini)
|
||||
*(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*)
|
||||
*(.rel.data.rel.ro* .rel.gnu.linkonce.d.rel.ro.*)
|
||||
*(.rel.data .rel.data.* .rel.gnu.linkonce.d.*)
|
||||
*(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*)
|
||||
*(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*)
|
||||
*(.rel.ctors)
|
||||
*(.rel.dtors)
|
||||
*(.rel.got)
|
||||
*(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*)
|
||||
PROVIDE_HIDDEN (__rel_iplt_start = .);
|
||||
*(.rel.iplt)
|
||||
PROVIDE_HIDDEN (__rel_iplt_end = .);
|
||||
PROVIDE_HIDDEN (__rela_iplt_start = .);
|
||||
PROVIDE_HIDDEN (__rela_iplt_end = .);
|
||||
}
|
||||
.rela.dyn :
|
||||
{
|
||||
*(.rela.init)
|
||||
*(.rela.text .rela.text.* .rela.gnu.linkonce.t.*)
|
||||
*(.rela.fini)
|
||||
*(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*)
|
||||
*(.rela.data .rela.data.* .rela.gnu.linkonce.d.*)
|
||||
*(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*)
|
||||
*(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*)
|
||||
*(.rela.ctors)
|
||||
*(.rela.dtors)
|
||||
*(.rela.got)
|
||||
*(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*)
|
||||
PROVIDE_HIDDEN (__rel_iplt_start = .);
|
||||
PROVIDE_HIDDEN (__rel_iplt_end = .);
|
||||
PROVIDE_HIDDEN (__rela_iplt_start = .);
|
||||
*(.rela.iplt)
|
||||
PROVIDE_HIDDEN (__rela_iplt_end = .);
|
||||
}
|
||||
.rel.plt :
|
||||
{
|
||||
*(.rel.plt)
|
||||
}
|
||||
.rela.plt :
|
||||
{
|
||||
*(.rela.plt)
|
||||
}
|
||||
.init :
|
||||
{
|
||||
KEEP (*(.init))
|
||||
} =0
|
||||
.plt : { *(.plt) }
|
||||
.iplt : { *(.iplt) }
|
||||
.text :
|
||||
{
|
||||
*(.text.unlikely .text.*_unlikely)
|
||||
*(.text.exit .text.exit.*)
|
||||
*(.text.startup .text.startup.*)
|
||||
*(.text.hot .text.hot.*)
|
||||
*(.text .stub .text.* .gnu.linkonce.t.*)
|
||||
/* .gnu.warning sections are handled specially by elf32.em. */
|
||||
*(.gnu.warning)
|
||||
*(.glue_7t) *(.glue_7) *(.vfp11_veneer) *(.v4_bx)
|
||||
} =0
|
||||
.fini :
|
||||
{
|
||||
KEEP (*(.fini))
|
||||
} =0
|
||||
PROVIDE (__etext = .);
|
||||
PROVIDE (_etext = .);
|
||||
PROVIDE (etext = .);
|
||||
.rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) }
|
||||
.rodata1 : { *(.rodata1) }
|
||||
.ARM.extab : { *(.ARM.extab* .gnu.linkonce.armextab.*) }
|
||||
PROVIDE_HIDDEN (__exidx_start = .);
|
||||
.ARM.exidx : { *(.ARM.exidx* .gnu.linkonce.armexidx.*) }
|
||||
PROVIDE_HIDDEN (__exidx_end = .);
|
||||
.eh_frame_hdr : { *(.eh_frame_hdr) }
|
||||
.eh_frame : ONLY_IF_RO { KEEP (*(.eh_frame)) }
|
||||
.gcc_except_table : ONLY_IF_RO { *(.gcc_except_table
|
||||
.gcc_except_table.*) }
|
||||
/* These sections are generated by the Sun/Oracle C++ compiler. */
|
||||
.exception_ranges : ONLY_IF_RO { *(.exception_ranges
|
||||
.exception_ranges*) }
|
||||
/* Adjust the address for the data segment. We want to adjust up to
|
||||
the same address within the page on the next page up. */
|
||||
/* XXX: align on page boundary */
|
||||
/* . = ALIGN(CONSTANT (MAXPAGESIZE)) + (. & (CONSTANT (MAXPAGESIZE) - 1));*/
|
||||
. = ALIGN(4096);
|
||||
/* Exception handling */
|
||||
.eh_frame : ONLY_IF_RW { KEEP (*(.eh_frame)) }
|
||||
.gcc_except_table : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) }
|
||||
.exception_ranges : ONLY_IF_RW { *(.exception_ranges .exception_ranges*) }
|
||||
/* Thread Local Storage sections */
|
||||
.tdata : { *(.tdata .tdata.* .gnu.linkonce.td.*) }
|
||||
.tbss : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) }
|
||||
.preinit_array :
|
||||
{
|
||||
PROVIDE_HIDDEN (__preinit_array_start = .);
|
||||
KEEP (*(.preinit_array))
|
||||
PROVIDE_HIDDEN (__preinit_array_end = .);
|
||||
}
|
||||
.init_array :
|
||||
{
|
||||
PROVIDE_HIDDEN (__init_array_start = .);
|
||||
KEEP (*(SORT(.init_array.*)))
|
||||
KEEP (*(.init_array))
|
||||
PROVIDE_HIDDEN (__init_array_end = .);
|
||||
}
|
||||
.fini_array :
|
||||
{
|
||||
PROVIDE_HIDDEN (__fini_array_start = .);
|
||||
KEEP (*(SORT(.fini_array.*)))
|
||||
KEEP (*(.fini_array))
|
||||
PROVIDE_HIDDEN (__fini_array_end = .);
|
||||
}
|
||||
.ctors :
|
||||
{
|
||||
/* gcc uses crtbegin.o to find the start of
|
||||
the constructors, so we make sure it is
|
||||
first. Because this is a wildcard, it
|
||||
doesn't matter if the user does not
|
||||
actually link against crtbegin.o; the
|
||||
linker won't look for a file to match a
|
||||
wildcard. The wildcard also means that it
|
||||
doesn't matter which directory crtbegin.o
|
||||
is in. */
|
||||
KEEP (*crtbegin.o(.ctors))
|
||||
KEEP (*crtbegin?.o(.ctors))
|
||||
/* We don't want to include the .ctor section from
|
||||
the crtend.o file until after the sorted ctors.
|
||||
The .ctor section from the crtend file contains the
|
||||
end of ctors marker and it must be last */
|
||||
KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .ctors))
|
||||
KEEP (*(SORT(.ctors.*)))
|
||||
KEEP (*(.ctors))
|
||||
}
|
||||
.dtors :
|
||||
{
|
||||
KEEP (*crtbegin.o(.dtors))
|
||||
KEEP (*crtbegin?.o(.dtors))
|
||||
KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors))
|
||||
KEEP (*(SORT(.dtors.*)))
|
||||
KEEP (*(.dtors))
|
||||
}
|
||||
/* XXX: no jcr, got, etc.
|
||||
|
||||
.jcr : { KEEP (*(.jcr)) }
|
||||
.data.rel.ro : { *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*) *(.data.rel.ro* .gnu.linkonce.d.rel.ro.*) }
|
||||
.dynamic : { *(.dynamic) }
|
||||
.got : { *(.got.plt) *(.igot.plt) *(.got) *(.igot) }
|
||||
*/
|
||||
.data :
|
||||
{
|
||||
__data_start = . ;
|
||||
/* XXX: put pagetable data at beginning */
|
||||
pagetable.o(.data)
|
||||
*(.data .data.* .gnu.linkonce.d.*)
|
||||
SORT(CONSTRUCTORS)
|
||||
/* XXX: 16KB align */
|
||||
. = ALIGN(16384);
|
||||
}
|
||||
.data1 : { *(.data1) }
|
||||
_edata = .; PROVIDE (edata = .);
|
||||
__bss_start = .;
|
||||
__bss_start__ = .;
|
||||
.bss :
|
||||
{
|
||||
/* XXX: put pagetable bss at beginning */
|
||||
pagetable.o(.bss)
|
||||
*(.dynbss)
|
||||
*(.bss .bss.* .gnu.linkonce.b.*)
|
||||
*(COMMON)
|
||||
/* Align here to ensure that the .bss section occupies space up to
|
||||
_end. Align after .bss to ensure correct alignment even if the
|
||||
.bss section disappears because there are no input sections.
|
||||
FIXME: Why do we need it? When there is no .bss section, we don't
|
||||
pad the .data section. */
|
||||
. = ALIGN(. != 0 ? 32 / 8 : 1);
|
||||
}
|
||||
_bss_end__ = . ; __bss_end__ = . ;
|
||||
. = ALIGN(32 / 8);
|
||||
. = ALIGN(32 / 8);
|
||||
__end__ = . ;
|
||||
_end = .; PROVIDE (end = .);
|
||||
/* Stabs debugging sections. */
|
||||
.stab 0 : { *(.stab) }
|
||||
.stabstr 0 : { *(.stabstr) }
|
||||
.stab.excl 0 : { *(.stab.excl) }
|
||||
.stab.exclstr 0 : { *(.stab.exclstr) }
|
||||
.stab.index 0 : { *(.stab.index) }
|
||||
.stab.indexstr 0 : { *(.stab.indexstr) }
|
||||
.comment 0 : { *(.comment) }
|
||||
/* DWARF debug sections.
|
||||
Symbols in the DWARF debugging sections are relative to the beginning
|
||||
of the section so we begin them at 0. */
|
||||
/* DWARF 1 */
|
||||
.debug 0 : { *(.debug) }
|
||||
.line 0 : { *(.line) }
|
||||
/* GNU DWARF 1 extensions */
|
||||
.debug_srcinfo 0 : { *(.debug_srcinfo) }
|
||||
.debug_sfnames 0 : { *(.debug_sfnames) }
|
||||
/* DWARF 1.1 and DWARF 2 */
|
||||
.debug_aranges 0 : { *(.debug_aranges) }
|
||||
.debug_pubnames 0 : { *(.debug_pubnames) }
|
||||
/* DWARF 2 */
|
||||
.debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
|
||||
.debug_abbrev 0 : { *(.debug_abbrev) }
|
||||
.debug_line 0 : { *(.debug_line) }
|
||||
.debug_frame 0 : { *(.debug_frame) }
|
||||
.debug_str 0 : { *(.debug_str) }
|
||||
.debug_loc 0 : { *(.debug_loc) }
|
||||
.debug_macinfo 0 : { *(.debug_macinfo) }
|
||||
/* SGI/MIPS DWARF 2 extensions */
|
||||
.debug_weaknames 0 : { *(.debug_weaknames) }
|
||||
.debug_funcnames 0 : { *(.debug_funcnames) }
|
||||
.debug_typenames 0 : { *(.debug_typenames) }
|
||||
.debug_varnames 0 : { *(.debug_varnames) }
|
||||
/* DWARF 3 */
|
||||
.debug_pubtypes 0 : { *(.debug_pubtypes) }
|
||||
.debug_ranges 0 : { *(.debug_ranges) }
|
||||
.stack 0x80000 :
|
||||
{
|
||||
_stack = .;
|
||||
*(.stack)
|
||||
}
|
||||
.ARM.attributes 0 : { KEEP (*(.ARM.attributes)) KEEP (*(.gnu.attributes)) }
|
||||
.note.gnu.arm.ident 0 : { KEEP (*(.note.gnu.arm.ident)) }
|
||||
/DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) }
|
||||
}
|
||||
|
|
@ -40,7 +40,7 @@ static struct pdm {
|
|||
u32_t val;
|
||||
phys_bytes phys;
|
||||
u32_t *page_directories;
|
||||
} pagedir_mappings[MAX_PAGEDIR_PDES];
|
||||
} pagedir_mappings[MAX_PAGEDIR_PDES] __aligned(ARCH_PAGEDIR_SIZE);
|
||||
|
||||
static multiboot_module_t *kern_mb_mod = NULL;
|
||||
static size_t kern_size = 0;
|
||||
|
|
@ -80,7 +80,7 @@ int missing_sparedirs = SPAREPAGEDIRS;
|
|||
static struct {
|
||||
void *pagedir;
|
||||
phys_bytes phys;
|
||||
} sparepagedirs[SPAREPAGEDIRS];
|
||||
} sparepagedirs[SPAREPAGEDIRS] __aligned(ARCH_PAGEDIR_SIZE);
|
||||
|
||||
#define is_staticaddr(v) ((vir_bytes) (v) < VM_OWN_HEAPSTART)
|
||||
|
||||
|
|
@ -109,7 +109,10 @@ static char static_sparepages[VM_PAGE_SIZE*STATIC_SPAREPAGES]
|
|||
__aligned(VM_PAGE_SIZE);
|
||||
|
||||
#if defined(__arm__)
|
||||
static char static_sparepagedirs[ARCH_PAGEDIR_SIZE*STATIC_SPAREPAGEDIRS + ARCH_PAGEDIR_SIZE] __aligned(ARCH_PAGEDIR_SIZE);
|
||||
/* We need one ARCH_PAGEDIR_SIZE extra to be able to ensure the physical
|
||||
* addresses are aligned on pagetables boundaries. Without this the MMU will
|
||||
* fail to parse properly the L1 pagetables. */
|
||||
static char static_sparepagedirs[ARCH_PAGEDIR_SIZE*(STATIC_SPAREPAGEDIRS+1)];
|
||||
#endif
|
||||
|
||||
void pt_assert(pt_t *pt)
|
||||
|
|
@ -1091,9 +1094,6 @@ void pt_init(void)
|
|||
int s, r, p;
|
||||
phys_bytes phys;
|
||||
vir_bytes sparepages_mem;
|
||||
#if defined(__arm__)
|
||||
vir_bytes sparepagedirs_mem;
|
||||
#endif
|
||||
static u32_t currentpagedir[ARCH_VM_DIR_ENTRIES];
|
||||
int m = kernel_boot_info.kern_mod;
|
||||
#if defined(__i386__)
|
||||
|
|
@ -1117,12 +1117,6 @@ void pt_init(void)
|
|||
sparepages_mem = (vir_bytes) static_sparepages;
|
||||
assert(!(sparepages_mem % VM_PAGE_SIZE));
|
||||
|
||||
#if defined(__arm__)
|
||||
/* Get ourselves spare pagedirs. */
|
||||
sparepagedirs_mem = (vir_bytes) static_sparepagedirs;
|
||||
assert(!(sparepagedirs_mem % ARCH_PAGEDIR_SIZE));
|
||||
#endif
|
||||
|
||||
/* Spare pages are used to allocate memory before VM has its own page
|
||||
* table that things (i.e. arbitrary physical memory) can be mapped into.
|
||||
* We get it by pre-allocating it in our bss (allocated and mapped in by
|
||||
|
|
@ -1132,20 +1126,40 @@ void pt_init(void)
|
|||
#if defined(__arm__)
|
||||
missing_sparedirs = 0;
|
||||
assert(STATIC_SPAREPAGEDIRS <= SPAREPAGEDIRS);
|
||||
for(s = 0; s < SPAREPAGEDIRS; s++) {
|
||||
vir_bytes v = (sparepagedirs_mem + s*ARCH_PAGEDIR_SIZE);;
|
||||
phys_bytes ph;
|
||||
if((r=sys_umap(SELF, VM_D, (vir_bytes) v,
|
||||
ARCH_PAGEDIR_SIZE, &ph)) != OK)
|
||||
{
|
||||
phys_bytes sparepagedirs_phys_mem;
|
||||
uint32_t offset;
|
||||
|
||||
/* Get ourselves spare pagedirs. */
|
||||
vir_bytes sparepagedirs_mem = (vir_bytes) static_sparepagedirs;
|
||||
|
||||
if ((r = sys_umap(SELF, VM_D, sparepagedirs_mem,
|
||||
ARCH_PAGEDIR_SIZE * (STATIC_SPAREPAGEDIRS + 1),
|
||||
&sparepagedirs_phys_mem)) != OK) {
|
||||
panic("pt_init: sys_umap failed: %d", r);
|
||||
if(s >= STATIC_SPAREPAGEDIRS) {
|
||||
sparepagedirs[s].pagedir = NULL;
|
||||
missing_sparedirs++;
|
||||
continue;
|
||||
}
|
||||
sparepagedirs[s].pagedir = (void *) v;
|
||||
sparepagedirs[s].phys = ph;
|
||||
}
|
||||
}
|
||||
/* Align to ARCH_PAGEDIR_SIZE sparepagedirs_phys_mem &
|
||||
* sparepagedirs_mem. */
|
||||
offset = ARCH_PAGEDIR_SIZE -
|
||||
(sparepagedirs_phys_mem % ARCH_PAGEDIR_SIZE);
|
||||
sparepagedirs_phys_mem += offset;
|
||||
sparepagedirs_mem += offset;
|
||||
|
||||
for(s = 0; s < SPAREPAGEDIRS; s++) {
|
||||
vir_bytes v = (sparepagedirs_mem + s*ARCH_PAGEDIR_SIZE);
|
||||
phys_bytes ph = (sparepagedirs_phys_mem + s*ARCH_PAGEDIR_SIZE);
|
||||
#if 0
|
||||
printf("sparepagedirs[%d] pagedir %p phys %p\n", s, v, ph);
|
||||
#endif
|
||||
if(s >= STATIC_SPAREPAGEDIRS) {
|
||||
sparepagedirs[s].pagedir = NULL;
|
||||
missing_sparedirs++;
|
||||
continue;
|
||||
}
|
||||
sparepagedirs[s].pagedir = (void *) v;
|
||||
sparepagedirs[s].phys = ph;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if(!(spare_pagequeue = reservedqueue_new(SPAREPAGES, 1, 1, 0)))
|
||||
|
|
|
|||
|
|
@ -28,9 +28,6 @@ fi
|
|||
: ${IMG=minix_arm_sd.img}
|
||||
|
||||
# ARM definitions:
|
||||
: ${BUILDVARS=-V MKGCCCMDS=yes -V MKLLVM=no}
|
||||
# These BUILDVARS are for building with LLVM:
|
||||
#: ${BUILDVARS=-V MKLIBCXX=no -V MKKYUA=no -V MKATF=no -V MKLLVMCMDS=no}
|
||||
: ${FAT_SIZE=$(( 10*(2**20) / 512))} # This is in sectors
|
||||
|
||||
# Beagleboard-xm
|
||||
|
|
|
|||
|
|
@ -120,6 +120,11 @@ USETOOLS?= never
|
|||
# LSC FIXME: RELEASEMACHINEDIR is set to evbarm, instead of evbearm-el
|
||||
.if !empty(MACHINE:Mevbarm*)
|
||||
RELEASEMACHINEDIR:= evbearm-el
|
||||
# LSC: Clang uses floating point instruction to vectorize some operation, even
|
||||
# at -O0, make sure it uses soft-float as the minix uKernel doesn't yet
|
||||
# save / restore the hardware fpu context on ARM.
|
||||
CFLAGS+= -mno-implicit-float -fno-vectorize
|
||||
MKSOFTFLOAT=yes
|
||||
.endif
|
||||
|
||||
.if ${HAVE_GCC:Dyes} == "yes" || \
|
||||
|
|
|
|||
22
sys/lib/libkern/arch/arm/Makefile.inc
Normal file
22
sys/lib/libkern/arch/arm/Makefile.inc
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
# $NetBSD: Makefile.inc,v 1.21 2014/01/29 23:37:18 joerg Exp $
|
||||
|
||||
SRCS+= byte_swap_2.S byte_swap_4.S
|
||||
SRCS+= ffs.S
|
||||
SRCS+= memcmp.S memcpy.S memset.S memmove.S strcmp.S strncmp.S
|
||||
|
||||
.if !empty(MACHINE_ARCH:Mearm*)
|
||||
SRCS+= unwind_stub.c
|
||||
.endif
|
||||
.if empty(MACHINE_ARCH:Mearmv7*)
|
||||
CPUFLAGS.ffs.S+= -marm
|
||||
.endif
|
||||
CPUFLAGS.divide.S+= -marm
|
||||
CPUFLAGS.memcmp.S+= -marm
|
||||
CPUFLAGS.memcpy.S+= -marm
|
||||
CPUFLAGS.memmove.S+= -marm
|
||||
CPUFLAGS.memset.S+= -marm
|
||||
.if empty(CPPFLAGS:M-D_STANDALONE)
|
||||
CPUFLAGS.strcpy.S+= -marm
|
||||
CPUFLAGS.strlcpy.S+= -marm
|
||||
CPUFLAGS.strncpy.S+= -marm
|
||||
.endif
|
||||
48
sys/lib/libkern/arch/arm/unwind_stub.c
Normal file
48
sys/lib/libkern/arch/arm/unwind_stub.c
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
/*-
|
||||
* Copyright (c) 2013 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by Matt Thomas of 3am Software Foundry.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(1, "$NetBSD: unwind_stub.c,v 1.2 2013/08/12 23:42:14 matt Exp $");
|
||||
|
||||
#if defined(__minix)
|
||||
#include <ehabi.h>
|
||||
#else
|
||||
#include <arm/ehabi.h>
|
||||
#endif /* defined(__minix) */
|
||||
|
||||
static _Unwind_Reason_Code __used
|
||||
__aeabi_unwind_cpp_stub(_Unwind_State state, _Unwind_Control_Block *ucbp,
|
||||
_Unwind_Context *context)
|
||||
{
|
||||
return _URC_FAILURE;
|
||||
}
|
||||
|
||||
__weak_alias(__aeabi_unwind_cpp_pr0, __aeabi_unwind_cpp_stub)
|
||||
__weak_alias(__aeabi_unwind_cpp_pr1, __aeabi_unwind_cpp_stub)
|
||||
__weak_alias(__aeabi_unwind_cpp_pr2, __aeabi_unwind_cpp_stub)
|
||||
|
|
@ -16,3 +16,9 @@ CPPFLAGS.libunwind.cxx+=-I${NETBSDSRCDIR}/sys/lib/libunwind
|
|||
.if ${LIBC_MACHINE_CPU} == "arm"
|
||||
AFLAGS.unwind_registers.S+= ${${ACTIVE_CC} == "clang":? -mfpu=vfp3 :}
|
||||
.endif
|
||||
|
||||
.if defined(__MINIX)
|
||||
.PATH: ${NETBSDSRCDIR}/sys/lib/libkern/arch/arm
|
||||
SRCS+= unwind_stub.c
|
||||
CPPFLAGS.unwind_stub.c+=-I${NETBSDSRCDIR}/sys/arch/arm/include
|
||||
.endif # defined(__MINIX)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user