Changeset f9c3ef44 in mainline


Ignore:
Timestamp:
2012-07-28T09:01:24Z (12 years ago)
Author:
Frantisek Princ <frantisek.princ@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
8847142
Parents:
7df0c2ff (diff), b2ba418 (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 with mainline

Files:
16 edited
1 moved

Legend:

Unmodified
Added
Removed
  • boot/arch/ia64/Makefile.inc

    r7df0c2ff rf9c3ef44  
    3131BFD_ARCH = ia64
    3232
     33#
     34# FIXME:
     35#
     36# The -fno-selective-scheduling and -fno-selective-scheduling2 options
     37# should be removed as soon as a bug in GCC concerning unchecked
     38# speculative loads is fixed.
     39#
     40# See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53975 for reference.
     41#
     42
    3343BITS = 64
    3444ENDIANESS = LE
    35 EXTRA_CFLAGS = -fno-unwind-tables -mfixed-range=f32-f127 -mno-pic -mno-sdata
     45EXTRA_CFLAGS = -fno-unwind-tables -mfixed-range=f32-f127 -mno-pic -mno-sdata -fno-selective-scheduling -fno-selective-scheduling2
    3646
    3747RD_SRVS_NON_ESSENTIAL +=
  • kernel/arch/amd64/src/asm.S

    r7df0c2ff rf9c3ef44  
    362362         */
    363363        call syscall_handler
    364        
     364
     365        /*
     366         * Test if the saved return address is canonical and not-kernel.
     367         * We do this by looking at the 16 most significant bits
     368         * of the saved return address (two bytes at offset 6).
     369         */
     370        testw $0xffff, ISTATE_OFFSET_RIP+6(%rsp)
     371        jnz bad_rip
     372
    365373        cli
    366374       
     
    388396        sysretq
    389397
     398bad_rip:
     399        movq %rsp, %rdi
     400        movabs $bad_rip_msg, %rsi
     401        xorb %al, %al
     402        callq fault_from_uspace
     403        /* not reached */
     404       
     405bad_rip_msg:
     406        .asciz "Invalid instruction pointer."
     407
    390408/** Print Unicode character to EGA display.
    391409 *
  • kernel/arch/amd64/src/boot/multiboot.S

    r7df0c2ff rf9c3ef44  
    7676
    7777multiboot_image_start:
     78        cli
    7879        cld
    7980       
     
    8182        movl $START_STACK, %esp
    8283       
    83         /* Initialize Global Descriptor Table register */
     84        /*
     85         * Initialize Global Descriptor Table and
     86         * Interrupt Descriptor Table registers
     87         */
    8488        lgdtl bootstrap_gdtr
     89        lidtl bootstrap_idtr
    8590       
    8691        /* Kernel data + stack */
     
    645650.section K_DATA_START, "aw", @progbits
    646651
     652.global bootstrap_idtr
     653bootstrap_idtr:
     654        .word 0
     655        .long 0
     656
    647657.global bootstrap_gdtr
    648658bootstrap_gdtr:
  • kernel/arch/amd64/src/boot/multiboot2.S

    r7df0c2ff rf9c3ef44  
    116116
    117117multiboot2_image_start:
     118        cli
    118119        cld
    119120       
     
    121122        movl $START_STACK, %esp
    122123       
    123         /* Initialize Global Descriptor Table register */
     124        /*
     125         * Initialize Global Descriptor Table and
     126         * Interrupt Descriptor Table registers
     127         */
    124128        lgdtl bootstrap_gdtr
     129        lidtl bootstrap_idtr
    125130       
    126131        /* Kernel data + stack */
  • kernel/arch/amd64/src/boot/vesa_ret.inc

    r7df0c2ff rf9c3ef44  
    11.code32
    22vesa_init_protected:
     3        cli
    34        cld
    45       
  • kernel/arch/ia32/src/boot/multiboot.S

    r7df0c2ff rf9c3ef44  
    7373
    7474multiboot_image_start:
     75        cli
    7576        cld
    7677       
     
    7879        movl $START_STACK, %esp
    7980       
    80         /* Initialize Global Descriptor Table register */
     81        /*
     82         * Initialize Global Descriptor Table and
     83         * Interrupt Descriptor Table registers
     84         */
    8185        lgdtl bootstrap_gdtr
     86        lidtl bootstrap_idtr
    8287       
    8388        /* Kernel data + stack */
     
    701706page_directory:
    702707        .space 4096, 0
     708
     709.global bootstrap_idtr
     710bootstrap_idtr:
     711        .word 0
     712        .long 0
    703713
    704714.global bootstrap_gdtr
  • kernel/arch/ia32/src/boot/multiboot2.S

    r7df0c2ff rf9c3ef44  
    114114
    115115multiboot2_image_start:
     116        cli
    116117        cld
    117118       
     
    119120        movl $START_STACK, %esp
    120121       
    121         /* Initialize Global Descriptor Table register */
     122        /*
     123         * Initialize Global Descriptor Table and
     124         * Interrupt Descriptor Table registers
     125         */
    122126        lgdtl bootstrap_gdtr
     127        lidtl bootstrap_idtr
    123128       
    124129        /* Kernel data + stack */
  • kernel/arch/ia32/src/boot/vesa_prot.inc

    r7df0c2ff rf9c3ef44  
    8888                /* Returned back to protected mode */
    8989               
     90                /*
     91                 * Initialize Global Descriptor Table and
     92                 * Interrupt Descriptor Table registers
     93                 */
     94                lgdtl bootstrap_gdtr
     95                lidtl bootstrap_idtr
     96               
    9097                movzx %ax, %ecx
    9198                mov %ecx, KA2PA(bfb_scanline)
  • kernel/arch/ia32/src/boot/vesa_real.inc

    r7df0c2ff rf9c3ef44  
    3030.code32
    3131vesa_init:
     32        lidtl vesa_idtr
    3233        jmp $GDT_SELECTOR(VESA_INIT_DES), $vesa_init_real - vesa_init
     34
     35vesa_idtr:
     36        .word 0x3ff
     37        .long 0
    3338
    3439.code16
  • kernel/arch/ia32/src/boot/vesa_ret.inc

    r7df0c2ff rf9c3ef44  
    11.code32
    22vesa_init_protected:
     3        cli
    34        cld
    45       
  • kernel/arch/ia64/Makefile.inc

    r7df0c2ff rf9c3ef44  
    3030BFD_ARCH = ia64-elf64
    3131
    32 CMN1 = -mconstant-gp -fno-unwind-tables -mfixed-range=f32-f127
     32#
     33# FIXME:
     34#
     35# The -fno-selective-scheduling and -fno-selective-scheduling2 options
     36# should be removed as soon as a bug in GCC concerning unchecked
     37# speculative loads is fixed.
     38#
     39# See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53975 for reference.
     40#
     41
     42CMN1 = -mconstant-gp -fno-unwind-tables -mfixed-range=f32-f127 -fno-selective-scheduling -fno-selective-scheduling2
    3343GCC_CFLAGS += $(CMN1)
    3444ICC_CFLAGS += $(CMN1)
  • kernel/generic/include/interrupt.h

    r7df0c2ff rf9c3ef44  
    3838#include <arch/interrupt.h>
    3939#include <print.h>
     40#include <stdarg.h>
    4041#include <typedefs.h>
    4142#include <proc/task.h>
     
    5859extern exc_table_t exc_table[];
    5960
     61extern void fault_from_uspace(istate_t *, const char *, ...);
    6062extern void fault_if_from_uspace(istate_t *, const char *, ...)
    6163    PRINTF_ATTRIBUTE(2, 3);
  • kernel/generic/src/interrupt/interrupt.c

    r7df0c2ff rf9c3ef44  
    5050#include <panic.h>
    5151#include <print.h>
     52#include <stdarg.h>
    5253#include <symtab.h>
    5354#include <proc/thread.h>
     
    165166}
    166167
    167 /** Terminate thread and task if exception came from userspace.
    168  *
    169  */
    170 NO_TRACE void fault_if_from_uspace(istate_t *istate, const char *fmt, ...)
    171 {
    172         if (!istate_from_uspace(istate))
    173                 return;
    174        
     168static NO_TRACE void fault_from_uspace_core(istate_t *istate, const char *fmt, va_list args)
     169{
    175170        printf("Task %s (%" PRIu64 ") killed due to an exception at "
    176171            "program counter %p.\n", TASK->name, TASK->taskid,
     
    181176       
    182177        printf("Kill message: ");
     178        vprintf(fmt, args);
     179        printf("\n");
     180       
     181        task_kill_self(true);
     182}
     183
     184/** Terminate thread and task after the exception came from userspace.
     185 *
     186 */
     187NO_TRACE void fault_from_uspace(istate_t *istate, const char *fmt, ...)
     188{
     189        va_list args;
     190
     191        va_start(args, fmt);
     192        fault_from_uspace_core(istate, fmt, args);
     193        va_end(args);
     194}
     195
     196/** Terminate thread and task if exception came from userspace.
     197 *
     198 */
     199NO_TRACE void fault_if_from_uspace(istate_t *istate, const char *fmt, ...)
     200{
     201        if (!istate_from_uspace(istate))
     202                return;
    183203       
    184204        va_list args;
    185205        va_start(args, fmt);
    186         vprintf(fmt, args);
     206        fault_from_uspace_core(istate, fmt, args);
    187207        va_end(args);
    188         printf("\n");
    189        
    190         task_kill_self(true);
    191208}
    192209
  • uspace/lib/c/arch/ia64/Makefile.common

    r7df0c2ff rf9c3ef44  
    2727#
    2828
    29 GCC_CFLAGS += -fno-unwind-tables
     29#
     30# FIXME:
     31#
     32# The -fno-selective-scheduling and -fno-selective-scheduling2 options
     33# should be removed as soon as a bug in GCC concerning unchecked
     34# speculative loads is fixed.
     35#
     36# See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53975 for reference.
     37#
     38
     39GCC_CFLAGS += -fno-unwind-tables -fno-selective-scheduling -fno-selective-scheduling2
    3040
    3141ENDIANESS = LE
  • uspace/lib/c/generic/malloc.c

    r7df0c2ff rf9c3ef44  
    110110
    111111#define AREA_LAST_BLOCK_HEAD(area) \
    112         ((uintptr_t) BLOCK_HEAD(((heap_block_foot_t *)AREA_LAST_BLOCK_FOOT(area))))
     112        ((uintptr_t) BLOCK_HEAD(((heap_block_foot_t *) AREA_LAST_BLOCK_FOOT(area))))
    113113
    114114/** Get header in heap block.
     
    349349                return false;
    350350       
    351         heap_block_head_t *last_head = (heap_block_head_t *) AREA_LAST_BLOCK_HEAD(area);
     351        heap_block_head_t *last_head =
     352            (heap_block_head_t *) AREA_LAST_BLOCK_HEAD(area);
    352353       
    353354        if (last_head->free) {
     
    651652
    652653/** Try to enlarge any of the heap areas.
    653  *  If successful, allocate block of the given size in the area.
    654  *
     654 *
     655 * If successful, allocate block of the given size in the area.
    655656 * Should be called only inside the critical section.
    656657 *
    657  * @param size Gross size of item to allocate (bytes).
     658 * @param size  Gross size of item to allocate (bytes).
    658659 * @param align Memory address alignment.
     660 *
     661 * @return Allocated block.
     662 * @return NULL on failure.
    659663 *
    660664 */
     
    663667        if (size == 0)
    664668                return NULL;
    665                
     669       
    666670        /* First try to enlarge some existing area */
    667671        for (heap_area_t *area = first_heap_area; area != NULL;
    668672            area = area->next) {
    669            
     673               
    670674                if (area_grow(area, size + align)) {
    671                         heap_block_head_t *first = (heap_block_head_t *) AREA_LAST_BLOCK_HEAD(area);
    672                        
    673                         void *addr = malloc_area(area, first, NULL, size, align);
     675                        heap_block_head_t *first =
     676                            (heap_block_head_t *) AREA_LAST_BLOCK_HEAD(area);
     677                       
     678                        void *addr =
     679                            malloc_area(area, first, NULL, size, align);
    674680                        malloc_assert(addr != NULL);
    675681                        return addr;
     
    679685        /* Eventually try to create a new area */
    680686        if (area_create(AREA_OVERHEAD(size + align))) {
    681                 heap_block_head_t *first = (heap_block_head_t *) AREA_FIRST_BLOCK_HEAD(last_heap_area);
    682                
    683                 void *addr = malloc_area(last_heap_area, first, NULL, size, align);
     687                heap_block_head_t *first =
     688                    (heap_block_head_t *) AREA_FIRST_BLOCK_HEAD(last_heap_area);
     689               
     690                void *addr =
     691                    malloc_area(last_heap_area, first, NULL, size, align);
    684692                malloc_assert(addr != NULL);
    685693                return addr;
     
    707715       
    708716        size_t falign = lcm(align, BASE_ALIGN);
    709 
     717       
    710718        /* Check for integer overflow. */
    711719        if (falign < align)
    712720                return NULL;
    713 
    714         size_t gross_size = GROSS_SIZE(size);
    715        
    716         heap_block_head_t *split;
     721       
     722        /*
     723         * The size of the allocated block needs to be naturally
     724         * aligned, because the footer structure also needs to reside
     725         * on a naturally aligned address in order to avoid unaligned
     726         * memory accesses.
     727         */
     728        size_t gross_size = GROSS_SIZE(ALIGN_UP(size, BASE_ALIGN));
    717729       
    718730        /* Try the next fit approach */
    719         split = next_fit;
     731        heap_block_head_t *split = next_fit;
    720732       
    721733        if (split != NULL) {
     
    754766void *calloc(const size_t nmemb, const size_t size)
    755767{
     768        // FIXME: Check for overflow
     769       
    756770        void *block = malloc(nmemb * size);
    757771        if (block == NULL)
     
    893907        if (addr == NULL)
    894908                return;
    895 
     909       
    896910        futex_down(&malloc_futex);
    897911       
  • uspace/srv/loader/Makefile

    r7df0c2ff rf9c3ef44  
    4444GENERIC_SOURCES = \
    4545        main.c \
    46         interp.s
     46        interp.S
    4747
    4848SOURCES = \
  • uspace/srv/loader/interp.S

    r7df0c2ff rf9c3ef44  
    44# the program loader.
    55#
    6 .section .interp , ""
     6
     7#ifdef UARCH_arm32
     8#define AT_NOTE %note
     9#else
     10#define AT_NOTE @note
     11#endif
     12
     13.section .interp, "a", AT_NOTE
    714        .string "kernel"
Note: See TracChangeset for help on using the changeset viewer.