Changeset 5d67baa in mainline


Ignore:
Timestamp:
2008-06-30T20:33:18Z (16 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
939e9c1
Parents:
ac0e791
Message:

cstyle fixes

Location:
kernel
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/ppc32/src/mm/page.c

    rac0e791 r5d67baa  
    4848uintptr_t hw_map(uintptr_t physaddr, size_t size)
    4949{
    50         if (last_frame + ALIGN_UP(size, PAGE_SIZE) > KA2PA(KERNEL_ADDRESS_SPACE_END_ARCH))
    51                 panic("Unable to map physical memory %p (%" PRIs " bytes)", physaddr, size)
     50        if (last_frame + ALIGN_UP(size, PAGE_SIZE) >
     51            KA2PA(KERNEL_ADDRESS_SPACE_END_ARCH))
     52                panic("Unable to map physical memory %p (%" PRIs " bytes)",
     53                    physaddr, size)
    5254       
    5355        uintptr_t virtaddr = PA2KA(last_frame);
    5456        pfn_t i;
    5557        for (i = 0; i < ADDR2PFN(ALIGN_UP(size, PAGE_SIZE)); i++)
    56                 page_mapping_insert(AS_KERNEL, virtaddr + PFN2ADDR(i), physaddr + PFN2ADDR(i), PAGE_NOT_CACHEABLE | PAGE_WRITE);
     58                page_mapping_insert(AS_KERNEL, virtaddr + PFN2ADDR(i),
     59                    physaddr + PFN2ADDR(i), PAGE_NOT_CACHEABLE | PAGE_WRITE);
    5760       
    5861        last_frame = ALIGN_UP(last_frame + size, FRAME_SIZE);
  • kernel/arch/ppc32/src/mm/tlb.c

    rac0e791 r5d67baa  
    4848 * if lock is true.
    4949 *
    50  * @param as       Address space.
    51  * @param lock     Lock/unlock the address space.
    52  * @param badvaddr Faulting virtual address.
    53  * @param access   Access mode that caused the fault.
    54  * @param istate   Pointer to interrupted state.
    55  * @param pfrc     Pointer to variable where as_page_fault() return code will be stored.
    56  * @return         PTE on success, NULL otherwise.
    57  *
    58  */
    59 static pte_t *find_mapping_and_check(as_t *as, bool lock, uintptr_t badvaddr, int access, istate_t *istate, int *pfrc)
     50 * @param as            Address space.
     51 * @param lock          Lock/unlock the address space.
     52 * @param badvaddr      Faulting virtual address.
     53 * @param access        Access mode that caused the fault.
     54 * @param istate        Pointer to interrupted state.
     55 * @param pfrc          Pointer to variable where as_page_fault() return code
     56 *                      will be stored.
     57 * @return              PTE on success, NULL otherwise.
     58 *
     59 */
     60static pte_t *
     61find_mapping_and_check(as_t *as, bool lock, uintptr_t badvaddr, int access,
     62    istate_t *istate, int *pfrc)
    6063{
    6164        /*
     
    7881                page_table_unlock(as, lock);
    7982                switch (rc = as_page_fault(badvaddr, access, istate)) {
    80                         case AS_PF_OK:
    81                                 /*
    82                                 * The higher-level page fault handler succeeded,
    83                                 * The mapping ought to be in place.
    84                                 */
    85                                 page_table_lock(as, lock);
    86                                 pte = page_mapping_find(as, badvaddr);
    87                                 ASSERT((pte) && (pte->p));
    88                                 *pfrc = 0;
    89                                 return pte;
    90                         case AS_PF_DEFER:
    91                                 page_table_lock(as, lock);
    92                                 *pfrc = rc;
    93                                 return NULL;
    94                         case AS_PF_FAULT:
    95                                 page_table_lock(as, lock);
    96                                 printf("Page fault.\n");
    97                                 *pfrc = rc;
    98                                 return NULL;
    99                         default:
    100                                 panic("unexpected rc (%d)\n", rc);
     83                case AS_PF_OK:
     84                        /*
     85                        * The higher-level page fault handler succeeded,
     86                        * The mapping ought to be in place.
     87                        */
     88                        page_table_lock(as, lock);
     89                        pte = page_mapping_find(as, badvaddr);
     90                        ASSERT((pte) && (pte->p));
     91                        *pfrc = 0;
     92                        return pte;
     93                case AS_PF_DEFER:
     94                        page_table_lock(as, lock);
     95                        *pfrc = rc;
     96                        return NULL;
     97                case AS_PF_FAULT:
     98                        page_table_lock(as, lock);
     99                        printf("Page fault.\n");
     100                        *pfrc = rc;
     101                        return NULL;
     102                default:
     103                        panic("unexpected rc (%d)\n", rc);
    101104                }       
    102105        }
     
    115118        if (s)
    116119                sym2 = s;
    117         panic("%p: PHT Refill Exception at %p (%s<-%s)\n", badvaddr, istate->pc, symbol, sym2);
     120        panic("%p: PHT Refill Exception at %p (%s<-%s)\n", badvaddr,
     121            istate->pc, symbol, sym2);
    118122}
    119123
     
    148152           PTE in PTEG */
    149153        for (i = 0; i < 8; i++) {
    150                 if ((!phte[base + i].v) || ((phte[base + i].vsid == vsid) && (phte[base + i].api == api))) {
     154                if ((!phte[base + i].v) || ((phte[base + i].vsid == vsid) &&
     155                    (phte[base + i].api == api))) {
    151156                        found = true;
    152157                        break;
     
    161166                   PTE in PTEG */
    162167                for (i = 0; i < 8; i++) {
    163                         if ((!phte[base2 + i].v) || ((phte[base2 + i].vsid == vsid) && (phte[base2 + i].api == api))) {
     168                        if ((!phte[base2 + i].v) ||
     169                            ((phte[base2 + i].vsid == vsid) &&
     170                            (phte[base2 + i].api == api))) {
    164171                                found = true;
    165172                                base = base2;
     
    215222           PTE in PTEG */
    216223        for (i = 0; i < 8; i++) {
    217                 if ((!phte_physical[base + i].v) || ((phte_physical[base + i].vsid == vsid) && (phte_physical[base + i].api == api))) {
     224                if ((!phte_physical[base + i].v) ||
     225                    ((phte_physical[base + i].vsid == vsid) &&
     226                    (phte_physical[base + i].api == api))) {
    218227                        found = true;
    219228                        break;
     
    228237                   PTE in PTEG */
    229238                for (i = 0; i < 8; i++) {
    230                         if ((!phte_physical[base2 + i].v) || ((phte_physical[base2 + i].vsid == vsid) && (phte_physical[base2 + i].api == api))) {
     239                        if ((!phte_physical[base2 + i].v) ||
     240                            ((phte_physical[base2 + i].vsid == vsid) &&
     241                            (phte_physical[base2 + i].api == api))) {
    231242                                found = true;
    232243                                base = base2;
     
    255266/** Process Instruction/Data Storage Interrupt
    256267 *
    257  * @param n Interrupt vector number.
    258  * @param istate Interrupted register context.
     268 * @param n             Interrupt vector number.
     269 * @param istate        Interrupted register context.
    259270 *
    260271 */
     
    285296        page_table_lock(as, lock);
    286297       
    287         pte = find_mapping_and_check(as, lock, badvaddr, PF_ACCESS_READ /* FIXME */, istate, &pfrc);
     298        pte = find_mapping_and_check(as, lock, badvaddr,
     299            PF_ACCESS_READ /* FIXME */, istate, &pfrc);
    288300        if (!pte) {
    289301                switch (pfrc) {
    290                         case AS_PF_FAULT:
    291                                 goto fail;
    292                                 break;
    293                         case AS_PF_DEFER:
    294                                 /*
    295                                  * The page fault came during copy_from_uspace()
    296                                 * or copy_to_uspace().
    297                                 */
    298                                 page_table_unlock(as, lock);
    299                                 return;
    300                         default:
    301                                 panic("Unexpected pfrc (%d)\n", pfrc);
     302                case AS_PF_FAULT:
     303                        goto fail;
     304                        break;
     305                case AS_PF_DEFER:
     306                        /*
     307                         * The page fault came during copy_from_uspace()
     308                        * or copy_to_uspace().
     309                        */
     310                        page_table_unlock(as, lock);
     311                        return;
     312                default:
     313                        panic("Unexpected pfrc (%d)\n", pfrc);
    302314                }
    303315        }
     
    317329/** Process Instruction/Data Storage Interrupt in Real Mode
    318330 *
    319  * @param n Interrupt vector number.
    320  * @param istate Interrupted register context.
     331 * @param n             Interrupt vector number.
     332 * @param istate        Interrupted register context.
    321333 *
    322334 */
     
    374386        uint32_t i;
    375387        for (i = 0; i < 8192; i++) {
    376                 if ((phte[i].v) && (phte[i].vsid >= (asid << 4)) && (phte[i].vsid < ((asid << 4) + 16)))
     388                if ((phte[i].v) && (phte[i].vsid >= (asid << 4)) &&
     389                    (phte[i].vsid < ((asid << 4) + 16)))
    377390                        phte[i].v = 0;
    378391        }
     
    408421        } else \
    409422                length = 0; \
    410         printf(name ": page=%.*p frame=%.*p length=%d KB (mask=%#x)%s%s\n", sizeof(upper) * 2, upper & 0xffff0000, sizeof(lower) * 2, lower & 0xffff0000, length, mask, ((upper >> 1) & 1) ? " supervisor" : "", (upper & 1) ? " user" : "");
     423        printf(name ": page=%.*p frame=%.*p length=%d KB (mask=%#x)%s%s\n", \
     424            sizeof(upper) * 2, upper & 0xffff0000, sizeof(lower) * 2, \
     425            lower & 0xffff0000, length, mask, \
     426            ((upper >> 1) & 1) ? " supervisor" : "", \
     427            (upper & 1) ? " user" : "");
    411428
    412429
     
    422439                        : "r" (sr << 28)
    423440                );
    424                 printf("vsid[%d]: VSID=%.*p (ASID=%d)%s%s\n", sr, sizeof(vsid) * 2, vsid & 0xffffff, (vsid & 0xffffff) >> 4, ((vsid >> 30) & 1) ? " supervisor" : "", ((vsid >> 29) & 1) ? " user" : "");
     441                printf("vsid[%d]: VSID=%.*p (ASID=%d)%s%s\n", sr,
     442                    sizeof(vsid) * 2, vsid & 0xffffff, (vsid & 0xffffff) >> 4,
     443                    ((vsid >> 30) & 1) ? " supervisor" : "",
     444                    ((vsid >> 29) & 1) ? " user" : "");
    425445        }
    426446       
  • kernel/generic/src/console/kconsole.c

    rac0e791 r5d67baa  
    170170
    171171/** Try to find a command beginning with prefix */
    172 static const char * cmdtab_search_one(const char *name,link_t **startpos)
     172static const char *cmdtab_search_one(const char *name,link_t **startpos)
    173173{
    174174        size_t namelen = strlen(name);
     
    204204static int cmdtab_compl(char *name)
    205205{
    206         static char output[MAX_SYMBOL_NAME+1];
     206        static char output[MAX_SYMBOL_NAME + 1];
    207207        link_t *startpos = NULL;
    208208        const char *foundtxt;
     
    214214                startpos = startpos->next;
    215215                if (!found)
    216                         strncpy(output, foundtxt, strlen(foundtxt)+1);
     216                        strncpy(output, foundtxt, strlen(foundtxt) + 1);
    217217                else {
    218218                        for (i = 0; output[i] && foundtxt[i] &&
     
    241241}
    242242
    243 static char * clever_readline(const char *prompt, chardev_t *input)
     243//char *clever_readline(const char *prompt, chardev_t *input);
     244static char *clever_readline(const char *prompt, chardev_t *input)
    244245{
    245246        static int histposition = 0;
    246247
    247         static char tmp[MAX_CMDLINE+1];
     248        static char tmp[MAX_CMDLINE + 1];
    248249        int curlen = 0, position = 0;
    249250        char *current = history[histposition];
     
    258259                        putchar(c);
    259260                        break;
    260                 } if (c == '\b') { /* Backspace */
     261                }
     262                if (c == '\b') { /* Backspace */
    261263                        if (position == 0)
    262264                                continue;
     
    544546                        strncpy(buf, (const char *) &cmdline[start],
    545547                            min((end - start) + 2, cmd->argv[i].len));
    546                         buf[min((end - start) + 1, cmd->argv[i].len - 1)] = '\0';
     548                        buf[min((end - start) + 1, cmd->argv[i].len - 1)] =
     549                            '\0';
    547550                        break;
    548551                case ARG_TYPE_INT:
     
    561564                                cmd->argv[i].intval = (unative_t) buf;
    562565                                cmd->argv[i].vartype = ARG_TYPE_STRING;
    563                         } else if (!parse_int_arg(cmdline + start, end - start + 1,
    564                             &cmd->argv[i].intval)) {
     566                        } else if (!parse_int_arg(cmdline + start,
     567                            end - start + 1, &cmd->argv[i].intval)) {
    565568                                cmd->argv[i].vartype = ARG_TYPE_INT;
    566569                        } else {
  • kernel/generic/src/main/main.c

    rac0e791 r5d67baa  
    6262#include <main/version.h>
    6363#include <console/kconsole.h>
     64#include <console/console.h>
    6465#include <cpu.h>
    6566#include <align.h>
     
    8182#include <smp/smp.h>
    8283#include <ddi/ddi.h>
    83 #include <console/console.h>
     84
    8485
    8586/** Global configuration structure. */
     
    236237        LOG_EXEC(slab_enable_cpucache());
    237238       
    238         printf("Detected %" PRIc " CPU(s), %" PRIu64" MB free memory\n",
    239                 config.cpu_count, SIZE2MB(zone_total_size()));
     239        printf("Detected %" PRIc " CPU(s), %" PRIu64" MiB free memory\n",
     240            config.cpu_count, SIZE2MB(zone_total_size()));
    240241       
    241242        LOG_EXEC(cpu_init());
     
    253254                for (i = 0; i < init.cnt; i++)
    254255                        printf("init[%" PRIc "].addr=%#" PRIp ", init[%" PRIc
    255                             "].size=%#" PRIs "\n", i, init.tasks[i].addr,
    256                             i, init.tasks[i].size);
     256                            "].size=%#" PRIs "\n", i, init.tasks[i].addr, i,
     257                            init.tasks[i].size);
    257258        } else
    258259                printf("No init binaries found\n");
Note: See TracChangeset for help on using the changeset viewer.