Changeset 04803bf in mainline for uspace/lib/c/arch
- Timestamp:
- 2011-03-21T22:00:17Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 143932e3
- Parents:
- b50b5af2 (diff), 7308e84 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)links above to see all the changes relative to each parent. - Location:
- uspace/lib/c/arch
- Files:
-
- 59 added
- 145 moved
-
abs32le/Makefile.common (moved) (moved from kernel/arch/ia32/src/debug/panic.s ) (2 diffs)
-
abs32le/Makefile.inc (added)
-
abs32le/_link.ld.in (moved) (moved from uspace/lib/libc/arch/arm32/_link.ld.in ) (3 diffs)
-
abs32le/include/atomic.h (added)
-
abs32le/include/config.h (added)
-
abs32le/include/ddi.h (added)
-
abs32le/include/entry.h (added)
-
abs32le/include/faddr.h (moved) (moved from boot/generic/gentypes.h ) (3 diffs)
-
abs32le/include/fibril.h (added)
-
abs32le/include/inttypes.h (added)
-
abs32le/include/istate.h (added)
-
abs32le/include/syscall.h (added)
-
abs32le/include/thread.h (added)
-
abs32le/include/tls.h (added)
-
abs32le/include/types.h (moved) (moved from boot/arch/arm32/loader/types.h ) (2 diffs)
-
abs32le/src/entry.c (moved) (moved from kernel/arch/arm32/include/debug.h ) (2 diffs)
-
abs32le/src/fibril.c (added)
-
abs32le/src/stacktrace.c (added)
-
abs32le/src/syscall.c (added)
-
abs32le/src/thread_entry.c (added)
-
abs32le/src/tls.c (added)
-
amd64/Makefile.common (added)
-
amd64/Makefile.inc (moved) (moved from uspace/lib/libc/arch/ia32/Makefile.inc ) (1 diff)
-
amd64/_link.ld.in (added)
-
amd64/include/atomic.h (moved) (moved from uspace/lib/libc/arch/amd64/include/atomic.h ) (2 diffs)
-
amd64/include/config.h (moved) (moved from uspace/lib/libc/arch/amd64/include/config.h )
-
amd64/include/ddi.h (moved) (moved from uspace/lib/libc/arch/amd64/include/ddi.h )
-
amd64/include/faddr.h (moved) (moved from uspace/lib/libc/arch/amd64/include/faddr.h )
-
amd64/include/fibril.h (moved) (moved from uspace/lib/libc/arch/amd64/include/fibril.h ) (1 diff)
-
amd64/include/inttypes.h (added)
-
amd64/include/istate.h (added)
-
amd64/include/limits.h (moved) (moved from uspace/lib/libc/arch/amd64/include/limits.h )
-
amd64/include/stackarg.h (moved) (moved from uspace/lib/libc/arch/amd64/include/stackarg.h )
-
amd64/include/syscall.h (moved) (moved from uspace/lib/libc/arch/amd64/include/syscall.h )
-
amd64/include/thread.h (moved) (moved from uspace/lib/libc/arch/amd64/include/thread.h )
-
amd64/include/tls.h (moved) (moved from uspace/lib/libc/arch/amd64/include/tls.h )
-
amd64/include/types.h (moved) (moved from uspace/lib/libc/arch/amd64/include/types.h ) (2 diffs)
-
amd64/src/entry.s (moved) (moved from uspace/lib/libc/arch/amd64/src/entry.s ) (1 diff)
-
amd64/src/fibril.S (moved) (moved from uspace/lib/libc/arch/amd64/src/fibril.S ) (2 diffs)
-
amd64/src/stacktrace.c (added)
-
amd64/src/stacktrace_asm.S (added)
-
amd64/src/syscall.S (moved) (moved from uspace/lib/libc/arch/amd64/src/syscall.S )
-
amd64/src/thread_entry.s (moved) (moved from uspace/lib/libc/arch/amd64/src/thread_entry.s ) (1 diff)
-
amd64/src/tls.c (moved) (moved from uspace/lib/libc/arch/amd64/src/tls.c )
-
arm32/Makefile.common (added)
-
arm32/Makefile.inc (moved) (moved from uspace/lib/libc/arch/arm32/Makefile.inc ) (1 diff)
-
arm32/_link.ld.in (moved) (moved from uspace/lib/libc/arch/amd64/_link.ld.in ) (3 diffs)
-
arm32/include/atomic.h (moved) (moved from uspace/lib/libc/arch/arm32/include/atomic.h ) (9 diffs)
-
arm32/include/config.h (moved) (moved from uspace/lib/libc/arch/arm32/include/config.h )
-
arm32/include/ddi.h (moved) (moved from uspace/lib/libc/arch/arm32/include/ddi.h )
-
arm32/include/faddr.h (moved) (moved from uspace/lib/libc/arch/arm32/include/faddr.h )
-
arm32/include/fibril.h (moved) (moved from uspace/lib/libc/arch/arm32/include/fibril.h ) (2 diffs)
-
arm32/include/inttypes.h (added)
-
arm32/include/istate.h (added)
-
arm32/include/limits.h (moved) (moved from uspace/lib/libc/arch/arm32/include/limits.h )
-
arm32/include/stackarg.h (moved) (moved from uspace/lib/libc/arch/arm32/include/stackarg.h )
-
arm32/include/syscall.h (moved) (moved from uspace/lib/libc/arch/arm32/include/syscall.h )
-
arm32/include/thread.h (moved) (moved from uspace/lib/libc/arch/arm32/include/thread.h )
-
arm32/include/tls.h (moved) (moved from uspace/lib/libc/arch/arm32/include/tls.h )
-
arm32/include/types.h (moved) (moved from uspace/lib/libc/arch/arm32/include/types.h ) (3 diffs)
-
arm32/src/eabi.S (moved) (moved from uspace/lib/libc/arch/arm32/src/eabi.S )
-
arm32/src/entry.s (moved) (moved from uspace/lib/libc/arch/arm32/src/entry.s ) (1 diff)
-
arm32/src/fibril.S (moved) (moved from uspace/lib/libc/arch/arm32/src/fibril.S )
-
arm32/src/stacktrace.c (added)
-
arm32/src/stacktrace_asm.S (added)
-
arm32/src/syscall.c (moved) (moved from uspace/lib/libc/arch/arm32/src/syscall.c ) (2 diffs)
-
arm32/src/thread_entry.s (moved) (moved from uspace/lib/libc/arch/arm32/src/thread_entry.s ) (1 diff)
-
arm32/src/tls.c (moved) (moved from uspace/lib/libc/arch/arm32/src/tls.c )
-
ia32/Makefile.common (added)
-
ia32/Makefile.inc (moved) (moved from uspace/lib/libc/arch/ia64/Makefile.inc ) (1 diff)
-
ia32/_link.ld.in (added)
-
ia32/include/atomic.h (moved) (moved from uspace/lib/libc/arch/ia32/include/atomic.h ) (2 diffs)
-
ia32/include/config.h (moved) (moved from uspace/lib/libc/arch/ia32/include/config.h )
-
ia32/include/ddi.h (moved) (moved from uspace/lib/libc/arch/ia32/include/ddi.h )
-
ia32/include/faddr.h (moved) (moved from uspace/lib/libc/arch/ia32/include/faddr.h )
-
ia32/include/fibril.h (moved) (moved from uspace/lib/libc/arch/ia32/include/fibril.h ) (2 diffs)
-
ia32/include/inttypes.h (added)
-
ia32/include/istate.h (added)
-
ia32/include/limits.h (moved) (moved from uspace/lib/libc/arch/ia32/include/limits.h )
-
ia32/include/stackarg.h (moved) (moved from uspace/lib/libc/arch/ia32/include/stackarg.h )
-
ia32/include/syscall.h (moved) (moved from uspace/lib/libc/arch/ia32/include/syscall.h ) (1 diff)
-
ia32/include/thread.h (moved) (moved from uspace/lib/libc/arch/ia32/include/thread.h )
-
ia32/include/tls.h (moved) (moved from uspace/lib/libc/arch/ia32/include/tls.h ) (1 diff)
-
ia32/include/types.h (moved) (moved from uspace/lib/libc/arch/ia32/include/types.h ) (2 diffs)
-
ia32/src/entry.s (moved) (moved from uspace/lib/libc/arch/ia32/src/entry.s ) (3 diffs)
-
ia32/src/fibril.S (moved) (moved from uspace/lib/libc/arch/ia32/src/fibril.S )
-
ia32/src/setjmp.S (moved) (moved from uspace/lib/libc/arch/ia32/src/setjmp.S )
-
ia32/src/stacktrace.c (added)
-
ia32/src/stacktrace_asm.S (added)
-
ia32/src/syscall.S (moved) (moved from uspace/lib/libc/arch/ia32/src/syscall.S ) (4 diffs)
-
ia32/src/thread_entry.s (moved) (moved from uspace/lib/libc/arch/ia32/src/thread_entry.s ) (1 diff)
-
ia32/src/tls.c (moved) (moved from uspace/lib/libc/arch/ia32/src/tls.c )
-
ia64/Makefile.common (added)
-
ia64/Makefile.inc (added)
-
ia64/_link.ld.in (moved) (moved from uspace/lib/libc/arch/ia64/_link.ld.in ) (5 diffs)
-
ia64/include/atomic.h (added)
-
ia64/include/config.h (moved) (moved from uspace/lib/libc/arch/ia64/include/config.h )
-
ia64/include/ddi.h (moved) (moved from uspace/lib/libc/arch/ia64/include/ddi.h ) (1 diff)
-
ia64/include/faddr.h (moved) (moved from uspace/lib/libc/arch/ia64/include/faddr.h ) (2 diffs)
-
ia64/include/fibril.h (moved) (moved from uspace/lib/libc/arch/ia64/include/fibril.h ) (2 diffs)
-
ia64/include/inttypes.h (added)
-
ia64/include/istate.h (added)
-
ia64/include/limits.h (moved) (moved from uspace/lib/libc/arch/ia64/include/limits.h )
-
ia64/include/stack.h (moved) (moved from uspace/lib/libc/arch/ia64/include/stack.h )
-
ia64/include/stackarg.h (moved) (moved from uspace/lib/libc/arch/ia64/include/stackarg.h )
-
ia64/include/syscall.h (moved) (moved from uspace/lib/libc/arch/ia64/include/syscall.h )
-
ia64/include/thread.h (moved) (moved from uspace/lib/libc/arch/ia64/include/thread.h )
-
ia64/include/tls.h (moved) (moved from uspace/lib/libc/arch/ia64/include/tls.h )
-
ia64/include/types.h (moved) (moved from uspace/lib/libc/arch/ia64/include/types.h ) (3 diffs)
-
ia64/src/ddi.c (added)
-
ia64/src/entry.s (moved) (moved from uspace/lib/libc/arch/ia64/src/entry.s ) (1 diff)
-
ia64/src/fibril.S (moved) (moved from uspace/lib/libc/arch/ia64/src/fibril.S )
-
ia64/src/stacktrace.c (added)
-
ia64/src/stacktrace_asm.S (added)
-
ia64/src/syscall.S (moved) (moved from uspace/lib/libc/arch/ia64/src/syscall.S )
-
ia64/src/thread_entry.s (moved) (moved from uspace/lib/libc/arch/ia64/src/thread_entry.s ) (1 diff)
-
ia64/src/tls.c (moved) (moved from uspace/lib/libc/arch/ia64/src/tls.c )
-
mips32/Makefile.common (added)
-
mips32/Makefile.inc (moved) (moved from uspace/lib/libc/arch/amd64/Makefile.inc ) (1 diff)
-
mips32/_link.ld.in (moved) (moved from uspace/lib/libc/arch/mips32/_link.ld.in ) (2 diffs)
-
mips32/include/atomic.h (moved) (moved from uspace/lib/libc/arch/mips32/include/atomic.h ) (3 diffs)
-
mips32/include/config.h (moved) (moved from uspace/lib/libc/arch/mips32/include/config.h )
-
mips32/include/ddi.h (moved) (moved from uspace/lib/libc/arch/mips32/include/ddi.h )
-
mips32/include/faddr.h (moved) (moved from uspace/lib/libc/arch/mips32/include/faddr.h )
-
mips32/include/fibril.h (moved) (moved from uspace/lib/libc/arch/mips32/include/fibril.h ) (1 diff)
-
mips32/include/inttypes.h (added)
-
mips32/include/istate.h (added)
-
mips32/include/limits.h (moved) (moved from uspace/lib/libc/arch/mips32/include/limits.h )
-
mips32/include/stackarg.h (moved) (moved from uspace/lib/libc/arch/mips32/include/stackarg.h )
-
mips32/include/syscall.h (moved) (moved from uspace/lib/libc/arch/mips32/include/syscall.h )
-
mips32/include/thread.h (moved) (moved from uspace/lib/libc/arch/mips32/include/thread.h )
-
mips32/include/tls.h (moved) (moved from uspace/lib/libc/arch/mips32/include/tls.h )
-
mips32/include/types.h (moved) (moved from uspace/lib/libc/arch/mips32/include/types.h ) (3 diffs)
-
mips32/src/entry.s (moved) (moved from uspace/lib/libc/arch/mips32/src/entry.s ) (2 diffs)
-
mips32/src/fibril.S (moved) (moved from uspace/lib/libc/arch/mips32/src/fibril.S )
-
mips32/src/stacktrace.c (added)
-
mips32/src/stacktrace_asm.S (added)
-
mips32/src/syscall.c (moved) (moved from uspace/lib/libc/arch/mips32/src/syscall.c )
-
mips32/src/thread_entry.s (moved) (moved from uspace/lib/libc/arch/mips32/src/thread_entry.s )
-
mips32/src/tls.c (moved) (moved from uspace/lib/libc/arch/mips32/src/tls.c )
-
mips32eb/Makefile.common (added)
-
mips32eb/Makefile.inc (moved) (moved from uspace/lib/libc/arch/mips32/Makefile.inc ) (1 diff)
-
mips32eb/_link.ld.in (moved) (moved from uspace/lib/libc/arch/mips32eb/_link.ld.in )
-
mips32eb/include/atomic.h (moved) (moved from uspace/lib/libc/arch/mips32eb/include/atomic.h )
-
mips32eb/include/config.h (moved) (moved from uspace/lib/libc/arch/mips32eb/include/config.h )
-
mips32eb/include/ddi.h (moved) (moved from uspace/lib/libc/arch/mips32eb/include/ddi.h )
-
mips32eb/include/faddr.h (moved) (moved from uspace/lib/libc/arch/mips32eb/include/faddr.h )
-
mips32eb/include/fibril.h (moved) (moved from uspace/lib/libc/arch/mips32eb/include/fibril.h )
-
mips32eb/include/inttypes.h (added)
-
mips32eb/include/istate.h (added)
-
mips32eb/include/limits.h (moved) (moved from uspace/lib/libc/arch/mips32eb/include/limits.h )
-
mips32eb/include/stackarg.h (moved) (moved from uspace/lib/libc/arch/mips32eb/include/stackarg.h )
-
mips32eb/include/syscall.h (moved) (moved from uspace/lib/libc/arch/mips32eb/include/syscall.h )
-
mips32eb/include/thread.h (moved) (moved from uspace/lib/libc/arch/mips32eb/include/thread.h )
-
mips32eb/include/tls.h (moved) (moved from uspace/lib/libc/arch/mips32eb/include/tls.h )
-
mips32eb/include/types.h (moved) (moved from uspace/lib/libc/arch/mips32eb/include/types.h )
-
mips32eb/src (moved) (moved from uspace/lib/libc/arch/mips32eb/src )
-
ppc32/Makefile.common (moved) (moved from boot/arch/ppc32/loader/boot.S ) (1 diff)
-
ppc32/Makefile.inc (added)
-
ppc32/_link.ld.in (moved) (moved from uspace/lib/libc/arch/ppc32/_link.ld.in ) (4 diffs)
-
ppc32/include/atomic.h (moved) (moved from uspace/lib/libc/arch/ppc32/include/atomic.h ) (6 diffs)
-
ppc32/include/config.h (moved) (moved from uspace/lib/libc/arch/ppc32/include/config.h )
-
ppc32/include/ddi.h (moved) (moved from uspace/lib/libc/arch/ppc32/include/ddi.h )
-
ppc32/include/faddr.h (moved) (moved from uspace/lib/libc/arch/ppc32/include/faddr.h )
-
ppc32/include/fibril.h (moved) (moved from uspace/lib/libc/arch/ppc32/include/fibril.h ) (1 diff)
-
ppc32/include/inttypes.h (added)
-
ppc32/include/istate.h (added)
-
ppc32/include/limits.h (moved) (moved from uspace/lib/libc/arch/ppc32/include/limits.h )
-
ppc32/include/regname.h (moved) (moved from uspace/lib/libc/arch/ppc32/include/regname.h )
-
ppc32/include/stackarg.h (moved) (moved from uspace/lib/libc/arch/ppc32/include/stackarg.h )
-
ppc32/include/syscall.h (moved) (moved from uspace/lib/libc/arch/ppc32/include/syscall.h )
-
ppc32/include/thread.h (moved) (moved from uspace/lib/libc/arch/ppc32/include/thread.h )
-
ppc32/include/tls.h (moved) (moved from uspace/lib/libc/arch/ppc32/include/tls.h )
-
ppc32/include/types.h (moved) (moved from uspace/lib/libc/arch/ppc32/include/types.h ) (3 diffs)
-
ppc32/src/entry.s (moved) (moved from uspace/lib/libc/arch/ppc32/src/entry.s ) (1 diff)
-
ppc32/src/fibril.S (moved) (moved from uspace/lib/libc/arch/ppc32/src/fibril.S )
-
ppc32/src/stacktrace.c (added)
-
ppc32/src/stacktrace_asm.S (added)
-
ppc32/src/syscall.c (moved) (moved from uspace/lib/libc/arch/ppc32/src/syscall.c )
-
ppc32/src/thread_entry.s (moved) (moved from uspace/lib/libc/arch/ppc32/src/thread_entry.s ) (1 diff)
-
ppc32/src/tls.c (moved) (moved from uspace/lib/libc/arch/ppc32/src/tls.c )
-
sparc64/Makefile.common (moved) (moved from uspace/lib/libc/arch/sparc64/Makefile.inc ) (2 diffs)
-
sparc64/Makefile.inc (added)
-
sparc64/_link.ld.in (moved) (moved from uspace/lib/libc/arch/sparc64/_link.ld.in ) (4 diffs)
-
sparc64/include/atomic.h (moved) (moved from uspace/lib/libc/arch/sparc64/include/atomic.h ) (2 diffs)
-
sparc64/include/config.h (moved) (moved from uspace/lib/libc/arch/sparc64/include/config.h ) (1 diff)
-
sparc64/include/ddi.h (moved) (moved from uspace/lib/libc/arch/sparc64/include/ddi.h ) (1 diff)
-
sparc64/include/faddr.h (moved) (moved from uspace/lib/libc/arch/sparc64/include/faddr.h )
-
sparc64/include/fibril.h (moved) (moved from uspace/lib/libc/arch/sparc64/include/fibril.h ) (2 diffs)
-
sparc64/include/inttypes.h (added)
-
sparc64/include/istate.h (added)
-
sparc64/include/limits.h (moved) (moved from uspace/lib/libc/arch/sparc64/include/limits.h )
-
sparc64/include/stack.h (moved) (moved from uspace/lib/libc/arch/sparc64/include/stack.h )
-
sparc64/include/stackarg.h (moved) (moved from uspace/lib/libc/arch/sparc64/include/stackarg.h )
-
sparc64/include/syscall.h (moved) (moved from uspace/lib/libc/arch/sparc64/include/syscall.h )
-
sparc64/include/thread.h (moved) (moved from uspace/lib/libc/arch/sparc64/include/thread.h )
-
sparc64/include/tls.h (moved) (moved from uspace/lib/libc/arch/sparc64/include/tls.h )
-
sparc64/include/types.h (moved) (moved from uspace/lib/libc/arch/sparc64/include/types.h ) (3 diffs)
-
sparc64/src/entry.s (moved) (moved from uspace/lib/libc/arch/sparc64/src/entry.s ) (1 diff)
-
sparc64/src/fibril.S (moved) (moved from uspace/lib/libc/arch/sparc64/src/fibril.S ) (2 diffs)
-
sparc64/src/stacktrace.c (added)
-
sparc64/src/stacktrace_asm.S (added)
-
sparc64/src/thread_entry.s (moved) (moved from uspace/lib/libc/arch/sparc64/src/thread_entry.s ) (1 diff)
-
sparc64/src/tls.c (moved) (moved from uspace/lib/libc/arch/sparc64/src/tls.c )
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/arch/abs32le/Makefile.common
rb50b5af2 r04803bf 1 1 # 2 # Copyright (c) 20 01-2004 Jakub Jermar2 # Copyright (c) 2010 Martin Decky 3 3 # All rights reserved. 4 4 # … … 27 27 # 28 28 29 .text 30 .global panic_printf 29 ifeq ($(COMPILER),clang) 30 CLANG_ARCH = i386 31 endif 31 32 32 panic_printf: 33 movl $halt, (%esp) # fake stack to make printf return to halt 34 jmp printf 33 ENDIANESS = LE -
uspace/lib/c/arch/abs32le/_link.ld.in
rb50b5af2 r04803bf 1 STARTUP(LIBC_P REFIX/arch/UARCH/src/entry.o)1 STARTUP(LIBC_PATH/arch/UARCH/src/entry.o) 2 2 ENTRY(__entry) 3 3 … … 9 9 SECTIONS { 10 10 . = 0x1000 + SIZEOF_HEADERS; 11 12 .init : { 13 *(.init); 14 } : text 11 15 12 .text : { 16 13 *(.text); 17 *(.rodata*);14 *(.rodata*); 18 15 } :text 19 16 20 17 . = . + 0x1000; 21 18 22 19 .data : { 23 *(.opd); 24 *(.data .data.*); 25 *(.sdata); 20 *(.data); 21 *(.data.rel*); 26 22 } :data 23 27 24 .tdata : { 28 25 _tdata_start = .; 29 26 *(.tdata); 27 *(.gnu.linkonce.tb.*); 30 28 _tdata_end = .; 31 29 _tbss_start = .; … … 33 31 _tbss_end = .; 34 32 } :data 33 35 34 _tls_alignment = ALIGNOF(.tdata); 35 36 .sbss : { 37 *(.scommon); 38 *(.sbss); 39 } 40 36 41 .bss : { 37 *(.sbss); 38 *(.scommon); 39 *(COMMON); 40 *(.bss); 42 *(COMMON); 43 *(.bss); 41 44 } :data 42 43 . = ALIGN(0x1000);44 _heap = .;45 45 46 46 /DISCARD/ : { 47 47 *(*); 48 48 } 49 50 49 } -
uspace/lib/c/arch/abs32le/include/faddr.h
rb50b5af2 r04803bf 1 1 /* 2 * Copyright (c) 20 06Martin Decky2 * Copyright (c) 2010 Martin Decky 3 3 * All rights reserved. 4 4 * … … 27 27 */ 28 28 29 /** @addtogroup generic29 /** @addtogroup libabs32le 30 30 * @{ 31 31 */ … … 33 33 */ 34 34 35 #ifndef BOOT_GENTYPES_H_36 #define BOOT_GENTYPES_H_35 #ifndef LIBC_abs32le_FADDR_H_ 36 #define LIBC_abs32le_FADDR_H_ 37 37 38 #define NULL 0 39 #define false 0 40 #define true 1 38 #include <libarch/types.h> 41 39 42 typedef unsigned long size_t; 40 #define FADDR(fptr) ((uintptr_t) (fptr)) 43 41 44 42 #endif -
uspace/lib/c/arch/abs32le/include/types.h
rb50b5af2 r04803bf 1 1 /* 2 * Copyright (c) 20 06Martin Decky2 * Copyright (c) 2010 Martin Decky 3 3 * All rights reserved. 4 4 * … … 27 27 */ 28 28 29 30 /** @addtogroup arm32boot 29 /** @addtogroup libcabs32le 31 30 * @{ 32 31 */ 33 /** @file 34 * @brief Definitions of basic types like #uintptr_t. 35 */ 32 /** @file 33 */ 36 34 35 #ifndef LIBC_abs32le_TYPES_H_ 36 #define LIBC_abs32le_TYPES_H_ 37 37 38 #ifndef BOOT_arm32_TYPES_H 39 #define BOOT_arm32_TYPES_H 38 #define __32_BITS__ 40 39 40 #include <libarch/common.h> 41 41 42 #include <gentypes.h> 42 #define SIZE_MIN UINT32_MIN 43 #define SIZE_MAX UINT32_MAX 43 44 44 typedef signed char int8_t; 45 #define SSIZE_MIN INT32_MIN 46 #define SSIZE_MAX INT32_MAX 45 47 46 typedef u nsigned char uint8_t;47 typedef unsigned short uint16_t; 48 typedef unsigned int uint32_t;49 typedef u nsigned long long uint64_t;48 typedef uint32_t sysarg_t; 49 50 typedef int32_t ssize_t; 51 typedef uint32_t size_t; 50 52 51 53 typedef uint32_t uintptr_t; 52 typedef uint32_t unative_t;53 54 typedef uint32_t atomic_count_t; 55 typedef int32_t atomic_signed_t; 54 56 55 57 #endif 56 58 57 58 59 /** @} 59 60 */ -
uspace/lib/c/arch/abs32le/src/entry.c
rb50b5af2 r04803bf 1 1 /* 2 * Copyright (c) 20 05 Jakub Jermar2 * Copyright (c) 2010 Martin Decky 3 3 * All rights reserved. 4 4 * … … 27 27 */ 28 28 29 /** @addtogroup arm32debug30 * @{31 */32 29 /** @file 33 * @brief Empty.34 30 */ 35 31 36 #ifndef KERN_arm32_DEBUG_H_ 37 #define KERN_arm32_DEBUG_H_ 32 #include <unistd.h> 33 #include <libarch/entry.h> 34 #include "../../../generic/private/libc.h" 38 35 39 #endif 36 void __entry(void) 37 { 38 __main(NULL); 39 } 40 40 41 41 /** @} -
uspace/lib/c/arch/amd64/Makefile.inc
rb50b5af2 r04803bf 27 27 # 28 28 29 ## Toolchain configuration 30 # 31 32 TARGET = i686-pc-linux-gnu 33 TOOLCHAIN_DIR = $(CROSS_PREFIX)/i686/bin 34 35 ARCH_SOURCES += arch/$(UARCH)/src/syscall.S \ 29 ARCH_SOURCES = \ 30 arch/$(UARCH)/src/entry.s \ 31 arch/$(UARCH)/src/thread_entry.s \ 32 arch/$(UARCH)/src/syscall.S \ 36 33 arch/$(UARCH)/src/fibril.S \ 37 34 arch/$(UARCH)/src/tls.c \ 38 arch/$(UARCH)/src/setjmp.S 35 arch/$(UARCH)/src/stacktrace.c \ 36 arch/$(UARCH)/src/stacktrace_asm.S 39 37 40 LFLAGS += -N 41 42 ENDIANESS = LE 43 44 BFD_NAME = elf32-i386 45 BFD_ARCH = i386 38 .PRECIOUS: arch/$(UARCH)/src/entry.o -
uspace/lib/c/arch/amd64/include/atomic.h
rb50b5af2 r04803bf 38 38 #define LIBC_amd64_ATOMIC_H_ 39 39 40 static inline void atomic_inc(atomic_t *val) { 41 asm volatile ("lock incq %0\n" : "+m" (val->count)); 40 #define LIBC_ARCH_ATOMIC_H_ 41 42 #include <atomicdflt.h> 43 44 static inline void atomic_inc(atomic_t *val) 45 { 46 asm volatile ( 47 "lock incq %[count]\n" 48 : [count] "+m" (val->count) 49 ); 42 50 } 43 51 44 static inline void atomic_dec(atomic_t *val) { 45 asm volatile ("lock decq %0\n" : "+m" (val->count)); 52 static inline void atomic_dec(atomic_t *val) 53 { 54 asm volatile ( 55 "lock decq %[count]\n" 56 : [count] "+m" (val->count) 57 ); 46 58 } 47 59 48 static inline long atomic_postinc(atomic_t *val)60 static inline atomic_count_t atomic_postinc(atomic_t *val) 49 61 { 50 long r; 51 52 asm volatile ( 53 "movq $1, %0\n" 54 "lock xaddq %0, %1\n" 55 : "=r" (r), "+m" (val->count) 56 ); 57 58 return r; 59 } 60 61 static inline long atomic_postdec(atomic_t *val) 62 { 63 long r; 62 atomic_count_t r = 1; 64 63 65 64 asm volatile ( 66 " movq $-1, %0\n"67 "lock xaddq %0, %1\n"68 : "=r" (r), "+m" (val->count)65 "lock xaddq %[r], %[count]\n" 66 : [count] "+m" (val->count), 67 [r] "+r" (r) 69 68 ); 70 69 … … 72 71 } 73 72 74 #define atomic_preinc(val) (atomic_postinc(val) + 1) 75 #define atomic_predec(val) (atomic_postdec(val) - 1) 73 static inline atomic_count_t atomic_postdec(atomic_t *val) 74 { 75 atomic_count_t r = -1; 76 77 asm volatile ( 78 "lock xaddq %[r], %[count]\n" 79 : [count] "+m" (val->count), 80 [r] "+r" (r) 81 ); 82 83 return r; 84 } 85 86 #define atomic_preinc(val) (atomic_postinc(val) + 1) 87 #define atomic_predec(val) (atomic_postdec(val) - 1) 76 88 77 89 #endif -
uspace/lib/c/arch/amd64/include/fibril.h
rb50b5af2 r04803bf 44 44 #define SP_DELTA 16 45 45 46 #define context_set(c, _pc, stack, size, ptls) \ 47 do { \ 48 (c)->pc = (sysarg_t) (_pc); \ 49 (c)->sp = ((sysarg_t) (stack)) + (size) - SP_DELTA; \ 50 (c)->tls = (sysarg_t) (ptls); \ 51 (c)->rbp = 0; \ 52 } while (0) 53 46 54 /* We include only registers that must be preserved 47 55 * during function call 48 56 */ 49 57 typedef struct { 50 uint64_t sp; 51 uint64_t pc; 52 53 uint64_t rbx; 54 uint64_t rbp; 58 uint64_t sp; 59 uint64_t pc; 55 60 56 uint64_t r12; 57 uint64_t r13; 58 uint64_t r14; 59 uint64_t r15; 61 uint64_t rbx; 62 uint64_t rbp; 60 63 61 uint64_t tls; 64 uint64_t r12; 65 uint64_t r13; 66 uint64_t r14; 67 uint64_t r15; 68 69 uint64_t tls; 62 70 } context_t; 71 72 static inline uintptr_t context_get_fp(context_t *ctx) 73 { 74 return ctx->rbp; 75 } 63 76 64 77 #endif -
uspace/lib/c/arch/amd64/include/types.h
rb50b5af2 r04803bf 36 36 #define LIBC_amd64_TYPES_H_ 37 37 38 typedef unsigned long long sysarg_t; 38 #define __64_BITS__ 39 39 40 typedef signed char int8_t; 41 typedef short int int16_t; 42 typedef int int32_t; 43 typedef long long int int64_t; 40 #include <libarch/common.h> 44 41 45 typedef unsigned char uint8_t; 46 typedef unsigned short int uint16_t; 47 typedef unsigned int uint32_t; 48 typedef unsigned long long int uint64_t; 42 #define SIZE_MIN UINT64_MIN 43 #define SIZE_MAX UINT64_MAX 44 45 #define SSIZE_MIN INT64_MIN 46 #define SSIZE_MAX INT64_MAX 47 48 typedef uint64_t sysarg_t; 49 49 50 50 typedef int64_t ssize_t; … … 52 52 53 53 typedef uint64_t uintptr_t; 54 typedef uint64_t atomic_count_t; 55 typedef int64_t atomic_signed_t; 54 56 55 57 #endif -
uspace/lib/c/arch/amd64/src/entry.s
rb50b5af2 r04803bf 38 38 # 39 39 __entry: 40 # 41 # Create the first stack frame. 42 # 43 pushq $0 44 movq %rsp, %rbp 45 40 46 # %rdi was deliberately chosen as the first argument is also in %rdi 41 47 # Pass PCB pointer to __main (no operation) 42 48 call __main 43 44 call __exit -
uspace/lib/c/arch/amd64/src/fibril.S
rb50b5af2 r04803bf 49 49 movq %rax, OFFSET_TLS(%rdi) 50 50 51 xor q %rax,%rax # context_save returns 152 inc q %rax51 xorl %eax, %eax # context_save returns 1 52 incl %eax 53 53 ret 54 54 … … 67 67 # Set thread local storage 68 68 movq OFFSET_TLS(%rdi), %rdi # Set arg1 to TLS addr 69 mov q $1, %rax # SYS_TLS_SET69 movl $1, %eax # SYS_TLS_SET 70 70 syscall 71 71 72 xor q %rax,%rax # context_restore returns 072 xorl %eax, %eax # context_restore returns 0 73 73 ret -
uspace/lib/c/arch/amd64/src/thread_entry.s
rb50b5af2 r04803bf 36 36 __thread_entry: 37 37 # 38 # Create the first stack frame. 39 # 40 pushq $0 41 movq %rsp, %rbp 42 43 # 38 44 # RAX contains address of uarg 39 45 # -
uspace/lib/c/arch/arm32/Makefile.inc
rb50b5af2 r04803bf 28 28 # 29 29 30 ## Toolchain configuration 31 # 32 33 TARGET = arm-linux-gnu 34 TOOLCHAIN_DIR = $(CROSS_PREFIX)/arm/bin 35 36 ARCH_SOURCES += arch/$(UARCH)/src/syscall.c \ 30 ARCH_SOURCES = \ 31 arch/$(UARCH)/src/entry.s \ 32 arch/$(UARCH)/src/thread_entry.s \ 33 arch/$(UARCH)/src/syscall.c \ 37 34 arch/$(UARCH)/src/fibril.S \ 38 35 arch/$(UARCH)/src/tls.c \ 39 arch/$(UARCH)/src/eabi.S 36 arch/$(UARCH)/src/eabi.S \ 37 arch/$(UARCH)/src/stacktrace.c \ 38 arch/$(UARCH)/src/stacktrace_asm.S 40 39 41 CFLAGS += -ffixed-r9 -mtp=soft 42 LFLAGS += -N $(SOFTINT_PREFIX)/libsoftint.a 43 44 ENDIANESS = LE 45 46 BFD_NAME = elf32-littlearm 47 BFD_ARCH = arm 40 .PRECIOUS: arch/$(UARCH)/src/entry.o -
uspace/lib/c/arch/arm32/_link.ld.in
rb50b5af2 r04803bf 1 STARTUP(LIBC_P REFIX/arch/UARCH/src/entry.o)1 STARTUP(LIBC_PATH/arch/UARCH/src/entry.o) 2 2 ENTRY(__entry) 3 3 … … 13 13 *(.init); 14 14 } :text 15 15 16 .text : { 16 17 *(.text); 17 18 *(.rodata*); 18 19 } :text 19 20 20 21 . = . + 0x1000; 21 22 22 23 .data : { 23 *(.data); 24 *(.opd); 25 *(.data .data.*); 26 *(.sdata); 24 27 } :data 28 25 29 .tdata : { 26 30 _tdata_start = .; … … 31 35 _tbss_end = .; 32 36 } :data 37 33 38 _tls_alignment = ALIGNOF(.tdata); 39 34 40 .bss : { 41 *(.sbss); 42 *(.scommon); 35 43 *(COMMON); 36 44 *(.bss); 37 45 } :data 38 39 . = ALIGN(0x1000);40 _heap = .;41 46 42 47 /DISCARD/ : { 43 48 *(*); 44 49 } 45 46 50 } -
uspace/lib/c/arch/arm32/include/atomic.h
rb50b5af2 r04803bf 27 27 */ 28 28 29 /** @addtogroup libcarm32 29 /** @addtogroup libcarm32 30 30 * @{ 31 31 */ … … 37 37 #define LIBC_arm32_ATOMIC_H_ 38 38 39 #define LIBC_ARCH_ATOMIC_H_ 40 #define CAS 41 42 #include <atomicdflt.h> 43 #include <bool.h> 44 #include <sys/types.h> 45 46 extern uintptr_t *ras_page; 47 48 static inline bool cas(atomic_t *val, atomic_count_t ov, atomic_count_t nv) 49 { 50 atomic_count_t ret = 0; 51 52 /* 53 * The following instructions between labels 1 and 2 constitute a 54 * Restartable Atomic Seqeunce. Should the sequence be non-atomic, 55 * the kernel will restart it. 56 */ 57 asm volatile ( 58 "1:\n" 59 " adr %[ret], 1b\n" 60 " str %[ret], %[rp0]\n" 61 " adr %[ret], 2f\n" 62 " str %[ret], %[rp1]\n" 63 " ldr %[ret], %[addr]\n" 64 " cmp %[ret], %[ov]\n" 65 " streq %[nv], %[addr]\n" 66 "2:\n" 67 " moveq %[ret], #1\n" 68 " movne %[ret], #0\n" 69 : [ret] "+&r" (ret), 70 [rp0] "=m" (ras_page[0]), 71 [rp1] "=m" (ras_page[1]), 72 [addr] "+m" (val->count) 73 : [ov] "r" (ov), 74 [nv] "r" (nv) 75 : "memory" 76 ); 77 78 ras_page[0] = 0; 79 asm volatile ( 80 "" ::: "memory" 81 ); 82 ras_page[1] = 0xffffffff; 83 84 return (bool) ret; 85 } 86 39 87 /** Atomic addition. 40 88 * … … 43 91 * 44 92 * @return Value after addition. 45 */ 46 static inline long atomic_add(atomic_t *val, int i) 47 { 48 int ret; 49 volatile long * mem = &(val->count); 50 51 asm volatile ( 52 "1:\n" 53 "ldr r2, [%1]\n" 54 "add r3, r2, %2\n" 55 "str r3, %0\n" 56 "swp r3, r3, [%1]\n" 57 "cmp r3, r2\n" 58 "bne 1b\n" 59 60 : "=m" (ret) 61 : "r" (mem), "r" (i) 62 : "r3", "r2" 63 ); 64 93 * 94 */ 95 static inline atomic_count_t atomic_add(atomic_t *val, atomic_count_t i) 96 { 97 atomic_count_t ret = 0; 98 99 /* 100 * The following instructions between labels 1 and 2 constitute a 101 * Restartable Atomic Seqeunce. Should the sequence be non-atomic, 102 * the kernel will restart it. 103 */ 104 asm volatile ( 105 "1:\n" 106 " adr %[ret], 1b\n" 107 " str %[ret], %[rp0]\n" 108 " adr %[ret], 2f\n" 109 " str %[ret], %[rp1]\n" 110 " ldr %[ret], %[addr]\n" 111 " add %[ret], %[ret], %[imm]\n" 112 " str %[ret], %[addr]\n" 113 "2:\n" 114 : [ret] "+&r" (ret), 115 [rp0] "=m" (ras_page[0]), 116 [rp1] "=m" (ras_page[1]), 117 [addr] "+m" (val->count) 118 : [imm] "r" (i) 119 ); 120 121 ras_page[0] = 0; 122 asm volatile ( 123 "" ::: "memory" 124 ); 125 ras_page[1] = 0xffffffff; 126 65 127 return ret; 66 128 } … … 70 132 * 71 133 * @param val Variable to be incremented. 134 * 72 135 */ 73 136 static inline void atomic_inc(atomic_t *val) … … 80 143 * 81 144 * @param val Variable to be decremented. 145 * 82 146 */ 83 147 static inline void atomic_dec(atomic_t *val) … … 91 155 * @param val Variable to be incremented. 92 156 * @return Value after incrementation. 93 */ 94 static inline long atomic_preinc(atomic_t *val) 157 * 158 */ 159 static inline atomic_count_t atomic_preinc(atomic_t *val) 95 160 { 96 161 return atomic_add(val, 1); … … 102 167 * @param val Variable to be decremented. 103 168 * @return Value after decrementation. 104 */ 105 static inline long atomic_predec(atomic_t *val) 169 * 170 */ 171 static inline atomic_count_t atomic_predec(atomic_t *val) 106 172 { 107 173 return atomic_add(val, -1); … … 113 179 * @param val Variable to be incremented. 114 180 * @return Value before incrementation. 115 */ 116 static inline long atomic_postinc(atomic_t *val) 181 * 182 */ 183 static inline atomic_count_t atomic_postinc(atomic_t *val) 117 184 { 118 185 return atomic_add(val, 1) - 1; … … 124 191 * @param val Variable to be decremented. 125 192 * @return Value before decrementation. 126 */ 127 static inline long atomic_postdec(atomic_t *val) 193 * 194 */ 195 static inline atomic_count_t atomic_postdec(atomic_t *val) 128 196 { 129 197 return atomic_add(val, -1) + 1; -
uspace/lib/c/arch/arm32/include/fibril.h
rb50b5af2 r04803bf 58 58 * @param ptls Pointer to the TCB. 59 59 */ 60 #define context_set(c, _pc, stack, size, ptls) \ 61 (c)->pc = (sysarg_t) (_pc); \ 62 (c)->sp = ((sysarg_t) (stack)) + (size) - SP_DELTA; \ 63 (c)->tls = ((sysarg_t)(ptls)) + sizeof(tcb_t) + ARM_TP_OFFSET; 64 60 #define context_set(c, _pc, stack, size, ptls) \ 61 do { \ 62 (c)->pc = (sysarg_t) (_pc); \ 63 (c)->sp = ((sysarg_t) (stack)) + (size) - SP_DELTA; \ 64 (c)->tls = ((sysarg_t)(ptls)) + sizeof(tcb_t) + ARM_TP_OFFSET; \ 65 (c)->fp = 0; \ 66 } while (0) 65 67 66 68 /** Fibril context. … … 79 81 uint32_t r7; 80 82 uint32_t r8; 81 uint32_t tls; 83 uint32_t tls; /* r9 */ 82 84 uint32_t r10; 83 uint32_t r11;85 uint32_t fp; /* r11 */ 84 86 } context_t; 87 88 static inline uintptr_t context_get_fp(context_t *ctx) 89 { 90 return ctx->fp; 91 } 85 92 86 93 -
uspace/lib/c/arch/arm32/include/types.h
rb50b5af2 r04803bf 27 27 */ 28 28 29 /** @addtogroup libcarm32 29 /** @addtogroup libcarm32 30 30 * @{ 31 31 */ 32 /** @file 32 /** @file 33 33 * @brief Definitions of basic types like #uintptr_t. 34 34 */ … … 37 37 #define LIBC_arm32_TYPES_H_ 38 38 39 typedef unsigned int sysarg_t; 39 #define __32_BITS__ 40 40 41 typedef char int8_t; 42 typedef short int int16_t; 43 typedef long int int32_t; 44 typedef long long int int64_t; 41 #include <libarch/common.h> 45 42 46 typedef unsigned char uint8_t; 47 typedef unsigned short int uint16_t; 48 typedef unsigned long int uint32_t; 49 typedef unsigned long long int uint64_t; 43 #define SIZE_MIN UINT32_MIN 44 #define SIZE_MAX UINT32_MAX 45 46 #define SSIZE_MIN INT32_MIN 47 #define SSIZE_MAX INT32_MAX 48 49 typedef uint32_t sysarg_t; 50 50 51 51 typedef int32_t ssize_t; … … 53 53 54 54 typedef uint32_t uintptr_t; 55 typedef uint32_t atomic_count_t; 56 typedef int32_t atomic_signed_t; 55 57 56 58 #endif -
uspace/lib/c/arch/arm32/src/entry.s
rb50b5af2 r04803bf 36 36 # 37 37 # r1 contains the PCB pointer 38 # r2 contains the RAS page address 38 39 # 39 40 __entry: 41 # Store the RAS page address into the ras_page variable 42 ldr r0, =ras_page 43 str r2, [r0] 44 45 # 46 # Create the first stack frame. 47 # 48 mov fp, #0 49 mov ip, sp 50 push {fp, ip, lr, pc} 51 sub fp, ip, #4 52 40 53 # Pass pcb_ptr to __main as the first argument (in r0) 41 54 mov r0, r1 42 55 bl __main 43 56 44 bl __exit 57 .data 58 59 .global ras_page 60 ras_page: 61 .long 0 -
uspace/lib/c/arch/arm32/src/syscall.c
rb50b5af2 r04803bf 60 60 register sysarg_t __arm_reg_r5 asm("r5") = p6; 61 61 register sysarg_t __arm_reg_r6 asm("r6") = id; 62 63 asm volatile ( "swi" 62 63 asm volatile ( 64 "swi 0" 64 65 : "=r" (__arm_reg_r0) 65 66 : "r" (__arm_reg_r0), … … 71 72 "r" (__arm_reg_r6) 72 73 ); 73 74 74 75 return __arm_reg_r0; 75 76 } -
uspace/lib/c/arch/arm32/src/thread_entry.s
rb50b5af2 r04803bf 35 35 # 36 36 __thread_entry: 37 # 38 # Create the first stack frame. 39 # 40 mov fp, #0 41 mov ip, sp 42 push {fp, ip, lr, pc} 43 sub fp, ip, #4 44 37 45 b __thread_main -
uspace/lib/c/arch/ia32/Makefile.inc
rb50b5af2 r04803bf 27 27 # 28 28 29 ## Toolchain configuration 30 # 31 32 TARGET = ia64-pc-linux-gnu 33 TOOLCHAIN_DIR = $(CROSS_PREFIX)/ia64/bin 34 35 ARCH_SOURCES += arch/$(UARCH)/src/syscall.S \ 29 ARCH_SOURCES = \ 30 arch/$(UARCH)/src/entry.s \ 31 arch/$(UARCH)/src/thread_entry.s \ 32 arch/$(UARCH)/src/syscall.S \ 36 33 arch/$(UARCH)/src/fibril.S \ 37 34 arch/$(UARCH)/src/tls.c \ 38 arch/$(UARCH)/src/ddi.c 35 arch/$(UARCH)/src/setjmp.S \ 36 arch/$(UARCH)/src/stacktrace.c \ 37 arch/$(UARCH)/src/stacktrace_asm.S 39 38 40 CFLAGS += -fno-unwind-tables 41 LFLAGS += -N $(SOFTINT_PREFIX)/libsoftint.a 42 43 ENDIANESS = LE 44 45 BFD_NAME = elf64-ia64-little 46 BFD_ARCH = ia64-elf64 39 .PRECIOUS: arch/$(UARCH)/src/entry.o -
uspace/lib/c/arch/ia32/include/atomic.h
rb50b5af2 r04803bf 36 36 #define LIBC_ia32_ATOMIC_H_ 37 37 38 static inline void atomic_inc(atomic_t *val) { 39 asm volatile ("lock incl %0\n" : "+m" (val->count)); 38 #define LIBC_ARCH_ATOMIC_H_ 39 40 #include <atomicdflt.h> 41 42 static inline void atomic_inc(atomic_t *val) 43 { 44 asm volatile ( 45 "lock incl %[count]\n" 46 : [count] "+m" (val->count) 47 ); 40 48 } 41 49 42 static inline void atomic_dec(atomic_t *val) { 43 asm volatile ("lock decl %0\n" : "+m" (val->count)); 50 static inline void atomic_dec(atomic_t *val) 51 { 52 asm volatile ( 53 "lock decl %[count]\n" 54 : [count] "+m" (val->count) 55 ); 44 56 } 45 57 46 static inline long atomic_postinc(atomic_t *val)58 static inline atomic_count_t atomic_postinc(atomic_t *val) 47 59 { 48 long r; 49 50 asm volatile ( 51 "movl $1, %0\n" 52 "lock xaddl %0, %1\n" 53 : "=r" (r), "+m" (val->count) 54 ); 55 56 return r; 57 } 58 59 static inline long atomic_postdec(atomic_t *val) 60 { 61 long r; 60 atomic_count_t r = 1; 62 61 63 62 asm volatile ( 64 " movl $-1, %0\n"65 "lock xaddl %0, %1\n"66 : "=r" (r), "+m" (val->count)63 "lock xaddl %[r], %[count]\n" 64 : [count] "+m" (val->count), 65 [r] "+r" (r) 67 66 ); 68 67 … … 70 69 } 71 70 72 #define atomic_preinc(val) (atomic_postinc(val) + 1) 73 #define atomic_predec(val) (atomic_postdec(val) - 1) 71 static inline atomic_count_t atomic_postdec(atomic_t *val) 72 { 73 atomic_count_t r = -1; 74 75 asm volatile ( 76 "lock xaddl %[r], %[count]\n" 77 : [count] "+m" (val->count), 78 [r] "+r" (r) 79 ); 80 81 return r; 82 } 83 84 #define atomic_preinc(val) (atomic_postinc(val) + 1) 85 #define atomic_predec(val) (atomic_postdec(val) - 1) 74 86 75 87 #endif -
uspace/lib/c/arch/ia32/include/fibril.h
rb50b5af2 r04803bf 44 44 #define SP_DELTA (12) 45 45 46 #define context_set(c, _pc, stack, size, ptls) \ 47 do { \ 48 (c)->pc = (sysarg_t) (_pc); \ 49 (c)->sp = ((sysarg_t) (stack)) + (size) - SP_DELTA; \ 50 (c)->tls = (sysarg_t) (ptls); \ 51 (c)->ebp = 0; \ 52 } while (0) 53 46 54 /* We include only registers that must be preserved 47 55 * during function call … … 59 67 } context_t; 60 68 69 static inline uintptr_t context_get_fp(context_t *ctx) 70 { 71 return ctx->ebp; 72 } 73 61 74 #endif 62 75 -
uspace/lib/c/arch/ia32/include/syscall.h
rb50b5af2 r04803bf 40 40 #include <kernel/syscall/syscall.h> 41 41 42 #define __syscall0 __syscall_sysenter43 #define __syscall1 __syscall_sysenter44 #define __syscall2 __syscall_sysenter45 #define __syscall3 __syscall_sysenter46 #define __syscall4 __syscall_sysenter47 #define __syscall5 __syscall_int48 #define __syscall6 __syscall_int42 #define __syscall0 __syscall_fast_func 43 #define __syscall1 __syscall_fast_func 44 #define __syscall2 __syscall_fast_func 45 #define __syscall3 __syscall_fast_func 46 #define __syscall4 __syscall_fast_func 47 #define __syscall5 __syscall_slow 48 #define __syscall6 __syscall_slow 49 49 50 extern sysarg_t 51 __syscall_sysenter(const sysarg_t, const sysarg_t, const sysarg_t, const sysarg_t,52 const sysarg_t, const sysarg_t,const syscall_t);50 extern sysarg_t (* __syscall_fast_func)(const sysarg_t, const sysarg_t, 51 const sysarg_t, const sysarg_t, const sysarg_t, const sysarg_t, 52 const syscall_t); 53 53 54 extern sysarg_t 55 __syscall_int(const sysarg_t, const sysarg_t, const sysarg_t, const sysarg_t, 56 const sysarg_t, const sysarg_t, const syscall_t); 54 extern sysarg_t __syscall_slow(const sysarg_t, const sysarg_t, const sysarg_t, 55 const sysarg_t, const sysarg_t, const sysarg_t, const syscall_t); 57 56 58 57 #endif -
uspace/lib/c/arch/ia32/include/tls.h
rb50b5af2 r04803bf 53 53 { 54 54 void *retval; 55 56 asm ("movl %%gs:0, %0" : "=r"(retval)); 55 56 asm ( 57 "movl %%gs:0, %0" 58 : "=r" (retval) 59 ); 60 57 61 return retval; 58 62 } -
uspace/lib/c/arch/ia32/include/types.h
rb50b5af2 r04803bf 36 36 #define LIBC_ia32_TYPES_H_ 37 37 38 typedef unsigned int sysarg_t; 38 #define __32_BITS__ 39 39 40 typedef char int8_t; 41 typedef short int int16_t; 42 typedef int int32_t; 43 typedef long long int int64_t; 40 #include <libarch/common.h> 44 41 45 typedef unsigned char uint8_t; 46 typedef unsigned short int uint16_t; 47 typedef unsigned int uint32_t; 48 typedef unsigned long long int uint64_t; 42 #define SIZE_MIN UINT32_MIN 43 #define SIZE_MAX UINT32_MAX 44 45 #define SSIZE_MIN INT32_MIN 46 #define SSIZE_MAX INT32_MAX 47 48 typedef uint32_t sysarg_t; 49 49 50 50 typedef int32_t ssize_t; … … 52 52 53 53 typedef uint32_t uintptr_t; 54 typedef uint32_t atomic_count_t; 55 typedef int32_t atomic_signed_t; 54 56 55 57 #endif -
uspace/lib/c/arch/ia32/src/entry.s
rb50b5af2 r04803bf 27 27 # 28 28 29 INTEL_CPUID_STANDARD = 1 30 INTEL_SEP = 11 31 29 32 .section .init, "ax" 30 33 … … 35 38 ## User-space task entry point 36 39 # 37 # %e bxcontains the PCB pointer40 # %edi contains the PCB pointer 38 41 # 39 42 __entry: … … 43 46 mov %ax, %fs 44 47 # Do not set %gs, it contains descriptor that can see TLS 45 48 49 # Detect the mechanism used for making syscalls 50 movl $(INTEL_CPUID_STANDARD), %eax 51 cpuid 52 bt $(INTEL_SEP), %edx 53 jnc 0f 54 leal __syscall_fast_func, %eax 55 movl $__syscall_fast, (%eax) 56 0: 57 # 58 # Create the first stack frame. 59 # 60 pushl $0 61 movl %esp, %ebp 62 46 63 # Pass the PCB pointer to __main as the first argument 47 pushl %e bx64 pushl %edi 48 65 call __main 49 50 call __exit -
uspace/lib/c/arch/ia32/src/syscall.S
rb50b5af2 r04803bf 27 27 # 28 28 29 .data 30 31 .global __syscall_fast_func 32 __syscall_fast_func: 33 .long __syscall_slow 34 29 35 .text 30 36 … … 35 41 * could benefit from this and not save unused registers on the stack. 36 42 */ 37 .global __syscall_ int38 __syscall_ int:43 .global __syscall_slow 44 __syscall_slow: 39 45 pushl %ebx 40 46 pushl %esi … … 64 70 * segment, otherwise the SYSENTER wouldn't work in the first place). 65 71 */ 66 .global __syscall_ sysenter67 .type __syscall_ sysenter, @function72 .global __syscall_fast 73 .type __syscall_fast, @function 68 74 69 __syscall_ sysenter:75 __syscall_fast: 70 76 pushl %ebx 71 77 pushl %esi … … 92 98 ret 93 99 94 .size __syscall_ sysenter, . - __syscall_sysenter100 .size __syscall_fast, . - __syscall_fast -
uspace/lib/c/arch/ia32/src/thread_entry.s
rb50b5af2 r04803bf 42 42 43 43 # 44 # Create the first stack frame. 45 # 46 pushl $0 47 mov %esp, %ebp 48 49 # 44 50 # EAX contains address of uarg. 45 51 # -
uspace/lib/c/arch/ia64/_link.ld.in
rb50b5af2 r04803bf 1 STARTUP(LIBC_P REFIX/arch/UARCH/src/entry.o)1 STARTUP(LIBC_PATH/arch/UARCH/src/entry.o) 2 2 ENTRY(__entry) 3 3 … … 9 9 SECTIONS { 10 10 . = 0x4000 + SIZEOF_HEADERS; 11 11 12 12 .init : { 13 13 *(.init); 14 } : text 14 } :text 15 15 16 .text : { 16 17 *(.text); 17 18 *(.rodata*); 18 19 } :text 19 20 20 21 . = . + 0x4000; 21 22 22 23 .got : { 23 24 _gp = .; 24 25 *(.got*); 25 } :data 26 } :data 27 26 28 .data : { 27 29 *(.opd); … … 29 31 *(.sdata); 30 32 } :data 33 31 34 .tdata : { 32 35 _tdata_start = .; … … 37 40 _tbss_end = .; 38 41 } :data 42 39 43 _tls_alignment = ALIGNOF(.tdata); 44 40 45 .bss : { 41 46 *(.sbss); … … 44 49 *(.bss); 45 50 } :data 46 47 . = ALIGN(0x4000); 48 _heap = .; 49 51 50 52 /DISCARD/ : { 51 53 *(*); 52 }54 } 53 55 } -
uspace/lib/c/arch/ia64/include/ddi.h
rb50b5af2 r04803bf 39 39 #include <libarch/types.h> 40 40 41 #define IO_SPACE_BOUNDARY ( 64 * 1024)41 #define IO_SPACE_BOUNDARY ((void *) (64 * 1024)) 42 42 43 43 uint64_t get_ia64_iospace_address(void); -
uspace/lib/c/arch/ia64/include/faddr.h
rb50b5af2 r04803bf 27 27 */ 28 28 29 /** @addtogroup libcia64 29 /** @addtogroup libcia64 30 30 * @{ 31 31 */ … … 38 38 #include <libarch/types.h> 39 39 40 /** 40 /** 41 41 * 42 42 * Calculate absolute address of function 43 43 * referenced by fptr pointer. 44 44 * 45 * @param f Function pointer.45 * @param fptr Function pointer. 46 46 * 47 47 */ 48 #define FADDR(f ) (*((uintptr_t *)(f)));48 #define FADDR(fptr) (((fncptr_t *) (fptr))->fnc) 49 49 50 50 #endif -
uspace/lib/c/arch/ia64/include/fibril.h
rb50b5af2 r04803bf 53 53 #define PSTHREAD_INITIAL_STACK_DIVISION 2 54 54 55 #ifdef context_set56 #undef context_set57 #endif58 59 55 #define context_set(c, _pc, stack, size, tls) \ 60 56 do { \ … … 110 106 uint64_t pr; 111 107 112 __r128f2 __attribute__ ((aligned(16)));113 __r128f3;114 __r128f4;115 __r128f5;108 uint128_t f2 __attribute__ ((aligned(16))); 109 uint128_t f3; 110 uint128_t f4; 111 uint128_t f5; 116 112 117 __r128f16;118 __r128f17;119 __r128f18;120 __r128f19;121 __r128f20;122 __r128f21;123 __r128f22;124 __r128f23;125 __r128f24;126 __r128f25;127 __r128f26;128 __r128f27;129 __r128f28;130 __r128f29;131 __r128f30;132 __r128f31;113 uint128_t f16; 114 uint128_t f17; 115 uint128_t f18; 116 uint128_t f19; 117 uint128_t f20; 118 uint128_t f21; 119 uint128_t f22; 120 uint128_t f23; 121 uint128_t f24; 122 uint128_t f25; 123 uint128_t f26; 124 uint128_t f27; 125 uint128_t f28; 126 uint128_t f29; 127 uint128_t f30; 128 uint128_t f31; 133 129 134 130 } context_t; 131 132 static inline uintptr_t context_get_fp(context_t *ctx) 133 { 134 return 0; /* FIXME */ 135 } 135 136 136 137 #endif -
uspace/lib/c/arch/ia64/include/types.h
rb50b5af2 r04803bf 27 27 */ 28 28 29 /** @addtogroup libcia64 29 /** @addtogroup libcia64 30 30 * @{ 31 31 */ … … 36 36 #define LIBC_ia64_TYPES_H_ 37 37 38 typedef unsigned long long sysarg_t; 38 #define __64_BITS__ 39 39 40 typedef char int8_t; 41 typedef short int int16_t; 42 typedef int int32_t; 43 typedef long int int64_t; 40 #include <libarch/common.h> 44 41 45 typedef unsigned char uint8_t; 46 typedef unsigned short int uint16_t; 47 typedef unsigned int uint32_t; 48 typedef unsigned long int uint64_t; 42 #define SIZE_MIN UINT64_MIN 43 #define SIZE_MAX UINT64_MAX 44 45 #define SSIZE_MIN INT64_MIN 46 #define SSIZE_MAX INT64_MAX 47 48 typedef struct { 49 uint64_t lo; 50 int64_t hi; 51 } int128_t; 52 53 typedef struct { 54 uint64_t lo; 55 uint64_t hi; 56 } uint128_t; 57 58 typedef uint64_t sysarg_t; 49 59 50 60 typedef int64_t ssize_t; … … 52 62 53 63 typedef uint64_t uintptr_t; 64 typedef uint64_t atomic_count_t; 65 typedef int64_t atomic_signed_t; 54 66 55 typedef unsigned char __r8; /* Reserve byte */ 56 typedef unsigned short __r16; 57 typedef unsigned int __r32; 58 typedef unsigned long __r64; 59 60 typedef struct __r128{ 61 __r64 lo; 62 __r64 hi; 63 } __r128; 67 typedef struct { 68 uintptr_t fnc; 69 uintptr_t gp; 70 } __attribute__((may_alias)) fncptr_t; 64 71 65 72 #endif -
uspace/lib/c/arch/ia64/src/entry.s
rb50b5af2 r04803bf 39 39 __entry: 40 40 alloc loc0 = ar.pfs, 0, 1, 2, 0 41 movl r1= _gp42 41 movl gp = _gp 42 43 43 # Pass PCB pointer as the first argument to __main 44 44 mov out0 = r2 45 45 br.call.sptk.many b0 = __main 46 0:47 br.call.sptk.many b0 = __exit -
uspace/lib/c/arch/ia64/src/thread_entry.s
rb50b5af2 r04803bf 37 37 alloc loc0 = ar.pfs, 0, 1, 1, 0 38 38 39 movl r1= _gp39 movl gp = _gp 40 40 41 41 # -
uspace/lib/c/arch/mips32/Makefile.inc
rb50b5af2 r04803bf 27 27 # 28 28 29 ## Toolchain configuration 30 # 29 ARCH_SOURCES = \ 30 arch/$(UARCH)/src/entry.s \ 31 arch/$(UARCH)/src/thread_entry.s \ 32 arch/$(UARCH)/src/syscall.c \ 33 arch/$(UARCH)/src/fibril.S \ 34 arch/$(UARCH)/src/tls.c \ 35 arch/$(UARCH)/src/stacktrace.c \ 36 arch/$(UARCH)/src/stacktrace_asm.S 31 37 32 TARGET = amd64-linux-gnu 33 TOOLCHAIN_DIR = $(CROSS_PREFIX)/amd64/bin 34 35 ARCH_SOURCES += arch/$(UARCH)/src/syscall.S \ 36 arch/$(UARCH)/src/fibril.S \ 37 arch/$(UARCH)/src/tls.c 38 39 LFLAGS += -N 40 41 ENDIANESS = LE 42 43 BFD_NAME = elf64-x86-64 44 BFD_ARCH = i386:x86-64 38 .PRECIOUS: arch/$(UARCH)/src/entry.o -
uspace/lib/c/arch/mips32/_link.ld.in
rb50b5af2 r04803bf 1 STARTUP(LIBC_P REFIX/arch/UARCH/src/entry.o)1 STARTUP(LIBC_PATH/arch/UARCH/src/entry.o) 2 2 ENTRY(__entry) 3 3 … … 13 13 *(.init); 14 14 } :text 15 15 16 .text : { 16 *(.text);17 *(.text); 17 18 *(.rodata*); 18 19 } :text 19 20 20 21 . = . + 0x4000; 21 22 22 23 .data : { 23 24 *(.data); 24 25 *(.data.rel*); 25 26 } :data 26 27 27 28 .got : { 28 29 _gp = .; 29 30 *(.got); 30 31 } :data 31 32 32 33 .tdata : { 33 34 _tdata_start = .; 34 35 *(.tdata); 35 36 _tdata_end = .; 37 } :data 38 39 .tbss : { 36 40 _tbss_start = .; 37 41 *(.tbss); 38 42 _tbss_end = .; 39 43 } :data 40 _tls_alignment = ALIGNOF(.tdata); 41 44 45 _tls_alignment = MAX(ALIGNOF(.tdata), ALIGNOF(.tbss)); 46 42 47 .sbss : { 43 48 *(.scommon); 44 49 *(.sbss); 45 } 50 } 51 46 52 .bss : { 47 53 *(.bss); 48 54 *(COMMON); 49 55 } :data 50 51 . = ALIGN(0x4000); 52 _heap = .; 53 56 54 57 /DISCARD/ : { 55 58 *(*); -
uspace/lib/c/arch/mips32/include/atomic.h
rb50b5af2 r04803bf 27 27 */ 28 28 29 /** @addtogroup libcmips32 29 /** @addtogroup libcmips32 30 30 * @{ 31 31 */ 32 32 /** @file 33 * @ingroup libcmips32eb 33 * @ingroup libcmips32eb 34 34 */ 35 35 … … 37 37 #define LIBC_mips32_ATOMIC_H_ 38 38 39 #define atomic_inc(x) ((void) atomic_add(x, 1)) 40 #define atomic_dec(x) ((void) atomic_add(x, -1)) 39 #define LIBC_ARCH_ATOMIC_H_ 41 40 42 #define atomic_postinc(x) (atomic_add(x, 1) - 1) 43 #define atomic_postdec(x) (atomic_add(x, -1) + 1) 41 #include <atomicdflt.h> 44 42 45 #define atomic_preinc(x) atomic_add(x, 1) 46 #define atomic_predec(x) atomic_add(x, -1) 43 #define atomic_inc(x) ((void) atomic_add(x, 1)) 44 #define atomic_dec(x) ((void) atomic_add(x, -1)) 45 46 #define atomic_postinc(x) (atomic_add(x, 1) - 1) 47 #define atomic_postdec(x) (atomic_add(x, -1) + 1) 48 49 #define atomic_preinc(x) atomic_add(x, 1) 50 #define atomic_predec(x) atomic_add(x, -1) 47 51 48 52 /* Atomic addition of immediate value. 49 53 * 50 54 * @param val Memory location to which will be the immediate value added. 51 * @param i Signed immediate that will be added to *val.55 * @param i Signed immediate that will be added to *val. 52 56 * 53 57 * @return Value after addition. 58 * 54 59 */ 55 static inline long atomic_add(atomic_t *val, int i)60 static inline atomic_count_t atomic_add(atomic_t *val, atomic_count_t i) 56 61 { 57 long tmp, v; 58 62 atomic_count_t tmp; 63 atomic_count_t v; 64 59 65 asm volatile ( 60 66 "1:\n" … … 66 72 /* nop */ /* nop is inserted automatically by compiler */ 67 73 " nop\n" 68 : "=&r" (tmp), "+m" (val->count), "=&r" (v) 69 : "r" (i), "i" (0) 70 ); 71 74 : "=&r" (tmp), 75 "+m" (val->count), 76 "=&r" (v) 77 : "r" (i), 78 "i" (0) 79 ); 80 72 81 return v; 73 82 } -
uspace/lib/c/arch/mips32/include/fibril.h
rb50b5af2 r04803bf 85 85 } context_t; 86 86 87 static inline uintptr_t context_get_fp(context_t *ctx) 88 { 89 return ctx->sp; 90 } 91 87 92 #endif 88 93 -
uspace/lib/c/arch/mips32/include/types.h
rb50b5af2 r04803bf 27 27 */ 28 28 29 /** @addtogroup libcmips32 29 /** @addtogroup libcmips32 30 30 * @{ 31 31 */ … … 37 37 #define LIBC_mips32_TYPES_H_ 38 38 39 typedef unsigned int sysarg_t; 39 #define __32_BITS__ 40 40 41 typedef char int8_t; 42 typedef short int int16_t; 43 typedef long int int32_t; 44 typedef long long int int64_t; 41 #include <libarch/common.h> 45 42 46 typedef unsigned char uint8_t; 47 typedef unsigned short int uint16_t; 48 typedef unsigned long int uint32_t; 49 typedef unsigned long long int uint64_t; 43 #define SIZE_MIN UINT32_MIN 44 #define SIZE_MAX UINT32_MAX 45 46 #define SSIZE_MIN INT32_MIN 47 #define SSIZE_MAX INT32_MAX 48 49 typedef uint32_t sysarg_t; 50 50 51 51 typedef int32_t ssize_t; … … 53 53 54 54 typedef uint32_t uintptr_t; 55 typedef uint32_t atomic_count_t; 56 typedef int32_t atomic_signed_t; 55 57 56 58 #endif -
uspace/lib/c/arch/mips32/src/entry.s
rb50b5af2 r04803bf 29 29 .text 30 30 .section .init, "ax" 31 31 32 .global __entry 32 .global __entry_driver 33 33 34 .set noreorder 34 35 .option pic2 … … 56 57 jal __main 57 58 nop 58 59 jal __exit60 nop61 59 .end 62 63 # Alignment of output section data to 0x400064 .section .data65 .align 14 -
uspace/lib/c/arch/mips32eb/Makefile.inc
rb50b5af2 r04803bf 27 27 # 28 28 29 ## Toolchain configuration 30 # 29 ARCH_SOURCES = \ 30 arch/$(UARCH)/src/entry.s \ 31 arch/$(UARCH)/src/thread_entry.s \ 32 arch/$(UARCH)/src/syscall.c \ 33 arch/$(UARCH)/src/fibril.S \ 34 arch/$(UARCH)/src/tls.c \ 35 arch/$(UARCH)/src/stacktrace.c \ 36 arch/$(UARCH)/src/stacktrace_asm.S 31 37 32 TARGET = mipsel-linux-gnu 33 TOOLCHAIN_DIR = $(CROSS_PREFIX)/mipsel/bin 34 35 ARCH_SOURCES += arch/$(UARCH)/src/syscall.c \ 36 arch/$(UARCH)/src/fibril.S \ 37 arch/$(UARCH)/src/tls.c 38 39 CFLAGS += -mips3 40 41 ENDIANESS = LE 42 43 BFD_ARCH = mips 44 BFD_NAME = elf32-tradlittlemips 38 .PRECIOUS: arch/$(UARCH)/src/entry.o -
uspace/lib/c/arch/ppc32/Makefile.common
rb50b5af2 r04803bf 27 27 # 28 28 29 #include "regname.h" 29 GCC_CFLAGS += -mcpu=powerpc -msoft-float -m32 30 AFLAGS = -a32 30 31 31 .section BOOTSTRAP, "ax" 32 ENDIANESS = BE 32 33 33 .global start 34 35 start: 36 lis r4, ofw_cif@ha 37 addi r4, r4, ofw_cif@l 38 stw r5, 0(r4) 39 40 bl ofw_init 41 42 b bootstrap 34 BFD_NAME = elf32-powerpc 35 BFD_ARCH = powerpc:common -
uspace/lib/c/arch/ppc32/_link.ld.in
rb50b5af2 r04803bf 1 STARTUP(LIBC_P REFIX/arch/UARCH/src/entry.o)1 STARTUP(LIBC_PATH/arch/UARCH/src/entry.o) 2 2 ENTRY(__entry) 3 3 … … 9 9 SECTIONS { 10 10 . = 0x1000 + SIZEOF_HEADERS; 11 11 12 12 .init : { 13 13 *(.init); 14 14 } :text 15 15 16 .text : { 16 17 *(.text); 17 18 *(.rodata*); 18 19 } :text 19 20 20 21 . = . + 0x1000; 21 22 22 23 .data : { 23 24 *(.data); 24 25 *(.sdata); 25 26 } :data 27 26 28 .tdata : { 27 29 _tdata_start = .; … … 32 34 _tbss_end = .; 33 35 } :data 36 34 37 _tls_alignment = ALIGNOF(.tdata); 38 35 39 .bss : { 36 40 *(.sbss); … … 38 42 *(.bss); 39 43 } :data 40 41 . = ALIGN(0x1000);42 _heap = .;43 44 44 45 /DISCARD/ : { 45 46 *(*); 46 47 } 47 48 48 } -
uspace/lib/c/arch/ppc32/include/atomic.h
rb50b5af2 r04803bf 27 27 */ 28 28 29 /** @addtogroup libcppc32 29 /** @addtogroup libcppc32 30 30 * @{ 31 31 */ … … 36 36 #define LIBC_ppc32_ATOMIC_H_ 37 37 38 #define LIBC_ARCH_ATOMIC_H_ 39 40 #include <atomicdflt.h> 41 38 42 static inline void atomic_inc(atomic_t *val) 39 43 { 40 longtmp;41 44 atomic_count_t tmp; 45 42 46 asm volatile ( 43 47 "1:\n" … … 46 50 "stwcx. %0, 0, %2\n" 47 51 "bne- 1b" 48 : "=&r" (tmp), "=m" (val->count) 49 : "r" (&val->count), "m" (val->count) 50 : "cc"); 52 : "=&r" (tmp), 53 "=m" (val->count) 54 : "r" (&val->count), 55 "m" (val->count) 56 : "cc" 57 ); 51 58 } 52 59 53 60 static inline void atomic_dec(atomic_t *val) 54 61 { 55 longtmp;56 62 atomic_count_t tmp; 63 57 64 asm volatile ( 58 65 "1:\n" 59 66 "lwarx %0, 0, %2\n" 60 67 "addic %0, %0, -1\n" 61 "stwcx. %0, 0, %2\n"68 "stwcx. %0, 0, %2\n" 62 69 "bne- 1b" 63 : "=&r" (tmp), "=m" (val->count) 64 : "r" (&val->count), "m" (val->count) 65 : "cc"); 70 : "=&r" (tmp), 71 "=m" (val->count) 72 : "r" (&val->count), 73 "m" (val->count) 74 : "cc" 75 ); 66 76 } 67 77 68 static inline longatomic_postinc(atomic_t *val)78 static inline atomic_count_t atomic_postinc(atomic_t *val) 69 79 { 70 80 atomic_inc(val); … … 72 82 } 73 83 74 static inline longatomic_postdec(atomic_t *val)84 static inline atomic_count_t atomic_postdec(atomic_t *val) 75 85 { 76 86 atomic_dec(val); … … 78 88 } 79 89 80 static inline longatomic_preinc(atomic_t *val)90 static inline atomic_count_t atomic_preinc(atomic_t *val) 81 91 { 82 92 atomic_inc(val); … … 84 94 } 85 95 86 static inline longatomic_predec(atomic_t *val)96 static inline atomic_count_t atomic_predec(atomic_t *val) 87 97 { 88 98 atomic_dec(val); -
uspace/lib/c/arch/ppc32/include/fibril.h
rb50b5af2 r04803bf 78 78 } __attribute__ ((packed)) context_t; 79 79 80 static inline uintptr_t context_get_fp(context_t *ctx) 81 { 82 return ctx->sp; 83 } 84 80 85 #endif 81 86 -
uspace/lib/c/arch/ppc32/include/types.h
rb50b5af2 r04803bf 27 27 */ 28 28 29 /** @addtogroup libcppc32 29 /** @addtogroup libcppc32 30 30 * @{ 31 31 */ … … 36 36 #define LIBC_ppc32_TYPES_H_ 37 37 38 typedef unsigned int sysarg_t; 38 #define __32_BITS__ 39 39 40 typedef char int8_t; 41 typedef short int int16_t; 42 typedef int int32_t; 43 typedef long long int int64_t; 40 #include <libarch/common.h> 44 41 45 typedef unsigned char uint8_t; 46 typedef unsigned short int uint16_t; 47 typedef unsigned int uint32_t; 48 typedef unsigned long long int uint64_t; 42 #define SIZE_MIN UINT32_MIN 43 #define SIZE_MAX UINT32_MAX 44 45 #define SSIZE_MIN INT32_MIN 46 #define SSIZE_MAX INT32_MAX 47 48 typedef uint32_t sysarg_t; 49 49 50 50 typedef int32_t ssize_t; … … 52 52 53 53 typedef uint32_t uintptr_t; 54 typedef uint32_t atomic_count_t; 55 typedef int32_t atomic_signed_t; 54 56 55 57 #endif -
uspace/lib/c/arch/ppc32/src/entry.s
rb50b5af2 r04803bf 38 38 # 39 39 __entry: 40 # 41 # Create the first stack frame. 42 # 43 li %r3, 0 44 stw %r3, 0(%r1) 45 stwu %r1, -16(%r1) 46 40 47 # Pass the PCB pointer to __main() as the first argument. 41 48 # The first argument is passed in r3. 42 49 mr %r3, %r6 43 50 bl __main 44 45 bl __exit -
uspace/lib/c/arch/ppc32/src/thread_entry.s
rb50b5af2 r04803bf 35 35 # 36 36 __thread_entry: 37 # 38 # Create the first stack frame. 39 # 40 li %r4, 0 41 stw %r4, 0(%r1) 42 stwu %r1, -16(%r1) 43 37 44 b __thread_main 38 45 -
uspace/lib/c/arch/sparc64/Makefile.common
rb50b5af2 r04803bf 27 27 # 28 28 29 ## Toolchain configuration 30 # 31 32 TARGET = sparc64-linux-gnu 33 TOOLCHAIN_DIR = $(CROSS_PREFIX)/sparc64/bin 34 35 ARCH_SOURCES += arch/$(UARCH)/src/fibril.S \ 36 arch/$(UARCH)/src/tls.c 37 38 CFLAGS += -mcpu=ultrasparc -m64 39 LFLAGS += -no-check-sections -N 29 GCC_CFLAGS += -mcpu=ultrasparc -m64 -mcmodel=medlow 30 LFLAGS = -no-check-sections 40 31 41 32 ENDIANESS = BE … … 43 34 BFD_NAME = elf64-sparc 44 35 BFD_ARCH = sparc 36 37 ifeq ($(PROCESSOR),us) 38 DEFS += -DSUN4U 39 endif 40 41 ifeq ($(PROCESSOR),us3) 42 DEFS += -DSUN4U 43 endif 44 45 ifeq ($(PROCESSOR),sun4v) 46 DEFS += -DSUN4V 47 endif -
uspace/lib/c/arch/sparc64/_link.ld.in
rb50b5af2 r04803bf 1 STARTUP(LIBC_P REFIX/arch/UARCH/src/entry.o)1 STARTUP(LIBC_PATH/arch/UARCH/src/entry.o) 2 2 ENTRY(__entry) 3 3 … … 9 9 SECTIONS { 10 10 . = 0x4000 + SIZEOF_HEADERS; 11 11 12 12 .init : { 13 13 *(.init); 14 14 } :text 15 15 16 .text : { 16 17 *(.text); 17 18 *(.rodata*); 18 19 } :text 19 20 20 21 . = . + 0x4000; 21 22 22 23 .got : { 23 24 _gp = .; 24 25 *(.got*); 25 26 } :data 27 26 28 .data : { 27 29 *(.data); 28 30 *(.sdata); 29 31 } :data 32 30 33 .tdata : { 31 34 _tdata_start = .; … … 36 39 _tbss_end = .; 37 40 } :data 41 38 42 _tls_alignment = ALIGNOF(.tdata); 43 39 44 .bss : { 40 45 *(.sbss); … … 42 47 *(.bss); 43 48 } :data 44 45 . = ALIGN(0x4000);46 _heap = .;47 49 48 50 /DISCARD/ : { 49 51 *(*); 50 52 } 51 52 53 } -
uspace/lib/c/arch/sparc64/include/atomic.h
rb50b5af2 r04803bf 36 36 #define LIBC_sparc64_ATOMIC_H_ 37 37 38 #define LIBC_ARCH_ATOMIC_H_ 39 40 #include <atomicdflt.h> 38 41 #include <sys/types.h> 39 42 … … 43 46 * 44 47 * @param val Atomic variable. 45 * @param i Signed value to be added.48 * @param i Signed value to be added. 46 49 * 47 50 * @return Value of the atomic variable as it existed before addition. 51 * 48 52 */ 49 static inline long atomic_add(atomic_t *val, int i)53 static inline atomic_count_t atomic_add(atomic_t *val, atomic_count_t i) 50 54 { 51 uint64_t a, b; 52 55 atomic_count_t a; 56 atomic_count_t b; 57 53 58 do { 54 volatile uintptr_t x = (uint64_t) &val->count;55 56 a = *(( uint64_t *) x);59 volatile uintptr_t ptr = (uintptr_t) &val->count; 60 61 a = *((atomic_count_t *) ptr); 57 62 b = a + i; 58 asm volatile ("casx %0, %2, %1\n" : "+m" (*((uint64_t *)x)), "+r" (b) : "r" (a)); 63 64 asm volatile ( 65 "casx %0, %2, %1\n" 66 : "+m" (*((atomic_count_t *) ptr)), 67 "+r" (b) 68 : "r" (a) 69 ); 59 70 } while (a != b); 60 71 61 72 return a; 62 73 } 63 74 64 static inline longatomic_preinc(atomic_t *val)75 static inline atomic_count_t atomic_preinc(atomic_t *val) 65 76 { 66 77 return atomic_add(val, 1) + 1; 67 78 } 68 79 69 static inline longatomic_postinc(atomic_t *val)80 static inline atomic_count_t atomic_postinc(atomic_t *val) 70 81 { 71 82 return atomic_add(val, 1); 72 83 } 73 84 74 static inline longatomic_predec(atomic_t *val)85 static inline atomic_count_t atomic_predec(atomic_t *val) 75 86 { 76 87 return atomic_add(val, -1) - 1; 77 88 } 78 89 79 static inline longatomic_postdec(atomic_t *val)90 static inline atomic_count_t atomic_postdec(atomic_t *val) 80 91 { 81 92 return atomic_add(val, -1); -
uspace/lib/c/arch/sparc64/include/config.h
rb50b5af2 r04803bf 36 36 #define LIBC_sparc64_CONFIG_H_ 37 37 38 #if defined (SUN4U) 38 39 #define PAGE_WIDTH 14 40 #elif defined(SUN4V) 41 #define PAGE_WIDTH 13 42 #endif 43 39 44 #define PAGE_SIZE (1 << PAGE_WIDTH) 40 45 -
uspace/lib/c/arch/sparc64/include/ddi.h
rb50b5af2 r04803bf 37 37 #include <libarch/types.h> 38 38 39 static inline memory_barrier(void)39 static inline void memory_barrier(void) 40 40 { 41 asm volatile ("membar #LoadLoad | #StoreStore\n" ::: "memory"); 41 asm volatile ( 42 "membar #LoadLoad | #StoreStore\n" 43 ::: "memory" 44 ); 42 45 } 43 46 -
uspace/lib/c/arch/sparc64/include/fibril.h
rb50b5af2 r04803bf 42 42 #define SP_DELTA (STACK_WINDOW_SAVE_AREA_SIZE + STACK_ARG_SAVE_AREA_SIZE) 43 43 44 #ifdef context_set 45 #undef context_set 46 #endif 47 48 #define context_set(c, _pc, stack, size, ptls) \ 49 (c)->pc = ((uintptr_t) _pc) - 8; \ 50 (c)->sp = ((uintptr_t) stack) + ALIGN_UP((size), \ 51 STACK_ALIGNMENT) - (STACK_BIAS + SP_DELTA); \ 52 (c)->fp = -STACK_BIAS; \ 53 (c)->tp = ptls 44 #define context_set(c, _pc, stack, size, ptls) \ 45 do { \ 46 (c)->pc = ((uintptr_t) _pc) - 8; \ 47 (c)->sp = ((uintptr_t) stack) + ALIGN_UP((size), \ 48 STACK_ALIGNMENT) - (STACK_BIAS + SP_DELTA); \ 49 (c)->fp = -STACK_BIAS; \ 50 (c)->tp = (uint64_t) ptls; \ 51 } while (0) 54 52 55 53 /* … … 79 77 } context_t; 80 78 79 static inline uintptr_t context_get_fp(context_t *ctx) 80 { 81 return ctx->sp + STACK_BIAS; 82 } 83 81 84 #endif 82 85 -
uspace/lib/c/arch/sparc64/include/types.h
rb50b5af2 r04803bf 27 27 */ 28 28 29 /** @addtogroup libcsparc64 29 /** @addtogroup libcsparc64 30 30 * @{ 31 31 */ … … 36 36 #define LIBC_sparc64_TYPES_H_ 37 37 38 typedef unsigned long sysarg_t; 38 #define __64_BITS__ 39 39 40 typedef signed char int8_t; 41 typedef short int int16_t; 42 typedef int int32_t; 43 typedef long int int64_t; 40 #include <libarch/common.h> 44 41 45 typedef unsigned char uint8_t; 46 typedef unsigned short int uint16_t; 47 typedef unsigned int uint32_t; 48 typedef unsigned long int uint64_t; 42 #define SIZE_MIN UINT64_MIN 43 #define SIZE_MAX UINT64_MAX 44 45 #define SSIZE_MIN INT64_MIN 46 #define SSIZE_MAX INT64_MAX 47 48 typedef uint64_t sysarg_t; 49 49 50 50 typedef int64_t ssize_t; … … 52 52 53 53 typedef uint64_t uintptr_t; 54 typedef uint64_t atomic_count_t; 55 typedef int64_t atomic_signed_t; 54 56 55 57 #endif -
uspace/lib/c/arch/sparc64/src/entry.s
rb50b5af2 r04803bf 39 39 # 40 40 __entry: 41 # 42 # Create the first stack frame. 43 # 44 save %sp, -176, %sp 45 flushw 46 add %g0, -0x7ff, %fp 47 41 48 # Pass pcb_ptr as the first argument to __main() 42 mov % o1, %o049 mov %i1, %o0 43 50 sethi %hi(_gp), %l7 44 51 call __main 45 52 or %l7, %lo(_gp), %l7 46 47 call __exit48 nop -
uspace/lib/c/arch/sparc64/src/fibril.S
rb50b5af2 r04803bf 35 35 36 36 context_save: 37 # 38 # We rely on the kernel to flush our active register windows to memory 39 # should a thread switch occur. 40 # 37 41 CONTEXT_SAVE_ARCH_CORE %o0 38 42 retl … … 42 46 # 43 47 # Flush all active windows. 44 # This is essential, because CONTEXT_LOAD overwrites 45 # %sp of CWP - 1 with the value written to %fp of CWP. 46 # Flushing all active windows mitigates this problem 47 # as CWP - 1 becomes the overlap window. 48 # 48 # This is essential, because CONTEXT_RESTORE_ARCH_CORE overwrites %sp of 49 # CWP - 1 with the value written to %fp of CWP. Flushing all active 50 # windows mitigates this problem as CWP - 1 becomes the overlap window. 51 # 49 52 flushw 50 53 -
uspace/lib/c/arch/sparc64/src/thread_entry.s
rb50b5af2 r04803bf 35 35 # 36 36 __thread_entry: 37 # 38 # Create the first stack frame. 39 # 40 save %sp, -176, %sp 41 flushw 42 add %g0, -0x7ff, %fp 43 44 # 45 # Propagate the input arguments to the new window. 46 # 47 mov %i0, %o0 48 37 49 sethi %hi(_gp), %l7 38 50 call __thread_main ! %o0 contains address of uarg
Note:
See TracChangeset
for help on using the changeset viewer.
