├── .gitignore ├── Demo ├── CORTEX_A15_Xen_GCC │ ├── .gitignore │ ├── Makefile │ ├── README │ ├── assert.c │ ├── hooks.c │ ├── include │ │ ├── FreeRTOSConfig.h │ │ └── freertos │ │ │ ├── arch_mm.h │ │ │ ├── arch_spinlock.h │ │ │ ├── asm │ │ │ ├── mm.h │ │ │ └── timer.h │ │ │ ├── ctype.h │ │ │ ├── extra-types.h │ │ │ ├── mmu.h │ │ │ ├── os.h │ │ │ ├── popcount.h │ │ │ └── spinlock.h │ ├── linker.lds │ └── platform │ │ ├── asm │ │ ├── hypercalls.s │ │ └── shared_info.s │ │ ├── console │ │ ├── console.c │ │ └── xencons_ring.c │ │ ├── include │ │ └── platform │ │ │ ├── console.h │ │ │ ├── events.h │ │ │ ├── gnttab.h │ │ │ ├── hypercalls.h │ │ │ ├── hypervisor.h │ │ │ ├── interrupts.h │ │ │ ├── ivcdev.h │ │ │ ├── libIVC.h │ │ │ ├── pt_regs.h │ │ │ ├── wait.h │ │ │ ├── waittypes.h │ │ │ ├── xen_hvm.h │ │ │ ├── xen_setup.h │ │ │ └── xenbus.h │ │ ├── ivcdev.c │ │ ├── libIVC.c │ │ ├── minlibc │ │ ├── FD_SET.c │ │ ├── FD_ZERO.c │ │ ├── _Unwind_Resume.c │ │ ├── __fprintf_chk.c │ │ ├── __fxstat.c │ │ ├── __gcc_personality_v0.c │ │ ├── __getdelim.c │ │ ├── __lxstat.c │ │ ├── __xstat.c │ │ ├── abort.c │ │ ├── access.c │ │ ├── addmntent.c │ │ ├── atof.c │ │ ├── atoi.c │ │ ├── bsearch.c │ │ ├── bzero.c │ │ ├── chmod.c │ │ ├── close.c │ │ ├── creat.c │ │ ├── ctime_r.c │ │ ├── dup.c │ │ ├── dup2.c │ │ ├── endmntent.c │ │ ├── environ.c │ │ ├── epoll_create.c │ │ ├── epoll_ctl.c │ │ ├── epoll_wait.c │ │ ├── errno.c │ │ ├── eventfd.c │ │ ├── eventfd_write.c │ │ ├── exit.c │ │ ├── fclose.c │ │ ├── fcntl.c │ │ ├── feof.c │ │ ├── fflush.c │ │ ├── fopen.c │ │ ├── fork.c │ │ ├── fprintf.c │ │ ├── fputc.c │ │ ├── fputs.c │ │ ├── fread.c │ │ ├── fseek.c │ │ ├── fstat.c │ │ ├── ftell.c │ │ ├── ftruncate.c │ │ ├── fwrite.c │ │ ├── getc.c │ │ ├── getegid.c │ │ ├── getenv.c │ │ ├── geteuid.c │ │ ├── getgid.c │ │ ├── getline.c │ │ ├── getmntent.c │ │ ├── getmntent_r.c │ │ ├── getpagesize.c │ │ ├── getpid.c │ │ ├── getrusage.c │ │ ├── gettimeofday.c │ │ ├── getuid.c │ │ ├── hasmntopt.c │ │ ├── iconv.c │ │ ├── iconv_close.c │ │ ├── iconv_open.c │ │ ├── include │ │ │ ├── alloca.h │ │ │ ├── assert.h │ │ │ ├── ctype.h │ │ │ ├── dirent.h │ │ │ ├── dlfcn.h │ │ │ ├── errno.h │ │ │ ├── fcntl.h │ │ │ ├── float.h │ │ │ ├── iconv.h │ │ │ ├── inttypes.h │ │ │ ├── langinfo.h │ │ │ ├── locale.h │ │ │ ├── math.h │ │ │ ├── mntent.h │ │ │ ├── poll.h │ │ │ ├── runtime_reqs.h │ │ │ ├── sched.h │ │ │ ├── signal.h │ │ │ ├── stdarg.h │ │ │ ├── stddef.h │ │ │ ├── stdio.h │ │ │ ├── stdlib.h │ │ │ ├── string.h │ │ │ ├── strings.h │ │ │ ├── sys │ │ │ │ ├── epoll.h │ │ │ │ ├── eventfd.h │ │ │ │ ├── mman.h │ │ │ │ ├── resource.h │ │ │ │ ├── select.h │ │ │ │ ├── stat.h │ │ │ │ ├── time.h │ │ │ │ ├── timeb.h │ │ │ │ ├── times.h │ │ │ │ ├── types.h │ │ │ │ ├── utsname.h │ │ │ │ ├── vfs.h │ │ │ │ └── wait.h │ │ │ ├── termios.h │ │ │ ├── time.h │ │ │ ├── unistd.h │ │ │ ├── utime.h │ │ │ └── wctype.h │ │ ├── isatty.c │ │ ├── isdigit.c │ │ ├── isspace.c │ │ ├── kill.c │ │ ├── link.c │ │ ├── localtime_r.c │ │ ├── lseek.c │ │ ├── lstat.c │ │ ├── malloc.c │ │ ├── memchr.c │ │ ├── memcmp.c │ │ ├── memcpy.c │ │ ├── memmove.c │ │ ├── memset.c │ │ ├── mkdir.c │ │ ├── mkfifo.c │ │ ├── mkstemp.c │ │ ├── mmap.c │ │ ├── mprotect.c │ │ ├── mremap.c │ │ ├── munmap.c │ │ ├── nl_langinfo.c │ │ ├── open.c │ │ ├── pabort.c │ │ ├── perror.c │ │ ├── pipe.c │ │ ├── poll.c │ │ ├── printf.c │ │ ├── putchar.c │ │ ├── putenv.c │ │ ├── puts.c │ │ ├── raise.c │ │ ├── read.c │ │ ├── select.c │ │ ├── setmntent.c │ │ ├── sigaction.c │ │ ├── sigaddset.c │ │ ├── sigemptyset.c │ │ ├── sigprocmask.c │ │ ├── snprintf.c │ │ ├── sprintf.c │ │ ├── sscanf.c │ │ ├── stat.c │ │ ├── statfs.c │ │ ├── stdio_values.c │ │ ├── strchr.c │ │ ├── strcmp.c │ │ ├── strcpy.c │ │ ├── strdup.c │ │ ├── strerror.c │ │ ├── strlen.c │ │ ├── strncmp.c │ │ ├── strncpy.c │ │ ├── strnlen.c │ │ ├── strrchr.c │ │ ├── strstr.c │ │ ├── strtol.c │ │ ├── sysconf.c │ │ ├── tcgetattr.c │ │ ├── tcsetattr.c │ │ ├── termios.c │ │ ├── time.c │ │ ├── tzset.c │ │ ├── umask.c │ │ ├── unlink.c │ │ ├── unsetenv.c │ │ ├── utime.c │ │ ├── vfprintf.c │ │ ├── vsnprintf.c │ │ ├── waitpid.c │ │ └── write.c │ │ ├── platform.c │ │ ├── runtime.c │ │ ├── util │ │ ├── ctype.c │ │ ├── ldivmod_helper.c │ │ ├── popcount.c │ │ └── qdivrem.c │ │ └── xen │ │ ├── events.c │ │ ├── events_setup.c │ │ ├── gnttab.c │ │ ├── hvm.c │ │ ├── hypervisor.c │ │ ├── xen_setup.c │ │ ├── xenbus-arm.c │ │ └── xenbus.c └── Common │ ├── Full │ ├── BlockQ.c │ ├── PollQ.c │ ├── comtest.c │ ├── death.c │ ├── dynamic.c │ ├── events.c │ ├── flash.c │ ├── flop.c │ ├── integer.c │ ├── print.c │ └── semtest.c │ ├── Minimal │ ├── AltBlckQ.c │ ├── AltBlock.c │ ├── AltPollQ.c │ ├── AltQTest.c │ ├── BlockQ.c │ ├── GenQTest.c │ ├── IntQueue.c │ ├── PollQ.c │ ├── QPeek.c │ ├── QueueOverwrite.c │ ├── QueueSet.c │ ├── TimerDemo.c │ ├── blocktim.c │ ├── comtest.c │ ├── comtest_strings.c │ ├── countsem.c │ ├── crflash.c │ ├── crhook.c │ ├── death.c │ ├── dynamic.c │ ├── flash.c │ ├── flash_timer.c │ ├── flop.c │ ├── integer.c │ ├── recmutex.c │ ├── semtest.c │ └── sp_flop.c │ └── include │ ├── AltBlckQ.h │ ├── AltBlock.h │ ├── AltPollQ.h │ ├── AltQTest.h │ ├── BlockQ.h │ ├── GenQTest.h │ ├── IntQueue.h │ ├── PollQ.h │ ├── QPeek.h │ ├── QueueOverwrite.h │ ├── QueueSet.h │ ├── TimerDemo.h │ ├── blocktim.h │ ├── comtest.h │ ├── comtest2.h │ ├── comtest_strings.h │ ├── countsem.h │ ├── crflash.h │ ├── crhook.h │ ├── death.h │ ├── dynamic.h │ ├── fileIO.h │ ├── flash.h │ ├── flash_timer.h │ ├── flop.h │ ├── integer.h │ ├── mevents.h │ ├── partest.h │ ├── print.h │ ├── recmutex.h │ ├── semtest.h │ └── serial.h ├── Example ├── Example.c └── Makefile ├── License └── license.txt ├── README.md ├── Source ├── croutine.c ├── include │ ├── FreeRTOS.h │ ├── StackMacros.h │ ├── croutine.h │ ├── list.h │ ├── mpu_wrappers.h │ ├── portable.h │ ├── projdefs.h │ ├── queue.h │ ├── semphr.h │ ├── task.h │ └── timers.h ├── list.c ├── portable │ ├── GCC │ │ └── ARM7_CA15_Xen │ │ │ ├── asm │ │ │ ├── arm_modes.s │ │ │ ├── boot.s │ │ │ ├── bss.s │ │ │ ├── cache.s │ │ │ ├── dumpregs.s │ │ │ ├── fpu.s │ │ │ ├── irq.s │ │ │ ├── ldivmod.s │ │ │ ├── print.s │ │ │ ├── stack.s │ │ │ ├── strings.s │ │ │ ├── timer.s │ │ │ ├── tlb.s │ │ │ └── vectors.s │ │ │ ├── gic.c │ │ │ ├── include │ │ │ ├── configcheck.h │ │ │ ├── port │ │ │ │ ├── gic.h │ │ │ │ └── interrupts.h │ │ │ └── portmacro.h │ │ │ ├── mmu.c │ │ │ ├── port.c │ │ │ └── tick.c │ └── MemMang │ │ ├── heap_1.c │ │ ├── heap_2.c │ │ ├── heap_3.c │ │ └── heap_4.c ├── queue.c ├── readme.txt ├── tasks.c └── timers.c └── setup.sh /.gitignore: -------------------------------------------------------------------------------- 1 | .*.swp 2 | *.o 3 | *.bin 4 | *.elf 5 | dtc 6 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/.gitignore: -------------------------------------------------------------------------------- 1 | *.bin 2 | *.elf 3 | *.a 4 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/README: -------------------------------------------------------------------------------- 1 | 2 | FreeRTOS as Xen ARM Guest 3 | ------------------------- 4 | 5 | This directory, together with the ARM7_CA15_Xen port directory, provides a port 6 | of FreeRTOS for the Cortex A15 ARM processor with support for running as a Xen 7 | guest operating system. 8 | 9 | Features provided this port: 10 | 11 | * Generic Interrupt Controller (GIC) setup 12 | * XenStore configuration and management API 13 | * Memory page allocator for mapping Xen pages 14 | * Minimal C library (in platform/minlibc/) 15 | * Xen console support (output only) 16 | * Xen inter-domain communication library (platform/libIVC.c) 17 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/assert.c: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright (C) 2014-2015 Galois, Inc. 4 | * 5 | * This program is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License** as published by the Free 7 | * Software Foundation; either version 2 of the License, or (at your option) 8 | * any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but WITHOUT 11 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 12 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 13 | * more details. 14 | 15 | * You should have received a copy of the GNU General Public License along with 16 | * this program; if not, write to the Free Software Foundation, Inc., 59 Temple 17 | * Place, Suite 330, Boston, MA 02111-1307 USA 18 | * 19 | */ 20 | 21 | #include 22 | #include 23 | 24 | void vAssertCalled( const char * pcFile, unsigned long ulLine ) 25 | { 26 | volatile unsigned long ul = 0; 27 | 28 | printk("ASSERTION FAILURE: %s:%d\n", pcFile, ulLine); 29 | 30 | taskENTER_CRITICAL(); 31 | { 32 | /* Set ul to a non-zero value using the debugger to step out of this 33 | function. */ 34 | while( ul == 0 ) 35 | { 36 | portNOP(); 37 | } 38 | } 39 | taskEXIT_CRITICAL(); 40 | } 41 | 42 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/hooks.c: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright (C) 2014-2015 Galois, Inc. 4 | * 5 | * This program is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License** as published by the Free 7 | * Software Foundation; either version 2 of the License, or (at your option) 8 | * any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but WITHOUT 11 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 12 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 13 | * more details. 14 | 15 | * You should have received a copy of the GNU General Public License along with 16 | * this program; if not, write to the Free Software Foundation, Inc., 59 Temple 17 | * Place, Suite 330, Boston, MA 02111-1307 USA 18 | * 19 | */ 20 | 21 | #include 22 | #include 23 | #include 24 | 25 | void vApplicationMallocFailedHook( void ) 26 | { 27 | /* Called if a call to pvPortMalloc() fails because there is insufficient 28 | free memory available in the FreeRTOS heap. pvPortMalloc() is called 29 | internally by FreeRTOS API functions that create tasks, queues, software 30 | timers, and semaphores. The size of the FreeRTOS heap is set by the 31 | configTOTAL_HEAP_SIZE configuration constant in FreeRTOSConfig.h. */ 32 | printk("Malloc failed\n"); 33 | __disable_irq(); 34 | for( ;; ); 35 | } 36 | 37 | void vApplicationStackOverflowHook( xTaskHandle pxTask, signed char *pcTaskName ) 38 | { 39 | ( void ) pcTaskName; 40 | ( void ) pxTask; 41 | 42 | /* Run time stack overflow checking is performed if 43 | configCHECK_FOR_STACK_OVERFLOW is defined to 1 or 2. This hook 44 | function is called if a stack overflow is detected. */ 45 | 46 | printk("Stack overflow in task (handle 0x%x, name '%s')\n", pxTask, pcTaskName); 47 | __disable_irq(); 48 | for( ;; ); 49 | } 50 | 51 | void vApplicationIdleHook( void ) 52 | { 53 | } 54 | 55 | void vApplicationTickHook( void ) 56 | { 57 | } 58 | 59 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/include/freertos/arch_mm.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014-2015 Galois, Inc. 3 | * 4 | * This program is free software; you can redistribute it and/or modify it 5 | * under the terms of the GNU General Public License** as published by the Free 6 | * Software Foundation; either version 2 of the License, or (at your option) 7 | * any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, but WITHOUT 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 12 | * more details. 13 | 14 | * You should have received a copy of the GNU General Public License along with 15 | * this program; if not, write to the Free Software Foundation, Inc., 59 Temple 16 | * Place, Suite 330, Boston, MA 02111-1307 USA 17 | * 18 | */ 19 | 20 | #ifndef _ARCH_MM_H_ 21 | #define _ARCH_MM_H_ 22 | 23 | #define PAGE_SHIFT 12 24 | #define PAGE_SIZE (1 << PAGE_SHIFT) 25 | #define L1_PAGETABLE_SHIFT 12 26 | #define VIRT_START ((unsigned long)0) 27 | #define to_phys(x) ((unsigned long)(x)-VIRT_START) 28 | #define PFN_DOWN(x) ((x) >> L1_PAGETABLE_SHIFT) 29 | #define virt_to_pfn(_virt) (PFN_DOWN(to_phys(_virt))) 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/include/freertos/arch_spinlock.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014-2015 Galois, Inc. 3 | * 4 | * This program is free software; you can redistribute it and/or modify it 5 | * under the terms of the GNU General Public License** as published by the Free 6 | * Software Foundation; either version 2 of the License, or (at your option) 7 | * any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, but WITHOUT 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 12 | * more details. 13 | 14 | * You should have received a copy of the GNU General Public License along with 15 | * this program; if not, write to the Free Software Foundation, Inc., 59 Temple 16 | * Place, Suite 330, Boston, MA 02111-1307 USA 17 | * 18 | */ 19 | 20 | 21 | 22 | #ifndef __ARCH_ASM_SPINLOCK_H 23 | #define __ARCH_ASM_SPINLOCK_H 24 | 25 | #include "os.h" 26 | 27 | 28 | #define ARCH_SPIN_LOCK_UNLOCKED { 1 } 29 | 30 | /* 31 | * Simple spin lock operations. There are two variants, one clears IRQ's 32 | * on the local processor, one does not. 33 | * 34 | * We make no fairness assumptions. They have a cost. 35 | */ 36 | 37 | #define arch_spin_is_locked(x) (*(volatile signed char *)(&(x)->slock) <= 0) 38 | #define arch_spin_unlock_wait(x) do { barrier(); } while(spin_is_locked(x)) 39 | 40 | /* 41 | * This works. Despite all the confusion. 42 | * (except on PPro SMP or if we are using OOSTORE) 43 | * (PPro errata 66, 92) 44 | */ 45 | 46 | static inline void _raw_spin_unlock(spinlock_t *lock) 47 | { 48 | xchg(&lock->slock, 1); 49 | } 50 | 51 | static inline int _raw_spin_trylock(spinlock_t *lock) 52 | { 53 | return xchg(&lock->slock, 0) != 0 ? 1 : 0; 54 | } 55 | 56 | static inline void _raw_spin_lock(spinlock_t *lock) 57 | { 58 | volatile int was_locked; 59 | do { 60 | was_locked = xchg(&lock->slock, 0) == 0 ? 1 : 0; 61 | } while(was_locked); 62 | } 63 | 64 | static inline void _raw_spin_lock_flags (spinlock_t *lock, unsigned long flags) 65 | { 66 | } 67 | 68 | #endif 69 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/include/freertos/asm/mm.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014-2015 Galois, Inc. 3 | * 4 | * This program is free software; you can redistribute it and/or modify it 5 | * under the terms of the GNU General Public License** as published by the Free 6 | * Software Foundation; either version 2 of the License, or (at your option) 7 | * any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, but WITHOUT 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 12 | * more details. 13 | 14 | * You should have received a copy of the GNU General Public License along with 15 | * this program; if not, write to the Free Software Foundation, Inc., 59 Temple 16 | * Place, Suite 330, Boston, MA 02111-1307 USA 17 | * 18 | */ 19 | 20 | 21 | #ifndef _ASM_MM_H 22 | #define _ASM_MM_H 23 | 24 | void invalidate_tlb(void); 25 | void install_pt_address(void); 26 | void set_domain_permissions(void); 27 | void flush_caches(void); 28 | void enable_mmu(void); 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/include/freertos/asm/timer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014-2015 Galois, Inc. 3 | * 4 | * This program is free software; you can redistribute it and/or modify it 5 | * under the terms of the GNU General Public License** as published by the Free 6 | * Software Foundation; either version 2 of the License, or (at your option) 7 | * any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, but WITHOUT 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 12 | * more details. 13 | 14 | * You should have received a copy of the GNU General Public License along with 15 | * this program; if not, write to the Free Software Foundation, Inc., 59 Temple 16 | * Place, Suite 330, Boston, MA 02111-1307 USA 17 | * 18 | */ 19 | 20 | 21 | #ifndef _ASM_TIMER_H 22 | #define _ASM_TIMER_H 23 | 24 | void setup_timer(void); 25 | void schedule_timer(void); 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/include/freertos/ctype.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014-2015 Galois, Inc. 3 | * 4 | * This program is free software; you can redistribute it and/or modify it 5 | * under the terms of the GNU General Public License** as published by the Free 6 | * Software Foundation; either version 2 of the License, or (at your option) 7 | * any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, but WITHOUT 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 12 | * more details. 13 | 14 | * You should have received a copy of the GNU General Public License along with 15 | * this program; if not, write to the Free Software Foundation, Inc., 59 Temple 16 | * Place, Suite 330, Boston, MA 02111-1307 USA 17 | * 18 | */ 19 | 20 | #ifndef _CTYPE_H 21 | #define _CTYPE_H 22 | 23 | #ifdef HAVE_LIBC 24 | #include_next 25 | #else 26 | /* 27 | * NOTE! This ctype does not handle EOF like the standard C 28 | * library is required to. 29 | */ 30 | 31 | #define _U 0x01 /* upper */ 32 | #define _L 0x02 /* lower */ 33 | #define _D 0x04 /* digit */ 34 | #define _C 0x08 /* cntrl */ 35 | #define _P 0x10 /* punct */ 36 | #define _S 0x20 /* white space (space/lf/tab) */ 37 | #define _X 0x40 /* hex digit */ 38 | #define _SP 0x80 /* hard space (0x20) */ 39 | 40 | 41 | extern unsigned char _ctype[]; 42 | 43 | #define __ismask(x) (_ctype[(int)(unsigned char)(x)]) 44 | 45 | #define isalnum(c) ((__ismask(c)&(_U|_L|_D)) != 0) 46 | #define isalpha(c) ((__ismask(c)&(_U|_L)) != 0) 47 | #define iscntrl(c) ((__ismask(c)&(_C)) != 0) 48 | #define isdigit(c) ((__ismask(c)&(_D)) != 0) 49 | #define isgraph(c) ((__ismask(c)&(_P|_U|_L|_D)) != 0) 50 | #define islower(c) ((__ismask(c)&(_L)) != 0) 51 | #define isprint(c) ((__ismask(c)&(_P|_U|_L|_D|_SP)) != 0) 52 | #define ispunct(c) ((__ismask(c)&(_P)) != 0) 53 | #define isspace(c) ((__ismask(c)&(_S)) != 0) 54 | #define isupper(c) ((__ismask(c)&(_U)) != 0) 55 | #define isxdigit(c) ((__ismask(c)&(_D|_X)) != 0) 56 | 57 | #define isascii(c) (((unsigned char)(c))<=0x7f) 58 | #define toascii(c) (((unsigned char)(c))&0x7f) 59 | 60 | static inline unsigned char __tolower(unsigned char c) 61 | { 62 | if (isupper(c)) 63 | c -= 'A'-'a'; 64 | return c; 65 | } 66 | 67 | static inline unsigned char __toupper(unsigned char c) 68 | { 69 | if (islower(c)) 70 | c -= 'a'-'A'; 71 | return c; 72 | } 73 | 74 | #define tolower(c) __tolower(c) 75 | #define toupper(c) __toupper(c) 76 | 77 | #endif 78 | 79 | #endif 80 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/include/freertos/extra-types.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014-2015 Galois, Inc. 3 | * 4 | * This program is free software; you can redistribute it and/or modify it 5 | * under the terms of the GNU General Public License** as published by the Free 6 | * Software Foundation; either version 2 of the License, or (at your option) 7 | * any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, but WITHOUT 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 12 | * more details. 13 | 14 | * You should have received a copy of the GNU General Public License along with 15 | * this program; if not, write to the Free Software Foundation, Inc., 59 Temple 16 | * Place, Suite 330, Boston, MA 02111-1307 USA 17 | * 18 | */ 19 | 20 | 21 | #ifndef _EXTRA_TYPES_H 22 | #define _EXTRA_TYPES_H 23 | 24 | typedef long long quad_t; 25 | typedef unsigned long long u_quad_t; 26 | typedef unsigned long u_long; 27 | 28 | #define _QUAD_HIGHWORD 1 29 | #define _QUAD_LOWWORD 0 30 | 31 | #define H _QUAD_HIGHWORD 32 | #define L _QUAD_LOWWORD 33 | 34 | #define HHALF(x) ((x) >> HALF_BITS) 35 | #define LHALF(x) ((x) & ((1 << HALF_BITS) - 1)) 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/include/freertos/mmu.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014-2015 Galois, Inc. 3 | * 4 | * This program is free software; you can redistribute it and/or modify it 5 | * under the terms of the GNU General Public License** as published by the Free 6 | * Software Foundation; either version 2 of the License, or (at your option) 7 | * any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, but WITHOUT 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 12 | * more details. 13 | 14 | * You should have received a copy of the GNU General Public License along with 15 | * this program; if not, write to the Free Software Foundation, Inc., 59 Temple 16 | * Place, Suite 330, Boston, MA 02111-1307 USA 17 | * 18 | */ 19 | 20 | 21 | #ifndef _MMU_H 22 | #define _MMU_H 23 | 24 | #ifndef __ASSEMBLER__ 25 | #include 26 | void * map_frames(unsigned long *lst, unsigned long count); 27 | void * map_frame(unsigned long pfn); 28 | void * map_frames_direct(unsigned long count, unsigned long *start_mfn); 29 | void mmu_setup(void); 30 | extern uint32_t physical_address_offset; 31 | extern void * device_tree; 32 | #endif 33 | 34 | // Set up 1MB descriptors for the 1 MB sections with these page table indices. 35 | // Everything at or above DIRECT_MAP_END will be unmapped initially. 36 | #define DIRECT_MAP_START 0x0 37 | #define DIRECT_MAP_END 0xc00 38 | 39 | // Entries at or above this page table index should be marked cacheable. 40 | // Entries below this index should be marked uncacheable due to being device 41 | // I/O memory. 42 | #define CACHEABLE_START 0x0 43 | 44 | // Descriptor flags. 45 | #define FLAGS_BUFFERABLE (1 << 2) 46 | #define FLAGS_CACHEABLE (1 << 3) 47 | #define FLAGS_READWRITE ((1 << 10) | (1 << 11)) 48 | #define SP_FLAGS_READWRITE ((1 << 4) | (1 << 5)) 49 | 50 | // Set these bits on the TTBR0 register value: IRGN0/1, RGN0/1 51 | // ((1 << 6) | (1 << 0) | (1 << 4) | (1 << 3)) 52 | #define TTBR_CACHEABLE_FLAGS 0x59 53 | 54 | // Bits to be set in each type of translation table descriptor we are likely to 55 | // use. 56 | #define DESC_FAULT 0x0 57 | 58 | // Page table descriptor: take the top 22 bits of the page table base address, 59 | // set bit 0 60 | #define _PAGE_TABLE(addr) (((addr) & (~0x3ff)) | 0x1) 61 | #define DESC_PAGE_TABLE(addr) (_PAGE_TABLE(addr)) 62 | 63 | // Section descriptor: given a section (megabyte) number, shift it into the top 64 | // 12 bits of the descriptor, set bit 1. 65 | #define _SECTION(sec_num) ((sec_num << 20) | 0x2) 66 | #define DESC_SECTION(sec_num, flags) (_SECTION(sec_num) | flags) 67 | 68 | // Small page descriptor: shift the PFN up 12 bits, set bit 1. 69 | #define _SMALL_PAGE(pfn) ((pfn << 12) | 0x2) 70 | #define DESC_SMALL_PAGE(pfn, flags) (_SMALL_PAGE(pfn) | flags) 71 | 72 | #define L2_ENTRIES 256 73 | #define L1_ENTRIES 4096 74 | #define L2_BASE_INDEX DIRECT_MAP_END 75 | #define L2_TOTAL (L1_ENTRIES - DIRECT_MAP_END) 76 | 77 | #endif 78 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/include/freertos/popcount.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014-2015 Galois, Inc. 3 | * 4 | * This program is free software; you can redistribute it and/or modify it 5 | * under the terms of the GNU General Public License** as published by the Free 6 | * Software Foundation; either version 2 of the License, or (at your option) 7 | * any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, but WITHOUT 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 12 | * more details. 13 | 14 | * You should have received a copy of the GNU General Public License along with 15 | * this program; if not, write to the Free Software Foundation, Inc., 59 Temple 16 | * Place, Suite 330, Boston, MA 02111-1307 USA 17 | * 18 | */ 19 | 20 | 21 | #ifndef _POPCOUNT_H 22 | #define _POPCOUNT_H 23 | 24 | #include 25 | 26 | uint32_t popcount(uint32_t n); 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/include/freertos/spinlock.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014-2015 Galois, Inc. 3 | * 4 | * This program is free software; you can redistribute it and/or modify it 5 | * under the terms of the GNU General Public License** as published by the Free 6 | * Software Foundation; either version 2 of the License, or (at your option) 7 | * any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, but WITHOUT 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 12 | * more details. 13 | 14 | * You should have received a copy of the GNU General Public License along with 15 | * this program; if not, write to the Free Software Foundation, Inc., 59 Temple 16 | * Place, Suite 330, Boston, MA 02111-1307 USA 17 | * 18 | */ 19 | 20 | #ifndef __ASM_SPINLOCK_H 21 | #define __ASM_SPINLOCK_H 22 | 23 | /* 24 | * Your basic SMP spinlocks, allowing only a single CPU anywhere 25 | */ 26 | 27 | typedef struct { 28 | volatile unsigned int slock; 29 | } spinlock_t; 30 | 31 | 32 | #include "arch_spinlock.h" 33 | 34 | 35 | #define SPINLOCK_MAGIC 0xdead4ead 36 | 37 | #define SPIN_LOCK_UNLOCKED ARCH_SPIN_LOCK_UNLOCKED 38 | 39 | #define spin_lock_init(x) do { *(x) = SPIN_LOCK_UNLOCKED; } while(0) 40 | 41 | /* 42 | * Simple spin lock operations. There are two variants, one clears IRQ's 43 | * on the local processor, one does not. 44 | * 45 | * We make no fairness assumptions. They have a cost. 46 | */ 47 | 48 | #define spin_is_locked(x) arch_spin_is_locked(x) 49 | 50 | #define spin_unlock_wait(x) arch_spin_unlock_wait(x) 51 | 52 | 53 | #define _spin_trylock(lock) ({_raw_spin_trylock(lock) ? \ 54 | 1 : ({ 0;});}) 55 | 56 | #define _spin_lock(lock) \ 57 | do { \ 58 | _raw_spin_lock(lock); \ 59 | } while(0) 60 | 61 | #define _spin_unlock(lock) \ 62 | do { \ 63 | _raw_spin_unlock(lock); \ 64 | } while (0) 65 | 66 | 67 | #define spin_lock(lock) _spin_lock(lock) 68 | #define spin_unlock(lock) _spin_unlock(lock) 69 | 70 | #define DEFINE_SPINLOCK(x) spinlock_t x = SPIN_LOCK_UNLOCKED 71 | 72 | #endif 73 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/linker.lds: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014-2015 Galois, Inc. 3 | * 4 | * This program is free software; you can redistribute it and/or modify it 5 | * under the terms of the GNU General Public License** as published by the Free 6 | * Software Foundation; either version 2 of the License, or (at your option) 7 | * any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, but WITHOUT 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 12 | * more details. 13 | 14 | * You should have received a copy of the GNU General Public License along with 15 | * this program; if not, write to the Free Software Foundation, Inc., 59 Temple 16 | * Place, Suite 330, Boston, MA 02111-1307 USA 17 | * 18 | */ 19 | 20 | OUTPUT_ARCH(arm) 21 | ENTRY(_start) 22 | SECTIONS 23 | { 24 | os_start = 0x10008000; 25 | 26 | . = os_start; 27 | 28 | .text : { 29 | *(.start); 30 | *(.text); 31 | } 32 | 33 | . = ALIGN(4); 34 | 35 | .rodata : { *(.rodata); } 36 | .data : { *(.data); } 37 | 38 | . = ALIGN(4); 39 | 40 | /* NOTE: The space specified in the zImage header (_end - _start) MUST be no 41 | * bigger than the binary image size of the entire kernel. */ 42 | _end = .; 43 | 44 | . = ALIGN(8); 45 | _start_stacks = .; 46 | svc_stack = _start_stacks + 16384; 47 | irq_stack = _start_stacks + 32768; 48 | firq_stack = _start_stacks + 49152; 49 | abt_stack = _start_stacks + 65536; 50 | und_stack = _start_stacks + 81920; 51 | 52 | . = und_stack; 53 | 54 | . = ALIGN(4); 55 | _bss_start = .; 56 | .bss : { *(.bss); } 57 | . = ALIGN(4); 58 | _bss_end = .; 59 | } 60 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/asm/shared_info.s: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014-2015 Galois, Inc. 3 | * 4 | * This program is free software; you can redistribute it and/or modify it 5 | * under the terms of the GNU General Public License** as published by the Free 6 | * Software Foundation; either version 2 of the License, or (at your option) 7 | * any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, but WITHOUT 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 12 | * more details. 13 | 14 | * You should have received a copy of the GNU General Public License along with 15 | * this program; if not, write to the Free Software Foundation, Inc., 59 Temple 16 | * Place, Suite 330, Boston, MA 02111-1307 USA 17 | * 18 | */ 19 | 20 | .section ".data" 21 | .globl "shared_info_page" 22 | 23 | .align 13 24 | shared_info_page: 25 | .fill (1024), 4, 0x0 26 | 27 | 28 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/include/platform/console.h: -------------------------------------------------------------------------------- 1 | /* 2 | **************************************************************************** 3 | * (C) 2006 - Grzegorz Milos - Cambridge University 4 | * (C) 2014 - Jonathan Daugherty - Galois, Inc. 5 | **************************************************************************** 6 | * 7 | * File: console.h 8 | * Author: Grzegorz Milos 9 | * Changes: 10 | * 11 | * Date: Mar 2006 12 | * 13 | * Environment: Xen Minimal OS 14 | * Description: Console interface. 15 | * 16 | * Handles console I/O. Defines printk. 17 | * 18 | **************************************************************************** 19 | * Permission is hereby granted, free of charge, to any person obtaining a copy 20 | * of this software and associated documentation files (the "Software"), to 21 | * deal in the Software without restriction, including without limitation the 22 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 23 | * sell copies of the Software, and to permit persons to whom the Software is 24 | * furnished to do so, subject to the following conditions: 25 | * 26 | * The above copyright notice and this permission notice shall be included in 27 | * all copies or substantial portions of the Software. 28 | * 29 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 30 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 31 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 32 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 33 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 34 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 35 | * DEALINGS IN THE SOFTWARE. 36 | */ 37 | #ifndef _LIB_CONSOLE_H_ 38 | #define _LIB_CONSOLE_H_ 39 | 40 | #include 41 | #include "pt_regs.h" 42 | #include 43 | #include "xenbus.h" 44 | #include 45 | #include 46 | #include 47 | #include "waittypes.h" 48 | 49 | #ifndef DEBUG 50 | #define DEBUG 0 51 | #endif 52 | 53 | #define dprintk if (DEBUG) printk 54 | 55 | struct consfront_dev { 56 | domid_t dom; 57 | 58 | struct xencons_interface *ring; 59 | grant_ref_t ring_ref; 60 | evtchn_port_t evtchn; 61 | 62 | char *nodename; 63 | char *backend; 64 | 65 | xenbus_event_queue events; 66 | 67 | #ifdef HAVE_LIBC 68 | int fd; 69 | #endif 70 | }; 71 | 72 | extern struct consfront_dev *xen_console; 73 | 74 | void printk(const char *fmt, ...); 75 | void _printk(const char *s); 76 | void prints(char *s); 77 | 78 | #define tprintk(_fmt, _args...) printk("[%s] " _fmt, current->name, ##_args) 79 | 80 | void xencons_rx(char *buf, unsigned len, struct pt_regs *regs); 81 | void xencons_tx(void); 82 | 83 | void init_console(void); 84 | void console_print(struct consfront_dev *dev, char *data, int length); 85 | void fini_console(struct consfront_dev *dev); 86 | 87 | /* Low level functions defined in xencons_ring.c */ 88 | extern DECLARE_WAIT_QUEUE_HEAD(console_queue); 89 | struct consfront_dev *xencons_ring_init(void); 90 | struct consfront_dev *init_consfront(char *_nodename); 91 | int xencons_ring_send(struct consfront_dev *dev, const char *data, unsigned len); 92 | int xencons_ring_send_no_notify(struct consfront_dev *dev, const char *data, unsigned len); 93 | int xencons_ring_avail(struct consfront_dev *dev); 94 | int xencons_ring_recv(struct consfront_dev *dev, char *data, unsigned len); 95 | void free_consfront(struct consfront_dev *dev); 96 | 97 | #endif /* _LIB_CONSOLE_H_ */ 98 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/include/platform/events.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode:C; c-basic-offset:4; tab-width:4 -*- 2 | **************************************************************************** 3 | * (C) 2003 - Rolf Neugebauer - Intel Research Cambridge 4 | * (C) 2005 - Grzegorz Milos - Intel Reseach Cambridge 5 | * (C) 2014 - Jonathan Daugherty - Galois, Inc. 6 | **************************************************************************** 7 | * 8 | * File: events.h 9 | * Author: Rolf Neugebauer (neugebar@dcs.gla.ac.uk) 10 | * Changes: Grzegorz Milos (gm281@cam.ac.uk) 11 | * 12 | * Date: Jul 2003, changes Jun 2005 13 | * 14 | * Environment: Xen Minimal OS 15 | * Description: Deals with events on the event channels 16 | * 17 | **************************************************************************** 18 | */ 19 | 20 | #ifndef _EVENTS_H_ 21 | #define _EVENTS_H_ 22 | 23 | #include 24 | #include 25 | #include "pt_regs.h" 26 | #include "hypercalls.h" 27 | #include "console.h" 28 | #include 29 | 30 | void init_events(void); 31 | 32 | extern shared_info_t * HYPERVISOR_shared_info; 33 | 34 | typedef void (*evtchn_handler_t)(evtchn_port_t, struct pt_regs *, void *); 35 | 36 | /* prototypes */ 37 | int do_event(evtchn_port_t port, struct pt_regs *regs); 38 | evtchn_port_t bind_virq(uint32_t virq, evtchn_handler_t handler, void *data); 39 | evtchn_port_t bind_pirq(uint32_t pirq, int will_share, evtchn_handler_t handler, void *data); 40 | evtchn_port_t bind_evtchn(evtchn_port_t port, evtchn_handler_t handler, 41 | void *data); 42 | void unbind_evtchn(evtchn_port_t port); 43 | void init_events(void); 44 | int evtchn_alloc_unbound(domid_t pal, evtchn_port_t *port); 45 | int evtchn_bind_interdomain(domid_t pal, evtchn_port_t remote_port, evtchn_port_t *local_port); 46 | int evtchn_get_peercontext(evtchn_port_t local_port, char *ctx, int size); 47 | void unbind_all_ports(void); 48 | 49 | static inline int notify_remote_via_evtchn(evtchn_port_t port) 50 | { 51 | int ret; 52 | 53 | evtchn_send_t op; 54 | op.port = port; 55 | ret = HYPERVISOR_event_channel_op(EVTCHNOP_send, &op); 56 | if (ret != 0) { 57 | printk("BUG: event channel notification failed, ret %d\n", ret); 58 | } 59 | 60 | return ret; 61 | } 62 | 63 | void fini_events(void); 64 | 65 | #endif /* _EVENTS_H_ */ 66 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/include/platform/gnttab.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014-2015 Galois, Inc. 3 | * 4 | * This program is free software; you can redistribute it and/or modify it 5 | * under the terms of the GNU General Public License** as published by the Free 6 | * Software Foundation; either version 2 of the License, or (at your option) 7 | * any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, but WITHOUT 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 12 | * more details. 13 | 14 | * You should have received a copy of the GNU General Public License along with 15 | * this program; if not, write to the Free Software Foundation, Inc., 59 Temple 16 | * Place, Suite 330, Boston, MA 02111-1307 USA 17 | * 18 | */ 19 | 20 | #ifndef __GNTTAB_H__ 21 | #define __GNTTAB_H__ 22 | 23 | #include 24 | #include 25 | 26 | #define NR_RESERVED_ENTRIES 8 27 | 28 | /* NR_GRANT_FRAMES must be less than or equal to that configured in Xen */ 29 | #define NR_GRANT_FRAMES 4 30 | #define NR_GRANT_ENTRIES (NR_GRANT_FRAMES * PAGE_SIZE / sizeof(grant_entry_t)) 31 | 32 | void init_gnttab(void); 33 | grant_ref_t gnttab_grant_access(domid_t domid, unsigned long frame, 34 | int readonly); 35 | int gnttab_map_ref(domid_t domid, grant_ref_t ref, unsigned long mfn); 36 | grant_ref_t gnttab_grant_transfer(domid_t domid, unsigned long pfn); 37 | unsigned long gnttab_end_transfer(grant_ref_t gref); 38 | int gnttab_end_access(grant_ref_t ref); 39 | const char *gnttabop_error(int16_t status); 40 | void fini_gnttab(void); 41 | 42 | #endif /* !__GNTTAB_H__ */ 43 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/include/platform/hypervisor.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * hypervisor.h 3 | * 4 | * Hypervisor handling. 5 | * 6 | * 7 | * Copyright (c) 2002, K A Fraser 8 | * Copyright (c) 2005, Grzegorz Milos 9 | * Copyright (C) 2014, Galois, Inc. 10 | * Updates: Aravindh Puthiyaparambil 11 | */ 12 | 13 | #ifndef _HYPERVISOR_H_ 14 | #define _HYPERVISOR_H_ 15 | 16 | #include 17 | #include "hypercalls.h" 18 | #include "pt_regs.h" 19 | 20 | /* 21 | * a placeholder for the start of day information passed up from the hypervisor 22 | */ 23 | union start_info_union 24 | { 25 | start_info_t start_info; 26 | char padding[512]; 27 | }; 28 | extern union start_info_union start_info_union; 29 | #define start_info (start_info_union.start_info) 30 | 31 | /* hypervisor.c */ 32 | void do_hypervisor_callback(struct pt_regs *regs); 33 | void mask_evtchn(uint32_t port); 34 | void unmask_evtchn(uint32_t port); 35 | void clear_evtchn(uint32_t port); 36 | 37 | extern int in_callback; 38 | 39 | #endif /* __HYPERVISOR_H__ */ 40 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/include/platform/interrupts.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014-2015 Galois, Inc. 3 | * 4 | * This program is free software; you can redistribute it and/or modify it 5 | * under the terms of the GNU General Public License** as published by the Free 6 | * Software Foundation; either version 2 of the License, or (at your option) 7 | * any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, but WITHOUT 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 12 | * more details. 13 | 14 | * You should have received a copy of the GNU General Public License along with 15 | * this program; if not, write to the Free Software Foundation, Inc., 59 Temple 16 | * Place, Suite 330, Boston, MA 02111-1307 USA 17 | * 18 | */ 19 | 20 | 21 | // From Xen source, include/public/arch-arm.h, GUEST_EVTCHN_PPI 22 | #define EVENT_IRQ 31 23 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/include/platform/ivcdev.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014-2015 Galois, Inc. 3 | * 4 | * This program is free software; you can redistribute it and/or modify it 5 | * under the terms of the GNU General Public License** as published by the Free 6 | * Software Foundation; either version 2 of the License, or (at your option) 7 | * any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, but WITHOUT 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 12 | * more details. 13 | 14 | * You should have received a copy of the GNU General Public License along with 15 | * this program; if not, write to the Free Software Foundation, Inc., 59 Temple 16 | * Place, Suite 330, Boston, MA 02111-1307 USA 17 | * 18 | */ 19 | 20 | 21 | #ifndef _IVCDEV_H 22 | #define _IVCDEV_H 23 | 24 | #include "libIVC.h" 25 | 26 | struct ivcdev { 27 | ivc_connection_t *rconn; 28 | ivc_connection_t *wconn; 29 | xList *waitq; 30 | }; 31 | 32 | struct ivcdev *ivc_makeConnection(const char *base_name, xList *waitq); 33 | struct ivcdev *ivc_acceptConnection(const char *base_name, int num_pages, xList *waitq); 34 | 35 | void ivc_putData(struct ivcdev *con, void *buffer, size_t size); 36 | struct readbuf *ivc_getData(struct ivcdev *con); 37 | int ivc_canRead(struct ivcdev *con); 38 | int ivc_canWrite(struct ivcdev *con); 39 | void ivc_wait_until_ready(struct ivcdev *con); 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/include/platform/libIVC.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2006-2008, 2014-2015 Galois, Inc. 3 | * 4 | * This program is free software; you can redistribute it and/or modify it 5 | * under the terms of the GNU General Public License** as published by the Free 6 | * Software Foundation; either version 2 of the License, or (at your option) 7 | * any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, but WITHOUT 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 12 | * more details. 13 | 14 | * You should have received a copy of the GNU General Public License along with 15 | * this program; if not, write to the Free Software Foundation, Inc., 59 Temple 16 | * Place, Suite 330, Boston, MA 02111-1307 USA 17 | * 18 | */ 19 | 20 | #ifndef HALVM_LIBIVC_H 21 | #define HALVM_LIBIVC_H 22 | 23 | #include 24 | #include "xen/event_channel.h" 25 | #include "wait.h" 26 | 27 | typedef struct ivc_connection ivc_connection_t; 28 | typedef enum ivc_contype ivc_contype_t; 29 | 30 | enum ivc_contype 31 | { 32 | ivcInputChannel, 33 | ivcOutputChannel, 34 | ivcInputOutputChannel 35 | }; 36 | 37 | struct readbuf { 38 | void *buf; 39 | uint32_t size; 40 | }; 41 | 42 | struct bufstate 43 | { 44 | volatile uint32_t consumed; 45 | volatile uint32_t produced; 46 | }; 47 | 48 | struct ivc_connection 49 | { 50 | xList *waitq; 51 | uint32_t peer; 52 | ivc_contype_t type; 53 | evtchn_port_t port; 54 | uint32_t insize, outsize; 55 | uint32_t inmod, outmod; 56 | void *inbuf, *outbuf; 57 | struct bufstate *input; 58 | struct bufstate *output; 59 | void *buffer_base; 60 | }; 61 | 62 | ivc_connection_t *makeConnection(char *, ivc_contype_t, xList *); 63 | ivc_connection_t *acceptConnection(char *, ivc_contype_t, 64 | uint32_t, xList *); 65 | void closeConnection(ivc_connection_t*); 66 | 67 | struct readbuf *getData(ivc_connection_t*); 68 | void putData(ivc_connection_t*, void *, size_t); 69 | uint32_t connectionPeer(ivc_connection_t*); 70 | 71 | int canRead(ivc_connection_t *con); 72 | int canWrite(ivc_connection_t *con); 73 | 74 | #endif 75 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/include/platform/pt_regs.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2006-2008, 2014-2015 Galois, Inc. 3 | * 4 | * This program is free software; you can redistribute it and/or modify it 5 | * under the terms of the GNU General Public License** as published by the Free 6 | * Software Foundation; either version 2 of the License, or (at your option) 7 | * any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, but WITHOUT 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 12 | * more details. 13 | 14 | * You should have received a copy of the GNU General Public License along with 15 | * this program; if not, write to the Free Software Foundation, Inc., 59 Temple 16 | * Place, Suite 330, Boston, MA 02111-1307 USA 17 | * 18 | */ 19 | 20 | 21 | #ifndef PTREGS_H 22 | #define PTREGS_H 23 | 24 | struct pt_regs { 25 | unsigned long r0; 26 | unsigned long r1; 27 | unsigned long r2; 28 | unsigned long r3; 29 | unsigned long r4; 30 | unsigned long r5; 31 | unsigned long r6; 32 | unsigned long r7; 33 | unsigned long r8; 34 | unsigned long r9; 35 | unsigned long r10; 36 | unsigned long r11; 37 | unsigned long r12; 38 | }; 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/include/platform/wait.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2006-2008, 2014-2015 Galois, Inc. 3 | * 4 | * This program is free software; you can redistribute it and/or modify it 5 | * under the terms of the GNU General Public License** as published by the Free 6 | * Software Foundation; either version 2 of the License, or (at your option) 7 | * any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, but WITHOUT 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 12 | * more details. 13 | 14 | * You should have received a copy of the GNU General Public License along with 15 | * this program; if not, write to the Free Software Foundation, Inc., 59 Temple 16 | * Place, Suite 330, Boston, MA 02111-1307 USA 17 | * 18 | */ 19 | 20 | #ifndef __WAIT_H__ 21 | #define __WAIT_H__ 22 | 23 | #include 24 | #include "waittypes.h" 25 | #include "console.h" 26 | #include 27 | #include 28 | #include 29 | 30 | #define WAIT_DEBUG 0 31 | #define wait_dprintk if (WAIT_DEBUG) printk 32 | 33 | static inline void wake_up_from_isr(xList *q) 34 | { 35 | while (listLIST_IS_EMPTY(q) == pdFALSE) { 36 | wait_dprintk("wake_up_from_isr: waking up a task from queue 0x%x\n", q); 37 | xTaskRemoveFromEventList(q); 38 | } 39 | } 40 | 41 | static inline void wake_up(xList *q) 42 | { 43 | __disable_irq(); 44 | wake_up_from_isr(q); 45 | __enable_irq(); 46 | } 47 | 48 | #define wait_on(wq) do { \ 49 | __disable_irq(); \ 50 | wait_dprintk("wait_on: adding task to queue 0x%x\n", wq); \ 51 | vTaskPlaceOnEventList(wq, portMAX_DELAY); \ 52 | __enable_irq(); \ 53 | portYIELD(); \ 54 | } while (0) 55 | 56 | #define wait_event(wq, condition) do { \ 57 | for(;;) \ 58 | { \ 59 | if(condition) \ 60 | break; \ 61 | wait_dprintk("wait_event: condition false, putting task to sleep on queue 0x%x\n", wq); \ 62 | __disable_irq(); \ 63 | vTaskPlaceOnEventList(wq, 0); \ 64 | __enable_irq(); \ 65 | taskYIELD(); \ 66 | } \ 67 | } while(0) 68 | 69 | #endif /* __WAIT_H__ */ 70 | 71 | /* 72 | * Local variables: 73 | * mode: C 74 | * c-file-style: "BSD" 75 | * c-basic-offset: 4 76 | * tab-width: 4 77 | * indent-tabs-mode: nil 78 | * End: 79 | */ 80 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/include/platform/waittypes.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2006-2008, 2014-2015 Galois, Inc. 3 | * 4 | * This program is free software; you can redistribute it and/or modify it 5 | * under the terms of the GNU General Public License** as published by the Free 6 | * Software Foundation; either version 2 of the License, or (at your option) 7 | * any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, but WITHOUT 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 12 | * more details. 13 | 14 | * You should have received a copy of the GNU General Public License along with 15 | * this program; if not, write to the Free Software Foundation, Inc., 59 Temple 16 | * Place, Suite 330, Boston, MA 02111-1307 USA 17 | * 18 | */ 19 | 20 | #ifndef __WAITTYPES_H__ 21 | #define __WAITTYPES_H__ 22 | 23 | #include 24 | #include 25 | 26 | #define DECLARE_WAIT_QUEUE_HEAD(name) xList name 27 | 28 | #define init_waitqueue_head vListInitialise 29 | 30 | #endif /* __WAIT_H__ */ 31 | 32 | /* 33 | * Local variables: 34 | * mode: C 35 | * c-file-style: "BSD" 36 | * c-basic-offset: 4 37 | * tab-width: 4 38 | * indent-tabs-mode: nil 39 | * End: 40 | */ 41 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/include/platform/xen_hvm.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2006-2008, 2014-2015 Galois, Inc. 3 | * 4 | * This program is free software; you can redistribute it and/or modify it 5 | * under the terms of the GNU General Public License** as published by the Free 6 | * Software Foundation; either version 2 of the License, or (at your option) 7 | * any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, but WITHOUT 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 12 | * more details. 13 | 14 | * You should have received a copy of the GNU General Public License along with 15 | * this program; if not, write to the Free Software Foundation, Inc., 59 Temple 16 | * Place, Suite 330, Boston, MA 02111-1307 USA 17 | * 18 | */ 19 | 20 | 21 | #ifndef _XEN_HVM_H 22 | #define _XEN_HVM_H 23 | 24 | int hvm_get_parameter(int idx, uint64_t *value); 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/include/platform/xen_setup.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2006-2008, 2014-2015 Galois, Inc. 3 | * 4 | * This program is free software; you can redistribute it and/or modify it 5 | * under the terms of the GNU General Public License** as published by the Free 6 | * Software Foundation; either version 2 of the License, or (at your option) 7 | * any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, but WITHOUT 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 12 | * more details. 13 | 14 | * You should have received a copy of the GNU General Public License along with 15 | * this program; if not, write to the Free Software Foundation, Inc., 59 Temple 16 | * Place, Suite 330, Boston, MA 02111-1307 USA 17 | * 18 | */ 19 | 20 | 21 | void xen_setup(); 22 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/FD_SET.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void FD_SET(int fd __attribute__((unused)), 4 | fd_set *set __attribute__((unused))) 5 | { 6 | } 7 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/FD_ZERO.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void FD_ZERO(fd_set *set __attribute__((unused))) 4 | { 5 | } 6 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/_Unwind_Resume.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | void _Unwind_Resume(void *x) __attribute__((noreturn)); 5 | 6 | void _Unwind_Resume(void *x __attribute__((unused))) 7 | { 8 | printf("Call to _Unwind_Resume ... how are you using pthreads?\n"); 9 | abort(); 10 | } 11 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/__fprintf_chk.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int __fprintf_chk(FILE *, int, const char *, ...); 5 | 6 | int __fprintf_chk(FILE * stream, int flag __attribute__ ((unused)), 7 | const char * format, ...) 8 | { 9 | va_list args; 10 | int res; 11 | 12 | va_start(args, format); 13 | res = vfprintf(stream, format, args); 14 | va_end(args); 15 | return res; 16 | } 17 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/__fxstat.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int __fxstat(int, int, struct stat*); 5 | 6 | int __fxstat(int ver __attribute__((unused)), 7 | int fildes __attribute__((unused)), 8 | struct stat *stat_buf __attribute__((unused))) 9 | { 10 | errno = ENOENT; 11 | return -1; 12 | } 13 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/__gcc_personality_v0.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int __gcc_personality_v0(int v, ...) __attribute__((noreturn)); 5 | 6 | int __gcc_personality_v0(int v, ...) 7 | { 8 | printf("You are in a very strange, bad place. (GCC personality %d)\n", v); 9 | abort(); 10 | } 11 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/__getdelim.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | size_t __getdelim(char **, size_t *, int, FILE *); 6 | 7 | size_t __getdelim(char **lineptr __attribute__ ((unused)), 8 | size_t *n __attribute__ ((unused)), 9 | int delim __attribute__ ((unused)), 10 | FILE *stream __attribute__ ((unused))) 11 | { 12 | printf("__getdelim\n"); 13 | errno = ENOSYS; 14 | return (-1); 15 | } 16 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/__lxstat.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | int __lxstat(int, const char *, struct stat *); 6 | 7 | int __lxstat(int ver __attribute__((unused)), 8 | const char *path __attribute__((unused)), 9 | struct stat *stat_buf __attribute__((unused))) 10 | { 11 | printf("__lxstat\n"); 12 | errno = ENOENT; 13 | return -1; 14 | } 15 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/__xstat.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | int __xstat(int, const char *, struct stat*); 6 | 7 | int __xstat(int ver __attribute__((unused)), 8 | const char *path __attribute__((unused)), 9 | struct stat *stat_buf __attribute__((unused))) 10 | { 11 | printf("__xstat\n"); 12 | errno = ENOENT; 13 | return -1; 14 | } 15 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/abort.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | void abort(void) 6 | { 7 | printf("Abort called!\n"); 8 | runtime_exit(); 9 | } 10 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/access.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | int access(const char *pathname __attribute__ ((unused)), 6 | int mode __attribute__ ((unused))) 7 | { 8 | printf("access\n"); 9 | errno = ENOENT; 10 | return (-1); 11 | } 12 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/addmntent.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | int addmntent(FILE *fp __attribute__((unused)), 6 | const struct mntent *mnt __attribute__((unused))) 7 | { 8 | return 1; 9 | } 10 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/atof.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #define isdigit(c) (c >= '0' && c <= '9') 4 | 5 | double atof(const char *s) 6 | { 7 | // This function stolen from either Rolf Neugebauer or Andrew Tolmach. 8 | // Probably Rolf. 9 | double a = 0.0; 10 | int e = 0; 11 | int c; 12 | while ((c = *s++) != '\0' && isdigit(c)) { 13 | a = a*10.0 + (c - '0'); 14 | } 15 | if (c == '.') { 16 | while ((c = *s++) != '\0' && isdigit(c)) { 17 | a = a*10.0 + (c - '0'); 18 | e = e-1; 19 | } 20 | } 21 | if (c == 'e' || c == 'E') { 22 | int sign = 1; 23 | int i = 0; 24 | c = *s++; 25 | if (c == '+') 26 | c = *s++; 27 | else if (c == '-') { 28 | c = *s++; 29 | sign = -1; 30 | } 31 | while (isdigit(c)) { 32 | i = i*10 + (c - '0'); 33 | c = *s++; 34 | } 35 | e += i*sign; 36 | } 37 | while (e > 0) { 38 | a *= 10.0; 39 | e--; 40 | } 41 | while (e < 0) { 42 | a *= 0.1; 43 | e++; 44 | } 45 | return a; 46 | } 47 | 48 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/atoi.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int atoi(const char *str) 5 | { 6 | int acc = 0; 7 | 8 | for(; str && isdigit(*str); ++str) { 9 | acc *= 10; 10 | acc += *str - 0x30; 11 | } 12 | 13 | return acc; 14 | } 15 | 16 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/bsearch.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void *bsearch(const void *key, 4 | const void *base0, 5 | size_t nmemb, 6 | size_t size, 7 | int (*compar)(const void *, const void *)) 8 | { 9 | const char *base = base0; 10 | size_t lim; 11 | int cmp; 12 | const void *p; 13 | 14 | for (lim = nmemb; lim != 0; lim >>= 1) { 15 | p = base + (lim >> 1) * size; 16 | cmp = (*compar)(key, p); 17 | if (cmp == 0) 18 | /* LINTED interface spec */ 19 | return ((void *)p); 20 | if (cmp > 0) { /* key > p: move right */ 21 | /* LINTED we don't touch base */ 22 | base = (char *)p + size; 23 | lim--; 24 | } /* else move left */ 25 | } 26 | return (NULL); 27 | } 28 | 29 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/bzero.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void bzero(void *ptr, size_t size) 4 | { 5 | unsigned long i; 6 | unsigned char *p = ptr; 7 | for(i = 0; i < size; ++i) p[i] = 0; 8 | } 9 | 10 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/chmod.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | int chmod(const char *path __attribute__((unused)), 6 | mode_t mode __attribute__((unused))) 7 | { 8 | printf("chmod\n"); 9 | errno = ENOSYS; 10 | return (-1); 11 | } 12 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/close.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | int close(int fd __attribute__ ((unused))) 6 | { 7 | printf("close\n"); 8 | errno = EBADF; 9 | return (-1); 10 | } 11 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/creat.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | int creat(const char *path __attribute__((unused)), 6 | mode_t mode __attribute__((unused))) 7 | { 8 | printf("creat\n"); 9 | errno = ENOSYS; 10 | return (-1); 11 | } 12 | 13 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/ctime_r.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | char *weekdays[7] = { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" }; 5 | char *months[12] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", 6 | "Aug", "Sep", "Oct", "Nov", "Dec" }; 7 | 8 | char *ctime_r(const time_t *timep, char *buf) 9 | { 10 | struct tm tm; 11 | time_t now = time((time_t*)timep); 12 | localtime_r(&now, &tm); 13 | snprintf(buf, 26, "%s %s %02i %02i:%02i:%02i %i\n", 14 | weekdays[tm.tm_wday], months[tm.tm_mon], tm.tm_mday, tm.tm_hour, 15 | tm.tm_min, tm.tm_sec, tm.tm_year + 1900); 16 | return buf; 17 | } 18 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/dup.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | int dup(int fildes __attribute__((unused))) 6 | { 7 | printf("dup\n"); 8 | errno = ENOSYS; 9 | return (-1); 10 | } 11 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/dup2.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | int dup2(int fildes __attribute__((unused)), 6 | int fildes2 __attribute__((unused))) 7 | { 8 | printf("dup2\n"); 9 | errno = ENOSYS; 10 | return (-1); 11 | } 12 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/endmntent.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | int endmntent(FILE *fp __attribute__((unused))) 6 | { 7 | return 1; 8 | } 9 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/environ.c: -------------------------------------------------------------------------------- 1 | char **environ; 2 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/epoll_create.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | int epoll_create(int size __attribute__((unused))) 6 | { 7 | printf("epoll_create\n"); 8 | errno = ENOMEM; 9 | return -1; 10 | } 11 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/epoll_ctl.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int epoll_ctl(int epfd __attribute__((unused)), 5 | int op __attribute__((unused)), 6 | int fd __attribute__((unused)), 7 | struct epoll_event *event __attribute__((unused))) 8 | { 9 | errno = EINVAL; 10 | return -1; 11 | } 12 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/epoll_wait.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | int epoll_wait(int epfd __attribute__((unused)), 6 | struct epoll_event *events __attribute__((unused)), 7 | int maxevents __attribute__((unused)), 8 | int timeout) 9 | { 10 | switch(timeout) { 11 | case -1: 12 | printf("epoll_wait with endless wait. aborting.\n"); 13 | abort(); 14 | case 0: 15 | return 0; 16 | default: 17 | runtime_block(timeout); 18 | return 0; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/errno.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int errno; 4 | 5 | int *__errno_location() 6 | { 7 | return &errno; 8 | } 9 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/eventfd.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | int eventfd(unsigned int initval __attribute__((unused)), 6 | int flags __attribute__((unused))) 7 | { 8 | printf("eventfd\n"); 9 | errno = EINVAL; 10 | return -1; 11 | } 12 | 13 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/eventfd_write.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | int eventfd_write(int fd __attribute__((unused)), 6 | eventfd_t value __attribute__((unused))) 7 | { 8 | printf("eventfd_write\n"); 9 | errno = EINVAL; 10 | return -1; 11 | } 12 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/exit.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | void exit(int status) 6 | { 7 | printf("Exit called with %d\n", status); 8 | runtime_exit(); 9 | } 10 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/fclose.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int fclose(FILE *fp __attribute__((unused))) 5 | { 6 | printf("fclose\n"); 7 | errno = EBADF; 8 | return EOF; 9 | } 10 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/fcntl.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int fcntl(int fd __attribute__((unused)), 5 | int cmd __attribute__((unused)), 6 | ...) 7 | { 8 | errno = EACCES; 9 | return -1; 10 | } 11 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/feof.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int feof(FILE *stream __attribute__((unused))) 5 | { 6 | printf("feof\n"); 7 | errno = EBADF; 8 | return -1; 9 | } 10 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/fflush.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int fflush(FILE *stream) 5 | { 6 | if((stream == stdin) || (stream == stdout) || (stream == stderr)) { 7 | return 0; 8 | } else { 9 | errno = EBADF; 10 | return EOF; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/fopen.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | FILE *fopen(const char *path __attribute__((unused)), 5 | const char *mode __attribute__((unused))) 6 | { 7 | printf("fopen\n"); 8 | errno = EACCES; 9 | return 0; 10 | } 11 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/fork.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | pid_t fork(void) 6 | { 7 | printf("fork\n"); 8 | errno = EAGAIN; 9 | return -1; 10 | } 11 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/fprintf.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int fprintf(FILE *stream, const char *format, ...) 5 | { 6 | va_list args; 7 | int res; 8 | 9 | va_start(args, format); 10 | res = vfprintf(stream, format, args); 11 | va_end(args); 12 | return res; 13 | } 14 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/fputc.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int fputc(int c, FILE *stream) 5 | { 6 | if(fprintf(stream, "%c", c) >= 1) 7 | return (int)c; 8 | else 9 | return EOF; 10 | } 11 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/fputs.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int fputs(const char *s, FILE *stream) 5 | { 6 | if((stream == stdin) || (stream == stdout) || (stream == stderr)) { 7 | return puts(s); 8 | } else { 9 | errno = EBADF; 10 | return EOF; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/fread.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | size_t fread(void *ptr __attribute__((unused)), 5 | size_t size __attribute__((unused)), 6 | size_t nmemb __attribute__((unused)), 7 | FILE *stream __attribute__((unused))) 8 | { 9 | // XXX is this the right errno value? 10 | printf("fread\n"); 11 | errno = EACCES; 12 | return 0; 13 | } 14 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/fseek.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int fseek(FILE *stream __attribute__((unused)), 5 | long offset __attribute__((unused)), 6 | int whence __attribute__((unused))) 7 | { 8 | printf("fseek\n"); 9 | errno = EBADF; 10 | return 0; 11 | } 12 | 13 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/fstat.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int fstat(int fd __attribute__((unused)), 5 | struct stat *buf __attribute__((unused))) 6 | { 7 | errno = EBADF; 8 | return -1; 9 | } 10 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/ftell.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | long ftell(FILE *stream __attribute__((unused))) 5 | { 6 | printf("ftell\n"); 7 | errno = EBADF; 8 | return -1; 9 | } 10 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/ftruncate.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | int ftruncate(int fd __attribute__ ((unused)), 6 | off_t length __attribute__ ((unused))) 7 | { 8 | printf("ftruncate\n"); 9 | errno = EPERM; 10 | return (-1); 11 | } 12 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/fwrite.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | size_t fwrite(const void *ptr, size_t size, size_t nmemb, FILE *stream) 5 | { 6 | size_t size_in_chars = size * nmemb, i; 7 | 8 | for(i = 0; i < size_in_chars; i++) 9 | if(fputc(*(char*)((unsigned long)ptr + i), stream) == EOF) 10 | return i / size; 11 | 12 | return nmemb; 13 | } 14 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/getc.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int getc(FILE *stream __attribute__((unused))) 5 | { 6 | printf("getc\n"); 7 | errno = EBADF; 8 | return -1; 9 | } 10 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/getegid.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | gid_t getegid(void) 5 | { 6 | printf("getegid\n"); 7 | return 0xaffab1e; 8 | } 9 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/getenv.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | char *getenv(const char *name __attribute__((unused))) 4 | { 5 | return NULL; // There is no environment, so this always returns "not found" 6 | } 7 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/geteuid.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | uid_t geteuid(void) 5 | { 6 | printf("geteuid\n"); 7 | return 0x0ddba11; 8 | } 9 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/getgid.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | gid_t getgid(void) 5 | { 6 | printf("getgid\n"); 7 | return 0xaffab1e; 8 | } 9 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/getline.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | ssize_t getline(char **lineptr __attribute__((unused)), 5 | size_t *n __attribute__ ((unused)), 6 | FILE *stream __attribute__ ((unused))) 7 | { 8 | printf("getline\n"); 9 | errno = ENOSYS; 10 | return (-1); 11 | } 12 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/getmntent.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | struct mntent *getmntent(FILE *fp __attribute__((unused))) 6 | { 7 | return NULL; 8 | } 9 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/getmntent_r.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | struct mntent *getmntent_r(FILE *fp __attribute__((unused)), 6 | struct mntent *mntbuf __attribute__((unused)), 7 | char *buf __attribute__((unused)), 8 | int buflen __attribute__((unused))) 9 | { 10 | return NULL; 11 | } 12 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/getpagesize.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int getpagesize(void) 4 | { 5 | return runtime_pagesize(); 6 | } 7 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/getpid.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | pid_t getpid(void) 6 | { 7 | printf("getpid\n"); 8 | return 0xca5cad1a; 9 | } 10 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/getrusage.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int getrusage(int who, struct rusage *usage) 5 | { 6 | return runtime_rusage(who, usage); 7 | } 8 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/gettimeofday.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | int gettimeofday(struct timeval *tv, 7 | struct timezone *tz __attribute__((unused))) 8 | { 9 | return runtime_gettimeofday(tv); 10 | } 11 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/getuid.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | /* HaLVM users are affable oddballs? */ 5 | uid_t getuid(void) 6 | { 7 | printf("getuid\n"); 8 | return 0x0ddba11; 9 | } 10 | 11 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/hasmntopt.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | char *hasmntopt(const struct mntent *mnt __attribute__((unused)), 6 | const char *opt __attribute__((unused))) 7 | { 8 | return NULL; 9 | } 10 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/iconv.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | size_t iconv(iconv_t cd __attribute__((unused)), 6 | char **inbuf, size_t *inbytesleft, 7 | char **outbuf, size_t *outbytesleft) 8 | { 9 | /* The main case is when inbuf is not NULL and *inbuf is not NULL */ 10 | if(inbuf && *inbuf) { 11 | size_t bytesConverted = 0; 12 | 13 | if(!outbuf || !(*outbuf)) { 14 | /* this case is not noted by the man page, which is sad */ 15 | printf("bad iconv() case; (*)inbuf is good but (*)outbuf isn't\n"); 16 | errno = EINVAL; 17 | return -1; 18 | } 19 | 20 | do { 21 | if(*inbytesleft == 0) 22 | return bytesConverted; 23 | if(*outbytesleft == 0) { 24 | errno = E2BIG; 25 | return -1; 26 | } 27 | 28 | **outbuf = **inbuf; 29 | *outbuf += 1; 30 | *inbuf += 1; 31 | *outbytesleft -= 1; 32 | *inbytesleft -= 1; 33 | } while(1); 34 | } 35 | 36 | /* the other two cases appear to not apply, or the appropriate return */ 37 | /* value is zero in any case. */ 38 | return 0; 39 | } 40 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/iconv_close.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int iconv_close(iconv_t cd __attribute__((unused))) 4 | { 5 | return 0; 6 | } 7 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/iconv_open.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | /* GHC apparantly can't get along without iconv. So this is the world's */ 4 | /* most unimpressive implementation of it. There is only one iconv_t */ 5 | /* return value (0xacce55ed), and it always translates things exactly */ 6 | /* byte for byte, no matter what you do. */ 7 | iconv_t iconv_open(const char *tocode __attribute__((unused)), 8 | const char *fromcode __attribute__((unused))) 9 | { 10 | return (iconv_t)0xacce55ed; 11 | } 12 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/include/alloca.h: -------------------------------------------------------------------------------- 1 | #ifndef MINLIBC_ALLOCA_H 2 | #define MINLIBC_ALLOCA_H 3 | 4 | #define alloca(x) __builtin_alloca(x) 5 | 6 | #endif 7 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/include/assert.h: -------------------------------------------------------------------------------- 1 | #ifndef MINLIBC_ASSERT_H 2 | #define MINLIBC_ASSERT_H 3 | 4 | #include 5 | 6 | #define assert(x) ((!(x)) ? pabort("Assertion failed at %s:%d\n", __FILE__, __LINE__) : 0) 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/include/ctype.h: -------------------------------------------------------------------------------- 1 | #ifndef MINLIBC_CTYPE_H 2 | #define MINLIBC_CTYPE_H 3 | 4 | int isdigit(int c); 5 | int isspace(int c); 6 | 7 | #endif 8 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/include/dirent.h: -------------------------------------------------------------------------------- 1 | #ifndef MINLIBC_DIRENT_H 2 | #define MINLIBC_DIRENT_H 3 | 4 | #endif 5 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/include/dlfcn.h: -------------------------------------------------------------------------------- 1 | #ifndef MINLIBC_DLFCN_H 2 | #define MINLIBC_DLFCN_H 3 | 4 | #endif 5 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/include/errno.h: -------------------------------------------------------------------------------- 1 | #ifndef MINLIBC_ERRNO_H 2 | #define MINLIBC_ERRNO_H 3 | 4 | #define EPERM 1 5 | #define ENOENT 2 6 | #define ESRCH 3 7 | #define EINTR 4 8 | #define EIO 5 9 | #define E2BIG 7 10 | #define EBADF 9 11 | #define ECHILD 10 12 | #define EAGAIN 11 13 | #define ENOMEM 12 14 | #define EACCES 13 15 | #define EFAULT 14 16 | #define EBUSY 16 17 | #define EEXIST 17 18 | #define EISDIR 21 19 | #define EINVAL 22 20 | #define EMFILE 24 21 | #define ENOSPC 28 22 | #define EROFS 30 23 | #define ERANGE 34 24 | #define EDEADLK 35 25 | #define ENOTEMPTY 39 26 | #define EXFULL 54 27 | #define ENOSYS 78 28 | #define EISCONN 106 29 | 30 | extern int errno; 31 | 32 | int *__errno_location(void); 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/include/fcntl.h: -------------------------------------------------------------------------------- 1 | #ifndef MINLIBC_FCNTL_H 2 | #define MINLIBC_FCNTL_H 3 | 4 | #include 5 | 6 | typedef signed long int off_t; 7 | 8 | #define O_NONBLOCK 04000 9 | #define O_RDONLY 0x23 10 | 11 | #define F_GETFL 3 12 | #define F_SETFL 4 13 | 14 | int open(const char *pathname, int flags, ...); 15 | int fcntl(int fd, int cmd, ...); 16 | int creat(const char *path, mode_t mode); 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/include/float.h: -------------------------------------------------------------------------------- 1 | #ifndef MINLIBC_FLOAT_H 2 | #define MINLIBC_FLOAT_H 3 | 4 | 5 | #endif 6 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/include/iconv.h: -------------------------------------------------------------------------------- 1 | #ifndef MINLIBC_ICONV_H 2 | #define MINLIBC_ICONV_H 3 | 4 | #include 5 | 6 | typedef void *iconv_t; 7 | 8 | iconv_t iconv_open(const char *, const char *); 9 | size_t iconv(iconv_t, char **, size_t*, char **, size_t*); 10 | int iconv_close(iconv_t cd); 11 | 12 | #endif 13 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/include/inttypes.h: -------------------------------------------------------------------------------- 1 | #ifndef MINLIBC_INTTYPES_H 2 | #define MINLIBC_INTTYPES_H 3 | 4 | #endif 5 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/include/langinfo.h: -------------------------------------------------------------------------------- 1 | #ifndef MINLIBC_LANGINFO_H 2 | #define MINLIBC_LANGINFO_H 3 | 4 | #define CODESET 4 5 | 6 | typedef int nl_item; 7 | 8 | char *nl_langinfo(nl_item item); 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/include/locale.h: -------------------------------------------------------------------------------- 1 | #ifndef MINLIBC_LOCALE_H 2 | #define MINLIBC_LOCALE_H 3 | 4 | #endif 5 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/include/math.h: -------------------------------------------------------------------------------- 1 | #ifndef MINLIBC_MATH_H 2 | #define MINLIBC_MATH_H 3 | 4 | #define DBL_MIN_EXP __DBL_MIN_EXP__ 5 | #define DBL_MANT_DIG __DBL_MANT_DIG__ 6 | #define FLT_MIN_EXP __FLT_MIN_EXP__ 7 | #define FLT_MANT_DIG __FLT_MANT_DIG__ 8 | 9 | double modf(double x, double *iptr); 10 | double ldexp(double x, int exp); 11 | 12 | #endif 13 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/include/mntent.h: -------------------------------------------------------------------------------- 1 | #ifndef MINLIBC_MNTENT_H 2 | #define MINLIBC_MNTENT_H 3 | 4 | struct mntent { 5 | char *mnt_fsname; 6 | char *mnt_dir; 7 | char *mnt_type; 8 | char *mnt_opts; 9 | int mnt_freq; 10 | int mnt_passno; 11 | }; 12 | 13 | char *hasmntopt(const struct mntent *mnt, const char *opt); 14 | int endmntent(FILE *fp); 15 | struct mntent *getmntent(FILE *fp); 16 | int addmntent(FILE *fp, const struct mntent *mnt); 17 | struct mntent *getmntent_r(FILE *fp, struct mntent *mntbuf, 18 | char *buf, int buflen); 19 | FILE *setmntent(const char *filename, const char *type); 20 | 21 | #endif 22 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/include/poll.h: -------------------------------------------------------------------------------- 1 | #ifndef MINLIBC_POLL_H 2 | #define MINLIBC_POLL_H 3 | 4 | #include 5 | 6 | typedef unsigned long int nfds_t; 7 | 8 | struct pollfd { 9 | int fd; 10 | short int events; 11 | short int revents; 12 | }; 13 | 14 | #define POLLIN 0x001 15 | #define POLLOUT 0x004 16 | #define POLLERR 0x008 17 | #define POLLHUP 0x010 18 | 19 | int poll(struct pollfd *fds, nfds_t nfds, int timeout); 20 | 21 | #endif 22 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/include/runtime_reqs.h: -------------------------------------------------------------------------------- 1 | #ifndef MINLIBC_RUNTIME_REQS 2 | #define MINLIBC_RUNTIME_REQS 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | void runtime_write(size_t len, char *buffer); 10 | void runtime_block(unsigned long milliseconds); 11 | void runtime_exit(void) __attribute__((noreturn)); 12 | void *runtime_alloc(void *start, size_t length, int prot); 13 | void *runtime_libc_malloc(size_t size); 14 | void *runtime_realloc(void *start, int canmove, size_t oldlen, size_t newlen); 15 | void runtime_free(void *start, size_t length); 16 | int runtime_memprotect(void *addr, size_t length, int prot); 17 | int runtime_pagesize(void); 18 | time_t runtime_time(void); 19 | int runtime_gettimeofday(struct timeval *); 20 | int runtime_rusage(int who, struct rusage *); 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/include/sched.h: -------------------------------------------------------------------------------- 1 | #ifndef MINLIBC_SCHED_H 2 | #define MINLIBC_SCHED_H 3 | 4 | 5 | #endif 6 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/include/signal.h: -------------------------------------------------------------------------------- 1 | #ifndef MINLIBC_SIGNAL_H 2 | #define MINLIBC_SIGNAL_H 3 | 4 | #include 5 | 6 | typedef signed int siginfo_t; 7 | typedef unsigned long sigset_t; 8 | typedef void (*__sighandler_t)(int); 9 | 10 | struct sigaction { 11 | __sighandler_t sa_handler; 12 | unsigned long sa_flags; 13 | sigset_t sa_mask; 14 | }; 15 | 16 | #define SIG_DFL ((__sighandler_t)0) 17 | #define SIG_UNBLOCK 1 18 | 19 | int sigemptyset(sigset_t *set); 20 | int sigfillset(sigset_t *set); 21 | int sigaddset(sigset_t *set, int signum); 22 | int sigdelset(sigset_t *set, int signum); 23 | int sigismember(const sigset_t *set, int signum); 24 | 25 | int sigprocmask(int how, const sigset_t *set, sigset_t *oldset); 26 | int sigaction(int signum, const struct sigaction *act, 27 | struct sigaction *oldact); 28 | 29 | int raise(int sig); 30 | int kill(pid_t pid, int sig); 31 | 32 | #define SIGCONT 18 33 | #define SIGSTOP 19 34 | #define SIGTSTP 20 35 | #define SIGTTIN 21 36 | #define SIGTTOU 22 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/include/stdarg.h: -------------------------------------------------------------------------------- 1 | #ifndef MINLIBC_STDARG_H 2 | #define MINLIBC_STDARG_H 3 | 4 | #include 5 | 6 | typedef __builtin_va_list va_list; 7 | 8 | #define va_start(v,l) __builtin_va_start(v,l) 9 | #define va_end(v) __builtin_va_end(v) 10 | #define va_arg(v,l) __builtin_va_arg(v,l) 11 | 12 | int vfprintf(FILE *stream, const char *format, va_list ap); 13 | int vsnprintf(char *str, size_t size, const char *format, va_list ap); 14 | 15 | #endif 16 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/include/stddef.h: -------------------------------------------------------------------------------- 1 | #ifndef MINLIBC_STDDEF_H 2 | #define MINLIBC_STDDEF_H 3 | 4 | typedef int ptrdiff_t; 5 | 6 | #endif 7 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/include/stdio.h: -------------------------------------------------------------------------------- 1 | #ifndef MINLIBC_STDIO_H 2 | 3 | #include 4 | 5 | #define MINLIBC_STDIO_H 6 | 7 | #define BUFSIZ 8192 8 | #define EOF (-1) 9 | 10 | #define SEEK_SET 0x1 11 | #define SEEK_CUR 0x2 12 | #define SEEK_END 0x3 13 | 14 | typedef unsigned long FILE; 15 | typedef unsigned int pid_t; 16 | 17 | extern FILE *stdin; 18 | extern FILE *stdout; 19 | extern FILE *stderr; 20 | 21 | FILE *fopen(const char *path, const char *mode); 22 | int fputc(int c, FILE *stream); 23 | int fputs(const char *s, FILE *stream); 24 | size_t fread(void *ptr, size_t size, size_t nmemb, FILE *stream); 25 | size_t fwrite(const void *, size_t, size_t, FILE *); 26 | int fflush(FILE *stream); 27 | int fseek(FILE *stream, long offset, int whence); 28 | long ftell(FILE *stream); 29 | int feof(FILE *stream); 30 | int fclose(FILE *fp); 31 | 32 | int getc(FILE *stream); 33 | ssize_t getline(char **lineptr, size_t *n, FILE *stream); 34 | int putchar(int c); 35 | int puts(const char *s); 36 | 37 | int printf(const char *format, ...); 38 | int sprintf(char *str, const char *format, ...); 39 | int snprintf(char *str, size_t size, const char *format, ...); 40 | int fprintf(FILE *stream, const char *format, ...); 41 | 42 | void perror(const char *s); 43 | void pabort(const char *format, ...) __attribute__((noreturn)); 44 | 45 | int sscanf(const char *buf, const char *fmt, ...); 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/include/stdlib.h: -------------------------------------------------------------------------------- 1 | #ifndef MINLIBC_STDLIB_H 2 | #define MINLIBC_STDLIB_H 3 | 4 | #define NULL 0 5 | #define EXIT_SUCCESS 0 6 | #define EXIT_FAILURE 1 7 | 8 | typedef unsigned long int size_t; 9 | 10 | double atof(const char *nptr); 11 | int atoi(const char *nptr); 12 | long int strtol(const char *nptr, char **endptr, int base); 13 | 14 | char *getenv(const char *name); 15 | void abort(void); 16 | void exit(int status); 17 | 18 | void *malloc(size_t size); 19 | void *realloc(void *ptr, size_t size); 20 | void *calloc(size_t nmemb, size_t size); 21 | void free(void *ptr); 22 | 23 | int mkstemp(char *template); 24 | 25 | void *bsearch(const void *, const void *, size_t, size_t, 26 | int (*)(const void *, const void *)); 27 | 28 | int putenv(char *str); 29 | int unsetenv(const char *name); 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/include/string.h: -------------------------------------------------------------------------------- 1 | #ifndef MINLIBC_STRING_H 2 | #define MINLIBC_STRING_H 3 | 4 | #include 5 | 6 | size_t strlen(const char *s); 7 | size_t strnlen(const char *s, size_t maxlen); 8 | char *strcpy(char *dest, const char *src); 9 | char *strncpy(char *dest, const char *src, size_t n); 10 | int strcmp(const char *s1, const char *s2); 11 | char *strdup(const char *s); 12 | int strncmp(const char *s1, const char *s2, size_t n); 13 | char *strrchr(const char *s, int c); 14 | char *strerror(int errnum); 15 | char *strstr(const char *, const char *); 16 | char *strchr(const char *, int c); 17 | 18 | void *memcpy(void *dest, const void *src, size_t n); 19 | void *memset(void *s, int c, size_t n); 20 | void *memmove(void *dest, const void *src, size_t n); 21 | int memcmp(const void *s1, const void *s2, size_t n); 22 | void *memchr(const void *s, int c, size_t n); 23 | 24 | #endif 25 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/include/strings.h: -------------------------------------------------------------------------------- 1 | #ifndef MINLIBC_STRINGS_H 2 | #define MINLIBC_STRINGS_H 3 | 4 | #include 5 | 6 | void bzero(void *s, size_t n); 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/include/sys/epoll.h: -------------------------------------------------------------------------------- 1 | #ifndef MINLIBC_EPOLL_H 2 | #define MINLIBC_EPOLL_H 3 | 4 | #include 5 | #include 6 | 7 | typedef union epoll_data { 8 | void *ptr; 9 | int fd; 10 | uint32_t u32; 11 | uint64_t u64; 12 | } epoll_data_t; 13 | 14 | struct epoll_event { 15 | uint32_t events; 16 | epoll_data_t data; 17 | }; 18 | 19 | #define EPOLL_CTL_ADD 1 20 | #define EPOLL_CTL_DEL 2 21 | #define EPOLL_CTL_MOD 3 22 | 23 | #define EPOLLIN 0x1 24 | #define EPOLLOUT 0x4 25 | #define EPOLLERR 0x8 26 | #define EPOLLHUP 0x10 27 | #define EPOLLONESHOT (1u << 30) 28 | 29 | int epoll_create(int size); 30 | int epoll_ctl(int, int, int, struct epoll_event *); 31 | int epoll_wait(int, struct epoll_event *, int, int); 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/include/sys/eventfd.h: -------------------------------------------------------------------------------- 1 | #ifndef MINLIBC_SYS_EVENTFD_H 2 | #define MINLIBC_SYS_EVENTFD_H 3 | 4 | typedef unsigned long long eventfd_t; 5 | 6 | int eventfd(unsigned int initval, int flags); 7 | int eventfd_write(int, eventfd_t val); 8 | 9 | #endif 10 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/include/sys/mman.h: -------------------------------------------------------------------------------- 1 | #ifndef MINLIBC_MMAN_H 2 | #define MINLIBC_MMAN_H 3 | 4 | #include 5 | 6 | #define PROT_NONE 0x0 7 | #define PROT_READ 0x1 8 | #define PROT_WRITE 0x2 9 | #define PROT_EXEC 0x4 10 | #define PROT_NOCACHE 0x8 11 | #define PROT_READWRITE (PROT_READ | PROT_WRITE) 12 | 13 | #define MAP_ANON 0x20 14 | #define MAP_ANONYMOUS 0x20 15 | #define MAP_PRIVATE 0x02 16 | #define MAP_FAILED ((void *) -1) 17 | 18 | void *mmap(void *start, size_t length, int prot, int flags, int fd, off_t off); 19 | int munmap(void *start, size_t length); 20 | void *mremap(void *old_address, size_t old_size, size_t new_size, int flags); 21 | int mprotect(void *addr, size_t len, int prot); 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/include/sys/resource.h: -------------------------------------------------------------------------------- 1 | #ifndef MINLIBC_SYS_RESOURCE_H 2 | #define MINLIBC_SYS_RESOURCE_H 3 | 4 | #include 5 | #include 6 | 7 | #define RUSAGE_SELF 0 8 | 9 | struct rusage { 10 | struct timeval ru_utime; /* user time used */ 11 | struct timeval ru_stime; /* system time used */ 12 | long ru_maxrss; /* maximum resident set size */ 13 | long ru_ixrss; /* integral shared memory size */ 14 | long ru_idrss; /* integral unshared data size */ 15 | long ru_isrss; /* integral unshared stack size */ 16 | long ru_minflt; /* page reclaims */ 17 | long ru_majflt; /* page faults */ 18 | long ru_nswap; /* swaps */ 19 | long ru_inblock; /* block input operations */ 20 | long ru_oublock; /* block output operations */ 21 | long ru_msgsnd; /* messages sent */ 22 | long ru_msgrcv; /* messages received */ 23 | long ru_nsignals; /* signals received */ 24 | long ru_nvcsw; /* voluntary context switches */ 25 | long ru_nivcsw; /* involuntary context switches */ 26 | }; 27 | 28 | int getrusage(int who, struct rusage *usage); 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/include/sys/select.h: -------------------------------------------------------------------------------- 1 | #ifndef MINLIBC_SYS_SELECT_H 2 | #define MINLIBC_SYS_SELECT_H 3 | 4 | #include 5 | 6 | typedef struct {} fd_set; 7 | 8 | int select(int nfds, fd_set *readfds, fd_set *writefds, 9 | fd_set *exceptfds, struct timeval *timeout); 10 | 11 | void FD_SET(int fd, fd_set *set); 12 | void FD_ZERO(fd_set *set); 13 | 14 | #endif 15 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/include/sys/stat.h: -------------------------------------------------------------------------------- 1 | #ifndef MINLIBC_SYS_STAT_H 2 | #define MINLIBC_SYS_STAT_H 3 | 4 | #include 5 | #include 6 | 7 | #define S_IFMT 0170000 8 | #define S_IFSOCK 0140000 9 | #define S_IFLNK 0120000 10 | #define S_IFREG 0100000 11 | #define S_IFBLK 0060000 12 | #define S_IFDIR 0040000 13 | #define S_IFCHR 0020000 14 | #define S_IFIFO 0010000 15 | #define S_ISUID 0004000 16 | #define S_ISGID 0002000 17 | #define S_ISVTX 0001000 18 | #define S_IRWXU 00700 19 | #define S_IRUSR 00400 20 | #define S_IWUSR 00200 21 | #define S_IXUSR 00100 22 | #define S_IRWXG 00070 23 | #define S_IRGRP 00040 24 | #define S_IWGRP 00020 25 | #define S_IXGRP 00010 26 | #define S_IRWXO 00007 27 | #define S_IROTH 00004 28 | #define S_IWOTH 00002 29 | #define S_IXOTH 00001 30 | 31 | #define S_ISSOCK(x) (((x) & S_IFMT) == S_IFSOCK) 32 | #define S_ISFIFO(x) (((x) & S_IFMT) == S_IFIFO) 33 | #define S_ISDIR(x) (((x) & S_IFMT) == S_IFDIR) 34 | #define S_ISBLK(x) (((x) & S_IFMT) == S_IFBLK) 35 | #define S_ISCHR(x) (((x) & S_IFMT) == S_IFCHR) 36 | #define S_ISREG(x) (((x) & S_IFMT) == S_IFREG) 37 | 38 | typedef unsigned long int dev_t; 39 | typedef unsigned int nlink_t; 40 | typedef unsigned int blksize_t; 41 | typedef unsigned int blkcnt_t; 42 | 43 | struct stat { 44 | dev_t st_dev; 45 | ino_t st_ino; 46 | mode_t st_mode; 47 | nlink_t st_nlink; 48 | uid_t st_uid; 49 | gid_t st_gid; 50 | dev_t st_rdev; 51 | off_t st_size; 52 | blksize_t st_blksize; 53 | blkcnt_t st_blocks; 54 | time_t st_atime; 55 | time_t st_mtime; 56 | time_t st_ctime; 57 | }; 58 | 59 | int stat(const char *p, struct stat *buf); 60 | int fstat(int fd, struct stat *buf); 61 | int lstat(const char *path, struct stat *buf); 62 | 63 | int mkdir(const char *p, mode_t mode); 64 | int mkfifo(const char *p, mode_t mode); 65 | mode_t umask(mode_t cmask); 66 | int chmod(const char *p, mode_t mode); 67 | 68 | #endif 69 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/include/sys/time.h: -------------------------------------------------------------------------------- 1 | #ifndef MINLIBC_SYS_TIME_H 2 | #define MINLIBC_SYS_TIME_H 3 | 4 | #include 5 | 6 | struct timezone { 7 | int tz_minuteswest; 8 | int tz_dsttime; 9 | }; 10 | 11 | int gettimeofday(struct timeval *tv, struct timezone *tz); 12 | 13 | #endif 14 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/include/sys/timeb.h: -------------------------------------------------------------------------------- 1 | #ifndef MINLIBC_SYS_TIMEB_H 2 | #define MINLIBC_SYS_TIMEB_H 3 | 4 | #endif 5 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/include/sys/times.h: -------------------------------------------------------------------------------- 1 | #ifndef MINLIBC_SYS_TIMES_H 2 | #define MINLIBC_SYS_TIMES_H 3 | 4 | #endif 5 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/include/sys/types.h: -------------------------------------------------------------------------------- 1 | #ifndef MINLIBC_SYS_TYPES_H 2 | #define MINLIBC_SYS_TYPES_H 3 | 4 | typedef signed int mode_t; 5 | typedef signed long int off_t; 6 | typedef unsigned long int size_t; 7 | typedef signed long int ssize_t; 8 | typedef unsigned long int dev_t; 9 | typedef unsigned int ino_t; 10 | typedef unsigned int uid_t; 11 | typedef unsigned int gid_t; 12 | typedef unsigned int pid_t; 13 | 14 | #endif 15 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/include/sys/utsname.h: -------------------------------------------------------------------------------- 1 | #ifndef MINLIBC_SYS_UTSNAME_H 2 | #define MINLIBC_SYS_UTSNAME_H 3 | 4 | #endif 5 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/include/sys/vfs.h: -------------------------------------------------------------------------------- 1 | #ifndef MINLIBC_SYS_VFS_H 2 | #define MINLIBC_SYS_VFS_H 3 | 4 | struct statfs {}; 5 | 6 | int statfs(const char *path, struct statfs *buf); 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/include/sys/wait.h: -------------------------------------------------------------------------------- 1 | #ifndef MINLIBC_SYS_WAIT_H 2 | #define MINLIBC_SYS_WAIT_H 3 | 4 | #include 5 | 6 | pid_t waitpid(pid_t pid, int *stat_loc, int options); 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/include/termios.h: -------------------------------------------------------------------------------- 1 | #ifndef MINLIBC_TERMIOS_H 2 | #define MINLIBC_TERMIOS_H 3 | 4 | typedef unsigned int tcflag_t; 5 | typedef unsigned char cc_t; 6 | 7 | struct termios { 8 | tcflag_t c_iflag; 9 | tcflag_t c_oflag; 10 | tcflag_t c_cflag; 11 | tcflag_t c_lflag; 12 | cc_t c_line; 13 | cc_t c_cc[32]; 14 | }; 15 | 16 | int tcgetattr(int fd, struct termios *termios_p); 17 | int tcsetattr(int fd, int opts, const struct termios *termios_p); 18 | 19 | #endif 20 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/include/time.h: -------------------------------------------------------------------------------- 1 | #ifndef MINLIBC_TIME_H 2 | #define MINLIBC_TIME_H 3 | 4 | #ifdef __x86_64__ 5 | typedef signed long time_t; 6 | #else 7 | typedef signed long long time_t; 8 | #endif 9 | 10 | typedef signed long suseconds_t; 11 | 12 | struct timeval { 13 | time_t tv_sec; 14 | suseconds_t tv_usec; 15 | }; 16 | 17 | struct tm { 18 | int tm_sec; 19 | int tm_min; 20 | int tm_hour; 21 | int tm_mday; 22 | int tm_mon; 23 | int tm_year; 24 | int tm_wday; 25 | int tm_yday; 26 | int tm_isdst; 27 | int tm_gmtoff; 28 | const char *tm_zone; 29 | }; 30 | 31 | 32 | time_t time(time_t *tloc); 33 | char *ctime_r(const time_t *timep, char *buf); 34 | struct tm *localtime_r(const time_t *timep, struct tm *result); 35 | void tzset(void); 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/include/unistd.h: -------------------------------------------------------------------------------- 1 | #ifndef MINLIBC_UNISTD_H 2 | #define MINLIBC_UNISTD_H 3 | 4 | #include 5 | 6 | #define _SC_CLK_TCK 2 7 | #define _SC_PAGESIZE 30 8 | 9 | extern char **environ; 10 | 11 | int getpagesize(void); 12 | 13 | off_t lseek(int fd, off_t offset, int whence); 14 | ssize_t read(int fd, void *buf, size_t count); 15 | ssize_t write(int fd, const void *buf, size_t count); 16 | int close(int fd); 17 | int ftruncate(int fd, off_t length); 18 | int isatty(int fd); 19 | int dup(int fildes); 20 | int dup2(int fildes, int fildes2); 21 | int access(const char *pathname, int); 22 | 23 | gid_t getgid(void); 24 | gid_t getegid(void); 25 | uid_t getuid(void); 26 | uid_t geteuid(void); 27 | pid_t getpid(void); 28 | 29 | long sysconf(int name); 30 | pid_t fork(void); 31 | 32 | int pipe(int fildes[2]); 33 | int link(const char *path1, const char *path2); 34 | int unlink(const char *path); 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/include/utime.h: -------------------------------------------------------------------------------- 1 | #ifndef MINLIBC_UTIME_H 2 | #define MINLIBC_UTIME_H 3 | 4 | struct utimbuf { }; 5 | 6 | int utime(const char *filename, const struct utimbuf *times); 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/include/wctype.h: -------------------------------------------------------------------------------- 1 | #ifndef MINLIBC_WCTYPE_H 2 | #define MINLIBC_WCTYPE_H 3 | 4 | #endif 5 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/isatty.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | int isatty(int fd) 6 | { 7 | if(fd >= 0 && fd <= 2) 8 | return 1; 9 | errno = EBADF; 10 | return 0; 11 | } 12 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/isdigit.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int isdigit(int c) 4 | { 5 | return ((c >= '0') && (c <= '9')); 6 | } 7 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/isspace.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int isspace(int c) 4 | { 5 | return ((c == ' ') || (c == '\n') || (c == '\t')); 6 | } 7 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/kill.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | int kill(pid_t pid __attribute__((unused)), 6 | int sig __attribute__((unused))) 7 | { 8 | printf("kill\n"); 9 | errno = EPERM; 10 | return -1; 11 | } 12 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/link.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | int link(const char *path1 __attribute__((unused)), 6 | const char *path2 __attribute__((unused))) 7 | { 8 | printf("link\n"); 9 | errno = ENOENT; 10 | return -1; 11 | } 12 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/localtime_r.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | static const int days_per_month[2][12] = { 5 | { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }, 6 | { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 } 7 | }; 8 | 9 | static const int days_per_year[2] = { 365, 366 }; 10 | 11 | static int is_leap_year(int year) 12 | { 13 | // A years is a leap year if it is divisible by 4 except when the year 14 | // is divisible by 100 but not 400. 15 | return (year % 4 == 0) && !( (year % 100 == 0) && (year % 400 != 0) ); 16 | } 17 | 18 | /* sec min hr days */ 19 | #define secs_per_year(x) (60 * 60 * 24 * days_per_year[is_leap_year(x)]) 20 | #define secs_per_mon(x,y)(60 * 60 * 24 * days_per_month[is_leap_year(x)][y]) 21 | #define secs_per_day (60 * 60 * 24) 22 | #define secs_per_hour (60 * 60) 23 | #define secs_per_min (60) 24 | 25 | // This code disregards leap seconds. 26 | struct tm *localtime_r(const time_t *time, struct tm *result) 27 | { 28 | int cur_year = 1970; /* Groovy, man */ 29 | int cur_month = 0, cur_day = 0, cur_hour = 0, cur_min = 0; 30 | int weekday = 0, yearday = 0; 31 | int secs_left = *time; 32 | 33 | /* Then compute the weekday it is. Jan 1, 1970 was a Thursday. */ 34 | weekday = (4 + (secs_left / secs_per_day)) % 7; 35 | 36 | /* Start pulling off years */ 37 | while(secs_left >= secs_per_year(cur_year)) { 38 | ++cur_year; 39 | secs_left -= secs_per_year(cur_year); 40 | } 41 | 42 | yearday = secs_left / secs_per_day; 43 | 44 | /* Then pull off months */ 45 | while(secs_left >= secs_per_mon(cur_year, cur_month)) { 46 | ++cur_month; 47 | secs_left -= secs_per_mon(cur_year, cur_month); 48 | } 49 | 50 | /* Then pull off days */ 51 | while(secs_left >= secs_per_day) { 52 | ++cur_day; 53 | secs_left -= secs_per_day; 54 | } 55 | 56 | /* Then pull off hours */ 57 | while(secs_left >= secs_per_hour) { 58 | ++cur_hour; 59 | secs_left -= secs_per_hour; 60 | } 61 | 62 | /* Then pull off minutes */ 63 | while(secs_left >= secs_per_min) { 64 | ++cur_min; 65 | secs_left -= secs_per_min; 66 | } 67 | 68 | result->tm_sec = secs_left; 69 | result->tm_min = cur_min; 70 | result->tm_hour = cur_hour; 71 | result->tm_mday = cur_day; 72 | result->tm_mon = cur_month; 73 | result->tm_year = cur_year - 1900; 74 | result->tm_wday = weekday; 75 | result->tm_yday = yearday; 76 | result->tm_isdst = 0; 77 | result->tm_gmtoff = 0; 78 | result->tm_zone = "HALVMST"; /* HALVM Standard Time */ 79 | 80 | return result; 81 | } 82 | 83 | 84 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/lseek.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | off_t lseek(int fildes __attribute__ ((unused)), 6 | off_t offset __attribute__ ((unused)), 7 | int whence __attribute__ ((unused))) 8 | { 9 | printf("lseek\n"); 10 | errno = EBADF; 11 | return -1; 12 | } 13 | 14 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/lstat.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int lstat(const char *path __attribute__((unused)), 5 | struct stat *buf __attribute__((unused))) 6 | { 7 | errno = ENOENT; 8 | return -1; 9 | } 10 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/memchr.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | void *memchr(const void *s, int c, size_t n) 5 | { 6 | size_t i; 7 | 8 | for(i = 0; i < n; i++) 9 | if(((unsigned char*)s)[i] == (unsigned char)c) 10 | return (void*)((unsigned long)s + i); 11 | 12 | return NULL; 13 | } 14 | 15 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/memcmp.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int memcmp(const void *s1, const void *s2, size_t n) 4 | { 5 | unsigned char *str1 = (void*)s1; 6 | unsigned char *str2 = (void*)s2; 7 | size_t pos; 8 | 9 | for(pos = 0; pos < n; pos++) { 10 | if(str1[pos] < str2[pos]) 11 | return 1; 12 | if(str1[pos] > str2[pos]) 13 | return -1; 14 | } 15 | return 0; 16 | } 17 | 18 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/memcpy.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void *memcpy(void *dest, const void *src, size_t count) 4 | { 5 | /* This would be a prime candidate for reimplementation in assembly */ 6 | char *in_src = (char*)src; 7 | char *in_dest = (char*)dest; 8 | 9 | while(count--) 10 | *in_dest++ = *in_src++; 11 | return dest; 12 | } 13 | 14 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/memmove.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void *memmove(void *dest, const void *src, size_t n) 4 | { 5 | void *d0 = dest; 6 | char *d = (char *) dest; 7 | char *s = (char *) src; 8 | if (s < d) 9 | for (s += n, d += n; 0 != n; --n) 10 | *--d = *--s; 11 | else if (s != d) 12 | for (; 0 != n; --n) 13 | *d++ = *s++; 14 | return d0; 15 | } 16 | 17 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/memset.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void *memset(void *s,int c, size_t count) 4 | { 5 | char *xs = (char *) s; 6 | 7 | while (count--) 8 | *xs++ = c; 9 | 10 | return s; 11 | } 12 | 13 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/mkdir.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | int mkdir(const char *path __attribute__((unused)), 6 | mode_t mode __attribute__((unused))) 7 | { 8 | printf("mkdir\n"); 9 | errno = ENOENT; 10 | return -1; 11 | } 12 | 13 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/mkfifo.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | int mkfifo(const char *pathname __attribute__ ((unused)), 6 | mode_t mode __attribute__ ((unused))) 7 | { 8 | printf("mkfifo\n"); 9 | errno = ENOENT; 10 | return -1; 11 | } 12 | 13 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/mkstemp.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int mkstemp(char *template __attribute__ ((unused))) 4 | { 5 | return (-1); 6 | } 7 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/mmap.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | void *mmap(void *start, size_t length, int prot, 6 | int flags __attribute__((unused)), 7 | int fd, off_t offset __attribute__((unused))) 8 | { 9 | if(fd != -1) 10 | return NULL; 11 | 12 | return runtime_alloc(start, length, prot); 13 | } 14 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/mprotect.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int mprotect(void *addr, size_t len, int prot) 5 | { 6 | return runtime_memprotect(addr, len, prot); 7 | } 8 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/mremap.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | void *mremap(void *old_address, size_t old_size, size_t new_size, int flags) 5 | { 6 | return runtime_realloc(old_address, flags, old_size, new_size); 7 | } 8 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/munmap.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int munmap(void *start, size_t length) 5 | { 6 | runtime_free(start, length); 7 | return 0; 8 | } 9 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/nl_langinfo.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | char *nl_langinfo(nl_item item __attribute__((unused))) 4 | { 5 | return "UTF8"; 6 | } 7 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/open.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | int open(const char *pathname __attribute__((unused)), 6 | int flags __attribute__((unused)), 7 | ...) 8 | { 9 | printf("open\n"); 10 | errno = EACCES; 11 | return -1; 12 | } 13 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/pabort.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | void pabort(const char *format, ...) 6 | { 7 | va_list args; 8 | 9 | va_start(args, format); 10 | printf("ABORT: "); 11 | vfprintf(stderr, format, args); 12 | va_end(args); 13 | runtime_exit(); 14 | } 15 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/perror.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | void perror(const char *s) 6 | { 7 | printf("%s: %s\n", s, strerror(errno)); 8 | } 9 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/pipe.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | int pipe(int fildes[2] __attribute__((unused))) 6 | { 7 | printf("pipe\n"); 8 | errno = EMFILE; 9 | return -1; 10 | } 11 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/poll.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | int poll(struct pollfd *fds __attribute__((unused)), 6 | nfds_t nfds, 7 | int timeout) 8 | { 9 | printf("poll called with %ld fds and a timeout of %d\n", nfds, timeout); 10 | switch(timeout) { 11 | case -1: 12 | printf(" ... which will never wake up, so I'm giving up.\n"); 13 | abort(); 14 | case 0: 15 | return 0; 16 | default: 17 | runtime_block(timeout); 18 | return 0; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/printf.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int printf(const char *format, ...) 5 | { 6 | va_list args; 7 | int res; 8 | 9 | va_start(args, format); 10 | res = vfprintf(stdout, format, args); 11 | va_end(args); 12 | return res; 13 | } 14 | 15 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/putchar.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | int putchar(int c) 6 | { 7 | runtime_write(1, (char*)&c); 8 | return c; 9 | } 10 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/putenv.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | int putenv(char *str) 6 | { 7 | printf("WARNING: putenv('%s')\n", str); 8 | return ENOMEM; 9 | } 10 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/puts.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | int puts(const char *s) 7 | { 8 | int len = strlen(s); 9 | runtime_write(len, (char*)s); 10 | runtime_write(1,"\n"); 11 | return 0; 12 | } 13 | 14 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/raise.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int raise(int sig) 5 | { 6 | pabort("Someone called raise! (signal: %d)\n", sig); 7 | } 8 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/read.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | ssize_t read(int fildes __attribute__((unused)), 6 | void *buf __attribute__((unused)), 7 | size_t nbyte __attribute__((unused))) 8 | { 9 | printf("read\n"); 10 | errno = EBADF; 11 | return -1; 12 | } 13 | 14 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/select.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | int select(int nfds __attribute__((unused)), 7 | fd_set *reads __attribute__((unused)), 8 | fd_set *writes __attribute__((unused)), 9 | fd_set *excs __attribute__((unused)), 10 | struct timeval *timeout) 11 | { 12 | printf("select\n"); 13 | if(!timeout) { 14 | printf("select() called with endless wait. aborting.\n"); 15 | abort(); 16 | } 17 | 18 | runtime_block((timeout->tv_sec * 1000) + (timeout->tv_usec / 1000)); 19 | return 0; 20 | } 21 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/setmntent.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | FILE *setmntent(const char *filename __attribute__((unused)), 6 | const char *type __attribute__((unused))) 7 | { 8 | return NULL; 9 | } 10 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/sigaction.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int sigaction(int signum __attribute__((unused)), 5 | const struct sigaction *act __attribute__((unused)), 6 | struct sigaction *oldact __attribute__((unused))) 7 | { 8 | errno = ENOSYS; 9 | return -1; 10 | } 11 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/sigaddset.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | int sigaddset(sigset_t *set __attribute__ ((unused)), 6 | int signum __attribute__ ((unused))) 7 | { 8 | printf("sigaddset\n"); 9 | errno = EINVAL; 10 | return -1; 11 | } 12 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/sigemptyset.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | int sigemptyset(sigset_t *set __attribute__ ((unused))) 6 | { 7 | printf("sigemptyset\n"); 8 | errno = EINVAL; 9 | return -1; 10 | } 11 | 12 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/sigprocmask.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | int sigprocmask(int how __attribute__((unused)), 6 | const sigset_t *set __attribute__((unused)), 7 | sigset_t *oldset __attribute__((unused))) 8 | { 9 | printf("sigprocmask\n"); 10 | errno = EINVAL; 11 | return -1; 12 | } 13 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/snprintf.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | int snprintf(char *buf, size_t size, const char *fmt, ...) 6 | { 7 | va_list args; 8 | int i; 9 | 10 | va_start(args, fmt); 11 | i = vsnprintf(buf, size, fmt, args); 12 | va_end(args); 13 | return i; 14 | } 15 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/sprintf.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | int sprintf(char * buf, const char *fmt, ...) 6 | { 7 | va_list args; 8 | int i; 9 | 10 | va_start(args, fmt); 11 | i = vsnprintf(buf, 0xFFFFFFFFUL, fmt, args); 12 | va_end(args); 13 | return i; 14 | } 15 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/stat.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int stat(const char *path __attribute__((unused)), 5 | struct stat *buf __attribute__((unused))) 6 | { 7 | errno = EACCES; 8 | return -1; 9 | } 10 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/statfs.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | int statfs(const char *path __attribute__ ((unused)), 6 | struct statfs *buf __attribute__ ((unused))) 7 | { 8 | printf("statfs\n"); 9 | errno = ENOSYS; 10 | return (-1); 11 | } 12 | 13 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/stdio_values.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | FILE *stdout = (FILE*)0x0badbead; 4 | FILE *stdin = (FILE*)0xdeadbead; 5 | FILE *stderr = (FILE*)0xeebadbad; 6 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/strchr.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | char *strchr(const char *s, int c) 5 | { 6 | const char *cur; 7 | for (cur = s; *cur; cur++) { 8 | if (*cur == c) { 9 | return ((char*)cur); 10 | } 11 | } 12 | 13 | return NULL; 14 | } 15 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/strcmp.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int strcmp(const char *cs, const char *ct) 4 | { 5 | register signed char __res; 6 | 7 | while (1) { 8 | if ((__res = *cs - *ct++) != 0 || !*cs++) 9 | break; 10 | } 11 | return __res; 12 | } 13 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/strcpy.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | char *strcpy(char *dest, const char *src) 4 | { 5 | char *retval = dest; 6 | // FIXME: Make higher-speed version? 7 | while(*src) *dest++ = *src++; 8 | return retval; 9 | } 10 | 11 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/strdup.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | char *strdup(const char *s) 5 | { 6 | size_t bufsize = strlen(s) + 1; 7 | char *retval = runtime_libc_malloc(bufsize); 8 | if(retval) memcpy(retval, s, bufsize); 9 | return retval; 10 | } 11 | 12 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/strerror.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | char *strerror(int errnum) 6 | { 7 | static char buf[1024]; 8 | switch(errnum) { 9 | case EBADF: return "Bad file.\n"; 10 | case EACCES: return "Access prohibited.\n"; 11 | } 12 | sprintf(buf, "Unkown error: %d", errnum); 13 | return buf; 14 | } 15 | 16 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/strlen.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | size_t strlen(const char *s) 4 | { 5 | const char *sc; 6 | 7 | for (sc = s; *sc != '\0'; ++sc) 8 | /* nothing */; 9 | return sc - s; 10 | } 11 | 12 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/strncmp.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int strncmp(const char *str1, const char *str2, size_t count) 4 | { 5 | register signed char __res = 0; 6 | 7 | while(count--) { 8 | if ((__res = *str1 - *str2) != 0 || !*str1++ || !*str2++) 9 | break; 10 | } 11 | return __res; 12 | } 13 | 14 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/strncpy.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | char *strncpy(char *dest, const char *src, size_t count) 4 | { 5 | char *tmp = dest; 6 | while (count-- && (*dest++ = *src++) != '\0') 7 | /* nothing */; 8 | return tmp; 9 | } 10 | 11 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/strnlen.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | size_t strnlen(const char *s, size_t count) 4 | { 5 | const char *sc; 6 | 7 | for (sc = s; count-- && *sc != '\0'; ++sc) 8 | /* nothing */; 9 | return sc - s; 10 | } 11 | 12 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/strrchr.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | char *strrchr(const char *s, int c) 5 | { 6 | char *retval = NULL; 7 | const char *cur; 8 | for(cur = s; *cur; cur++) 9 | if(*cur == c) 10 | retval = (char*)cur; 11 | return retval; 12 | } 13 | 14 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/strstr.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | char *strstr(const char *str1, const char *str2) 5 | { 6 | size_t len_str2 = strlen(str2); 7 | char *cur; 8 | 9 | for (cur = (char*)str1; cur != NULL; cur = strchr(cur, *str2)) { 10 | if (!strncmp(cur, str2, len_str2)) { 11 | break; 12 | } 13 | cur++; 14 | } 15 | 16 | return cur; 17 | } 18 | 19 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/sysconf.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | long sysconf(int name) 6 | { 7 | switch(name) { 8 | case _SC_PAGESIZE: 9 | return 4096; 10 | case _SC_CLK_TCK: 11 | printf("i was called.\n"); 12 | return 100; /* FIXME: number of clock ticks per second */ 13 | } 14 | 15 | return 0; 16 | } 17 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/tcgetattr.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | int tcgetattr(int fd __attribute__((unused)), 6 | struct termios *termios_p __attribute__((unused))) 7 | { 8 | printf("tcgetattr\n"); 9 | errno = ENOSYS; 10 | return -1; 11 | } 12 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/tcsetattr.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | int tcsetattr(int fd __attribute__((unused)), 6 | int optional_actions __attribute__((unused)), 7 | const struct termios *termios_p __attribute__((unused))) 8 | { 9 | printf("tcsetattr\n"); 10 | errno = ENOSYS; 11 | return -1; 12 | } 13 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/termios.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | static void *saved_termios[3] = { NULL, NULL, NULL }; 4 | 5 | void *__hscore_get_saved_termios(int); 6 | void __hscore_set_saved_termios(int fd, void *ts); 7 | 8 | void *__hscore_get_saved_termios(int fd) 9 | { 10 | if(0 <= fd && fd < 3) 11 | return saved_termios[fd]; 12 | else 13 | return NULL; 14 | } 15 | 16 | void __hscore_set_saved_termios(int fd, void *ts) 17 | { 18 | if(0 <= fd && fd < 3) 19 | saved_termios[fd] = ts; 20 | } 21 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/time.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | time_t time(time_t *t) 5 | { 6 | time_t retval = runtime_time(); 7 | if(t) *t = retval; 8 | return retval; 9 | } 10 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/tzset.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void tzset(void) 4 | { 5 | /* nothing */ 6 | } 7 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/umask.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | mode_t umask(mode_t cmask) 6 | { 7 | static mode_t mask = 0; 8 | int retval = mask; 9 | printf("umask\n"); 10 | mask = cmask; 11 | return retval; 12 | } 13 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/unlink.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | int unlink(const char *pathname __attribute__ ((unused))) 6 | { 7 | printf("unlink\n"); 8 | errno = ENOENT; 9 | return (-1); 10 | } 11 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/unsetenv.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int unsetenv(const char *n __attribute__((unused))) 4 | { 5 | return 0; 6 | } 7 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/utime.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | int utime(const char *path __attribute__((unused)), 6 | const struct utimbuf *times __attribute__((unused))) 7 | { 8 | printf("utime\n"); 9 | errno = ENOENT; 10 | return -1; 11 | } 12 | 13 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/vfprintf.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | int vfprintf(FILE *stream, const char *format, va_list ap) 7 | { 8 | static char buf[4096]; 9 | 10 | if((stream == stdin) || (stream == stdout) || (stream == stderr)) { 11 | int r = vsnprintf(buf, sizeof(buf), format, ap); 12 | runtime_write(r, buf); 13 | return r; 14 | } else { 15 | return -1; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/waitpid.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | pid_t waitpid(pid_t pid __attribute__((unused)), 6 | int *stat_loc __attribute__((unused)), 7 | int options __attribute__((unused))) 8 | { 9 | printf("waitpid\n"); 10 | errno = ECHILD; 11 | return -1; 12 | } 13 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/minlibc/write.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | ssize_t write(int filedes, const void *buf, size_t nbyte) 7 | { 8 | printf("write\n"); 9 | if(filedes == 0 || filedes > 2) { 10 | errno = EBADF; 11 | return -1; 12 | } 13 | runtime_write(nbyte, (char*)buf); 14 | return nbyte; 15 | } 16 | 17 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/platform.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014-2015 Galois, Inc. 3 | * 4 | * This program is free software; you can redistribute it and/or modify it 5 | * under the terms of the GNU General Public License** as published by the Free 6 | * Software Foundation; either version 2 of the License, or (at your option) 7 | * any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, but WITHOUT 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 12 | * more details. 13 | 14 | * You should have received a copy of the GNU General Public License along with 15 | * this program; if not, write to the Free Software Foundation, Inc., 59 Temple 16 | * Place, Suite 330, Boston, MA 02111-1307 USA 17 | * 18 | */ 19 | 20 | 21 | #include 22 | #include 23 | 24 | /* Called by boot.s to set up platform-specific services. */ 25 | void platform_setup() 26 | { 27 | xen_setup(device_tree); 28 | } 29 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/runtime.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014-2015 Galois, Inc. 3 | * 4 | * This program is free software; you can redistribute it and/or modify it 5 | * under the terms of the GNU General Public License** as published by the Free 6 | * Software Foundation; either version 2 of the License, or (at your option) 7 | * any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, but WITHOUT 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 12 | * more details. 13 | 14 | * You should have received a copy of the GNU General Public License along with 15 | * this program; if not, write to the Free Software Foundation, Inc., 59 Temple 16 | * Place, Suite 330, Boston, MA 02111-1307 USA 17 | * 18 | */ 19 | 20 | 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | 29 | void *pvPortMalloc(size_t); 30 | 31 | void runtime_write(size_t len, char *buffer) 32 | { 33 | (void)HYPERVISOR_console_io(CONSOLEIO_WRITE, len, buffer); 34 | } 35 | 36 | void runtime_exit(void) 37 | { 38 | printk("<<< FreeRTOS exit >>>\n"); 39 | vTaskSuspendAll(); 40 | taskDISABLE_INTERRUPTS(); 41 | BUG(); 42 | } 43 | 44 | inline void *runtime_libc_malloc(size_t len) 45 | { 46 | return pvPortMalloc(len); 47 | } 48 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/util/ctype.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2006-2008, 2014-2015 Galois, Inc. 3 | * 4 | * This program is free software; you can redistribute it and/or modify it 5 | * under the terms of the GNU General Public License** as published by the Free 6 | * Software Foundation; either version 2 of the License, or (at your option) 7 | * any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, but WITHOUT 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 12 | * more details. 13 | 14 | * You should have received a copy of the GNU General Public License along with 15 | * this program; if not, write to the Free Software Foundation, Inc., 59 Temple 16 | * Place, Suite 330, Boston, MA 02111-1307 USA 17 | * 18 | */ 19 | 20 | 21 | #include 22 | 23 | unsigned char _ctype[] = { 24 | _C,_C,_C,_C,_C,_C,_C,_C, /* 0-7 */ 25 | _C,_C|_S,_C|_S,_C|_S,_C|_S,_C|_S,_C,_C, /* 8-15 */ 26 | _C,_C,_C,_C,_C,_C,_C,_C, /* 16-23 */ 27 | _C,_C,_C,_C,_C,_C,_C,_C, /* 24-31 */ 28 | _S|_SP,_P,_P,_P,_P,_P,_P,_P, /* 32-39 */ 29 | _P,_P,_P,_P,_P,_P,_P,_P, /* 40-47 */ 30 | _D,_D,_D,_D,_D,_D,_D,_D, /* 48-55 */ 31 | _D,_D,_P,_P,_P,_P,_P,_P, /* 56-63 */ 32 | _P,_U|_X,_U|_X,_U|_X,_U|_X,_U|_X,_U|_X,_U, /* 64-71 */ 33 | _U,_U,_U,_U,_U,_U,_U,_U, /* 72-79 */ 34 | _U,_U,_U,_U,_U,_U,_U,_U, /* 80-87 */ 35 | _U,_U,_U,_P,_P,_P,_P,_P, /* 88-95 */ 36 | _P,_L|_X,_L|_X,_L|_X,_L|_X,_L|_X,_L|_X,_L, /* 96-103 */ 37 | _L,_L,_L,_L,_L,_L,_L,_L, /* 104-111 */ 38 | _L,_L,_L,_L,_L,_L,_L,_L, /* 112-119 */ 39 | _L,_L,_L,_P,_P,_P,_P,_C, /* 120-127 */ 40 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 128-143 */ 41 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 144-159 */ 42 | _S|_SP,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P, /* 160-175 */ 43 | _P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P, /* 176-191 */ 44 | _U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U, /* 192-207 */ 45 | _U,_U,_U,_U,_U,_U,_U,_P,_U,_U,_U,_U,_U,_U,_U,_L, /* 208-223 */ 46 | _L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L, /* 224-239 */ 47 | _L,_L,_L,_L,_L,_L,_L,_P,_L,_L,_L,_L,_L,_L,_L,_L}; /* 240-255 */ 48 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/util/ldivmod_helper.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2012 Andrew Turner 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 18 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 | * SUCH DAMAGE. 25 | * 26 | */ 27 | 28 | #include 29 | 30 | u_quad_t __qdivrem(u_quad_t u, u_quad_t v, u_quad_t *rem); 31 | 32 | quad_t 33 | __divdi3(quad_t a, quad_t b) 34 | { 35 | u_quad_t ua, ub, uq; 36 | int neg; 37 | 38 | if (a < 0) 39 | ua = -(u_quad_t)a, neg = 1; 40 | else 41 | ua = a, neg = 0; 42 | if (b < 0) 43 | ub = -(u_quad_t)b, neg ^= 1; 44 | else 45 | ub = b; 46 | uq = __qdivrem(ua, ub, (u_quad_t *)0); 47 | return (neg ? -uq : uq); 48 | } 49 | 50 | /* 51 | * Helper for __aeabi_ldivmod. 52 | * TODO: __divdi3 calls __qdivrem. We should do the same and use the 53 | * remainder value rather than re-calculating it. 54 | */ 55 | long long __kern_ldivmod(long long, long long, long long *); 56 | 57 | long long 58 | __kern_ldivmod(long long n, long long m, long long *rem) 59 | { 60 | long long q; 61 | 62 | q = __divdi3(n, m); /* q = n / m */ 63 | *rem = n - m * q; 64 | 65 | return q; 66 | } 67 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/util/popcount.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014-2015 Galois, Inc. 3 | * 4 | * This program is free software; you can redistribute it and/or modify it 5 | * under the terms of the GNU General Public License** as published by the Free 6 | * Software Foundation; either version 2 of the License, or (at your option) 7 | * any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, but WITHOUT 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 12 | * more details. 13 | 14 | * You should have received a copy of the GNU General Public License along with 15 | * this program; if not, write to the Free Software Foundation, Inc., 59 Temple 16 | * Place, Suite 330, Boston, MA 02111-1307 USA 17 | * 18 | */ 19 | 20 | 21 | #include 22 | 23 | // Slow but sufficient. We need this because we lose access to 24 | // __builtin_popcount when we start compiling with -nostdlib. 25 | uint32_t popcount(uint32_t n) 26 | { 27 | int c, i; 28 | c = 0; 29 | for (i = 0; i < 32; i++) { 30 | if (n & 0x1) 31 | c++; 32 | n >>= 1; 33 | } 34 | return c; 35 | } 36 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/xen/events_setup.c: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright (C) 2014-2015 Galois, Inc. 4 | * 5 | * This program is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License** as published by the Free 7 | * Software Foundation; either version 2 of the License, or (at your option) 8 | * any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but WITHOUT 11 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 12 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 13 | * more details. 14 | 15 | * You should have received a copy of the GNU General Public License along with 16 | * this program; if not, write to the Free Software Foundation, Inc., 59 Temple 17 | * Place, Suite 330, Boston, MA 02111-1307 USA 18 | * 19 | */ 20 | 21 | #include 22 | #include 23 | #include 24 | 25 | evtchn_port_t debug_port = -1; 26 | 27 | static void virq_debug(evtchn_port_t port, struct pt_regs *regs, void *params) 28 | { 29 | printk("Received a virq_debug event\n"); 30 | } 31 | 32 | void arch_init_events(void) { 33 | printk("events: binding debug VIRQ\n"); 34 | debug_port = bind_virq(VIRQ_DEBUG, (evtchn_handler_t)virq_debug, 0); 35 | 36 | if(debug_port == -1) { 37 | printk("events: could not bind VIRQ!\n"); 38 | while (1) {}; 39 | } else { 40 | printk("events: bound debug port (%d)\n", debug_port); 41 | } 42 | 43 | unmask_evtchn(debug_port); 44 | } 45 | 46 | void arch_fini_events(void) { 47 | if(debug_port != -1) 48 | { 49 | mask_evtchn(debug_port); 50 | unbind_evtchn(debug_port); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/xen/hvm.c: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright (C) 2014-2015 Galois, Inc. 4 | * 5 | * This program is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License** as published by the Free 7 | * Software Foundation; either version 2 of the License, or (at your option) 8 | * any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but WITHOUT 11 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 12 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 13 | * more details. 14 | 15 | * You should have received a copy of the GNU General Public License along with 16 | * this program; if not, write to the Free Software Foundation, Inc., 59 Temple 17 | * Place, Suite 330, Boston, MA 02111-1307 USA 18 | * 19 | */ 20 | 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | 27 | int hvm_get_parameter(int idx, uint64_t *value) 28 | { 29 | int r; 30 | struct xen_hvm_param xhv; 31 | 32 | xhv.domid = DOMID_SELF; 33 | xhv.index = idx; 34 | 35 | r = HYPERVISOR_hvm_op(HVMOP_get_param, &xhv); 36 | 37 | if (r < 0) { 38 | printk("Cannot get hvm parameter %d: %d!\n", idx, r); 39 | } else { 40 | *value = xhv.value; 41 | } 42 | 43 | return r; 44 | } 45 | 46 | 47 | -------------------------------------------------------------------------------- /Demo/CORTEX_A15_Xen_GCC/platform/xen/xenbus-arm.c: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright (C) 2014-2015 Galois, Inc. 4 | * 5 | * This program is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License** as published by the Free 7 | * Software Foundation; either version 2 of the License, or (at your option) 8 | * any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but WITHOUT 11 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 12 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 13 | * more details. 14 | 15 | * You should have received a copy of the GNU General Public License along with 16 | * this program; if not, write to the Free Software Foundation, Inc., 59 Temple 17 | * Place, Suite 330, Boston, MA 02111-1307 USA 18 | * 19 | */ 20 | 21 | #include 22 | #include 23 | #include 24 | #include 25 | 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | 33 | void arch_init_xenbus(struct xenstore_domain_interface **xenstore_buf, uint32_t *store_evtchn) { 34 | uint64_t value; 35 | uint64_t xenstore_pfn; 36 | 37 | if (hvm_get_parameter(HVM_PARAM_STORE_EVTCHN, &value)) 38 | BUG(); 39 | 40 | *store_evtchn = (int)value; 41 | 42 | if(hvm_get_parameter(HVM_PARAM_STORE_PFN, &xenstore_pfn)) 43 | BUG(); 44 | 45 | printk("arch_init_xenbus: xenstore pfn = %llu\n", xenstore_pfn); 46 | 47 | *xenstore_buf = (struct xenstore_domain_interface *) map_frame(xenstore_pfn); 48 | } 49 | -------------------------------------------------------------------------------- /Demo/Common/include/AltBlock.h: -------------------------------------------------------------------------------- 1 | /* 2 | FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. 3 | All rights reserved 4 | 5 | VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. 6 | 7 | *************************************************************************** 8 | * * 9 | * FreeRTOS provides completely free yet professionally developed, * 10 | * robust, strictly quality controlled, supported, and cross * 11 | * platform software that has become a de facto standard. * 12 | * * 13 | * Help yourself get started quickly and support the FreeRTOS * 14 | * project by purchasing a FreeRTOS tutorial book, reference * 15 | * manual, or both from: http://www.FreeRTOS.org/Documentation * 16 | * * 17 | * Thank you! * 18 | * * 19 | *************************************************************************** 20 | 21 | This file is part of the FreeRTOS distribution. 22 | 23 | FreeRTOS is free software; you can redistribute it and/or modify it under 24 | the terms of the GNU General Public License (version 2) as published by the 25 | Free Software Foundation >>!AND MODIFIED BY!<< the FreeRTOS exception. 26 | 27 | >>! NOTE: The modification to the GPL is included to allow you to distribute 28 | >>! a combined work that includes FreeRTOS without being obliged to provide 29 | >>! the source code for proprietary components outside of the FreeRTOS 30 | >>! kernel. 31 | 32 | FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY 33 | WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 34 | FOR A PARTICULAR PURPOSE. Full license text is available from the following 35 | link: http://www.freertos.org/a00114.html 36 | 37 | 1 tab == 4 spaces! 38 | 39 | *************************************************************************** 40 | * * 41 | * Having a problem? Start by reading the FAQ "My application does * 42 | * not run, what could be wrong?" * 43 | * * 44 | * http://www.FreeRTOS.org/FAQHelp.html * 45 | * * 46 | *************************************************************************** 47 | 48 | http://www.FreeRTOS.org - Documentation, books, training, latest versions, 49 | license and Real Time Engineers Ltd. contact details. 50 | 51 | http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products, 52 | including FreeRTOS+Trace - an indispensable productivity tool, a DOS 53 | compatible FAT file system, and our tiny thread aware UDP/IP stack. 54 | 55 | http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High 56 | Integrity Systems to sell under the OpenRTOS brand. Low cost OpenRTOS 57 | licenses offer ticketed support, indemnification and middleware. 58 | 59 | http://www.SafeRTOS.com - High Integrity Systems also provide a safety 60 | engineered and independently SIL3 certified version for use in safety and 61 | mission critical applications that require provable dependability. 62 | 63 | 1 tab == 4 spaces! 64 | */ 65 | 66 | #ifndef FAST_BLOCK_TIME_TEST_H 67 | #define FAST_BLOCK_TIME_TEST_H 68 | 69 | void vCreateAltBlockTimeTasks( void ); 70 | portBASE_TYPE xAreAltBlockTimeTestTasksStillRunning( void ); 71 | 72 | #endif 73 | 74 | 75 | -------------------------------------------------------------------------------- /Demo/Common/include/BlockQ.h: -------------------------------------------------------------------------------- 1 | /* 2 | FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. 3 | All rights reserved 4 | 5 | VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. 6 | 7 | *************************************************************************** 8 | * * 9 | * FreeRTOS provides completely free yet professionally developed, * 10 | * robust, strictly quality controlled, supported, and cross * 11 | * platform software that has become a de facto standard. * 12 | * * 13 | * Help yourself get started quickly and support the FreeRTOS * 14 | * project by purchasing a FreeRTOS tutorial book, reference * 15 | * manual, or both from: http://www.FreeRTOS.org/Documentation * 16 | * * 17 | * Thank you! * 18 | * * 19 | *************************************************************************** 20 | 21 | This file is part of the FreeRTOS distribution. 22 | 23 | FreeRTOS is free software; you can redistribute it and/or modify it under 24 | the terms of the GNU General Public License (version 2) as published by the 25 | Free Software Foundation >>!AND MODIFIED BY!<< the FreeRTOS exception. 26 | 27 | >>! NOTE: The modification to the GPL is included to allow you to distribute 28 | >>! a combined work that includes FreeRTOS without being obliged to provide 29 | >>! the source code for proprietary components outside of the FreeRTOS 30 | >>! kernel. 31 | 32 | FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY 33 | WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 34 | FOR A PARTICULAR PURPOSE. Full license text is available from the following 35 | link: http://www.freertos.org/a00114.html 36 | 37 | 1 tab == 4 spaces! 38 | 39 | *************************************************************************** 40 | * * 41 | * Having a problem? Start by reading the FAQ "My application does * 42 | * not run, what could be wrong?" * 43 | * * 44 | * http://www.FreeRTOS.org/FAQHelp.html * 45 | * * 46 | *************************************************************************** 47 | 48 | http://www.FreeRTOS.org - Documentation, books, training, latest versions, 49 | license and Real Time Engineers Ltd. contact details. 50 | 51 | http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products, 52 | including FreeRTOS+Trace - an indispensable productivity tool, a DOS 53 | compatible FAT file system, and our tiny thread aware UDP/IP stack. 54 | 55 | http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High 56 | Integrity Systems to sell under the OpenRTOS brand. Low cost OpenRTOS 57 | licenses offer ticketed support, indemnification and middleware. 58 | 59 | http://www.SafeRTOS.com - High Integrity Systems also provide a safety 60 | engineered and independently SIL3 certified version for use in safety and 61 | mission critical applications that require provable dependability. 62 | 63 | 1 tab == 4 spaces! 64 | */ 65 | 66 | #ifndef BLOCK_Q_H 67 | #define BLOCK_Q_H 68 | 69 | void vStartBlockingQueueTasks( unsigned portBASE_TYPE uxPriority ); 70 | portBASE_TYPE xAreBlockingQueuesStillRunning( void ); 71 | 72 | #endif 73 | 74 | 75 | -------------------------------------------------------------------------------- /Demo/Common/include/PollQ.h: -------------------------------------------------------------------------------- 1 | /* 2 | FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. 3 | All rights reserved 4 | 5 | VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. 6 | 7 | *************************************************************************** 8 | * * 9 | * FreeRTOS provides completely free yet professionally developed, * 10 | * robust, strictly quality controlled, supported, and cross * 11 | * platform software that has become a de facto standard. * 12 | * * 13 | * Help yourself get started quickly and support the FreeRTOS * 14 | * project by purchasing a FreeRTOS tutorial book, reference * 15 | * manual, or both from: http://www.FreeRTOS.org/Documentation * 16 | * * 17 | * Thank you! * 18 | * * 19 | *************************************************************************** 20 | 21 | This file is part of the FreeRTOS distribution. 22 | 23 | FreeRTOS is free software; you can redistribute it and/or modify it under 24 | the terms of the GNU General Public License (version 2) as published by the 25 | Free Software Foundation >>!AND MODIFIED BY!<< the FreeRTOS exception. 26 | 27 | >>! NOTE: The modification to the GPL is included to allow you to distribute 28 | >>! a combined work that includes FreeRTOS without being obliged to provide 29 | >>! the source code for proprietary components outside of the FreeRTOS 30 | >>! kernel. 31 | 32 | FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY 33 | WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 34 | FOR A PARTICULAR PURPOSE. Full license text is available from the following 35 | link: http://www.freertos.org/a00114.html 36 | 37 | 1 tab == 4 spaces! 38 | 39 | *************************************************************************** 40 | * * 41 | * Having a problem? Start by reading the FAQ "My application does * 42 | * not run, what could be wrong?" * 43 | * * 44 | * http://www.FreeRTOS.org/FAQHelp.html * 45 | * * 46 | *************************************************************************** 47 | 48 | http://www.FreeRTOS.org - Documentation, books, training, latest versions, 49 | license and Real Time Engineers Ltd. contact details. 50 | 51 | http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products, 52 | including FreeRTOS+Trace - an indispensable productivity tool, a DOS 53 | compatible FAT file system, and our tiny thread aware UDP/IP stack. 54 | 55 | http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High 56 | Integrity Systems to sell under the OpenRTOS brand. Low cost OpenRTOS 57 | licenses offer ticketed support, indemnification and middleware. 58 | 59 | http://www.SafeRTOS.com - High Integrity Systems also provide a safety 60 | engineered and independently SIL3 certified version for use in safety and 61 | mission critical applications that require provable dependability. 62 | 63 | 1 tab == 4 spaces! 64 | */ 65 | 66 | #ifndef POLLED_Q_H 67 | #define POLLED_Q_H 68 | 69 | void vStartPolledQueueTasks( unsigned portBASE_TYPE uxPriority ); 70 | portBASE_TYPE xArePollingQueuesStillRunning( void ); 71 | 72 | #endif 73 | 74 | 75 | -------------------------------------------------------------------------------- /Demo/Common/include/QPeek.h: -------------------------------------------------------------------------------- 1 | /* 2 | FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. 3 | All rights reserved 4 | 5 | VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. 6 | 7 | *************************************************************************** 8 | * * 9 | * FreeRTOS provides completely free yet professionally developed, * 10 | * robust, strictly quality controlled, supported, and cross * 11 | * platform software that has become a de facto standard. * 12 | * * 13 | * Help yourself get started quickly and support the FreeRTOS * 14 | * project by purchasing a FreeRTOS tutorial book, reference * 15 | * manual, or both from: http://www.FreeRTOS.org/Documentation * 16 | * * 17 | * Thank you! * 18 | * * 19 | *************************************************************************** 20 | 21 | This file is part of the FreeRTOS distribution. 22 | 23 | FreeRTOS is free software; you can redistribute it and/or modify it under 24 | the terms of the GNU General Public License (version 2) as published by the 25 | Free Software Foundation >>!AND MODIFIED BY!<< the FreeRTOS exception. 26 | 27 | >>! NOTE: The modification to the GPL is included to allow you to distribute 28 | >>! a combined work that includes FreeRTOS without being obliged to provide 29 | >>! the source code for proprietary components outside of the FreeRTOS 30 | >>! kernel. 31 | 32 | FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY 33 | WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 34 | FOR A PARTICULAR PURPOSE. Full license text is available from the following 35 | link: http://www.freertos.org/a00114.html 36 | 37 | 1 tab == 4 spaces! 38 | 39 | *************************************************************************** 40 | * * 41 | * Having a problem? Start by reading the FAQ "My application does * 42 | * not run, what could be wrong?" * 43 | * * 44 | * http://www.FreeRTOS.org/FAQHelp.html * 45 | * * 46 | *************************************************************************** 47 | 48 | http://www.FreeRTOS.org - Documentation, books, training, latest versions, 49 | license and Real Time Engineers Ltd. contact details. 50 | 51 | http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products, 52 | including FreeRTOS+Trace - an indispensable productivity tool, a DOS 53 | compatible FAT file system, and our tiny thread aware UDP/IP stack. 54 | 55 | http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High 56 | Integrity Systems to sell under the OpenRTOS brand. Low cost OpenRTOS 57 | licenses offer ticketed support, indemnification and middleware. 58 | 59 | http://www.SafeRTOS.com - High Integrity Systems also provide a safety 60 | engineered and independently SIL3 certified version for use in safety and 61 | mission critical applications that require provable dependability. 62 | 63 | 1 tab == 4 spaces! 64 | */ 65 | 66 | #ifndef Q_PEEK_TEST_H 67 | #define Q_PEEK_TEST_H 68 | 69 | void vStartQueuePeekTasks( void ); 70 | portBASE_TYPE xAreQueuePeekTasksStillRunning( void ); 71 | 72 | #endif /* Q_PEEK_TEST_H */ 73 | 74 | 75 | 76 | -------------------------------------------------------------------------------- /Demo/Common/include/blocktim.h: -------------------------------------------------------------------------------- 1 | /* 2 | FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. 3 | All rights reserved 4 | 5 | VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. 6 | 7 | *************************************************************************** 8 | * * 9 | * FreeRTOS provides completely free yet professionally developed, * 10 | * robust, strictly quality controlled, supported, and cross * 11 | * platform software that has become a de facto standard. * 12 | * * 13 | * Help yourself get started quickly and support the FreeRTOS * 14 | * project by purchasing a FreeRTOS tutorial book, reference * 15 | * manual, or both from: http://www.FreeRTOS.org/Documentation * 16 | * * 17 | * Thank you! * 18 | * * 19 | *************************************************************************** 20 | 21 | This file is part of the FreeRTOS distribution. 22 | 23 | FreeRTOS is free software; you can redistribute it and/or modify it under 24 | the terms of the GNU General Public License (version 2) as published by the 25 | Free Software Foundation >>!AND MODIFIED BY!<< the FreeRTOS exception. 26 | 27 | >>! NOTE: The modification to the GPL is included to allow you to distribute 28 | >>! a combined work that includes FreeRTOS without being obliged to provide 29 | >>! the source code for proprietary components outside of the FreeRTOS 30 | >>! kernel. 31 | 32 | FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY 33 | WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 34 | FOR A PARTICULAR PURPOSE. Full license text is available from the following 35 | link: http://www.freertos.org/a00114.html 36 | 37 | 1 tab == 4 spaces! 38 | 39 | *************************************************************************** 40 | * * 41 | * Having a problem? Start by reading the FAQ "My application does * 42 | * not run, what could be wrong?" * 43 | * * 44 | * http://www.FreeRTOS.org/FAQHelp.html * 45 | * * 46 | *************************************************************************** 47 | 48 | http://www.FreeRTOS.org - Documentation, books, training, latest versions, 49 | license and Real Time Engineers Ltd. contact details. 50 | 51 | http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products, 52 | including FreeRTOS+Trace - an indispensable productivity tool, a DOS 53 | compatible FAT file system, and our tiny thread aware UDP/IP stack. 54 | 55 | http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High 56 | Integrity Systems to sell under the OpenRTOS brand. Low cost OpenRTOS 57 | licenses offer ticketed support, indemnification and middleware. 58 | 59 | http://www.SafeRTOS.com - High Integrity Systems also provide a safety 60 | engineered and independently SIL3 certified version for use in safety and 61 | mission critical applications that require provable dependability. 62 | 63 | 1 tab == 4 spaces! 64 | */ 65 | 66 | #ifndef BLOCK_TIME_TEST_H 67 | #define BLOCK_TIME_TEST_H 68 | 69 | void vCreateBlockTimeTasks( void ); 70 | portBASE_TYPE xAreBlockTimeTestTasksStillRunning( void ); 71 | 72 | #endif 73 | 74 | 75 | -------------------------------------------------------------------------------- /Demo/Common/include/death.h: -------------------------------------------------------------------------------- 1 | /* 2 | FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. 3 | All rights reserved 4 | 5 | VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. 6 | 7 | *************************************************************************** 8 | * * 9 | * FreeRTOS provides completely free yet professionally developed, * 10 | * robust, strictly quality controlled, supported, and cross * 11 | * platform software that has become a de facto standard. * 12 | * * 13 | * Help yourself get started quickly and support the FreeRTOS * 14 | * project by purchasing a FreeRTOS tutorial book, reference * 15 | * manual, or both from: http://www.FreeRTOS.org/Documentation * 16 | * * 17 | * Thank you! * 18 | * * 19 | *************************************************************************** 20 | 21 | This file is part of the FreeRTOS distribution. 22 | 23 | FreeRTOS is free software; you can redistribute it and/or modify it under 24 | the terms of the GNU General Public License (version 2) as published by the 25 | Free Software Foundation >>!AND MODIFIED BY!<< the FreeRTOS exception. 26 | 27 | >>! NOTE: The modification to the GPL is included to allow you to distribute 28 | >>! a combined work that includes FreeRTOS without being obliged to provide 29 | >>! the source code for proprietary components outside of the FreeRTOS 30 | >>! kernel. 31 | 32 | FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY 33 | WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 34 | FOR A PARTICULAR PURPOSE. Full license text is available from the following 35 | link: http://www.freertos.org/a00114.html 36 | 37 | 1 tab == 4 spaces! 38 | 39 | *************************************************************************** 40 | * * 41 | * Having a problem? Start by reading the FAQ "My application does * 42 | * not run, what could be wrong?" * 43 | * * 44 | * http://www.FreeRTOS.org/FAQHelp.html * 45 | * * 46 | *************************************************************************** 47 | 48 | http://www.FreeRTOS.org - Documentation, books, training, latest versions, 49 | license and Real Time Engineers Ltd. contact details. 50 | 51 | http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products, 52 | including FreeRTOS+Trace - an indispensable productivity tool, a DOS 53 | compatible FAT file system, and our tiny thread aware UDP/IP stack. 54 | 55 | http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High 56 | Integrity Systems to sell under the OpenRTOS brand. Low cost OpenRTOS 57 | licenses offer ticketed support, indemnification and middleware. 58 | 59 | http://www.SafeRTOS.com - High Integrity Systems also provide a safety 60 | engineered and independently SIL3 certified version for use in safety and 61 | mission critical applications that require provable dependability. 62 | 63 | 1 tab == 4 spaces! 64 | */ 65 | 66 | #ifndef SUICIDE_TASK_H 67 | #define SUICIDE_TASK_H 68 | 69 | void vCreateSuicidalTasks( unsigned portBASE_TYPE uxPriority ); 70 | portBASE_TYPE xIsCreateTaskStillRunning( void ); 71 | 72 | #endif 73 | 74 | 75 | -------------------------------------------------------------------------------- /Demo/Common/include/flash.h: -------------------------------------------------------------------------------- 1 | /* 2 | FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. 3 | All rights reserved 4 | 5 | VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. 6 | 7 | *************************************************************************** 8 | * * 9 | * FreeRTOS provides completely free yet professionally developed, * 10 | * robust, strictly quality controlled, supported, and cross * 11 | * platform software that has become a de facto standard. * 12 | * * 13 | * Help yourself get started quickly and support the FreeRTOS * 14 | * project by purchasing a FreeRTOS tutorial book, reference * 15 | * manual, or both from: http://www.FreeRTOS.org/Documentation * 16 | * * 17 | * Thank you! * 18 | * * 19 | *************************************************************************** 20 | 21 | This file is part of the FreeRTOS distribution. 22 | 23 | FreeRTOS is free software; you can redistribute it and/or modify it under 24 | the terms of the GNU General Public License (version 2) as published by the 25 | Free Software Foundation >>!AND MODIFIED BY!<< the FreeRTOS exception. 26 | 27 | >>! NOTE: The modification to the GPL is included to allow you to distribute 28 | >>! a combined work that includes FreeRTOS without being obliged to provide 29 | >>! the source code for proprietary components outside of the FreeRTOS 30 | >>! kernel. 31 | 32 | FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY 33 | WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 34 | FOR A PARTICULAR PURPOSE. Full license text is available from the following 35 | link: http://www.freertos.org/a00114.html 36 | 37 | 1 tab == 4 spaces! 38 | 39 | *************************************************************************** 40 | * * 41 | * Having a problem? Start by reading the FAQ "My application does * 42 | * not run, what could be wrong?" * 43 | * * 44 | * http://www.FreeRTOS.org/FAQHelp.html * 45 | * * 46 | *************************************************************************** 47 | 48 | http://www.FreeRTOS.org - Documentation, books, training, latest versions, 49 | license and Real Time Engineers Ltd. contact details. 50 | 51 | http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products, 52 | including FreeRTOS+Trace - an indispensable productivity tool, a DOS 53 | compatible FAT file system, and our tiny thread aware UDP/IP stack. 54 | 55 | http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High 56 | Integrity Systems to sell under the OpenRTOS brand. Low cost OpenRTOS 57 | licenses offer ticketed support, indemnification and middleware. 58 | 59 | http://www.SafeRTOS.com - High Integrity Systems also provide a safety 60 | engineered and independently SIL3 certified version for use in safety and 61 | mission critical applications that require provable dependability. 62 | 63 | 1 tab == 4 spaces! 64 | */ 65 | 66 | #ifndef FLASH_LED_H 67 | #define FLASH_LED_H 68 | 69 | void vStartLEDFlashTasks( unsigned portBASE_TYPE uxPriority ); 70 | 71 | #endif 72 | 73 | -------------------------------------------------------------------------------- /Demo/Common/include/flop.h: -------------------------------------------------------------------------------- 1 | /* 2 | FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. 3 | All rights reserved 4 | 5 | VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. 6 | 7 | *************************************************************************** 8 | * * 9 | * FreeRTOS provides completely free yet professionally developed, * 10 | * robust, strictly quality controlled, supported, and cross * 11 | * platform software that has become a de facto standard. * 12 | * * 13 | * Help yourself get started quickly and support the FreeRTOS * 14 | * project by purchasing a FreeRTOS tutorial book, reference * 15 | * manual, or both from: http://www.FreeRTOS.org/Documentation * 16 | * * 17 | * Thank you! * 18 | * * 19 | *************************************************************************** 20 | 21 | This file is part of the FreeRTOS distribution. 22 | 23 | FreeRTOS is free software; you can redistribute it and/or modify it under 24 | the terms of the GNU General Public License (version 2) as published by the 25 | Free Software Foundation >>!AND MODIFIED BY!<< the FreeRTOS exception. 26 | 27 | >>! NOTE: The modification to the GPL is included to allow you to distribute 28 | >>! a combined work that includes FreeRTOS without being obliged to provide 29 | >>! the source code for proprietary components outside of the FreeRTOS 30 | >>! kernel. 31 | 32 | FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY 33 | WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 34 | FOR A PARTICULAR PURPOSE. Full license text is available from the following 35 | link: http://www.freertos.org/a00114.html 36 | 37 | 1 tab == 4 spaces! 38 | 39 | *************************************************************************** 40 | * * 41 | * Having a problem? Start by reading the FAQ "My application does * 42 | * not run, what could be wrong?" * 43 | * * 44 | * http://www.FreeRTOS.org/FAQHelp.html * 45 | * * 46 | *************************************************************************** 47 | 48 | http://www.FreeRTOS.org - Documentation, books, training, latest versions, 49 | license and Real Time Engineers Ltd. contact details. 50 | 51 | http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products, 52 | including FreeRTOS+Trace - an indispensable productivity tool, a DOS 53 | compatible FAT file system, and our tiny thread aware UDP/IP stack. 54 | 55 | http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High 56 | Integrity Systems to sell under the OpenRTOS brand. Low cost OpenRTOS 57 | licenses offer ticketed support, indemnification and middleware. 58 | 59 | http://www.SafeRTOS.com - High Integrity Systems also provide a safety 60 | engineered and independently SIL3 certified version for use in safety and 61 | mission critical applications that require provable dependability. 62 | 63 | 1 tab == 4 spaces! 64 | */ 65 | 66 | #ifndef FLOP_TASKS_H 67 | #define FLOP_TASKS_H 68 | 69 | void vStartMathTasks( unsigned portBASE_TYPE uxPriority ); 70 | portBASE_TYPE xAreMathsTaskStillRunning( void ); 71 | 72 | #endif 73 | 74 | 75 | -------------------------------------------------------------------------------- /Demo/Common/include/mevents.h: -------------------------------------------------------------------------------- 1 | /* 2 | FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. 3 | All rights reserved 4 | 5 | VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. 6 | 7 | *************************************************************************** 8 | * * 9 | * FreeRTOS provides completely free yet professionally developed, * 10 | * robust, strictly quality controlled, supported, and cross * 11 | * platform software that has become a de facto standard. * 12 | * * 13 | * Help yourself get started quickly and support the FreeRTOS * 14 | * project by purchasing a FreeRTOS tutorial book, reference * 15 | * manual, or both from: http://www.FreeRTOS.org/Documentation * 16 | * * 17 | * Thank you! * 18 | * * 19 | *************************************************************************** 20 | 21 | This file is part of the FreeRTOS distribution. 22 | 23 | FreeRTOS is free software; you can redistribute it and/or modify it under 24 | the terms of the GNU General Public License (version 2) as published by the 25 | Free Software Foundation >>!AND MODIFIED BY!<< the FreeRTOS exception. 26 | 27 | >>! NOTE: The modification to the GPL is included to allow you to distribute 28 | >>! a combined work that includes FreeRTOS without being obliged to provide 29 | >>! the source code for proprietary components outside of the FreeRTOS 30 | >>! kernel. 31 | 32 | FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY 33 | WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 34 | FOR A PARTICULAR PURPOSE. Full license text is available from the following 35 | link: http://www.freertos.org/a00114.html 36 | 37 | 1 tab == 4 spaces! 38 | 39 | *************************************************************************** 40 | * * 41 | * Having a problem? Start by reading the FAQ "My application does * 42 | * not run, what could be wrong?" * 43 | * * 44 | * http://www.FreeRTOS.org/FAQHelp.html * 45 | * * 46 | *************************************************************************** 47 | 48 | http://www.FreeRTOS.org - Documentation, books, training, latest versions, 49 | license and Real Time Engineers Ltd. contact details. 50 | 51 | http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products, 52 | including FreeRTOS+Trace - an indispensable productivity tool, a DOS 53 | compatible FAT file system, and our tiny thread aware UDP/IP stack. 54 | 55 | http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High 56 | Integrity Systems to sell under the OpenRTOS brand. Low cost OpenRTOS 57 | licenses offer ticketed support, indemnification and middleware. 58 | 59 | http://www.SafeRTOS.com - High Integrity Systems also provide a safety 60 | engineered and independently SIL3 certified version for use in safety and 61 | mission critical applications that require provable dependability. 62 | 63 | 1 tab == 4 spaces! 64 | */ 65 | 66 | #ifndef EVENTS_TEST_H 67 | #define EVENTS_TEST_H 68 | 69 | void vStartMultiEventTasks( void ); 70 | portBASE_TYPE xAreMultiEventTasksStillRunning( void ); 71 | 72 | #endif 73 | 74 | 75 | -------------------------------------------------------------------------------- /Demo/Common/include/recmutex.h: -------------------------------------------------------------------------------- 1 | /* 2 | FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. 3 | All rights reserved 4 | 5 | VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. 6 | 7 | *************************************************************************** 8 | * * 9 | * FreeRTOS provides completely free yet professionally developed, * 10 | * robust, strictly quality controlled, supported, and cross * 11 | * platform software that has become a de facto standard. * 12 | * * 13 | * Help yourself get started quickly and support the FreeRTOS * 14 | * project by purchasing a FreeRTOS tutorial book, reference * 15 | * manual, or both from: http://www.FreeRTOS.org/Documentation * 16 | * * 17 | * Thank you! * 18 | * * 19 | *************************************************************************** 20 | 21 | This file is part of the FreeRTOS distribution. 22 | 23 | FreeRTOS is free software; you can redistribute it and/or modify it under 24 | the terms of the GNU General Public License (version 2) as published by the 25 | Free Software Foundation >>!AND MODIFIED BY!<< the FreeRTOS exception. 26 | 27 | >>! NOTE: The modification to the GPL is included to allow you to distribute 28 | >>! a combined work that includes FreeRTOS without being obliged to provide 29 | >>! the source code for proprietary components outside of the FreeRTOS 30 | >>! kernel. 31 | 32 | FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY 33 | WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 34 | FOR A PARTICULAR PURPOSE. Full license text is available from the following 35 | link: http://www.freertos.org/a00114.html 36 | 37 | 1 tab == 4 spaces! 38 | 39 | *************************************************************************** 40 | * * 41 | * Having a problem? Start by reading the FAQ "My application does * 42 | * not run, what could be wrong?" * 43 | * * 44 | * http://www.FreeRTOS.org/FAQHelp.html * 45 | * * 46 | *************************************************************************** 47 | 48 | http://www.FreeRTOS.org - Documentation, books, training, latest versions, 49 | license and Real Time Engineers Ltd. contact details. 50 | 51 | http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products, 52 | including FreeRTOS+Trace - an indispensable productivity tool, a DOS 53 | compatible FAT file system, and our tiny thread aware UDP/IP stack. 54 | 55 | http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High 56 | Integrity Systems to sell under the OpenRTOS brand. Low cost OpenRTOS 57 | licenses offer ticketed support, indemnification and middleware. 58 | 59 | http://www.SafeRTOS.com - High Integrity Systems also provide a safety 60 | engineered and independently SIL3 certified version for use in safety and 61 | mission critical applications that require provable dependability. 62 | 63 | 1 tab == 4 spaces! 64 | */ 65 | 66 | #ifndef RECURSIVE_MUTEX_TEST_H 67 | #define RECURSIVE_MUTEX_TEST_H 68 | 69 | void vStartRecursiveMutexTasks( void ); 70 | portBASE_TYPE xAreRecursiveMutexTasksStillRunning( void ); 71 | 72 | #endif 73 | 74 | -------------------------------------------------------------------------------- /Example/Example.c: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | void firstTask(void *unused) 13 | { 14 | printk("In first task\n"); 15 | vTaskDelete(NULL); 16 | } 17 | 18 | void secondTask(void *unused) 19 | { 20 | printk("In second task\n"); 21 | vTaskDelete(NULL); 22 | } 23 | 24 | int main(void) 25 | { 26 | portBASE_TYPE ret; 27 | 28 | printk("Creating first task\n"); 29 | ret = xTaskCreate(firstTask, (signed portCHAR *) "firstTask", 4096, NULL, configTIMER_TASK_PRIORITY - 1, NULL); 30 | if (ret != pdPASS) { 31 | printk("Error creating task, status was %d\n", ret); 32 | return 1; 33 | } 34 | 35 | printk("Creating second task\n"); 36 | ret = xTaskCreate(secondTask, (signed portCHAR *) "secondTask", 4096, NULL, configTIMER_TASK_PRIORITY - 1, NULL); 37 | if (ret != pdPASS) { 38 | printk("Error creating task, status was %d\n", ret); 39 | return 1; 40 | } 41 | 42 | printk("Starting scheduler\n"); 43 | vTaskStartScheduler(); 44 | 45 | printk("Scheduler exited\n"); 46 | return 0; 47 | } 48 | -------------------------------------------------------------------------------- /Example/Makefile: -------------------------------------------------------------------------------- 1 | 2 | ########################################################### 3 | # Things you probably want to change: 4 | # The FreeRTOS source path 5 | FREERTOS=../ 6 | # Where Xen headers are installed 7 | XEN_PREFIX=/usr 8 | # The cross compiler name prefix 9 | CROSS_COMPILE=arm-none-eabi- 10 | ########################################################### 11 | 12 | FREERTOS_LIB=$(FREERTOS)/Demo/CORTEX_A15_Xen_GCC/FreeRTOS.a 13 | PORT=$(FREERTOS)/Source/portable/GCC/ARM7_CA15_Xen 14 | XEN_INCLUDE=$(XEN_PREFIX)/include 15 | CC=$(CROSS_COMPILE)gcc 16 | OBJCOPY=$(CROSS_COMPILE)objcopy 17 | 18 | DEBUG= 19 | LDSCRIPT=$(FREERTOS)/Demo/CORTEX_A15_Xen_GCC/linker.lds 20 | LDFLAGS=-nostartfiles -Xlinker 21 | OPTIMIZE=-O3 22 | ELFFLAGS=-static -T $(LDSCRIPT) 23 | 24 | CFLAGS= $(DEBUG) $(OPTIMIZE) \ 25 | -Wall \ 26 | -Werror \ 27 | -I $(FREERTOS)/Source/include \ 28 | -I $(FREERTOS)/Demo/CORTEX_A15_Xen_GCC/include \ 29 | -I $(FREERTOS)/Demo/CORTEX_A15_Xen_GCC/platform/include \ 30 | -I $(FREERTOS)/Demo/CORTEX_A15_Xen_GCC/platform/minlibc/include \ 31 | -I $(FREERTOS)/Demo/Common/include \ 32 | -I $(PORT)/include \ 33 | -I $(XEN_INCLUDE) \ 34 | -D XEN_HAVE_PV_GUEST_ENTRY=1 \ 35 | -D CA15_XEN_GCC \ 36 | -mcpu=cortex-a15 \ 37 | -mfpu=vfpv4 \ 38 | -fomit-frame-pointer \ 39 | -fno-strict-aliasing \ 40 | -nostdlib 41 | 42 | .SECONDARY: Example.elf 43 | 44 | all: Example.bin 45 | 46 | %.bin: %.elf 47 | $(OBJCOPY) $*.elf -O binary $*.bin 48 | 49 | %.elf: %.o $(FREERTOS_LIB) Makefile 50 | $(CC) $(CFLAGS) $*.o $(FREERTOS_LIB) $(LDFLAGS) -o$*.elf $(ELFFLAGS) 51 | 52 | Example.o: %.o : %.c Makefile 53 | $(CC) -c $(CFLAGS) $*.c -o $*.o 54 | 55 | clean: 56 | rm -f *.elf *.bin *.o 57 | -------------------------------------------------------------------------------- /Source/portable/GCC/ARM7_CA15_Xen/asm/arm_modes.s: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright (C) 2014-2015 Galois, Inc. 4 | * 5 | * This program is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License** as published by the Free 7 | * Software Foundation; either version 2 of the License, or (at your option) 8 | * any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but WITHOUT 11 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 12 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 13 | * more details. 14 | 15 | * You should have received a copy of the GNU General Public License along with 16 | * this program; if not, write to the Free Software Foundation, Inc., 59 Temple 17 | * Place, Suite 330, Boston, MA 02111-1307 USA 18 | * 19 | */ 20 | 21 | #define CPSR_I 0x80 22 | 23 | #define FIQ_MODE 0x11 24 | #define IRQ_MODE 0x12 25 | #define SVC_MODE 0x13 26 | #define ABT_MODE 0x17 27 | #define UND_MODE 0x1b 28 | #define SYS_MODE 0x1f 29 | -------------------------------------------------------------------------------- /Source/portable/GCC/ARM7_CA15_Xen/asm/bss.s: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright (C) 2014-2015 Galois, Inc. 4 | * 5 | * This program is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License** as published by the Free 7 | * Software Foundation; either version 2 of the License, or (at your option) 8 | * any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but WITHOUT 11 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 12 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 13 | * more details. 14 | 15 | * You should have received a copy of the GNU General Public License along with 16 | * this program; if not, write to the Free Software Foundation, Inc., 59 Temple 17 | * Place, Suite 330, Boston, MA 02111-1307 USA 18 | * 19 | */ 20 | 21 | .macro zero_bss 22 | @ BSS start and end MUST be word-aligned. 23 | ldr r0, =_bss_start 24 | ldr r1, =_bss_end 25 | add r1, r1, #4 26 | mov r2, #0 27 | 28 | 1: 29 | str r2, [r0] 30 | 31 | add r0, r0, #4 32 | cmp r0, r1 33 | blt 1b 34 | .endm 35 | -------------------------------------------------------------------------------- /Source/portable/GCC/ARM7_CA15_Xen/asm/cache.s: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright (C) 2014-2015 Galois, Inc. 4 | * 5 | * This program is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License** as published by the Free 7 | * Software Foundation; either version 2 of the License, or (at your option) 8 | * any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but WITHOUT 11 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 12 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 13 | * more details. 14 | 15 | * You should have received a copy of the GNU General Public License along with 16 | * this program; if not, write to the Free Software Foundation, Inc., 59 Temple 17 | * Place, Suite 330, Boston, MA 02111-1307 USA 18 | * 19 | */ 20 | 21 | .section ".start" 22 | .globl flush_caches 23 | 24 | .macro flush_dcache level 25 | dsb 26 | isb 27 | /* Figure out the cache size information */ 28 | mov r0, \level 29 | sub r0, r0, #1 30 | lsl r0, r0, #1 31 | mcr p15, 2, r0, c0, c0, 0 /* select the cache */ 32 | mrc p15, 1, r0, c0, c0, 0 /* read its information */ 33 | lsr r9, r0, #13 34 | movw r7, 0x7FFF 35 | and r9, r9, r7 /* r9 = number of sets */ 36 | lsr r8, r0, #3 37 | movw r7, 0x3FF 38 | and r8, r8, r7 /* r8 = number of ways */ 39 | /* INVARIANT: 40 | total number of ways = r8 41 | total number of sets = r9 */ 42 | mov r0, #0 /* curway = r0 = 0 */ 43 | mov r1, #0 /* curset = r1 = 0 */ 44 | 1: 45 | lsl r2, r0, #30 /* shift way into position */ 46 | lsl r3, r1, #6 /* shift set into position */ 47 | mov r4, \level 48 | sub r4, r4, #1 49 | lsl r4, r4, #1 /* shift level into position */ 50 | orr r5, r2, r3 /* combine them */ 51 | orr r5, r5, r4 /* and again */ 52 | mcr p15, 0, r5, c7, c14, 2 /* flush it! */ 53 | add r0, r0, #1 /* increment way counter */ 54 | cmp r0, r8 /* is curway == maxways? */ 55 | bne 1b /* if not, go back */ 56 | mov r0, #0 /* otherwise, reset curway to 0 */ 57 | add r1, r1, #1 /* increment set counter */ 58 | cmp r1, r9 /* is curset == maxsets? */ 59 | bne 1b /* if not, go back */ 60 | movw r0, #0 61 | mcr p15, 0, r0, c7, c10, 4 62 | .endm 63 | 64 | flush_caches: 65 | push {r0-r9, lr} 66 | /* Paranoia! */ 67 | eor r0, r0, r0 /* i.e., r0 = 0*/ 68 | 69 | /* Flush the instruction cache. */ 70 | mcr p15, 0, r0, cr7, cr5, 0 71 | 72 | /* Flush the data cache */ 73 | flush_dcache #1 74 | flush_dcache #2 75 | 76 | /* Flush the BTAC (branch predictor cache) */ 77 | mcr p15, 0, r0, cr7, cr5, 6 /* this may be covered by IC flush */ 78 | 79 | pop {r0-r9, lr} 80 | bx lr 81 | -------------------------------------------------------------------------------- /Source/portable/GCC/ARM7_CA15_Xen/asm/dumpregs.s: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright (C) 2014-2015 Galois, Inc. 4 | * 5 | * This program is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License** as published by the Free 7 | * Software Foundation; either version 2 of the License, or (at your option) 8 | * any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but WITHOUT 11 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 12 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 13 | * more details. 14 | 15 | * You should have received a copy of the GNU General Public License along with 16 | * this program; if not, write to the Free Software Foundation, Inc., 59 Temple 17 | * Place, Suite 330, Boston, MA 02111-1307 USA 18 | * 19 | */ 20 | 21 | .macro _dumpregs 22 | push {r0-r12,lr} 23 | push {r12, lr} 24 | 25 | push {r3} 26 | mov r3, r2 27 | mov r2, r1 28 | mov r1, r0 29 | ldr r0, =info_msg2 30 | bl __printk 31 | pop {r3} 32 | 33 | mov r1, r3 34 | mov r2, r4 35 | mov r3, r5 36 | ldr r0, =info_msg3 37 | bl __printk 38 | 39 | mov r1, r6 40 | mov r2, r7 41 | mov r3, r8 42 | ldr r0, =info_msg4 43 | bl __printk 44 | 45 | mov r1, r9 46 | mov r2, r10 47 | mov r3, r11 48 | ldr r0, =info_msg5 49 | bl __printk 50 | 51 | pop {r12, lr} 52 | mov r1, r12 53 | mov r2, lr 54 | mrs r3, cpsr 55 | ldr r0, =info_msg6 56 | bl __printk 57 | 58 | mrs r1, spsr 59 | ldr r0, =info_msg7 60 | bl __printk 61 | 62 | mrc p15, 0, r1, c5, c0, 1 @ Read IFSR into r1 63 | ldr r0, =info_msg8 64 | bl __printk 65 | 66 | mrc p15, 0, r1, c5, c0, 0 @ Read DFSR into r1 67 | ldr r0, =info_msg9 68 | bl __printk 69 | 70 | mrc p15, 0, r1, c6, c0, 0 @ Read DFAR into r1 71 | ldr r0, =info_msg10 72 | bl __printk 73 | 74 | pop {r0-r12,lr} 75 | .endm 76 | 77 | .macro _dumpstack 78 | push {r0-r12, lr} 79 | add r4, sp, #56 @ 14 * 4 bytes to compensate for the push above 80 | 81 | ldr r0, =stack_start 82 | bl __printk 83 | 84 | ldr r0, =stack_entry 85 | mov r1, r4 86 | ldr r2, [r4] 87 | bl __printk 88 | 89 | ldr r0, =stack_entry 90 | add r1, r4, #4 91 | ldr r2, [r4, #4] 92 | bl __printk 93 | 94 | ldr r0, =stack_entry 95 | add r1, r4, #8 96 | ldr r2, [r4, #8] 97 | bl __printk 98 | 99 | ldr r0, =stack_entry 100 | add r1, r4, #12 101 | ldr r2, [r4, #12] 102 | bl __printk 103 | 104 | ldr r0, =stack_entry 105 | add r1, r4, #16 106 | ldr r2, [r4, #16] 107 | bl __printk 108 | 109 | ldr r0, =stack_entry 110 | add r1, r4, #20 111 | ldr r2, [r4, #20] 112 | bl __printk 113 | 114 | ldr r0, =stack_entry 115 | add r1, r4, #24 116 | ldr r2, [r4, #24] 117 | bl __printk 118 | 119 | ldr r0, =stack_entry 120 | add r1, r4, #28 121 | ldr r2, [r4, #28] 122 | bl __printk 123 | 124 | pop {r0-r12, lr} 125 | .endm 126 | -------------------------------------------------------------------------------- /Source/portable/GCC/ARM7_CA15_Xen/asm/fpu.s: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright (C) 2014-2015 Galois, Inc. 4 | * 5 | * This program is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License** as published by the Free 7 | * Software Foundation; either version 2 of the License, or (at your option) 8 | * any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but WITHOUT 11 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 12 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 13 | * more details. 14 | 15 | * You should have received a copy of the GNU General Public License along with 16 | * this program; if not, write to the Free Software Foundation, Inc., 59 Temple 17 | * Place, Suite 330, Boston, MA 02111-1307 USA 18 | * 19 | */ 20 | 21 | #include "print.s" 22 | 23 | .section ".start" 24 | .globl fpu_enable 25 | 26 | fpu_enable: 27 | MRC p15, 0, r0, c1, c0, 2 28 | ORR r0, r0, #(3<<20) 29 | ORR r0, r0, #(3<<22) 30 | BIC r0, r0, #(3<<30) 31 | MCR p15, 0, r0, c1, c0, 2 32 | 33 | ISB 34 | MOV r0, #(1<<30) 35 | VMSR FPEXC, r0 36 | 37 | print fpu_enabled 38 | 39 | bx lr 40 | -------------------------------------------------------------------------------- /Source/portable/GCC/ARM7_CA15_Xen/asm/ldivmod.s: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2012 Andrew Turner 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 18 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 | * SUCH DAMAGE. 25 | * 26 | */ 27 | 28 | #define ENTRY_NP(symbol) \ 29 | .globl symbol; \ 30 | symbol: 31 | 32 | #define END(symbol) 33 | 34 | /* 35 | * These calculate: 36 | * q = n / m 37 | * With a remainer r. 38 | * 39 | * They take n in {r0, r1} and m in {r2, r3} then pass them into the 40 | * helper function. The hepler functions return q in {r0, r1} as 41 | * required by the API spec however r is returned on the stack. The 42 | * ABI required us to return r in {r2, r3}. 43 | * 44 | * We need to allocate 8 bytes on the stack to store r, the link 45 | * register, and a pointer to the space where the helper function 46 | * will write r to. After returning from the helper fuinction we load 47 | * the old link register and r from the stack and return. 48 | */ 49 | ENTRY_NP(__aeabi_ldivmod) 50 | sub sp, sp, #8 /* Space for the remainder */ 51 | stmfd sp!, {sp, lr} /* Save a pointer to the above space and lr */ 52 | bl __kern_ldivmod 53 | ldr lr, [sp, #4] /* Restore lr */ 54 | add sp, sp, #8 /* Move sp to the remainder value */ 55 | ldmfd sp!, {r2, r3} /* Load the remainder */ 56 | mov pc, lr 57 | END(__aeabi_ldivmod) 58 | 59 | ENTRY_NP(__aeabi_uldivmod) 60 | sub sp, sp, #8 /* Space for the remainder */ 61 | stmfd sp!, {sp, lr} /* Save a pointer to the above space and lr */ 62 | bl __qdivrem 63 | ldr lr, [sp, #4] /* Restore lr */ 64 | add sp, sp, #8 /* Move sp to the remainder value */ 65 | ldmfd sp!, {r2, r3} /* Load the remainder */ 66 | mov pc, lr 67 | END(__aeabi_uldivmod) 68 | -------------------------------------------------------------------------------- /Source/portable/GCC/ARM7_CA15_Xen/asm/print.s: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright (C) 2014-2015 Galois, Inc. 4 | * 5 | * This program is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License** as published by the Free 7 | * Software Foundation; either version 2 of the License, or (at your option) 8 | * any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but WITHOUT 11 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 12 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 13 | * more details. 14 | 15 | * You should have received a copy of the GNU General Public License along with 16 | * this program; if not, write to the Free Software Foundation, Inc., 59 Temple 17 | * Place, Suite 330, Boston, MA 02111-1307 USA 18 | * 19 | */ 20 | 21 | # print msg prints the string referred to by msg to the Xen console. Example: 22 | # 23 | # .section ".data" 24 | # foo: 25 | # .asciz "bar\n" 26 | # 27 | # print foo 28 | # 29 | # Note that the string MUST be declared using 'asciz', not 'ascii', to be 30 | # null-terminated; otherwise the call to printk will overrun the end of the 31 | # string. 32 | .macro print msg 33 | push {r0, r1, lr} 34 | ldr r0, =\msg 35 | bl printk 36 | pop {r0, r1, lr} 37 | .endm 38 | -------------------------------------------------------------------------------- /Source/portable/GCC/ARM7_CA15_Xen/asm/stack.s: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014-2015 Galois, Inc. 3 | * 4 | * This program is free software; you can redistribute it and/or modify it 5 | * under the terms of the GNU General Public License** as published by the Free 6 | * Software Foundation; either version 2 of the License, or (at your option) 7 | * any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, but WITHOUT 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 12 | * more details. 13 | 14 | * You should have received a copy of the GNU General Public License along with 15 | * this program; if not, write to the Free Software Foundation, Inc., 59 Temple 16 | * Place, Suite 330, Boston, MA 02111-1307 USA 17 | * 18 | */ 19 | 20 | #include "arm_modes.s" 21 | 22 | .macro setup_stacks 23 | @ Set up stack pointers 24 | CPS #ABT_MODE 25 | LDR sp, =abt_stack 26 | 27 | CPS #FIQ_MODE 28 | LDR sp, =firq_stack 29 | 30 | CPS #IRQ_MODE 31 | LDR sp, =irq_stack 32 | 33 | CPS #UND_MODE 34 | LDR sp, =und_stack 35 | 36 | @ Set up SVC mode stack and continue in this mode. 37 | CPS #SVC_MODE 38 | LDR sp, =svc_stack 39 | .endm 40 | -------------------------------------------------------------------------------- /Source/portable/GCC/ARM7_CA15_Xen/asm/strings.s: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright (C) 2014-2015 Galois, Inc. 4 | * 5 | * This program is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License** as published by the Free 7 | * Software Foundation; either version 2 of the License, or (at your option) 8 | * any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but WITHOUT 11 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 12 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 13 | * more details. 14 | 15 | * You should have received a copy of the GNU General Public License along with 16 | * this program; if not, write to the Free Software Foundation, Inc., 59 Temple 17 | * Place, Suite 330, Boston, MA 02111-1307 USA 18 | * 19 | */ 20 | 21 | .section ".data" 22 | .globl timer_banner 23 | .globl cntfrq_msg 24 | .globl timervalue_msg 25 | .globl interrupts_enabled 26 | .globl interrupts_disabled 27 | .globl jumpmsg 28 | .globl stack_start 29 | .globl stack_entry 30 | .globl info_msg1 31 | .globl info_msg2 32 | .globl info_msg3 33 | .globl info_msg4 34 | .globl info_msg5 35 | .globl info_msg6 36 | .globl info_msg7 37 | .globl info_msg8 38 | .globl info_msg9 39 | .globl info_msg10 40 | .globl fpu_enabled 41 | 42 | timer_banner: 43 | .asciz "Enabling virtual timer...\n" 44 | cntfrq_msg: 45 | .asciz "System counter frequency: %ld hz\n" 46 | timervalue_msg: 47 | .asciz "Tick timervalue: %ld\n" 48 | interrupts_enabled: 49 | .asciz "Interrupts enabled, disabling\n" 50 | interrupts_disabled: 51 | .asciz "Interrupts already disabled\n" 52 | jumpmsg: 53 | .asciz "Restored context, resuming task\n" 54 | stack_start: 55 | .asciz "--- STACK ---\n" 56 | stack_entry: 57 | .asciz " 0x%.8x: 0x%.8x\n" 58 | info_msg1: 59 | .asciz "Abort! vector %d\n" 60 | info_msg2: 61 | .asciz " r0 = 0x%.8x r1 = 0x%.8x r2 = 0x%.8x\n" 62 | info_msg3: 63 | .asciz " r3 = 0x%.8x r4 = 0x%.8x r5 = 0x%.8x\n" 64 | info_msg4: 65 | .asciz " r6 = 0x%.8x r7 = 0x%.8x r8 = 0x%.8x\n" 66 | info_msg5: 67 | .asciz " r9 = 0x%.8x r10 = 0x%.8x r11 = 0x%.8x\n" 68 | info_msg6: 69 | .asciz " r12 = 0x%.8x lr = 0x%.8x cpsr = 0x%.8x\n" 70 | info_msg7: 71 | .asciz "spsr = 0x%.8x\n" 72 | info_msg8: 73 | .asciz "ifsr = 0x%.8x\n" 74 | info_msg9: 75 | .asciz "dfsr = 0x%.8x\n" 76 | info_msg10: 77 | .asciz "dfar = 0x%.8x\n" 78 | fpu_enabled: 79 | .asciz "FPU enabled\n" 80 | -------------------------------------------------------------------------------- /Source/portable/GCC/ARM7_CA15_Xen/asm/timer.s: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright (C) 2014-2015 Galois, Inc. 4 | * 5 | * This program is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License** as published by the Free 7 | * Software Foundation; either version 2 of the License, or (at your option) 8 | * any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but WITHOUT 11 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 12 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 13 | * more details. 14 | 15 | * You should have received a copy of the GNU General Public License along with 16 | * this program; if not, write to the Free Software Foundation, Inc., 59 Temple 17 | * Place, Suite 330, Boston, MA 02111-1307 USA 18 | * 19 | */ 20 | 21 | #include "print.s" 22 | #include "FreeRTOSConfig.h" 23 | 24 | .section ".start" 25 | .globl schedule_timer 26 | .globl setup_timer 27 | .globl system_timer_frequency 28 | 29 | # Set up the ARM generic timer initially. Call this once, at boot time, after 30 | # interrupts have been configured and enabled and after the stack has been 31 | # configured. This schedules an initial timer interrupt; once the interrupt is 32 | # handled, further timer interrupts will be scheduled. 33 | setup_timer: 34 | push {r0, r1, r2, lr} 35 | 36 | print timer_banner 37 | 38 | @ Read the system clock frequency 39 | mrc p15, 0, r1, c14, c0, 0 40 | 41 | push {r1} 42 | 43 | @ r1 must hold the clock frequency 44 | print cntfrq_msg 45 | 46 | pop {r1} 47 | 48 | ldr r0, =system_timer_frequency 49 | str r1, [r0] 50 | 51 | mov r2, #configTICK_RATE_HZ_ASM 52 | udiv r1, r1, r2 53 | 54 | ldr r0, =tick_timervalue 55 | str r1, [r0] 56 | 57 | print timervalue_msg 58 | 59 | bl schedule_timer 60 | 61 | pop {r0, r1, r2, lr} 62 | bx lr 63 | 64 | # Schedule a timer interrupt. Call this in an interrupt handler to further 65 | # schedule timer interrupts; requires the stack to be configured. For more 66 | # information on the registers used, please see the ARM Architecture Reference 67 | # Manual (ARM 7-A/7-R edition), Chapter B8. 68 | schedule_timer: 69 | push {r0, lr} 70 | 71 | @ Set TimerValue (CNTV_TVAL) 72 | ldr r0, =tick_timervalue 73 | ldr r0, [r0] 74 | mcr p15, 0, r0, c14, c3, 0 75 | 76 | isb 77 | 78 | @ Write CNTV_CTL control register 79 | mov r0, #0x1 80 | mcr p15, 0, r0, c14, c3, 1 81 | isb 82 | 83 | pop {r0, lr} 84 | bx lr 85 | 86 | .section ".data" 87 | .align 2 88 | 89 | system_timer_frequency: 90 | .long 0x0 91 | tick_timervalue: 92 | .long 0x0 93 | -------------------------------------------------------------------------------- /Source/portable/GCC/ARM7_CA15_Xen/asm/tlb.s: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright (C) 2014-2015 Galois, Inc. 4 | * 5 | * This program is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License** as published by the Free 7 | * Software Foundation; either version 2 of the License, or (at your option) 8 | * any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but WITHOUT 11 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 12 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 13 | * more details. 14 | 15 | * You should have received a copy of the GNU General Public License along with 16 | * this program; if not, write to the Free Software Foundation, Inc., 59 Temple 17 | * Place, Suite 330, Boston, MA 02111-1307 USA 18 | * 19 | */ 20 | 21 | .section ".start" 22 | .globl invalidate_tlb 23 | 24 | invalidate_tlb: 25 | push {r0, lr} 26 | 27 | /* Invalidate the TLB(s) */ 28 | mov r0, #0 29 | mcr p15, 0, r0, c8, c7, 0 /* invalidate unified TLB */ 30 | mcr p15, 0, r0, c8, c6, 0 /* invalidate data TLB */ 31 | mcr p15, 0, r0, c8, c5, 0 /* invalidated instruction TLB */ 32 | 33 | /* U-Boot does two operations on what the Cortex-A9 manual says are 34 | deprecated registers. I've left them in for now, but we might 35 | consider taking them out. -ACW */ 36 | mcr p15, 0, r0, c7, c10, 4 /* "data syncronization barrier" */ 37 | mcr p15, 0, r0, c7, c5, 4 /* "instruction syncronization barrier" */ 38 | 39 | pop {r0, lr} 40 | bx lr 41 | -------------------------------------------------------------------------------- /Source/portable/GCC/ARM7_CA15_Xen/asm/vectors.s: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright (C) 2014-2015 Galois, Inc. 4 | * 5 | * This program is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License** as published by the Free 7 | * Software Foundation; either version 2 of the License, or (at your option) 8 | * any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but WITHOUT 11 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 12 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 13 | * more details. 14 | 15 | * You should have received a copy of the GNU General Public License along with 16 | * this program; if not, write to the Free Software Foundation, Inc., 59 Temple 17 | * Place, Suite 330, Boston, MA 02111-1307 USA 18 | * 19 | */ 20 | 21 | #include "print.s" 22 | #include "dumpregs.s" 23 | 24 | .section ".start" 25 | .globl exception_vector_table 26 | .globl FreeRTOS_SWI_Handler 27 | .globl info_msg2 28 | .globl info_msg3 29 | .globl info_msg4 30 | .globl info_msg5 31 | .globl info_msg6 32 | 33 | @ 5 low-order zero bits, i.e., 32-byte aligned 34 | .align 5 35 | exception_vector_table: 36 | b unused 37 | b undef 38 | b swi_handler 39 | b pabt 40 | b dabt 41 | b unused2 42 | b irq_handler 43 | b firq_handler 44 | 45 | unused: 46 | push {r1} 47 | mov r1, #0 48 | b 1f 49 | undef: 50 | push {r1} 51 | mov r1, #1 52 | b 1f 53 | svc: 54 | push {r1} 55 | mov r1, #2 56 | b 1f 57 | pabt: 58 | push {r1} 59 | mov r1, #3 60 | b 1f 61 | dabt: 62 | push {r1} 63 | mov r1, #4 64 | b 1f 65 | unused2: 66 | push {r1} 67 | mov r1, #5 68 | b 1f 69 | firq_handler: 70 | push {r1} 71 | mov r1, #7 72 | b 1f 73 | 1: 74 | push {r0, lr} 75 | ldr r0, =info_msg1 76 | bl __printk 77 | pop {r0, lr} 78 | pop {r1} 79 | _dumpregs 80 | b . 81 | -------------------------------------------------------------------------------- /Source/portable/GCC/ARM7_CA15_Xen/include/configcheck.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright (C) 2014-2015 Galois, Inc. 4 | * 5 | * This program is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License** as published by the Free 7 | * Software Foundation; either version 2 of the License, or (at your option) 8 | * any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but WITHOUT 11 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 12 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 13 | * more details. 14 | 15 | * You should have received a copy of the GNU General Public License along with 16 | * this program; if not, write to the Free Software Foundation, Inc., 59 Temple 17 | * Place, Suite 330, Boston, MA 02111-1307 USA 18 | * 19 | */ 20 | 21 | #ifndef configUNIQUE_INTERRUPT_PRIORITIES 22 | #error configUNIQUE_INTERRUPT_PRIORITIES must be defined. See http://www.freertos.org/Using-FreeRTOS-on-Cortex-A-Embedded-Processors.html 23 | #endif 24 | 25 | #ifndef configSETUP_TICK_INTERRUPT 26 | #error configSETUP_TICK_INTERRUPT() must be defined. See http://www.freertos.org/Using-FreeRTOS-on-Cortex-A-Embedded-Processors.html 27 | #endif /* configSETUP_TICK_INTERRUPT */ 28 | 29 | #ifndef configMAX_API_CALL_INTERRUPT_PRIORITY 30 | #error configMAX_API_CALL_INTERRUPT_PRIORITY must be defined. See http://www.freertos.org/Using-FreeRTOS-on-Cortex-A-Embedded-Processors.html 31 | #endif 32 | 33 | #if configMAX_API_CALL_INTERRUPT_PRIORITY == 0 34 | #error configMAX_API_CALL_INTERRUPT_PRIORITY must not be set to 0 35 | #endif 36 | 37 | #if configMAX_API_CALL_INTERRUPT_PRIORITY > configUNIQUE_INTERRUPT_PRIORITIES 38 | // #error configMAX_API_CALL_INTERRUPT_PRIORITY must be less than or equal to configUNIQUE_INTERRUPT_PRIORITIES as the lower the numeric priority value the higher the logical interrupt priority 39 | #endif 40 | 41 | #if configUSE_PORT_OPTIMISED_TASK_SELECTION == 1 42 | /* Check the configuration. */ 43 | #if( configMAX_PRIORITIES > 32 ) 44 | #error configUSE_PORT_OPTIMISED_TASK_SELECTION can only be set to 1 when configMAX_PRIORITIES is less than or equal to 32. It is very rare that a system requires more than 10 to 15 difference priorities as tasks that share a priority will time slice. 45 | #endif 46 | #endif /* configUSE_PORT_OPTIMISED_TASK_SELECTION */ 47 | 48 | /* In case security extensions are implemented. */ 49 | #if configMAX_API_CALL_INTERRUPT_PRIORITY <= ( configUNIQUE_INTERRUPT_PRIORITIES / 2 ) 50 | #error configMAX_API_CALL_INTERRUPT_PRIORITY must be greater than ( configUNIQUE_INTERRUPT_PRIORITIES / 2 ) 51 | #endif 52 | -------------------------------------------------------------------------------- /Source/portable/GCC/ARM7_CA15_Xen/include/port/gic.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright (C) 2014-2015 Galois, Inc. 4 | * 5 | * This program is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License** as published by the Free 7 | * Software Foundation; either version 2 of the License, or (at your option) 8 | * any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but WITHOUT 11 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 12 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 13 | * more details. 14 | 15 | * You should have received a copy of the GNU General Public License along with 16 | * this program; if not, write to the Free Software Foundation, Inc., 59 Temple 17 | * Place, Suite 330, Boston, MA 02111-1307 USA 18 | * 19 | */ 20 | 21 | #ifndef GIC_H 22 | #define GIC_H 23 | 24 | #ifndef __ASSEMBLER__ 25 | #include 26 | 27 | extern uint32_t ulPriorityShift; 28 | extern uint32_t ulGICUniqueIntPriorities; 29 | 30 | void handle_event(); 31 | void gic_enable_event_irq(void); 32 | void gic_enable_vtimer_irq(void); 33 | int gic_register_handler(uint32_t irq, void (*)(uint32_t)); 34 | 35 | struct gic_info { 36 | volatile char *gicd_base; 37 | volatile char *gicc_base; 38 | }; 39 | 40 | extern struct gic_info gic; 41 | 42 | void gic_cpu_set_priority_mask(char priority); 43 | void gic_enable_interrupt(unsigned char irq_number, unsigned char cpu_set, 44 | unsigned char level_sensitive, unsigned char ppi); 45 | void gic_set_priority(unsigned char irq_number, unsigned char priority); 46 | #endif 47 | 48 | // Distributor Interface 49 | #define GICD_CTLR 0x0 50 | #define GICD_ISR 0x80 51 | #define GICD_ISENABLER 0x100 52 | #define GICD_PRIORITY 0x400 53 | #define GICD_ITARGETSR 0x800 54 | #define GICD_ICFGR 0xC00 55 | 56 | // CPU Interface 57 | #define GICC_CTLR 0x0 58 | #define GICC_PMR 0x4 59 | #define GICC_BPR 0x8 60 | #define GICC_IAR 0xc 61 | #define GICC_EOIR 0x10 62 | #define GICC_RPR 0x14 63 | #define GICC_HPIR 0x18 64 | 65 | // From the GIC Architecture Specification 1.0, page 3-9 66 | #define SPURIOUS_IRQ 1023 67 | 68 | #define VTIMER_TICK 0x6000000 69 | 70 | #define gicd(offset) (gic.gicd_base + (offset)) 71 | #define gicc(offset) (gic.gicc_base + (offset)) 72 | 73 | #define REG(addr) ((uint32_t *)(addr)) 74 | 75 | #define mb() __asm__("dmb"); 76 | #define rmb() __asm__("dmb"); 77 | #define wmb() __asm__("dmb"); 78 | 79 | #endif 80 | -------------------------------------------------------------------------------- /Source/portable/GCC/ARM7_CA15_Xen/include/port/interrupts.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright (C) 2014-2015 Galois, Inc. 4 | * 5 | * This program is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License** as published by the Free 7 | * Software Foundation; either version 2 of the License, or (at your option) 8 | * any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but WITHOUT 11 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 12 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 13 | * more details. 14 | 15 | * You should have received a copy of the GNU General Public License along with 16 | * this program; if not, write to the Free Software Foundation, Inc., 59 Temple 17 | * Place, Suite 330, Boston, MA 02111-1307 USA 18 | * 19 | */ 20 | 21 | // From http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0438c/BABIGHII.html 22 | #define VIRTUAL_TIMER_IRQ 27 23 | -------------------------------------------------------------------------------- /Source/portable/GCC/ARM7_CA15_Xen/tick.c: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright (C) 2014-2015 Galois, Inc. 4 | * 5 | * This program is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License** as published by the Free 7 | * Software Foundation; either version 2 of the License, or (at your option) 8 | * any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but WITHOUT 11 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 12 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 13 | * more details. 14 | 15 | * You should have received a copy of the GNU General Public License along with 16 | * this program; if not, write to the Free Software Foundation, Inc., 59 Temple 17 | * Place, Suite 330, Boston, MA 02111-1307 USA 18 | * 19 | */ 20 | 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | 27 | /* 28 | * The application must provide a function that configures a peripheral to 29 | * create the FreeRTOS tick interrupt, then define configSETUP_TICK_INTERRUPT() 30 | * in FreeRTOSConfig.h to call the function. 31 | */ 32 | void handle_timer_interrupt(uint32_t unused) 33 | { 34 | schedule_timer(); 35 | FreeRTOS_Tick_Handler(); 36 | } 37 | 38 | void vConfigureTickInterrupt( void ) 39 | { 40 | setup_timer(); 41 | gic_register_handler(VIRTUAL_TIMER_IRQ, handle_timer_interrupt); 42 | 43 | gic_enable_interrupt(VIRTUAL_TIMER_IRQ /* interrupt number */, 44 | 0x1 /*cpu_set*/, 1 /*level_sensitive*/, 1 /* ppi */); 45 | gic_set_priority(VIRTUAL_TIMER_IRQ, configTICK_PRIORITY << portPRIORITY_SHIFT); 46 | printk("Timer event IRQ enabled at priority %d\n", configTICK_PRIORITY); 47 | } 48 | -------------------------------------------------------------------------------- /Source/readme.txt: -------------------------------------------------------------------------------- 1 | Each real time kernel port consists of three files that contain the core kernel 2 | components and are common to every port, and one or more files that are 3 | specific to a particular microcontroller and or compiler. 4 | 5 | + The FreeRTOS/Source directory contains the three files that are common to 6 | every port - list.c, queue.c and tasks.c. The kernel is contained within these 7 | three files. croutine.c implements the optional co-routine functionality - which 8 | is normally only used on very memory limited systems. 9 | 10 | + The FreeRTOS/Source/Portable directory contains the files that are specific to 11 | a particular microcontroller and or compiler. 12 | 13 | + The FreeRTOS/Source/include directory contains the real time kernel header 14 | files. 15 | 16 | See the readme file in the FreeRTOS/Source/Portable directory for more 17 | information. -------------------------------------------------------------------------------- /setup.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e 4 | 5 | HERE=$(cd `dirname $0`; pwd) 6 | 7 | DTC_REPO=git://git.kernel.org/pub/scm/utils/dtc/dtc.git 8 | 9 | function fetch_dtc_repo { 10 | if [ -d "$HERE/dtc" ] 11 | then 12 | return 0 13 | fi 14 | 15 | cd $HERE 16 | git clone $DTC_REPO 17 | } 18 | 19 | fetch_dtc_repo 20 | --------------------------------------------------------------------------------