Changeset f4c2b6a in mainline


Ignore:
Timestamp:
2008-06-03T14:59:48Z (16 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
2c4fb51
Parents:
b63f8569
Message:

reflect changes in generic code
proper formatting directives
coding style

Location:
kernel
Files:
27 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/amd64/src/debugger.c

    rb63f8569 rf4c2b6a  
    107107        unsigned int i;
    108108        char *symbol;
    109        
    110         if (sizeof(void *) == 4) {
    111                 printf("#  Count Address    In symbol\n");
    112                 printf("-- ----- ---------- ---------\n");
    113         } else {
    114                 printf("#  Count Address            In symbol\n");
    115                 printf("-- ----- ------------------ ---------\n");
    116         }
     109
     110#ifdef __32_BITS__     
     111        printf("#  Count Address    In symbol\n");
     112        printf("-- ----- ---------- ---------\n");
     113#endif
     114
     115#ifdef __64_BITS__
     116        printf("#  Count Address            In symbol\n");
     117        printf("-- ----- ------------------ ---------\n");
     118#endif
    117119       
    118120        for (i = 0; i < BKPOINTS_MAX; i++)
    119121                if (breakpoints[i].address) {
    120122                        symbol = get_symtab_entry(breakpoints[i].address);
    121                        
    122                         if (sizeof(void *) == 4)
    123                                 printf("%-2u %-5d %#10zx %s\n", i, breakpoints[i].counter,
    124                                         breakpoints[i].address, symbol);
    125                         else
    126                                 printf("%-2u %-5d %#18zx %s\n", i, breakpoints[i].counter,
    127                                         breakpoints[i].address, symbol);
     123
     124#ifdef __32_BITS__
     125                        printf("%-2u %-5d %#10zx %s\n", i, breakpoints[i].counter,
     126                                breakpoints[i].address, symbol);
     127#endif
     128
     129#ifdef __64_BITS__
     130                        printf("%-2u %-5d %#18zx %s\n", i, breakpoints[i].counter,
     131                                breakpoints[i].address, symbol);
     132#endif
     133
    128134                }
    129135        return 1;
     
    163169                        ;
    164170                } else {
    165                         if (sizeof(int) == 4)
    166                                 dr7 |= ((unative_t) 0x3) << (18 + 4*curidx);
    167                         else /* 8 */
    168                                 dr7 |= ((unative_t) 0x2) << (18 + 4*curidx);
     171               
     172#ifdef __32_BITS__
     173                        dr7 |= ((unative_t) 0x3) << (18 + 4 * curidx);
     174#endif
     175
     176#ifdef __64_BITS__
     177                        dr7 |= ((unative_t) 0x2) << (18 + 4 * curidx);
     178#endif
    169179                       
    170180                        if ((flags & BKPOINT_WRITE))
    171                                 dr7 |= ((unative_t) 0x1) << (16 + 4*curidx);
     181                                dr7 |= ((unative_t) 0x1) << (16 + 4 * curidx);
    172182                        else if ((flags & BKPOINT_READ_WRITE))
    173                                 dr7 |= ((unative_t) 0x3) << (16 + 4*curidx);
     183                                dr7 |= ((unative_t) 0x3) << (16 + 4 * curidx);
    174184                }
    175185
  • kernel/arch/amd64/src/proc/thread.c

    rb63f8569 rf4c2b6a  
    4747         */
    4848        t->arch.syscall_rsp[SYSCALL_KSTACK_RSP] =
    49             (uintptr_t)&t->kstack[PAGE_SIZE - sizeof(uint64_t)];
     49            (uintptr_t) &t->kstack[PAGE_SIZE - sizeof(uint64_t)];
    5050}
    5151
  • kernel/arch/ia32/include/mm/page.h

    rb63f8569 rf4c2b6a  
    129129#include <mm/mm.h>
    130130#include <arch/interrupt.h>
     131#include <arch/types.h>
     132#include <typedefs.h>
    131133
    132134/* Page fault error codes. */
  • kernel/arch/ia32/include/smp/apic.h

    rb63f8569 rf4c2b6a  
    106106
    107107/** Interrupt Command Register. */
    108 #define ICRlo           (0x300/sizeof(uint32_t))
    109 #define ICRhi           (0x310/sizeof(uint32_t))
     108#define ICRlo           (0x300 / sizeof(uint32_t))
     109#define ICRhi           (0x310 / sizeof(uint32_t))
    110110typedef struct {
    111111        union {
     
    134134
    135135/* End Of Interrupt. */
    136 #define EOI             (0x0b0/sizeof(uint32_t))
     136#define EOI             (0x0b0 / sizeof(uint32_t))
    137137
    138138/** Error Status Register. */
    139 #define ESR             (0x280/sizeof(uint32_t))
     139#define ESR             (0x280 / sizeof(uint32_t))
    140140typedef union {
    141141        uint32_t value;
     
    155155
    156156/* Task Priority Register */
    157 #define TPR             (0x080/sizeof(uint32_t))
     157#define TPR             (0x080 / sizeof(uint32_t))
    158158typedef union {
    159159        uint32_t value;
     
    165165
    166166/** Spurious-Interrupt Vector Register. */
    167 #define SVR             (0x0f0/sizeof(uint32_t))
     167#define SVR             (0x0f0 / sizeof(uint32_t))
    168168typedef union {
    169169        uint32_t value;
     
    177177
    178178/** Time Divide Configuration Register. */
    179 #define TDCR            (0x3e0/sizeof(uint32_t))
     179#define TDCR            (0x3e0 / sizeof(uint32_t))
    180180typedef union {
    181181        uint32_t value;
     
    187187
    188188/* Initial Count Register for Timer */
    189 #define ICRT            (0x380/sizeof(uint32_t))
     189#define ICRT            (0x380 / sizeof(uint32_t))
    190190
    191191/* Current Count Register for Timer */
    192 #define CCRT            (0x390/sizeof(uint32_t))
     192#define CCRT            (0x390 / sizeof(uint32_t))
    193193
    194194/** LVT Timer register. */
    195 #define LVT_Tm          (0x320/sizeof(uint32_t))
     195#define LVT_Tm          (0x320 / sizeof(uint32_t))
    196196typedef union {
    197197        uint32_t value;
     
    208208
    209209/** LVT LINT registers. */
    210 #define LVT_LINT0       (0x350/sizeof(uint32_t))
    211 #define LVT_LINT1       (0x360/sizeof(uint32_t))
     210#define LVT_LINT0       (0x350 / sizeof(uint32_t))
     211#define LVT_LINT1       (0x360 / sizeof(uint32_t))
    212212typedef union {
    213213        uint32_t value;
     
    226226
    227227/** LVT Error register. */
    228 #define LVT_Err         (0x370/sizeof(uint32_t))
     228#define LVT_Err         (0x370 / sizeof(uint32_t))
    229229typedef union {
    230230        uint32_t value;
     
    240240
    241241/** Local APIC ID Register. */
    242 #define L_APIC_ID       (0x020/sizeof(uint32_t))
     242#define L_APIC_ID       (0x020 / sizeof(uint32_t))
    243243typedef union {
    244244        uint32_t value;
     
    250250
    251251/** Local APIC Version Register */
    252 #define LAVR            (0x030/sizeof(uint32_t))
     252#define LAVR            (0x030 / sizeof(uint32_t))
    253253#define LAVR_Mask       0xff
    254 #define is_local_apic(x)        (((x)&LAVR_Mask&0xf0)==0x1)
    255 #define is_82489DX_apic(x)      ((((x)&LAVR_Mask&0xf0)==0x0))
    256 #define is_local_xapic(x)       (((x)&LAVR_Mask)==0x14)
     254#define is_local_apic(x)        (((x) & LAVR_Mask & 0xf0) == 0x1)
     255#define is_82489DX_apic(x)      ((((x) & LAVR_Mask & 0xf0) == 0x0))
     256#define is_local_xapic(x)       (((x) & LAVR_Mask) == 0x14)
    257257
    258258/** Logical Destination Register. */
    259 #define  LDR            (0x0d0/sizeof(uint32_t))
     259#define  LDR            (0x0d0 / sizeof(uint32_t))
    260260typedef union {
    261261        uint32_t value;
     
    267267
    268268/** Destination Format Register. */
    269 #define DFR             (0x0e0/sizeof(uint32_t))
     269#define DFR             (0x0e0 / sizeof(uint32_t))
    270270typedef union {
    271271        uint32_t value;
     
    277277
    278278/* IO APIC */
    279 #define IOREGSEL        (0x00/sizeof(uint32_t))
    280 #define IOWIN           (0x10/sizeof(uint32_t))
     279#define IOREGSEL        (0x00 / sizeof(uint32_t))
     280#define IOWIN           (0x10 / sizeof(uint32_t))
    281281
    282282#define IOAPICID        0x00
  • kernel/arch/ia32/src/debug/panic.s

    rb63f8569 rf4c2b6a  
    3131
    3232panic_printf:
    33         movl $halt,(%esp)       # fake stack to make printf return to halt
     33        movl $halt, (%esp)      # fake stack to make printf return to halt
    3434        jmp printf
  • kernel/arch/ia32xen/src/smp/smp.c

    rb63f8569 rf4c2b6a  
    143143                 * Prepare new GDT for CPU in question.
    144144                 */
    145                 if (!(gdt_new = (struct descriptor *) malloc(GDT_ITEMS*sizeof(struct descriptor), FRAME_ATOMIC)))
     145                if (!(gdt_new = (struct descriptor *) malloc(GDT_ITEMS * sizeof(struct descriptor), FRAME_ATOMIC)))
    146146                        panic("couldn't allocate memory for GDT\n");
    147147
  • kernel/arch/mips32/src/debugger.c

    rb63f8569 rf4c2b6a  
    153153
    154154        /* Check, that the breakpoints do not conflict */
    155         for (i=0; i<BKPOINTS_MAX; i++) {
     155        for (i = 0; i < BKPOINTS_MAX; i++) {
    156156                if (breakpoints[i].address == (uintptr_t)argv->intval) {
    157157                        printf("Duplicate breakpoint %d.\n", i);
     
    315315                /* Reinst only breakpoint */
    316316                if ((breakpoints[i].flags & BKPOINT_REINST) \
    317                     && (fireaddr ==breakpoints[i].address+sizeof(unative_t))) {
     317                    && (fireaddr == breakpoints[i].address + sizeof(unative_t))) {
    318318                        cur = &breakpoints[i];
    319319                        break;
  • kernel/arch/mips32/src/exception.c

    rb63f8569 rf4c2b6a  
    162162                                 */
    163163#ifdef CONFIG_DEBUG
    164                                 printf("cpu%d: spurious interrupt (inum=%d)\n", CPU->id, i);
     164                                printf("cpu%u: spurious interrupt (inum=%d)\n", CPU->id, i);
    165165#endif
    166166                        }
  • kernel/arch/ppc32/include/boot/boot.h

    rb63f8569 rf4c2b6a  
    3939
    4040/* Temporary stack size for boot process */
    41 #define TEMP_STACK_SIZE 0x100
     41#define TEMP_STACK_SIZE 0x1000
    4242
    4343#define TASKMAP_MAX_RECORDS 32
  • kernel/arch/ppc32/include/drivers/cuda.h

    rb63f8569 rf4c2b6a  
    3737
    3838#include <arch/types.h>
     39#include <typedefs.h>
    3940
    4041extern void cuda_init(devno_t devno, uintptr_t base, size_t size);
  • kernel/arch/ppc32/include/exception.h

    rb63f8569 rf4c2b6a  
    8383        istate->pc = retaddr;
    8484}
     85
    8586/** Return true if exception happened while in userspace */
    8687#include <panic.h>
     
    9091        return 0;
    9192}
     93
    9294static inline unative_t istate_get_pc(istate_t *istate)
    9395{
  • kernel/arch/ppc32/include/mm/tlb.h

    rb63f8569 rf4c2b6a  
    3737
    3838#include <arch/interrupt.h>
     39#include <arch/types.h>
     40#include <typedefs.h>
    3941
    4042typedef struct {
  • kernel/arch/ppc32/src/interrupt.c

    rb63f8569 rf4c2b6a  
    8181                         */
    8282#ifdef CONFIG_DEBUG
    83                         printf("cpu%d: spurious interrupt (inum=%d)\n", CPU->id, inum);
     83                        printf("cpu%u: spurious interrupt (inum=%d)\n", CPU->id, inum);
    8484#endif
    8585                }
  • kernel/arch/ppc32/src/mm/page.c

    rb63f8569 rf4c2b6a  
    4949{
    5050        if (last_frame + ALIGN_UP(size, PAGE_SIZE) > KA2PA(KERNEL_ADDRESS_SPACE_END_ARCH))
    51                 panic("Unable to map physical memory %p (%d bytes)", physaddr, size)
     51                panic("Unable to map physical memory %p (%" PRIs " bytes)", physaddr, size)
    5252       
    5353        uintptr_t virtaddr = PA2KA(last_frame);
  • kernel/arch/ppc64/include/exception.h

    rb63f8569 rf4c2b6a  
    8383        istate->pc = retaddr;
    8484}
     85
    8586/** Return true if exception happened while in userspace */
    8687#include <panic.h>
     
    9091        return 0;
    9192}
     93
    9294static inline unative_t istate_get_pc(istate_t *istate)
    9395{
  • kernel/arch/ppc64/src/cpu/cpu.c

    rb63f8569 rf4c2b6a  
    5454void cpu_print_report(cpu_t *m)
    5555{
    56         printf("cpu%d: version=%d, revision=%d\n", m->id, m->arch.version, m->arch.revision);
     56        printf("cpu%u: version=%d, revision=%d\n", m->id, m->arch.version, m->arch.revision);
    5757}
    5858
  • kernel/arch/ppc64/src/interrupt.c

    rb63f8569 rf4c2b6a  
    8181                         */
    8282#ifdef CONFIG_DEBUG
    83                         printf("cpu%d: spurious interrupt (inum=%d)\n", CPU->id, inum);
     83                        printf("cpu%u: spurious interrupt (inum=%d)\n", CPU->id, inum);
    8484#endif
    8585                }
  • kernel/arch/ppc64/src/mm/page.c

    rb63f8569 rf4c2b6a  
    290290{
    291291        if (last_frame + ALIGN_UP(size, PAGE_SIZE) > KA2PA(KERNEL_ADDRESS_SPACE_END_ARCH))
    292                 panic("Unable to map physical memory %p (%d bytes)", physaddr, size)
     292                panic("Unable to map physical memory %p (%" PRIs " bytes)", physaddr, size)
    293293       
    294294        uintptr_t virtaddr = PA2KA(last_frame);
  • kernel/arch/sparc64/include/asm.h

    rb63f8569 rf4c2b6a  
    3838#include <arch/arch.h>
    3939#include <arch/types.h>
     40#include <typedefs.h>
    4041#include <align.h>
    4142#include <arch/register.h>
  • kernel/arch/sparc64/include/cpu.h

    rb63f8569 rf4c2b6a  
    3737
    3838#include <arch/types.h>
     39#include <typedefs.h>
    3940#include <arch/register.h>
    4041#include <arch/asm.h>
  • kernel/arch/sparc64/src/cpu/cpu.c

    rb63f8569 rf4c2b6a  
    136136        }
    137137
    138         printf("cpu%d: manuf=%s, impl=%s, mask=%d (%dMHz)\n", m->id, manuf,
     138        printf("cpu%d: manuf=%s, impl=%s, mask=%d (%d MHz)\n", m->id, manuf,
    139139                impl, m->arch.ver.mask, m->arch.clock_frequency / 1000000);
    140140}
  • kernel/arch/sparc64/src/smp/smp.c

    rb63f8569 rf4c2b6a  
    100100               
    101101                if (waitq_sleep_timeout(&ap_completion_wq, 1000000, SYNCH_FLAGS_NONE) == ESYNCH_TIMEOUT)
    102                         printf("%s: waiting for processor (mid = %d) timed out\n",
     102                        printf("%s: waiting for processor (mid = %" PRIu32 ") timed out\n",
    103103                            __func__, mid);
    104104        }
  • kernel/arch/sparc64/src/trap/exception.c

    rb63f8569 rf4c2b6a  
    4646void dump_istate(istate_t *istate)
    4747{
    48         printf("TSTATE=%#llx\n", istate->tstate);
    49         printf("TPC=%#llx (%s)\n", istate->tpc, get_symtab_entry(istate->tpc));
    50         printf("TNPC=%#llx (%s)\n", istate->tnpc, get_symtab_entry(istate->tnpc));
     48        printf("TSTATE=%#" PRIx64 "\n", istate->tstate);
     49        printf("TPC=%#" PRIx64 " (%s)\n", istate->tpc, get_symtab_entry(istate->tpc));
     50        printf("TNPC=%#" PRIx64 " (%s)\n", istate->tnpc, get_symtab_entry(istate->tnpc));
    5151}
    5252
  • kernel/arch/sparc64/src/trap/interrupt.c

    rb63f8569 rf4c2b6a  
    9898                 */
    9999#ifdef CONFIG_DEBUG
    100                 printf("cpu%d: spurious interrupt (intrcv=%#llx, "
    101                         "data0=%#llx)\n", CPU->id, intrcv, data0);
     100                printf("cpu%u: spurious interrupt (intrcv=%#" PRIx64
     101                        ", data0=%#" PRIx64 ")\n", CPU->id, intrcv, data0);
    102102#endif
    103103        }
  • kernel/genarch/include/ofw/ofw_tree.h

    rb63f8569 rf4c2b6a  
    3131
    3232#include <arch/types.h>
     33#include <typedefs.h>
    3334
    3435#define OFW_TREE_PROPERTY_MAX_NAMELEN   32
  • kernel/genarch/src/acpi/acpi.c

    rb63f8569 rf4c2b6a  
    106106                                        goto next;
    107107                                *signature_map[j].sdt_ptr = h;
    108                                 printf("%#zp: ACPI %s\n", *signature_map[j].sdt_ptr, signature_map[j].description);
     108                                printf("%p: ACPI %s\n", *signature_map[j].sdt_ptr, signature_map[j].description);
    109109                        }
    110110                }
     
    127127                                        goto next;
    128128                                *signature_map[j].sdt_ptr = h;
    129                                 printf("%#zp: ACPI %s\n", *signature_map[j].sdt_ptr, signature_map[j].description);
     129                                printf("%p: ACPI %s\n", *signature_map[j].sdt_ptr, signature_map[j].description);
    130130                        }
    131131                }
     
    161161
    162162rsdp_found:
    163         printf("%#zp: ACPI Root System Description Pointer\n", acpi_rsdp);
     163        printf("%p: ACPI Root System Description Pointer\n", acpi_rsdp);
    164164
    165165        acpi_rsdt = (struct acpi_rsdt *) (unative_t) acpi_rsdp->rsdt_address;
     
    170170
    171171        if (acpi_rsdt && !acpi_sdt_check((uint8_t *) acpi_rsdt)) {
    172                 printf("RSDT: %s\n", "bad checksum");
     172                printf("RSDT: bad checksum\n");
    173173                return;
    174174        }
    175175        if (acpi_xsdt && !acpi_sdt_check((uint8_t *) acpi_xsdt)) {
    176                 printf("XSDT: %s\n", "bad checksum");
     176                printf("XSDT: bad checksum\n");
    177177                return;
    178178        }
  • kernel/genarch/src/acpi/madt.c

    rb63f8569 rf4c2b6a  
    127127int madt_irq_to_pin(unsigned int irq)
    128128{
    129         ASSERT(irq < sizeof(isa_irq_map)/sizeof(int));
     129        ASSERT(irq < sizeof(isa_irq_map) / sizeof(int));
    130130        return isa_irq_map[irq];
    131131}
     
    185185                                case MADT_L_SAPIC:
    186186                                case MADT_PLATFORM_INTR_SRC:
    187                                         printf("MADT: skipping %s entry (type=%zd)\n", entry[h->type], h->type);
     187                                        printf("MADT: skipping %s entry (type=%" PRIu8 ")\n", entry[h->type], h->type);
    188188                                        break;
    189189       
    190190                                default:
    191191                                        if (h->type >= MADT_RESERVED_SKIP_BEGIN && h->type <= MADT_RESERVED_SKIP_END) {
    192                                                 printf("MADT: skipping reserved entry (type=%zd)\n", h->type);
     192                                                printf("MADT: skipping reserved entry (type=%" PRIu8 ")\n", h->type);
    193193                                        }
    194194                                        if (h->type >= MADT_RESERVED_OEM_BEGIN) {
    195                                                 printf("MADT: skipping OEM entry (type=%zd)\n", h->type);
     195                                                printf("MADT: skipping OEM entry (type=%" PRIu8 ")\n", h->type);
    196196                                        }
    197197                                        break;
     
    234234void madt_intr_src_ovrd_entry(struct madt_intr_src_ovrd *override, uint32_t index)
    235235{
    236         ASSERT(override->source < sizeof(isa_irq_map)/sizeof(int));
    237         printf("MADT: ignoring %s entry: bus=%zd, source=%zd, global_int=%zd, flags=%#hx\n",
     236        ASSERT(override->source < sizeof(isa_irq_map) / sizeof(int));
     237        printf("MADT: ignoring %s entry: bus=%" PRIu8 ", source=%" PRIu8 ", global_int=%" PRIu32 ", flags=%#" PRIx16 "\n",
    238238                entry[override->header.type], override->bus, override->source,
    239239                override->global_int, override->flags);
Note: See TracChangeset for help on using the changeset viewer.