Changes in / [ae49252:349e510d] in mainline


Ignore:
Files:
17 deleted
31 edited

Legend:

Unmodified
Added
Removed
  • boot/Makefile.common

    rae49252 r349e510d  
    9898        $(USPACE_PATH)/srv/bd/part/guid_part/g_part \
    9999        $(USPACE_PATH)/srv/bd/part/mbr_part/mbr_part \
    100         $(USPACE_PATH)/srv/bd/sata_bd/sata_bd \
    101100        $(USPACE_PATH)/srv/clipboard/clipboard \
    102101        $(USPACE_PATH)/srv/fs/tmpfs/tmpfs \
     
    123122        nic/ne2k \
    124123        nic/e1k \
    125         nic/rtl8139 \
    126         block/ahci
     124        nic/rtl8139
    127125
    128126RD_DRV_CFG =
  • kernel/Makefile

    rae49252 r349e510d  
    196196        generic/src/console/chardev.c \
    197197        generic/src/console/console.c \
    198         generic/src/console/prompt.c \
    199198        generic/src/cpu/cpu.c \
    200199        generic/src/ddi/ddi.c \
  • kernel/arch/abs32le/include/mm/page.h

    rae49252 r349e510d  
    105105        set_pt_flags((pte_t *) (ptl3), (size_t) (i), (x))
    106106
    107 /* Set PTE present bit accessors for each level. */
    108 #define SET_PTL1_PRESENT_ARCH(ptl0, i)  \
    109         set_pt_present((pte_t *) (ptl0), (size_t) (i))
    110 #define SET_PTL2_PRESENT_ARCH(ptl1, i)
    111 #define SET_PTL3_PRESENT_ARCH(ptl2, i)
    112 #define SET_FRAME_PRESENT_ARCH(ptl3, i) \
    113         set_pt_present((pte_t *) (ptl3), (size_t) (i))
    114 
    115107/* Macros for querying the last level entries. */
    116108#define PTE_VALID_ARCH(p) \
     
    181173}
    182174
    183 NO_TRACE static inline void set_pt_present(pte_t *pt, size_t i)
    184     WRITES(ARRAY_RANGE(pt, PTL0_ENTRIES_ARCH))
    185     REQUIRES_ARRAY_MUTABLE(pt, PTL0_ENTRIES_ARCH)
    186 {
    187         pte_t *p = &pt[i];
    188 
    189         p->present = 1;
    190 }
    191 
    192175extern void page_arch_init(void);
    193176extern void page_fault(unsigned int, istate_t *);
  • kernel/arch/amd64/include/mm/page.h

    rae49252 r349e510d  
    119119        set_pt_flags((pte_t *) (ptl3), (size_t) (i), (x))
    120120
    121 /* Set PTE present bit accessors for each level. */
    122 #define SET_PTL1_PRESENT_ARCH(ptl0, i) \
    123         set_pt_present((pte_t *) (ptl0), (size_t) (i))
    124 #define SET_PTL2_PRESENT_ARCH(ptl1, i) \
    125         set_pt_present((pte_t *) (ptl1), (size_t) (i))
    126 #define SET_PTL3_PRESENT_ARCH(ptl2, i) \
    127         set_pt_present((pte_t *) (ptl2), (size_t) (i))
    128 #define SET_FRAME_PRESENT_ARCH(ptl3, i) \
    129         set_pt_present((pte_t *) (ptl3), (size_t) (i))
    130 
    131121/* Macros for querying the last-level PTE entries. */
    132122#define PTE_VALID_ARCH(p) \
     
    225215}
    226216
    227 NO_TRACE static inline void set_pt_present(pte_t *pt, size_t i)
    228 {
    229         pte_t *p = &pt[i];
    230 
    231         p->present = 1;
    232 }
    233 
    234217extern void page_arch_init(void);
    235218extern void page_fault(unsigned int, istate_t *);
  • kernel/arch/amd64/src/mm/page.c

    rae49252 r349e510d  
    5757        uintptr_t cur;
    5858        unsigned int identity_flags =
    59             PAGE_GLOBAL | PAGE_CACHEABLE | PAGE_EXEC | PAGE_WRITE | PAGE_READ;
     59            PAGE_CACHEABLE | PAGE_EXEC | PAGE_GLOBAL | PAGE_WRITE;
    6060               
    6161        page_mapping_operations = &pt_mapping_operations;
  • kernel/arch/arm32/include/mm/page.h

    rae49252 r349e510d  
    4040#include <mm/mm.h>
    4141#include <arch/exception.h>
    42 #include <arch/barrier.h>
    4342#include <trace.h>
    4443
     
    110109#define SET_FRAME_FLAGS_ARCH(ptl3, i, x) \
    111110        set_pt_level1_flags((pte_t *) (ptl3), (size_t) (i), (x))
    112 
    113 /* Set PTE present bit accessors for each level. */
    114 #define SET_PTL1_PRESENT_ARCH(ptl0, i) \
    115         set_pt_level0_present((pte_t *) (ptl0), (size_t) (i))
    116 #define SET_PTL2_PRESENT_ARCH(ptl1, i)
    117 #define SET_PTL3_PRESENT_ARCH(ptl2, i)
    118 #define SET_FRAME_PRESENT_ARCH(ptl3, i) \
    119         set_pt_level1_present((pte_t *) (ptl3), (size_t) (i))
    120111
    121112/* Macros for querying the last-level PTE entries. */
     
    276267}
    277268
    278 NO_TRACE static inline void set_pt_level0_present(pte_t *pt, size_t i)
    279 {
    280         pte_level0_t *p = &pt[i].l0;
    281 
    282         p->should_be_zero = 0;
    283         write_barrier();
    284         p->descriptor_type = PTE_DESCRIPTOR_COARSE_TABLE;
    285 }
    286269
    287270/** Sets flags of level 1 page table entry.
     
    300283        pte_level1_t *p = &pt[i].l1;
    301284       
    302         if (flags & PAGE_NOT_PRESENT)
     285        if (flags & PAGE_NOT_PRESENT) {
    303286                p->descriptor_type = PTE_DESCRIPTOR_NOT_PRESENT;
    304         else
     287                p->access_permission_3 = 1;
     288        } else {
    305289                p->descriptor_type = PTE_DESCRIPTOR_SMALL_PAGE;
     290                p->access_permission_3 = p->access_permission_0;
     291        }
    306292       
    307293        p->cacheable = p->bufferable = (flags & PAGE_CACHEABLE) != 0;
     
    326312}
    327313
    328 NO_TRACE static inline void set_pt_level1_present(pte_t *pt, size_t i)
    329 {
    330         pte_level1_t *p = &pt[i].l1;
    331 
    332         p->descriptor_type = PTE_DESCRIPTOR_SMALL_PAGE;
    333 }
    334        
     314
    335315extern void page_arch_init(void);
    336316
     317
    337318#endif /* __ASM__ */
    338319
  • kernel/arch/ia32/include/mm/page.h

    rae49252 r349e510d  
    115115        set_pt_flags((pte_t *) (ptl3), (size_t) (i), (x))
    116116
    117 /* Set PTE present bit accessors for each level. */
    118 #define SET_PTL1_PRESENT_ARCH(ptl0, i) \
    119         set_pt_present((pte_t *) (ptl0), (size_t) (i))
    120 #define SET_PTL2_PRESENT_ARCH(ptl1, i)
    121 #define SET_PTL3_PRESENT_ARCH(ptl2, i)
    122 #define SET_FRAME_PRESENT_ARCH(ptl3, i) \
    123         set_pt_present((pte_t *) (ptl3), (size_t) (i))
    124 
    125117/* Macros for querying the last level entries. */
    126118#define PTE_VALID_ARCH(p) \
     
    202194}
    203195
    204 NO_TRACE static inline void set_pt_present(pte_t *pt, size_t i)
    205 {
    206         pte_t *p = &pt[i];
    207 
    208         p->present = 1;
    209 }
    210 
    211196extern void page_arch_init(void);
    212197extern void page_fault(unsigned int, istate_t *);
  • kernel/arch/ia32/src/mm/page.c

    rae49252 r349e510d  
    7171        for (cur = 0; cur < min(config.identity_size, config.physmem_end);
    7272            cur += FRAME_SIZE) {
    73                 flags = PAGE_GLOBAL | PAGE_CACHEABLE | PAGE_WRITE | PAGE_READ;
     73                flags = PAGE_CACHEABLE | PAGE_WRITE;
     74                if ((PA2KA(cur) >= config.base) &&
     75                    (PA2KA(cur) < config.base + config.kernel_size))
     76                        flags |= PAGE_GLOBAL;
    7477                page_mapping_insert(AS_KERNEL, PA2KA(cur), cur, flags);
    7578        }
  • kernel/arch/ia32/src/smp/apic.c

    rae49252 r349e510d  
    259259}
    260260
    261 #define DELIVS_PENDING_SILENT_RETRIES   4       
    262 
    263 static void l_apic_wait_for_delivery(void)
    264 {
    265         icr_t icr;
    266         unsigned retries = 0;
    267 
    268         do {
    269                 if (retries++ > DELIVS_PENDING_SILENT_RETRIES) {
    270                         retries = 0;
    271 #ifdef CONFIG_DEBUG
    272                         printf("IPI is pending.\n");
    273 #endif
    274                         delay(20);
    275                 }
    276                 icr.lo = l_apic[ICRlo];
    277         } while (icr.delivs == DELIVS_PENDING);
    278        
    279 }
    280 
    281261/** Send all CPUs excluding CPU IPI vector.
    282262 *
     
    299279       
    300280        l_apic[ICRlo] = icr.lo;
    301 
    302         l_apic_wait_for_delivery();
     281       
     282        icr.lo = l_apic[ICRlo];
     283        if (icr.delivs == DELIVS_PENDING) {
     284#ifdef CONFIG_DEBUG
     285                printf("IPI is pending.\n");
     286#endif
     287        }
    303288       
    304289        return apic_poll_errors();
     
    342327                return 0;
    343328       
    344         l_apic_wait_for_delivery();
    345 
    346329        icr.lo = l_apic[ICRlo];
     330        if (icr.delivs == DELIVS_PENDING) {
     331#ifdef CONFIG_DEBUG
     332                printf("IPI is pending.\n");
     333#endif
     334        }
     335       
    347336        icr.delmod = DELMOD_INIT;
    348337        icr.destmod = DESTMOD_PHYS;
  • kernel/arch/mips32/include/mm/page.h

    rae49252 r349e510d  
    128128        set_pt_flags((pte_t *) (ptl3), (size_t) (i), (x))
    129129
    130 /* Set PTE present bit accessors for each level. */
    131 #define SET_PTL1_PRESENT_ARCH(ptl0, i) \
    132         set_pt_present((pte_t *) (ptl0), (size_t) (i))
    133 #define SET_PTL2_PRESENT_ARCH(ptl1, i)
    134 #define SET_PTL3_PRESENT_ARCH(ptl2, i)
    135 #define SET_FRAME_PRESENT_ARCH(ptl3, i) \
    136         set_pt_present((pte_t *) (ptl3), (size_t) (i))
    137 
    138130/* Last-level info macros. */
    139131#define PTE_VALID_ARCH(pte)                     (*((uint32_t *) (pte)) != 0)
     
    190182}
    191183
    192 NO_TRACE static inline void set_pt_present(pte_t *pt, size_t i)
    193 {
    194         pte_t *p = &pt[i];
    195 
    196         p->p = 1;
    197 }
    198        
    199 
    200184extern void page_arch_init(void);
    201185
  • kernel/arch/ppc32/include/mm/page.h

    rae49252 r349e510d  
    129129        set_pt_flags((pte_t *) (ptl3), (size_t) (i), (x))
    130130
    131 /* Set PTE present accessors for each level. */
    132 #define SET_PTL1_PRESENT_ARCH(ptl0, i) \
    133         set_pt_present((pte_t *) (ptl0), (size_t) (i))
    134 
    135 #define SET_PTL2_PRESENT_ARCH(ptl1, i)
    136 #define SET_PTL3_PRESENT_ARCH(ptl2, i)
    137 
    138 #define SET_FRAME_PRESENT_ARCH(ptl3, i) \
    139         set_pt_present((pte_t *) (ptl3), (size_t) (i))
    140 
    141131/* Macros for querying the last-level PTEs. */
    142132#define PTE_VALID_ARCH(pte)       (*((uint32_t *) (pte)) != 0)
     
    185175}
    186176
    187 NO_TRACE static inline void set_pt_present(pte_t *pt, size_t i)
    188 {
    189         pte_t *entry = &pt[i];
    190 
    191         entry->present = 1;
    192 }
    193 
    194177extern void page_arch_init(void);
    195178
  • kernel/arch/sparc64/src/smp/sun4u/ipi.c

    rae49252 r349e510d  
    124124                        (void) interrupts_disable();
    125125                }
    126         } while (!done);
     126        } while (done);
    127127       
    128128        preemption_enable();
  • kernel/genarch/include/mm/page_pt.h

    rae49252 r349e510d  
    115115
    116116/*
    117  * These macros are provided to set the present bit within the page tables.
    118  *
    119  */
    120 #define SET_PTL1_PRESENT(ptl0, i)   SET_PTL1_PRESENT_ARCH(ptl0, i)
    121 #define SET_PTL2_PRESENT(ptl1, i)   SET_PTL2_PRESENT_ARCH(ptl1, i)
    122 #define SET_PTL3_PRESENT(ptl2, i)   SET_PTL3_PRESENT_ARCH(ptl2, i)
    123 #define SET_FRAME_PRESENT(ptl3, i)  SET_FRAME_PRESENT_ARCH(ptl3, i)
    124 
    125 /*
    126117 * Macros for querying the last-level PTEs.
    127118 *
  • kernel/genarch/src/mm/page_ht.c

    rae49252 r349e510d  
    4545#include <typedefs.h>
    4646#include <arch/asm.h>
    47 #include <arch/barrier.h>
    4847#include <synch/spinlock.h>
    4948#include <arch.h>
     
    208207                pte->page = ALIGN_DOWN(page, PAGE_SIZE);
    209208                pte->frame = ALIGN_DOWN(frame, FRAME_SIZE);
    210 
    211                 write_barrier();
    212209               
    213210                hash_table_insert(&page_ht, key, &pte->link);
  • kernel/genarch/src/mm/page_pt.c

    rae49252 r349e510d  
    4343#include <arch/mm/page.h>
    4444#include <arch/mm/as.h>
    45 #include <arch/barrier.h>
    4645#include <typedefs.h>
    4746#include <arch/asm.h>
     
    8786                SET_PTL1_ADDRESS(ptl0, PTL0_INDEX(page), KA2PA(newpt));
    8887                SET_PTL1_FLAGS(ptl0, PTL0_INDEX(page),
    89                     PAGE_NOT_PRESENT | PAGE_USER | PAGE_EXEC | PAGE_CACHEABLE |
     88                    PAGE_PRESENT | PAGE_USER | PAGE_EXEC | PAGE_CACHEABLE |
    9089                    PAGE_WRITE);
    91                 write_barrier();
    92                 SET_PTL1_PRESENT(ptl0, PTL0_INDEX(page));
    9390        }
    9491       
     
    10198                SET_PTL2_ADDRESS(ptl1, PTL1_INDEX(page), KA2PA(newpt));
    10299                SET_PTL2_FLAGS(ptl1, PTL1_INDEX(page),
    103                     PAGE_NOT_PRESENT | PAGE_USER | PAGE_EXEC | PAGE_CACHEABLE |
     100                    PAGE_PRESENT | PAGE_USER | PAGE_EXEC | PAGE_CACHEABLE |
    104101                    PAGE_WRITE);
    105                 write_barrier();
    106                 SET_PTL2_PRESENT(ptl1, PTL1_INDEX(page));       
    107102        }
    108103       
     
    115110                SET_PTL3_ADDRESS(ptl2, PTL2_INDEX(page), KA2PA(newpt));
    116111                SET_PTL3_FLAGS(ptl2, PTL2_INDEX(page),
    117                     PAGE_NOT_PRESENT | PAGE_USER | PAGE_EXEC | PAGE_CACHEABLE |
     112                    PAGE_PRESENT | PAGE_USER | PAGE_EXEC | PAGE_CACHEABLE |
    118113                    PAGE_WRITE);
    119                 write_barrier();
    120                 SET_PTL3_PRESENT(ptl2, PTL2_INDEX(page));
    121114        }
    122115       
     
    124117       
    125118        SET_FRAME_ADDRESS(ptl3, PTL3_INDEX(page), frame);
    126         SET_FRAME_FLAGS(ptl3, PTL3_INDEX(page), flags | PAGE_NOT_PRESENT);
    127         write_barrier();
    128         SET_FRAME_PRESENT(ptl3, PTL3_INDEX(page));
     119        SET_FRAME_FLAGS(ptl3, PTL3_INDEX(page), flags);
    129120}
    130121
     
    288279        if (GET_PTL1_FLAGS(ptl0, PTL0_INDEX(page)) & PAGE_NOT_PRESENT)
    289280                return NULL;
    290 
    291         read_barrier();
    292281       
    293282        pte_t *ptl1 = (pte_t *) PA2KA(GET_PTL1_ADDRESS(ptl0, PTL0_INDEX(page)));
    294283        if (GET_PTL2_FLAGS(ptl1, PTL1_INDEX(page)) & PAGE_NOT_PRESENT)
    295284                return NULL;
    296 
    297 #if (PTL1_ENTRIES != 0)
    298         read_barrier();
    299 #endif
    300285       
    301286        pte_t *ptl2 = (pte_t *) PA2KA(GET_PTL2_ADDRESS(ptl1, PTL1_INDEX(page)));
    302287        if (GET_PTL3_FLAGS(ptl2, PTL2_INDEX(page)) & PAGE_NOT_PRESENT)
    303288                return NULL;
    304 
    305 #if (PTL2_ENTRIES != 0)
    306         read_barrier();
    307 #endif
    308289       
    309290        pte_t *ptl3 = (pte_t *) PA2KA(GET_PTL3_ADDRESS(ptl2, PTL2_INDEX(page)));
     
    365346                SET_PTL1_ADDRESS(ptl0, PTL0_INDEX(addr), KA2PA(l1));
    366347                SET_PTL1_FLAGS(ptl0, PTL0_INDEX(addr),
    367                     PAGE_PRESENT | PAGE_USER | PAGE_CACHEABLE |
    368                     PAGE_EXEC | PAGE_WRITE | PAGE_READ);
     348                    PAGE_PRESENT | PAGE_USER | PAGE_EXEC | PAGE_CACHEABLE |
     349                    PAGE_WRITE);
    369350        }
    370351}
  • kernel/generic/include/debug.h

    rae49252 r349e510d  
    3737
    3838#include <panic.h>
    39 #include <symtab_lookup.h>
     39#include <symtab.h>
    4040
    4141#define CALLER  ((uintptr_t) __builtin_return_address(0))
  • kernel/generic/include/symtab.h

    rae49252 r349e510d  
    3636#define KERN_SYMTAB_H_
    3737
    38 #include <symtab_lookup.h>
    39 #include <console/chardev.h>
     38#include <typedefs.h>
    4039
     40#define MAX_SYMBOL_NAME  64
     41
     42struct symtab_entry {
     43        uint64_t address_le;
     44        char symbol_name[MAX_SYMBOL_NAME];
     45};
     46
     47extern int symtab_name_lookup(uintptr_t, const char **, uintptr_t *);
     48extern const char *symtab_fmt_name_lookup(uintptr_t);
     49extern int symtab_addr_lookup(const char *, uintptr_t *);
    4150extern void symtab_print_search(const char *);
    42 extern int symtab_compl(char *, size_t, indev_t *);
     51extern int symtab_compl(char *, size_t);
     52
     53#ifdef CONFIG_SYMTAB
     54
     55/** Symtable linked together by build process
     56 *
     57 */
     58extern struct symtab_entry symbol_table[];
     59
     60#endif /* CONFIG_SYMTAB */
    4361
    4462#endif
  • kernel/generic/src/console/kconsole.c

    rae49252 r349e510d  
    4343#include <console/chardev.h>
    4444#include <console/cmd.h>
    45 #include <console/prompt.h>
    4645#include <print.h>
    4746#include <panic.h>
     
    202201 *
    203202 */
    204 NO_TRACE static int cmdtab_compl(char *input, size_t size, indev_t *indev)
     203NO_TRACE static int cmdtab_compl(char *input, size_t size)
    205204{
    206205        const char *name = input;
    207206       
    208207        size_t found = 0;
    209        
    210         /*
    211          * Maximum Match Length: Length of longest matching common
    212          * substring in case more than one match is found.
    213          */
    214         size_t max_match_len = size;
    215         size_t max_match_len_tmp = size;
    216         size_t input_len = str_length(input);
    217208        link_t *pos = NULL;
    218209        const char *hint;
    219210        char *output = malloc(MAX_CMDLINE, 0);
    220         size_t hints_to_show = MAX_TAB_HINTS - 1;
    221         size_t total_hints_shown = 0;
    222         bool continue_showing_hints = true;
    223211       
    224212        output[0] = 0;
     
    230218                pos = pos->next;
    231219                found++;
    232         }
    233        
    234         /*
    235          * If the number of possible completions is more than MAX_TAB_HINTS,
    236          * ask the user whether to display them or not.
    237          */
    238         if (found > MAX_TAB_HINTS) {
    239                 printf("\n");
    240                 continue_showing_hints =
    241                     console_prompt_display_all_hints(indev, found);
    242220        }
    243221       
     
    247225                while (cmdtab_search_one(name, &pos)) {
    248226                        cmd_info_t *hlp = list_get_instance(pos, cmd_info_t, link);
    249                        
    250                         if (continue_showing_hints) {
    251                                 printf("%s (%s)\n", hlp->name, hlp->description);
    252                                 --hints_to_show;
    253                                 ++total_hints_shown;
    254                                
    255                                 if ((hints_to_show == 0) && (total_hints_shown != found)) {
    256                                         /* Ask user to continue */
    257                                         continue_showing_hints =
    258                                             console_prompt_more_hints(indev, &hints_to_show);
    259                                 }
    260                         }
    261                        
     227                        printf("%s (%s)\n", hlp->name, hlp->description);
    262228                        pos = pos->next;
    263                        
    264                         for (max_match_len_tmp = 0;
    265                             (output[max_match_len_tmp] ==
    266                             hlp->name[input_len + max_match_len_tmp]) &&
    267                             (max_match_len_tmp < max_match_len); ++max_match_len_tmp);
    268                        
    269                         max_match_len = max_match_len_tmp;
    270                 }
    271                
    272                 /* Keep only the characters common in all completions */
    273                 output[max_match_len] = 0;
     229                }
    274230        }
    275231       
     
    324280                                continue;
    325281                       
    326                         /*
    327                          * Find the beginning of the word
    328                          * and copy it to tmp
    329                          */
     282                        /* Find the beginning of the word
     283                           and copy it to tmp */
    330284                        size_t beg;
    331285                        for (beg = position - 1; (beg > 0) && (!isspace(current[beg]));
     
    340294                        if (beg == 0) {
    341295                                /* Command completion */
    342                                 found = cmdtab_compl(tmp, STR_BOUNDS(MAX_CMDLINE), indev);
     296                                found = cmdtab_compl(tmp, STR_BOUNDS(MAX_CMDLINE));
    343297                        } else {
    344298                                /* Symbol completion */
    345                                 found = symtab_compl(tmp, STR_BOUNDS(MAX_CMDLINE), indev);
     299                                found = symtab_compl(tmp, STR_BOUNDS(MAX_CMDLINE));
    346300                        }
    347301                       
    348302                        if (found == 0)
    349303                                continue;
    350 
    351                         /*
    352                          * We have hints, possibly many. In case of more than one hint,
    353                          * tmp will contain the common prefix.
    354                          */
     304                       
     305                        if (found > 1) {
     306                                /* No unique hint, list was printed */
     307                                printf("%s> ", prompt);
     308                                printf("%ls", current);
     309                                print_cc('\b', wstr_length(current) - position);
     310                                continue;
     311                        }
     312                       
     313                        /* We have a hint */
     314                       
    355315                        size_t off = 0;
    356316                        size_t i = 0;
     
    358318                                if (!wstr_linsert(current, ch, position + i, MAX_CMDLINE))
    359319                                        break;
    360                                
    361320                                i++;
    362321                        }
    363                        
    364                         if (found > 1) {
    365                                 /* No unique hint, list was printed */
    366                                 printf("%s> ", prompt);
    367                                 printf("%ls", current);
    368                                 position += str_length(tmp);
    369                                 print_cc('\b', wstr_length(current) - position);
    370                                 continue;
    371                         }
    372                        
    373                         /* We have a hint */
    374322                       
    375323                        printf("%ls", current + position);
     
    592540/** Parse command line.
    593541 *
    594  * @param cmdline Command line as read from input device.
     542 * @param cmdline Command line as read from input device. 
    595543 * @param size    Size (in bytes) of the string.
    596544 *
  • kernel/generic/src/debug/symtab.c

    rae49252 r349e510d  
    4343#include <typedefs.h>
    4444#include <errno.h>
    45 #include <console/prompt.h>
    4645
    4746/** Get name of a symbol that seems most likely to correspond to address.
     
    210209 *
    211210 */
    212 int symtab_compl(char *input, size_t size, indev_t *indev)
     211int symtab_compl(char *input, size_t size)
    213212{
    214213#ifdef CONFIG_SYMTAB
     
    228227        char output[MAX_SYMBOL_NAME];
    229228       
    230         /*
    231          * Maximum Match Length: Length of longest matching common substring in
    232          * case more than one match is found.
    233          */
    234         size_t max_match_len = size;
    235         size_t max_match_len_tmp = size;
    236         size_t input_len = str_length(input);
    237         char *sym_name;
    238         size_t hints_to_show = MAX_TAB_HINTS - 1;
    239         size_t total_hints_shown = 0;
    240         bool continue_showing_hints = true;
    241        
    242229        output[0] = 0;
    243        
    244         while ((hint = symtab_search_one(name, &pos)))
    245                 pos++;
    246        
    247         pos = 0;
    248230       
    249231        while ((hint = symtab_search_one(name, &pos))) {
     
    253235                pos++;
    254236                found++;
    255         }
    256        
    257         /*
    258          * If the number of possible completions is more than MAX_TAB_HINTS,
    259          * ask the user whether to display them or not.
    260          */
    261         if (found > MAX_TAB_HINTS) {
    262                 printf("\n");
    263                 continue_showing_hints =
    264                     console_prompt_display_all_hints(indev, found);
    265237        }
    266238       
     
    269241                pos = 0;
    270242                while (symtab_search_one(name, &pos)) {
    271                         sym_name = symbol_table[pos].symbol_name;
     243                        printf("%s\n", symbol_table[pos].symbol_name);
    272244                        pos++;
    273                        
    274                         if (continue_showing_hints) {
    275                                 /* We are still showing hints */
    276                                 printf("%s\n", sym_name);
    277                                 --hints_to_show;
    278                                 ++total_hints_shown;
    279                                
    280                                 if ((hints_to_show == 0) && (total_hints_shown != found)) {
    281                                         /* Ask the user to continue */
    282                                         continue_showing_hints =
    283                                             console_prompt_more_hints(indev, &hints_to_show);
    284                                 }
    285                         }
    286                        
    287                         for (max_match_len_tmp = 0;
    288                             (output[max_match_len_tmp] ==
    289                             sym_name[input_len + max_match_len_tmp]) &&
    290                             (max_match_len_tmp < max_match_len); ++max_match_len_tmp);
    291                        
    292                         max_match_len = max_match_len_tmp;
    293245                }
    294                
    295                 /* Keep only the characters common in all completions */
    296                 output[max_match_len] = 0;
    297246        }
    298247       
  • kernel/generic/src/mm/as.c

    rae49252 r349e510d  
    665665               
    666666                page_table_lock(as, false);
     667               
     668                /*
     669                 * Start TLB shootdown sequence.
     670                 */
     671                ipl_t ipl = tlb_shootdown_start(TLB_INVL_PAGES, as->asid,
     672                    area->base + P2SZ(pages), area->pages - pages);
    667673               
    668674                /*
     
    720726                                }
    721727                               
    722                                 /*
    723                                  * Start TLB shootdown sequence.
    724                                  *
    725                                  * The sequence is rather short and can be
    726                                  * repeated multiple times. The reason is that
    727                                  * we don't want to have used_space_remove()
    728                                  * inside the sequence as it may use a blocking
    729                                  * memory allocation for its B+tree. Blocking
    730                                  * while holding the tlblock spinlock is
    731                                  * forbidden and would hit a kernel assertion.
    732                                  */
    733 
    734                                 ipl_t ipl = tlb_shootdown_start(TLB_INVL_PAGES,
    735                                     as->asid, area->base + P2SZ(pages),
    736                                     area->pages - pages);
    737                
    738728                                for (; i < size; i++) {
    739729                                        pte_t *pte = page_mapping_find(as,
     
    753743                                        page_mapping_remove(as, ptr + P2SZ(i));
    754744                                }
    755                
    756                                 /*
    757                                  * Finish TLB shootdown sequence.
    758                                  */
    759                
    760                                 tlb_invalidate_pages(as->asid,
    761                                     area->base + P2SZ(pages),
    762                                     area->pages - pages);
    763                
    764                                 /*
    765                                  * Invalidate software translation caches
    766                                  * (e.g. TSB on sparc64, PHT on ppc32).
    767                                  */
    768                                 as_invalidate_translation_cache(as,
    769                                     area->base + P2SZ(pages),
    770                                     area->pages - pages);
    771                                 tlb_shootdown_finalize(ipl);
    772745                        }
    773746                }
     747               
     748                /*
     749                 * Finish TLB shootdown sequence.
     750                 */
     751               
     752                tlb_invalidate_pages(as->asid, area->base + P2SZ(pages),
     753                    area->pages - pages);
     754               
     755                /*
     756                 * Invalidate software translation caches
     757                 * (e.g. TSB on sparc64, PHT on ppc32).
     758                 */
     759                as_invalidate_translation_cache(as, area->base + P2SZ(pages),
     760                    area->pages - pages);
     761                tlb_shootdown_finalize(ipl);
     762               
    774763                page_table_unlock(as, false);
    775764        } else {
  • kernel/generic/src/mm/tlb.c

    rae49252 r349e510d  
    162162       
    163163        size_t i;
    164         for (i = 0; i < CPU->tlb_messages_count; i++) {
     164        for (i = 0; i < CPU->tlb_messages_count; CPU->tlb_messages_count--) {
    165165                tlb_invalidate_type_t type = CPU->tlb_messages[i].type;
    166166                asid_t asid = CPU->tlb_messages[i].asid;
     
    188188        }
    189189       
    190         CPU->tlb_messages_count = 0;
    191190        irq_spinlock_unlock(&CPU->lock, false);
    192191        CPU->tlb_active = true;
  • uspace/Makefile

    rae49252 r349e510d  
    8686        srv/vfs \
    8787        srv/bd/ata_bd \
    88         srv/bd/sata_bd \
    8988        srv/bd/file_bd \
    9089        srv/bd/gxe_bd \
     
    107106        drv/infrastructure/root \
    108107        drv/infrastructure/rootvirt \
    109         drv/block/ahci \
    110108        drv/char/i8042 \
    111109        drv/char/ps2mouse \
  • uspace/app/bdsh/cmds/modules/cat/cat.c

    rae49252 r349e510d  
    6262static sysarg_t console_rows = 0;
    6363static bool should_quit = false;
    64 static bool dash_represents_stdin = false;
    6564
    6665static console_ctrl_t *console = NULL;
     
    7473        { "more", no_argument, 0, 'm' },
    7574        { "hex", no_argument, 0, 'x' },
    76         { "stdin", no_argument, 0, 's' },
    7775        { 0, 0, 0, 0 }
    7876};
     
    9593                "  -m, --more       Pause after each screen full\n"
    9694                "  -x, --hex        Print bytes as hex values\n"
    97                 "  -s  --stdin      Treat `-' in file list as standard input\n"
    9895                "Currently, %s is under development, some options don't work.\n",
    9996                cmdname, cmdname);
     
    175172        off64_t file_size = 0, length = 0;
    176173
    177         bool reading_stdin = dash_represents_stdin && (str_cmp(fname, "-") == 0);
    178        
    179         if (reading_stdin) {
    180                 fd = fileno(stdin);
    181                 /* Allow storing the whole UTF-8 character. */
    182                 blen = STR_BOUNDS(1);
    183         } else
    184                 fd = open(fname, O_RDONLY);
    185        
     174        fd = open(fname, O_RDONLY);
    186175        if (fd < 0) {
    187176                printf("Unable to open %s\n", fname);
     
    218207
    219208        do {
    220                 size_t bytes_to_read;
    221                 if (reading_stdin) {
    222                         bytes_to_read = 1;
    223                 } else {
    224                         if ((length != CAT_FULL_FILE) &&
    225                             (length - (off64_t)count <= (off64_t)(blen - copied_bytes))) {
    226                                 bytes_to_read = (size_t) (length - count);
    227                         } else {
    228                                 bytes_to_read = blen - copied_bytes;
    229                         }
    230                 }
    231                
    232                 bytes = read(fd, buff + copied_bytes, bytes_to_read);
     209                bytes = read(fd, buff + copied_bytes, (
     210                        (length != CAT_FULL_FILE && length - (off64_t)count <= (off64_t)(blen - copied_bytes)) ?
     211                        (size_t)(length - count) :
     212                        (blen - copied_bytes) ) );
    233213                bytes += copied_bytes;
    234214                copied_bytes = 0;
     
    262242                        reads++;
    263243                }
    264                
    265                 if (reading_stdin)
    266                         fflush(stdout);
    267244        } while (bytes > 0 && !should_quit && (count < length || length == CAT_FULL_FILE));
    268245
     
    307284
    308285        for (c = 0, optind = 0, opt_ind = 0; c != -1;) {
    309                 c = getopt_long(argc, argv, "xhvmH:t:b:s", long_options, &opt_ind);
     286                c = getopt_long(argc, argv, "xhvmH:t:b:", long_options, &opt_ind);
    310287                switch (c) {
    311288                case 'h':
     
    341318                        hex = true;
    342319                        break;
    343                 case 's':
    344                         dash_represents_stdin = true;
    345                         break;
    346320                }
    347321        }
  • uspace/drv/bus/isa/isa.c

    rae49252 r349e510d  
    201201
    202202        isa_fun_t *fun = ddf_fun_data_alloc(fnode, sizeof(isa_fun_t));
    203         if (fun == NULL) {
    204                 ddf_fun_destroy(fnode);
     203        if (fun == NULL)
    205204                return NULL;
    206         }
    207205
    208206        fibril_mutex_initialize(&fun->mutex);
     
    554552
    555553        isa_fun_t *fun = isa_fun_create(isa, fun_name);
    556         free(fun_name);
    557554        if (fun == NULL) {
     555                free(fun_name);
    558556                return NULL;
    559557        }
  • uspace/drv/nic/ne2k/dp8390.c

    rae49252 r349e510d  
    201201        /* Check if the DP8390 is really there */
    202202        uint8_t val = pio_read_8(ne2k->port + DP_CR);
    203         if ((val & (CR_STP | CR_TXP | CR_DM_ABORT)) != (CR_STP | CR_DM_ABORT))
     203        if ((val & (CR_STP | CR_DM_ABORT)) != (CR_STP | CR_DM_ABORT))
    204204                return EXDEV;
    205205       
  • uspace/lib/c/Makefile

    rae49252 r349e510d  
    7171        generic/device/nic.c \
    7272        generic/device/pci.c \
    73         generic/device/ahci.c \
    7473        generic/elf/elf_load.c \
    7574        generic/event.c \
  • uspace/lib/c/include/ipc/dev_iface.h

    rae49252 r349e510d  
    5151        /** Interface provided by USB HID devices. */
    5252        USBHID_DEV_IFACE,
    53         /** Interface provided by AHCI devices. */
    54         AHCI_DEV_IFACE,
    5553
    5654        DEV_IFACE_MAX
  • uspace/lib/drv/Makefile

    rae49252 r349e510d  
    4444        generic/remote_pci.c \
    4545        generic/remote_usbhc.c \
    46         generic/remote_usbhid.c \
    47         generic/remote_ahci.c
     46        generic/remote_usbhid.c
    4847
    4948include $(USPACE_PREFIX)/Makefile.common
  • uspace/lib/drv/generic/dev_iface.c

    rae49252 r349e510d  
    4646#include "remote_usbhid.h"
    4747#include "remote_pci.h"
    48 #include "remote_ahci.h"
    4948
    5049static iface_dipatch_table_t remote_ifaces = {
     
    5655                &remote_usb_iface,
    5756                &remote_usbhc_iface,
    58                 &remote_usbhid_iface,
    59                 &remote_ahci_iface
     57                &remote_usbhid_iface
    6058        }
    6159};
  • uspace/srv/devman/main.c

    rae49252 r349e510d  
    419419       
    420420        /* Check that function with same name is not there already. */
    421         fun_node_t *tfun = find_fun_node_in_device(tree, pdev, fun_name);
    422         if (tfun) {
    423                 fun_del_ref(tfun);      /* drop the new unwanted reference */
     421        if (find_fun_node_in_device(tree, pdev, fun_name) != NULL) {
    424422                fibril_rwlock_write_unlock(&tree->rwlock);
    425423                dev_del_ref(pdev);
  • uspace/srv/hid/console/console.c

    rae49252 r349e510d  
    7676} console_state_t;
    7777
    78 #define UTF8_CHAR_BUFFER_SIZE (STR_BOUNDS(1) + 1)
    79 
    8078typedef struct {
    8179        atomic_t refcnt;           /**< Connection reference count */
    8280        prodcons_t input_pc;       /**< Incoming keyboard events */
    83         char char_remains[UTF8_CHAR_BUFFER_SIZE]; /**< Not yet sent bytes of last char event. */
    84         size_t char_remains_len;   /**< Number of not yet sent bytes. */
    8581       
    8682        fibril_mutex_t mtx;        /**< Lock protecting mutable fields */
     
    617613       
    618614        size_t pos = 0;
    619        
    620         /*
    621          * Read input from keyboard and copy it to the buffer.
    622          * We need to handle situation when wchar is split by 2 following
    623          * reads.
    624          */
    625615        while (pos < size) {
    626                 /* Copy to the buffer remaining characters. */
    627                 while ((pos < size) && (cons->char_remains_len > 0)) {
    628                         buf[pos] = cons->char_remains[0];
     616                link_t *link = prodcons_consume(&cons->input_pc);
     617                kbd_event_t *event = list_get_instance(link, kbd_event_t, link);
     618               
     619                if (event->type == KEY_PRESS) {
     620                        buf[pos] = event->c;
    629621                        pos++;
    630                        
    631                         /* Unshift the array. */
    632                         for (size_t i = 1; i < cons->char_remains_len; i++)
    633                                 cons->char_remains[i - 1] = cons->char_remains[i];
    634                        
    635                         cons->char_remains_len--;
    636                 }
    637                
    638                 /* Still not enough? Then get another key from the queue. */
    639                 if (pos < size) {
    640                         link_t *link = prodcons_consume(&cons->input_pc);
    641                         kbd_event_t *event = list_get_instance(link, kbd_event_t, link);
    642                        
    643                         /* Accept key presses of printable chars only. */
    644                         if ((event->type == KEY_PRESS) && (event->c != 0)) {
    645                                 wchar_t tmp[2] = { event->c, 0 };
    646                                 wstr_to_str(cons->char_remains, UTF8_CHAR_BUFFER_SIZE, tmp);
    647                                 cons->char_remains_len = str_size(cons->char_remains);
    648                         }
    649                        
    650                         free(event);
    651                 }
     622                }
     623               
     624                free(event);
    652625        }
    653626       
     
    957930                fibril_mutex_initialize(&consoles[i].mtx);
    958931                prodcons_initialize(&consoles[i].input_pc);
    959                 consoles[i].char_remains_len = 0;
    960932               
    961933                if (graphics_state == GRAPHICS_FULL) {
Note: See TracChangeset for help on using the changeset viewer.