Changeset c3f95d8 in mainline


Ignore:
Timestamp:
2011-03-13T11:39:00Z (13 years ago)
Author:
Martin Sucha <sucha14@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
5e3eea10
Parents:
f8c60f5 (diff), c1a5d8d (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:

Merged mainline changes

Files:
1 added
15 edited

Legend:

Unmodified
Added
Removed
  • Makefile

    rf8c60f5 rc3f95d8  
    4242CONFIG_HEADER = config.h
    4343
    44 .PHONY: all precheck cscope autotool config_auto config_default config distclean clean check
     44.PHONY: all precheck cscope autotool config_auto config_default config distclean clean check distfile dist
    4545
    4646all: $(COMMON_MAKEFILE) $(COMMON_HEADER) $(CONFIG_MAKEFILE) $(CONFIG_HEADER)
     
    6464endif
    6565
     66# Autotool (detects compiler features)
     67
    6668$(COMMON_MAKEFILE): autotool
    6769$(COMMON_HEADER): autotool
     
    7072        $(AUTOTOOL)
    7173        -[ -f $(COMMON_HEADER_PREV) ] && diff -q $(COMMON_HEADER_PREV) $(COMMON_HEADER) && mv -f $(COMMON_HEADER_PREV) $(COMMON_HEADER)
     74
     75# Build-time configuration
    7276
    7377$(CONFIG_MAKEFILE): config_default
     
    8488        $(CONFIG) $<
    8589
     90# Distribution files
     91
     92distfile: all
     93        $(MAKE) -C dist distfile
     94
     95dist:
     96        $(MAKE) -C dist dist
     97
     98# Cleaning
     99
    86100distclean: clean
    87         rm -f $(CSCOPE).out $(COMMON_MAKEFILE) $(COMMON_HEADER) $(COMMON_HEADER_PREV) $(CONFIG_MAKEFILE) $(CONFIG_HEADER) tools/*.pyc tools/checkers/*.pyc
     101        rm -f $(CSCOPE).out $(COMMON_MAKEFILE) $(COMMON_HEADER) $(COMMON_HEADER_PREV) $(CONFIG_MAKEFILE) $(CONFIG_HEADER) tools/*.pyc tools/checkers/*.pyc dist/HelenOS-*
    88102
    89103clean:
  • boot/arch/mips32/src/asm.S

    rf8c60f5 rc3f95d8  
    4141
    4242start:
    43         /* Setup CPU map (on msim this code
    44            is executed in parallel on all CPUs,
    45            but it not an issue) */
     43        /*
     44         * Setup the CP0 configuration
     45         *  - Disable 64-bit kernel addressing mode
     46         *  - DIsable 64-bit supervisor adressing mode
     47         *  - Disable 64-bit user addressing mode
     48         */
     49        mfc0 $a0, $status
     50        la $a1, 0xffffff1f
     51        and $a0, $a1, $a0
     52        mtc0 $a0, $status
     53       
     54        /*
     55         * Setup CPU map (on msim this code
     56         * is executed in parallel on all CPUs,
     57         * but it not an issue).
     58         */
    4659        la $a0, PA2KA(CPUMAP_OFFSET)
    4760       
     
    94107        lw $k1, ($k0)
    95108       
    96         /* If we are not running on BSP
    97            then end in an infinite loop  */
     109        /*
     110         * If we are not running on BSP
     111         * then end in an infinite loop.
     112         */
    98113        beq $k1, $zero, bsp
    99114        nop
     
    127142
    128143jump_to_kernel:
    129         #
    130         # TODO:
    131         # Make sure that the I-cache, D-cache and memory are mutually coherent
    132         # before passing control to the copied code.
    133         #
     144        /*
     145         * TODO:
     146         *
     147         * Make sure that the I-cache, D-cache and memory are mutually
     148         * coherent before passing control to the copied code.
     149         */
    134150        j $a0
    135151        nop
  • boot/arch/sparc64/include/arch.h

    rf8c60f5 rc3f95d8  
    4141#define STACK_BIAS                   2047
    4242#define STACK_WINDOW_SAVE_AREA_SIZE  (16 * 8)
     43#define STACK_ARG_SAVE_AREA_SIZE     (6 * 8)
    4344
    4445#define NWINDOWS  8
  • boot/arch/sparc64/src/asm.S

    rf8c60f5 rc3f95d8  
    152152.global ofw
    153153ofw:
    154         save %sp, -STACK_WINDOW_SAVE_AREA_SIZE, %sp
     154        save %sp, -(STACK_WINDOW_SAVE_AREA_SIZE + STACK_ARG_SAVE_AREA_SIZE), %sp
    155155        set ofw_cif, %l0
    156156        ldx [%l0], %l0
  • boot/arch/sparc64/src/main.c

    rf8c60f5 rc3f95d8  
    190190        bootinfo.memmap.zones[0].start += OBP_BIAS;
    191191        bootinfo.memmap.zones[0].size -= OBP_BIAS;
     192        bootinfo.memmap.total -= OBP_BIAS;
    192193}
    193194
     
    204205        bootinfo.physmem_start = ofw_get_physmem_start();
    205206        ofw_memmap(&bootinfo.memmap);
     207
     208        if (arch == ARCH_SUN4V)
     209                sun4v_fixups();
    206210       
    207211        void *bootinfo_pa = ofw_translate(&bootinfo);
     
    253257               
    254258                /*
    255                  * At this point, we claim the physical memory that we are
    256                  * going to use. We should be safe in case of the virtual
     259                 * At this point, we claim and map the physical memory that we
     260                 * are going to use. We should be safe in case of the virtual
    257261                 * address space because the OpenFirmware, according to its
    258                  * SPARC binding, should restrict its use of virtual memory
    259                  * to addresses from [0xffd00000; 0xffefffff] and
    260                  * [0xfe000000; 0xfeffffff].
    261                  *
    262                  * We don't map this piece of memory. We simply rely on
    263                  * SILO to have it done for us already in this case.
    264                  *
    265                  * XXX SILO only maps 8 MB for us here. We should improve
    266                  *     this code to be totally independent on the behavior
    267                  *     of SILO.
    268                  *
     262                 * SPARC binding, should restrict its use of virtual memory to
     263                 * addresses from [0xffd00000; 0xffefffff] and [0xfe000000;
     264                 * 0xfeffffff].
    269265                 */
    270266                ofw_claim_phys(bootinfo.physmem_start + dest[i - 1],
    271267                    ALIGN_UP(components[i - 1].inflated, PAGE_SIZE));
     268               
     269                ofw_map(bootinfo.physmem_start + dest[i - 1], dest[i - 1],
     270                    ALIGN_UP(components[i - 1].inflated, PAGE_SIZE), -1);
    272271               
    273272                int err = inflate(components[i - 1].start, components[i - 1].size,
     
    304303                sun4u_smp();
    305304       
    306         if (arch == ARCH_SUN4V)
    307                 sun4v_fixups();
    308        
    309305        printf("Booting the kernel ...\n");
    310306        jump_to_kernel(bootinfo.physmem_start | BSP_PROCESSOR, &bootinfo, subarch,
  • boot/generic/src/balloc.c

    rf8c60f5 rc3f95d8  
    6565void *balloc_rebase(void *ptr)
    6666{
    67         return (void *) ((uintptr_t) ptr - phys_base + ballocs->base);
     67        return (void *) (((uintptr_t) ptr - phys_base) + ballocs->base);
    6868}
  • kernel/arch/sparc64/src/sun4v/asm.S

    rf8c60f5 rc3f95d8  
    4141.global switch_to_userspace
    4242switch_to_userspace:
    43         wrpr PSTATE_PRIV_BIT, %pstate
    44         save %o1, -STACK_WINDOW_SAVE_AREA_SIZE, %sp
     43        save %o1, -(STACK_WINDOW_SAVE_AREA_SIZE + STACK_ARG_SAVE_AREA_SIZE), %sp
    4544        flushw
    4645        wrpr %g0, 0, %cleanwin          ! avoid information leak
  • tools/toolchain.sh

    rf8c60f5 rc3f95d8  
    2828# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    2929#
     30
     31GMP_MAIN=<<EOF
     32#define GCC_GMP_VERSION_NUM(a, b, c) \
     33        (((a) << 16L) | ((b) << 8) | (c))
     34
     35#define GCC_GMP_VERSION \
     36        GCC_GMP_VERSION_NUM(__GNU_MP_VERSION, __GNU_MP_VERSION_MINOR, __GNU_MP_VERSION_PATCHLEVEL)
     37
     38#if GCC_GMP_VERSION < GCC_GMP_VERSION_NUM(4,3,2)
     39        choke me
     40#endif
     41EOF
     42
     43MPFR_MAIN=<<EOF
     44#if MPFR_VERSION < MPFR_VERSION_NUM(2, 4, 2)
     45choke me
     46        #endif
     47EOF
     48
     49MPC_MAIN=<<EOF
     50#if MPC_VERSION < MPC_VERSION_NUM(0, 8, 1)
     51        choke me
     52#endif
     53EOF
     54
     55#
     56# Check if the library described in the argument
     57# exists and has acceptable version.
     58#
     59check_dependency() {
     60        DEPENDENCY="$1"
     61        HEADER="$2"
     62        BODY="$3"
     63       
     64        FNAME="/tmp/conftest-$$"
     65       
     66        echo "#include ${HEADER}" > "${FNAME}.c"
     67        echo >> "${FNAME}.c"
     68        echo "int main()" >> "${FNAME}.c"
     69        echo "{" >> "${FNAME}.c"
     70        echo "${BODY}" >> "${FNAME}.c"
     71        echo "  return 0;" >> "${FNAME}.c"
     72        echo "}" >> "${FNAME}.c"
     73       
     74        cc -c -o "${FNAME}.o" "${FNAME}.c" 2> "${FNAME}.log"
     75        RC="$?"
     76       
     77        if [ "$RC" -ne "0" ] ; then
     78                echo " ${DEPENDENCY} not found, too old or compiler error."
     79                echo " Please recheck manually the source file \"${FNAME}.c\"."
     80                echo " The compilation of the toolchain is probably going to fail,"
     81                echo " you have been warned."
     82                echo
     83                echo " ===== Compiler output ====="
     84                cat "${FNAME}.log"
     85                echo " ==========================="
     86                echo
     87        else
     88                echo " ${DEPENDENCY} found"
     89                rm -f "${FNAME}.log" "${FNAME}.o" "${FNAME}.c"
     90        fi
     91}
     92
     93check_dependecies() {
     94        echo ">>> Basic dependency check"
     95        check_dependency "GMP" "<gmp.h>" "${GMP_MAIN}"
     96        check_dependency "MPFR" "<mpfr.h>" "${MPFR_MAIN}"
     97        check_dependency "MPC" "<mpc.h>" "${MPC_MAIN}"
     98        echo
     99}
    30100
    31101check_error() {
     
    69139        echo " sparc64    SPARC V9"
    70140        echo " all        build all targets"
     141        echo
     142        echo "The toolchain will be installed to the directory specified by"
     143        echo "the CROSS_PREFIX environment variable. If the variable is not"
     144        echo "defined, /usr/local will be used by default."
    71145        echo
    72146       
     
    118192        echo " - native C library with headers"
    119193        echo
    120        
    121         show_countdown 10
    122194}
    123195
     
    281353
    282354show_dependencies
     355check_dependecies
     356show_countdown 10
    283357
    284358case "$1" in
  • uspace/app/bdsh/cmds/modules/mkfile/mkfile.c

    rf8c60f5 rc3f95d8  
    125125
    126126        for (c = 0, optind = 0, opt_ind = 0; c != -1;) {
    127                 c = getopt_long(argc, argv, "pvhVfm:", long_options, &opt_ind);
     127                c = getopt_long(argc, argv, "s:h", long_options, &opt_ind);
    128128                switch (c) {
    129129                case 'h':
  • uspace/app/bdsh/cmds/modules/mount/mount.c

    rf8c60f5 rc3f95d8  
    3131#include <vfs/vfs.h>
    3232#include <errno.h>
     33#include <getopt.h>
    3334#include "config.h"
    3435#include "util.h"
     
    4041static const char *cmdname = "mount";
    4142
    42 /* Dispays help for mount in various levels */
     43static struct option const long_options[] = {
     44        { "help", no_argument, 0, 'h' },
     45        { 0, 0, 0, 0 }
     46};
     47
     48
     49/* Displays help for mount in various levels */
    4350void help_cmd_mount(unsigned int level)
    4451{
     
    6067        const char *mopts = "";
    6168        const char *dev = "";
    62         int rc;
     69        int rc, c, opt_ind;
    6370
    6471        argc = cli_count_args(argv);
    6572
     73        for (c = 0, optind = 0, opt_ind = 0; c != -1;) {
     74                c = getopt_long(argc, argv, "h", long_options, &opt_ind);
     75                switch (c) {
     76                case 'h':
     77                        help_cmd_mount(HELP_LONG);
     78                        return CMD_SUCCESS;
     79                }
     80        }
     81
    6682        if ((argc < 3) || (argc > 5)) {
    67                 printf("%s: invalid number of arguments.\n",
     83                printf("%s: invalid number of arguments. Try `mount --help'\n",
    6884                    cmdname);
    6985                return CMD_FAILURE;
  • uspace/lib/block/libblock.c

    rf8c60f5 rc3f95d8  
    412412        l = hash_table_find(&cache->block_hash, &key);
    413413        if (l) {
     414found:
    414415                /*
    415416                 * We found the block in the cache.
     
    494495                                        fibril_mutex_unlock(&b->lock);
    495496                                        goto retry;
     497                                }
     498                                l = hash_table_find(&cache->block_hash, &key);
     499                                if (l) {
     500                                        /*
     501                                         * Someone else must have already
     502                                         * instantiated the block while we were
     503                                         * not holding the cache lock.
     504                                         * Leave the recycled block on the
     505                                         * freelist and continue as if we
     506                                         * found the block of interest during
     507                                         * the first try.
     508                                         */
     509                                        fibril_mutex_unlock(&b->lock);
     510                                        goto found;
    496511                                }
    497512
  • uspace/lib/c/generic/loader.c

    rf8c60f5 rc3f95d8  
    160160        int rc = async_data_write_start(ldr->phone_id, (void *) pa, pa_len);
    161161        if (rc != EOK) {
     162                free(pa);
    162163                async_wait_for(req, NULL);
    163164                return rc;
  • uspace/lib/c/generic/vfs/vfs.c

    rf8c60f5 rc3f95d8  
    6969        char *ncwd_path;
    7070        char *ncwd_path_nc;
     71        size_t total_size;
    7172
    7273        fibril_mutex_lock(&cwd_mutex);
     
    7778                        return NULL;
    7879                }
    79                 ncwd_path_nc = malloc(cwd_size + 1 + size + 1);
     80                total_size = cwd_size + 1 + size + 1;
     81                ncwd_path_nc = malloc(total_size);
    8082                if (!ncwd_path_nc) {
    8183                        fibril_mutex_unlock(&cwd_mutex);
    8284                        return NULL;
    8385                }
    84                 str_cpy(ncwd_path_nc, cwd_size + 1 + size + 1, cwd_path);
     86                str_cpy(ncwd_path_nc, total_size, cwd_path);
    8587                ncwd_path_nc[cwd_size] = '/';
    8688                ncwd_path_nc[cwd_size + 1] = '\0';
    8789        } else {
    88                 ncwd_path_nc = malloc(size + 1);
     90                total_size = size + 1;
     91                ncwd_path_nc = malloc(total_size);
    8992                if (!ncwd_path_nc) {
    9093                        fibril_mutex_unlock(&cwd_mutex);
     
    9396                ncwd_path_nc[0] = '\0';
    9497        }
    95         str_append(ncwd_path_nc, cwd_size + 1 + size + 1, path);
     98        str_append(ncwd_path_nc, total_size, path);
    9699        ncwd_path = canonify(ncwd_path_nc, retlen);
    97100        if (!ncwd_path) {
  • uspace/srv/devmap/devmap.c

    rf8c60f5 rc3f95d8  
    123123static devmap_handle_t last_handle = 0;
    124124static devmap_device_t *null_devices[NULL_DEVICES];
     125
     126/*
     127 * Dummy list for null devices. This is necessary so that null devices can
     128 * be used just as any other devices, e.g. in devmap_device_unregister_core().
     129 */
     130static LIST_INITIALIZE(dummy_null_driver_devices);
    125131
    126132static devmap_handle_t devmap_create_handle(void)
     
    953959        device->name = dev_name;
    954960       
    955         /* Insert device into list of all devices
    956            and into null devices array */
     961        /*
     962         * Insert device into list of all devices and into null devices array.
     963         * Insert device into a dummy list of null driver's devices so that it
     964         * can be safely removed later.
     965         */
    957966        list_append(&device->devices, &devices_list);
     967        list_append(&device->driver_devices, &dummy_null_driver_devices);
    958968        null_devices[i] = device;
    959969       
  • uspace/srv/fs/fat/fat_ops.c

    rf8c60f5 rc3f95d8  
    325325                    uint16_t_le2host(d->firstc));
    326326                if (rc != EOK) {
     327                        (void) block_put(b);
    327328                        (void) fat_node_put(FS_NODE(nodep));
    328329                        return rc;
     
    811812        fibril_mutex_unlock(&childp->idx->lock);
    812813        childp->lnkcnt = 0;
     814        childp->refcnt++;       /* keep the node in memory until destroyed */
    813815        childp->dirty = true;
    814816        fibril_mutex_unlock(&childp->lock);
     
    14881490        fs_index_t index = (fs_index_t)IPC_GET_ARG2(*request);
    14891491        fs_node_t *fn;
     1492        fat_node_t *nodep;
    14901493        int rc;
    14911494
     
    14991502                return;
    15001503        }
     1504
     1505        nodep = FAT_NODE(fn);
     1506        /*
     1507         * We should have exactly two references. One for the above
     1508         * call to fat_node_get() and one from fat_unlink().
     1509         */
     1510        assert(nodep->refcnt == 2);
    15011511
    15021512        rc = fat_destroy_node(fn);
Note: See TracChangeset for help on using the changeset viewer.