Changeset 7bdcc45 in mainline for kernel/arch/amd64/src


Ignore:
Timestamp:
2010-12-16T16:38:49Z (15 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
7837101
Parents:
8e58f94 (diff), eb221e5 (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 mainline changes.

Location:
kernel/arch/amd64/src
Files:
7 edited

Legend:

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

    r8e58f94 r7bdcc45  
    256256 * we need not to go to CPL0 to read it.
    257257 */
    258 unative_t sys_tls_set(unative_t addr)
     258sysarg_t sys_tls_set(sysarg_t addr)
    259259{
    260260        THREAD->arch.tls = addr;
  • kernel/arch/amd64/src/boot/memmap.c

    r8e58f94 r7bdcc45  
    3535#include <arch/boot/memmap.h>
    3636
    37 uint8_t e820counter = 0xff;
     37uint8_t e820counter = 0xffU;
    3838e820memmap_t e820table[MEMMAP_E820_MAX_RECORDS];
    3939
  • kernel/arch/amd64/src/cpu/cpu.c

    r8e58f94 r7bdcc45  
    4747 * Contains only non-MP-Specification specific SMP code.
    4848 */
    49 #define AMD_CPUID_EBX  0x68747541
    50 #define AMD_CPUID_ECX  0x444d4163
    51 #define AMD_CPUID_EDX  0x69746e65
     49#define AMD_CPUID_EBX  UINT32_C(0x68747541)
     50#define AMD_CPUID_ECX  UINT32_C(0x444d4163)
     51#define AMD_CPUID_EDX  UINT32_C(0x69746e65)
    5252
    53 #define INTEL_CPUID_EBX  0x756e6547
    54 #define INTEL_CPUID_ECX  0x6c65746e
    55 #define INTEL_CPUID_EDX  0x49656e69
    56 
     53#define INTEL_CPUID_EBX  UINT32_C(0x756e6547)
     54#define INTEL_CPUID_ECX  UINT32_C(0x6c65746e)
     55#define INTEL_CPUID_EDX  UINT32_C(0x49656e69)
    5756
    5857enum vendor {
  • kernel/arch/amd64/src/debugger.c

    r8e58f94 r7bdcc45  
    125125       
    126126        /* Disable breakpoint in DR7 */
    127         unative_t dr7 = read_dr7();
    128         dr7 &= ~(0x2 << (curidx * 2));
     127        sysarg_t dr7 = read_dr7();
     128        dr7 &= ~(0x02U << (curidx * 2));
    129129       
    130130        /* Setup DR register */
     
    147147               
    148148                /* Set type to requested breakpoint & length*/
    149                 dr7 &= ~(0x3 << (16 + 4 * curidx));
    150                 dr7 &= ~(0x3 << (18 + 4 * curidx));
     149                dr7 &= ~(0x03U << (16 + 4 * curidx));
     150                dr7 &= ~(0x03U << (18 + 4 * curidx));
    151151               
    152152                if (!(flags & BKPOINT_INSTR)) {
    153153#ifdef __32_BITS__
    154                         dr7 |= ((unative_t) 0x3) << (18 + 4 * curidx);
     154                        dr7 |= ((sysarg_t) 0x03U) << (18 + 4 * curidx);
    155155#endif
    156156                       
    157157#ifdef __64_BITS__
    158                         dr7 |= ((unative_t) 0x2) << (18 + 4 * curidx);
     158                        dr7 |= ((sysarg_t) 0x02U) << (18 + 4 * curidx);
    159159#endif
    160160                       
    161161                        if ((flags & BKPOINT_WRITE))
    162                                 dr7 |= ((unative_t) 0x1) << (16 + 4 * curidx);
     162                                dr7 |= ((sysarg_t) 0x01U) << (16 + 4 * curidx);
    163163                        else if ((flags & BKPOINT_READ_WRITE))
    164                                 dr7 |= ((unative_t) 0x3) << (16 + 4 * curidx);
     164                                dr7 |= ((sysarg_t) 0x03U) << (16 + 4 * curidx);
    165165                }
    166166               
    167167                /* Enable global breakpoint */
    168                 dr7 |= 0x2 << (curidx * 2);
     168                dr7 |= 0x02U << (curidx * 2);
    169169               
    170170                write_dr7(dr7);
     
    227227        if (!(breakpoints[slot].flags & BKPOINT_INSTR)) {
    228228                if ((breakpoints[slot].flags & BKPOINT_CHECK_ZERO)) {
    229                         if (*((unative_t *) breakpoints[slot].address) != 0)
     229                        if (*((sysarg_t *) breakpoints[slot].address) != 0)
    230230                                return;
    231231                       
    232                         printf("*** Found ZERO on address %" PRIp " (slot %d) ***\n",
    233                             breakpoints[slot].address, slot);
     232                        printf("*** Found ZERO on address %p (slot %d) ***\n",
     233                            (void *) breakpoints[slot].address, slot);
    234234                } else {
    235                         printf("Data watchpoint - new data: %" PRIp "\n",
    236                             *((unative_t *) breakpoints[slot].address));
    237                 }
    238         }
    239        
    240         printf("Reached breakpoint %d:%" PRIp " (%s)\n", slot, getip(istate),
    241             symtab_fmt_name_lookup(getip(istate)));
     235                        printf("Data watchpoint - new data: %#" PRIxn "\n",
     236                            *((sysarg_t *) breakpoints[slot].address));
     237                }
     238        }
     239       
     240        printf("Reached breakpoint %d:%p (%s)\n", slot,
     241            (void *) getip(istate), symtab_fmt_name_lookup(getip(istate)));
    242242       
    243243#ifdef CONFIG_KCONSOLE
     
    260260        }
    261261       
    262         cur->address = NULL;
     262        cur->address = (uintptr_t) NULL;
    263263       
    264264        setup_dr(slot);
     
    279279#endif
    280280       
    281         unative_t dr6 = read_dr6();
     281        sysarg_t dr6 = read_dr6();
    282282       
    283283        unsigned int i;
     
    313313        unsigned int i;
    314314        for (i = 0; i < BKPOINTS_MAX; i++)
    315                 breakpoints[i].address = NULL;
     315                breakpoints[i].address = (uintptr_t) NULL;
    316316       
    317317#ifdef CONFIG_KCONSOLE
     
    363363                       
    364364#ifdef __32_BITS__
    365                         printf("%-4u %7" PRIs " %p %s\n", i,
    366                             breakpoints[i].counter, breakpoints[i].address,
     365                        printf("%-4u %7zu %p %s\n", i,
     366                            breakpoints[i].counter, (void *) breakpoints[i].address,
    367367                            symbol);
    368368#endif
    369369                       
    370370#ifdef __64_BITS__
    371                         printf("%-4u %7" PRIs " %p %s\n", i,
    372                             breakpoints[i].counter, breakpoints[i].address,
     371                        printf("%-4u %7zu %p %s\n", i,
     372                            breakpoints[i].counter, (void *) breakpoints[i].address,
    373373                            symbol);
    374374#endif
     
    384384int cmd_del_breakpoint(cmd_arg_t *argv)
    385385{
    386         unative_t bpno = argv->intval;
     386        sysarg_t bpno = argv->intval;
    387387        if (bpno > BKPOINTS_MAX) {
    388388                printf("Invalid breakpoint number.\n");
     
    405405                flags = BKPOINT_WRITE;
    406406       
    407         printf("Adding breakpoint on address: %p\n", argv->intval);
    408        
    409         int id = breakpoint_add((void *)argv->intval, flags, -1);
     407        printf("Adding breakpoint on address: %p\n",
     408            (void *) argv->intval);
     409       
     410        int id = breakpoint_add((void *) argv->intval, flags, -1);
    410411        if (id < 0)
    411412                printf("Add breakpoint failed.\n");
  • kernel/arch/amd64/src/interrupt.c

    r8e58f94 r7bdcc45  
    6565void istate_decode(istate_t *istate)
    6666{
    67         printf("cs =%p\trip=%p\trfl=%p\terr=%p\n",
    68             istate->cs, istate->rip, istate->rflags, istate->error_word);
    69 
     67        printf("cs =%#0" PRIx64 "\trip=%p\t"
     68            "rfl=%#0" PRIx64 "\terr=%#0" PRIx64 "\n",
     69            istate->cs, (void *) istate->rip,
     70            istate->rflags, istate->error_word);
     71       
    7072        if (istate_from_uspace(istate))
    71                 printf("ss =%p\n", istate->ss);
    72        
    73         printf("rax=%p\trbx=%p\trcx=%p\trdx=%p\n",
     73                printf("ss =%#0" PRIx64 "\n", istate->ss);
     74       
     75        printf("rax=%#0" PRIx64 "\trbx=%#0" PRIx64 "\t"
     76            "rcx=%#0" PRIx64 "\trdx=%#0" PRIx64 "\n",
    7477            istate->rax, istate->rbx, istate->rcx, istate->rdx);
     78       
    7579        printf("rsi=%p\trdi=%p\trbp=%p\trsp=%p\n",
    76             istate->rsi, istate->rdi, istate->rbp,
    77             istate_from_uspace(istate) ? istate->rsp : (uintptr_t)&istate->rsp);
    78         printf("r8 =%p\tr9 =%p\tr10=%p\tr11=%p\n",
     80            (void *) istate->rsi, (void *) istate->rdi,
     81            (void *) istate->rbp,
     82            istate_from_uspace(istate) ? ((void *) istate->rsp) :
     83            &istate->rsp);
     84       
     85        printf("r8 =%#0" PRIx64 "\tr9 =%#0" PRIx64 "\t"
     86            "r10=%#0" PRIx64 "\tr11=%#0" PRIx64 "\n",
    7987            istate->r8, istate->r9, istate->r10, istate->r11);
    80         printf("r12=%p\tr13=%p\tr14=%p\tr15=%p\n",
     88       
     89        printf("r12=%#0" PRIx64 "\tr13=%#0" PRIx64 "\t"
     90            "r14=%#0" PRIx64 "\tr15=%#0" PRIx64 "\n",
    8191            istate->r12, istate->r13, istate->r14, istate->r15);
    8292}
  • kernel/arch/amd64/src/mm/page.c

    r8e58f94 r7bdcc45  
    8989       
    9090        if (as_page_fault(page, access, istate) == AS_PF_FAULT) {
    91                 fault_if_from_uspace(istate, "Page fault: %#x.", page);
     91                fault_if_from_uspace(istate, "Page fault: %p.", (void *) page);
    9292                panic_memtrap(istate, access, page, NULL);
    9393        }
     
    9797{
    9898        if (last_frame + ALIGN_UP(size, PAGE_SIZE) > KA2PA(KERNEL_ADDRESS_SPACE_END_ARCH))
    99                 panic("Unable to map physical memory %p (%" PRIs " bytes).", physaddr,
    100                     size);
     99                panic("Unable to map physical memory %p (%zu bytes).",
     100                    (void *) physaddr, size);
    101101       
    102102        uintptr_t virtaddr = PA2KA(last_frame);
  • kernel/arch/amd64/src/pm.c

    r8e58f94 r7bdcc45  
    2828 */
    2929
    30 /** @addtogroup amd64   
     30/** @addtogroup amd64
    3131 * @{
    3232 */
     
    5252        { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
    5353        /* KTEXT descriptor */
    54         { .limit_0_15  = 0xffff,
    55           .base_0_15   = 0, 
    56           .base_16_23  = 0, 
    57           .access      = AR_PRESENT | AR_CODE | DPL_KERNEL | AR_READABLE, 
    58           .limit_16_19 = 0xf,
    59           .available   = 0, 
    60           .longmode    = 1, 
     54        { .limit_0_15  = 0xffffU,
     55          .base_0_15   = 0,
     56          .base_16_23  = 0,
     57          .access      = AR_PRESENT | AR_CODE | DPL_KERNEL | AR_READABLE,
     58          .limit_16_19 = 0x0fU,
     59          .available   = 0,
     60          .longmode    = 1,
    6161          .special     = 0,
    62           .granularity = 1, 
     62          .granularity = 1,
    6363          .base_24_31  = 0 },
    6464        /* KDATA descriptor */
    65         { .limit_0_15  = 0xffff,
    66           .base_0_15   = 0, 
    67           .base_16_23  = 0, 
    68           .access      = AR_PRESENT | AR_DATA | AR_WRITABLE | DPL_KERNEL, 
    69           .limit_16_19 = 0xf,
    70           .available   = 0, 
    71           .longmode    = 0, 
    72           .special     = 0, 
    73           .granularity = 1, 
     65        { .limit_0_15  = 0xffffU,
     66          .base_0_15   = 0,
     67          .base_16_23  = 0,
     68          .access      = AR_PRESENT | AR_DATA | AR_WRITABLE | DPL_KERNEL,
     69          .limit_16_19 = 0x0fU,
     70          .available   = 0,
     71          .longmode    = 0,
     72          .special     = 0,
     73          .granularity = 1,
    7474          .base_24_31  = 0 },
    7575        /* UDATA descriptor */
    76         { .limit_0_15  = 0xffff,
    77           .base_0_15   = 0, 
    78           .base_16_23  = 0, 
    79           .access      = AR_PRESENT | AR_DATA | AR_WRITABLE | DPL_USER, 
    80           .limit_16_19 = 0xf,
    81           .available   = 0, 
    82           .longmode    = 0, 
    83           .special     = 1, 
    84           .granularity = 1, 
     76        { .limit_0_15  = 0xffffU,
     77          .base_0_15   = 0,
     78          .base_16_23  = 0,
     79          .access      = AR_PRESENT | AR_DATA | AR_WRITABLE | DPL_USER,
     80          .limit_16_19 = 0x0fU,
     81          .available   = 0,
     82          .longmode    = 0,
     83          .special     = 1,
     84          .granularity = 1,
    8585          .base_24_31  = 0 },
    8686        /* UTEXT descriptor */
    87         { .limit_0_15  = 0xffff,
    88           .base_0_15   = 0, 
    89           .base_16_23  = 0, 
    90           .access      = AR_PRESENT | AR_CODE | DPL_USER, 
    91           .limit_16_19 = 0xf,
    92           .available   = 0, 
    93           .longmode    = 1, 
    94           .special     = 0, 
    95           .granularity = 1, 
     87        { .limit_0_15  = 0xffffU,
     88          .base_0_15   = 0,
     89          .base_16_23  = 0,
     90          .access      = AR_PRESENT | AR_CODE | DPL_USER,
     91          .limit_16_19 = 0x0fU,
     92          .available   = 0,
     93          .longmode    = 1,
     94          .special     = 0,
     95          .granularity = 1,
    9696          .base_24_31  = 0 },
    9797        /* KTEXT 32-bit protected, for protected mode before long mode */
    98         { .limit_0_15  = 0xffff,
    99           .base_0_15   = 0, 
    100           .base_16_23  = 0, 
    101           .access      = AR_PRESENT | AR_CODE | DPL_KERNEL | AR_READABLE, 
    102           .limit_16_19 = 0xf,
    103           .available   = 0, 
    104           .longmode    = 0, 
     98        { .limit_0_15  = 0xffffU,
     99          .base_0_15   = 0,
     100          .base_16_23  = 0,
     101          .access      = AR_PRESENT | AR_CODE | DPL_KERNEL | AR_READABLE,
     102          .limit_16_19 = 0x0fU,
     103          .available   = 0,
     104          .longmode    = 0,
    105105          .special     = 1,
    106           .granularity = 1, 
     106          .granularity = 1,
    107107          .base_24_31  = 0 },
    108108        /* TSS descriptor - set up will be completed later,
     
    111111        { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
    112112        /* VESA Init descriptor */
    113 #ifdef CONFIG_FB       
    114         { 0xffff, 0, VESA_INIT_SEGMENT >> 12, AR_PRESENT | AR_CODE | DPL_KERNEL,
    115           0xf, 0, 0, 0, 0, 0
     113#ifdef CONFIG_FB
     114        {
     115                0xffff, 0, VESA_INIT_SEGMENT >> 12, AR_PRESENT | AR_CODE | DPL_KERNEL,
     116                    0xf, 0, 0, 0, 0, 0
    116117        }
    117118#endif
     
    129130{
    130131        tss_descriptor_t *td = (tss_descriptor_t *) d;
    131 
    132         td->base_0_15 = base & 0xffff;
    133         td->base_16_23 = ((base) >> 16) & 0xff;
    134         td->base_24_31 = ((base) >> 24) & 0xff;
     132       
     133        td->base_0_15 = base & 0xffffU;
     134        td->base_16_23 = ((base) >> 16) & 0xffU;
     135        td->base_24_31 = ((base) >> 24) & 0xffU;
    135136        td->base_32_63 = ((base) >> 32);
    136137}
     
    140141        tss_descriptor_t *td = (tss_descriptor_t *) d;
    141142       
    142         td->limit_0_15 = limit & 0xffff;
    143         td->limit_16_19 = (limit >> 16) & 0xf;
     143        td->limit_0_15 = limit & 0xffffU;
     144        td->limit_16_19 = (limit >> 16) & 0x0fU;
    144145}
    145146
     
    149150         * Offset is a linear address.
    150151         */
    151         d->offset_0_15 = offset & 0xffff;
    152         d->offset_16_31 = offset >> 16 & 0xffff;
     152        d->offset_0_15 = offset & 0xffffU;
     153        d->offset_16_31 = (offset >> 16) & 0xffffU;
    153154        d->offset_32_63 = offset >> 32;
    154155}
     
    165166{
    166167        idescriptor_t *d;
    167         int i;
    168 
     168        unsigned int i;
     169       
    169170        for (i = 0; i < IDT_ITEMS; i++) {
    170171                d = &idt[i];
    171 
     172               
    172173                d->unused = 0;
    173174                d->selector = GDT_SELECTOR(KTEXT_DES);
    174 
     175               
    175176                d->present = 1;
    176                 d->type = AR_INTERRUPT; /* masking interrupt */
     177                d->type = AR_INTERRUPT;  /* masking interrupt */
    177178        }
    178 
     179       
    179180        d = &idt[0];
    180181        idt_setoffset(d++, (uintptr_t) &int_0);
Note: See TracChangeset for help on using the changeset viewer.