Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset 3558ba93 in mainline


Ignore:
Timestamp:
2013-12-09T15:55:40Z (9 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master, serial
Children:
5b89d43b
Parents:
12735849 (diff), 9521eca (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.
Message:

Merge GCC port updates

This commit includes various small changes needed to compile GCC or
dependent libraries on more architectures than ia32.

A lot of ARM EABI functions (softfloat) were added, mostly as aliases
to already existing ones.

A generic implementation of long jump was added, based on context save
and restore functions.

Examples in src/c/ were updated to be compilable again and new scripts
for compiling with GCC were added.

New uspace/overlay directory was added that is verbatim copied into the
final image. Cleaning its content is left to the user.

A small `untar' utility was implemented for unpacking tarballs (it does
not support the standard switches nor a compressed content).

Merged branch: lp:~vojtech-horky/helenos/gcc-port

Files:
10 added
19 edited
2 moved

Legend:

Unmodified
Added
Removed
  • boot/Makefile

    r12735849 r3558ba93  
    8080                cp "$(USPACE_PATH)/$(DRVS_PATH)/$$file_dir/$$file_name/$$file_name.dev" "$(DIST_PATH)/$(DRVS_PATH)/$$file_name/" ; \
    8181        done
     82        if ls $(DIST_OVERLAY_PATH)/* >/dev/null; then \
     83                cp -r -L $(DIST_OVERLAY_PATH)/* "$(DIST_PATH)"; \
     84        fi
    8285
    8386clean: clean_dist
  • boot/Makefile.common

    r12735849 r3558ba93  
    4848USPACE_PATH = $(ROOT_PATH)/uspace
    4949DIST_PATH = $(USPACE_PATH)/dist
     50DIST_OVERLAY_PATH = $(USPACE_PATH)/overlay
    5051TOOLS_PATH = $(ROOT_PATH)/tools
    5152DRVS_PATH = drv
     
    205206        $(USPACE_PATH)/app/sysinfo/sysinfo \
    206207        $(USPACE_PATH)/app/top/top \
     208        $(USPACE_PATH)/app/untar/untar \
    207209        $(USPACE_PATH)/app/usbinfo/usbinfo \
    208210        $(USPACE_PATH)/app/vuhid/vuh \
  • uspace/Makefile

    r12735849 r3558ba93  
    6868        app/trace \
    6969        app/top \
     70        app/untar \
    7071        app/usbinfo \
    7172        app/vuhid \
  • uspace/app/tester/Makefile

    r12735849 r3558ba93  
    3737        util.c \
    3838        thread/thread1.c \
     39        thread/setjmp1.c \
    3940        print/print1.c \
    4041        print/print2.c \
  • uspace/app/tester/tester.c

    r12735849 r3558ba93  
    4848test_t tests[] = {
    4949#include "thread/thread1.def"
     50#include "thread/setjmp1.def"
    5051#include "print/print1.def"
    5152#include "print/print2.def"
  • uspace/app/tester/tester.h

    r12735849 r3558ba93  
    3939#include <stdbool.h>
    4040#include <stacktrace.h>
     41#include <stdio.h>
    4142
    4243#define IPC_TEST_SERVICE  10240
     
    8081
    8182extern const char *test_thread1(void);
     83extern const char *test_setjmp1(void);
    8284extern const char *test_print1(void);
    8385extern const char *test_print2(void);
  • uspace/app/untar/Makefile

    r12735849 r3558ba93  
    11#
    2 # Copyright (c) 2008 Josef Cejka
     2# Copyright (c) 2013 Vojtech Horky
    33# All rights reserved.
    44#
     
    2727#
    2828
    29 #include <libarch/context_offset.h>
     29USPACE_PREFIX = ../..
     30BINARY = untar
    3031
    31 .text
    32 .global setjmp
    33 .global longjmp
     32SOURCES = \
     33        main.c \
     34        tar.c
    3435
    35 .type setjmp,@function
    36 setjmp:
    37         movl 0(%esp), %eax  # save pc value into eax
    38         movl 4(%esp), %edx  # address of the jmp_buf structure to save context to
    39        
    40         # save registers to the jmp_buf structure
    41         CONTEXT_SAVE_ARCH_CORE %edx %eax
    42        
    43         xorl %eax, %eax     # set_jmp returns 0
    44         ret
    45 
    46 .type longjmp,@function
    47 longjmp:
    48         movl 4(%esp), %ecx  # put address of jmp_buf into ecx
    49         movl 8(%esp), %eax  # put return value into eax
    50        
    51         # restore registers from the jmp_buf structure
    52         CONTEXT_RESTORE_ARCH_CORE %ecx %edx
    53        
    54         movl %edx, 0(%esp)  # put saved pc on stack
    55         ret
     36include $(USPACE_PREFIX)/Makefile.common
  • uspace/dist/src/c/demos/tetris/screen.c

    r12735849 r3558ba93  
    344344       
    345345        while (timeout > 0) {
    346                 kbd_event_t event;
    347                
    348                 if (!console_get_kbd_event_timeout(console, &event, &timeout))
     346                cons_event_t event;
     347               
     348                if (!console_get_event_timeout(console, &event, &timeout))
    349349                        break;
    350350        }
     
    376376       
    377377        while (c == 0) {
    378                 kbd_event_t event;
    379                
    380                 if (!console_get_kbd_event_timeout(console, &event, &timeleft)) {
     378                cons_event_t event;
     379               
     380                if (!console_get_event_timeout(console, &event, &timeleft)) {
    381381                        timeleft = 0;
    382382                        return -1;
    383383                }
    384384               
    385                 if (event.type == KEY_PRESS)
    386                         c = event.c;
     385                if (event.type == CEV_KEY && event.ev.key.type == KEY_PRESS)
     386                        c = event.ev.key.c;
    387387        }
    388388       
     
    398398       
    399399        while (c == 0) {
    400                 kbd_event_t event;
    401                
    402                 if (!console_get_kbd_event(console, &event))
     400                cons_event_t event;
     401               
     402                if (!console_get_event(console, &event))
    403403                        return -1;
    404404               
    405                 if (event.type == KEY_PRESS)
    406                         c = event.c;
     405                if (event.type == CEV_KEY && event.ev.key.type == KEY_PRESS)
     406                        c = event.ev.key.c;
    407407        }
    408408       
  • uspace/lib/c/Makefile

    r12735849 r3558ba93  
    6161        generic/bd.c \
    6262        generic/bd_srv.c \
    63         generic/bitops.c \
    6463        generic/cap.c \
    6564        generic/cfg.c \
     
    143142        generic/net/socket_client.c \
    144143        generic/net/socket_parse.c \
     144        generic/setjmp.c \
    145145        generic/stack.c \
    146146        generic/stacktrace.c \
  • uspace/lib/c/arch/amd64/_link.ld.in

    r12735849 r3558ba93  
    3939        .data : {
    4040                *(.data);
     41                *(.data.rel*);
    4142        } :data
    4243       
  • uspace/lib/c/arch/ia32/Makefile.inc

    r12735849 r3558ba93  
    3434        arch/$(UARCH)/src/fibril.S \
    3535        arch/$(UARCH)/src/tls.c \
    36         arch/$(UARCH)/src/setjmp.S \
    3736        arch/$(UARCH)/src/stacktrace.c \
    3837        arch/$(UARCH)/src/stacktrace_asm.S \
  • uspace/lib/c/include/bitops.h

    r12735849 r3558ba93  
    107107}
    108108
    109 extern int __popcountsi2(int);
    110 
    111109#endif
    112110
  • uspace/lib/c/include/setjmp.h

    r12735849 r3558ba93  
    11/*
    22 * Copyright (c) 2008 Josef Cejka
     3 * Copyright (c) 2013 Vojtech Horky
    34 * All rights reserved.
    45 *
     
    3031 * @{
    3132 */
    32 /** @file
     33/** @file Long jump implementation.
     34 *
     35 * Implementation inspired by Jiri Zarevucky's code from
     36 * http://bazaar.launchpad.net/~zarevucky-jiri/helenos/stdc/revision/1544/uspace/lib/posix/setjmp.h
    3337 */
    3438
     
    3842#include <libarch/fibril.h>
    3943
    40 typedef context_t jmp_buf[1];
     44struct jmp_buf_interal {
     45        context_t context;
     46        int return_value;
     47};
     48typedef struct jmp_buf_interal jmp_buf[1];
    4149
    42 extern int setjmp(jmp_buf env);
     50/*
     51 * Specified as extern to minimize number of included headers
     52 * because this file is used as is in libposix too.
     53 */
     54extern int context_save(context_t *ctx) __attribute__((returns_twice));
     55
     56/**
     57 * Save current environment (registers).
     58 *
     59 * This function may return twice.
     60 *
     61 * @param env Variable where to save the environment (of type jmp_buf).
     62 * @return Whether the call returned after longjmp.
     63 * @retval 0 Environment was saved, normal execution.
     64 * @retval other longjmp was executed and returned here.
     65 */
     66#define setjmp(env) \
     67        ((env)[0].return_value = 0, \
     68        context_save(&(env)[0].context), \
     69        (env)[0].return_value)
     70
    4371extern void longjmp(jmp_buf env, int val) __attribute__((noreturn));
    4472
  • uspace/lib/posix/include/posix/float.h

    r12735849 r3558ba93  
    5959        #undef DBL_EPSILON
    6060        #define DBL_EPSILON __DBL_EPSILON__
     61        #undef LDBL_EPSILON
     62        #define LDBL_EPSILON __LDBL_EPSILON__
    6163        #undef FLT_RADIX
    6264        #define FLT_RADIX __FLT_RADIX__
     
    6971        #undef FLT_MANT_DIG
    7072        #define FLT_MANT_DIG __FLT_MANT_DIG__
     73        #undef LDBL_MIN
     74        #define LDBL_MIN __LDBL_MIN__
     75        #undef LDBL_MAX
     76        #define LDBL_MAX __LDBL_MAX__
    7177        #undef LDBL_MANT_DIG
    7278        #define LDBL_MANT_DIG __LDBL_MANT_DIG__
  • uspace/lib/posix/include/posix/setjmp.h

    r12735849 r3558ba93  
    2727 */
    2828
    29 /** @addtogroup libc
     29/** @addtogroup libposix
    3030 * @{
    3131 */
    3232
    33 #include <bitops.h>
    34 
    35 int __popcountsi2(int a)
    36 {
    37         int bits = 0;
    38         for (unsigned int i = 0; i < sizeof(a) * 8; i++)         {
    39                 if (((a >> i) & 1) != 0) {
    40                         bits++;
    41                 }
    42         }
    43         return bits;                                                                   
    44 }
    45 
     33/*
     34 * Just a pass-through to libc setjmp.
     35 */
     36#include "libc/setjmp.h"
    4637
    4738/** @}
  • uspace/lib/posix/include/posix/stdlib.h

    r12735849 r3558ba93  
    5656#define _Exit exit
    5757extern int __POSIX_DEF__(atexit)(void (*func)(void));
    58 extern void exit(int status);
     58extern void exit(int status) __attribute__((noreturn));
    5959extern void abort(void) __attribute__((noreturn));
    6060
  • uspace/lib/softfloat/softfloat.c

    r12735849 r3558ba93  
    12651265}
    12661266
     1267float __aeabi_d2f(double a)
     1268{
     1269        return __truncdfsf2(a);
     1270}
     1271
     1272double __aeabi_f2d(float a)
     1273{
     1274        return __extendsfdf2(a);
     1275}
     1276
     1277
    12671278float __aeabi_i2f(int i)
    12681279{
     
    12851296}
    12861297
     1298double __aeabi_l2d(long long i)
     1299{
     1300        return __floattidf(i);
     1301}
     1302
     1303float __aeabi_l2f(long long i)
     1304{
     1305        return __floattisf(i);
     1306}
     1307
     1308float __aeabi_ul2f(unsigned long long u)
     1309{
     1310        return __floatuntisf(u);
     1311}
     1312
    12871313int __aeabi_f2iz(float a)
    12881314{
     
    13051331}
    13061332
     1333long long __aeabi_d2lz(double a)
     1334{
     1335        return __fixdfti(a);
     1336}
     1337
    13071338int __aeabi_fcmpge(float a, float b)
    13081339{
     
    13391370        return __ltdf2(a, b);
    13401371}
     1372
     1373int __aeabi_dcmple(double a, double b)
     1374{
     1375        return __ledf2(a, b);
     1376}
     1377
    13411378
    13421379int __aeabi_dcmpeq(double a, double b)
  • uspace/lib/softfloat/softfloat.h

    r12735849 r3558ba93  
    204204
    205205/* ARM EABI */
     206extern float __aeabi_d2f(double);
     207extern double __aeabi_f2d(float);
    206208extern float __aeabi_i2f(int);
    207209extern float __aeabi_ui2f(int);
    208210extern double __aeabi_i2d(int);
    209211extern double __aeabi_ui2d(unsigned int);
     212extern double __aeabi_l2d(long long);
     213extern float __aeabi_l2f(long long);
     214extern float __aeabi_ul2f(unsigned long long);
    210215extern unsigned int __aeabi_d2uiz(double);
     216extern long long __aeabi_d2lz(double);
    211217
    212218extern int __aeabi_f2iz(float);
     
    222228extern int __aeabi_dcmpgt(double, double);
    223229extern int __aeabi_dcmplt(double, double);
     230extern int __aeabi_dcmple(double, double);
    224231extern int __aeabi_dcmpeq(double, double);
    225232
  • uspace/lib/softint/Makefile

    r12735849 r3558ba93  
    3535
    3636SOURCES = \
     37        generic/bits.c \
    3738        generic/comparison.c \
    3839        generic/division.c \
  • uspace/lib/softint/generic/shift.c

    r12735849 r3558ba93  
    123123}
    124124
     125long long __aeabi_llsl(long long val, int shift)
     126{
     127        return __ashldi3(val, shift);
     128}
     129
    125130/** @}
    126131 */
  • uspace/lib/softint/include/shift.h

    r12735849 r3558ba93  
    4646extern long long __lshrdi3(long long, int);
    4747
     48
     49/* ARM EABI */
     50extern long long __aeabi_llsl(long long, int);
     51
    4852#endif
    4953
Note: See TracChangeset for help on using the changeset viewer.