Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset 79e84c9 in mainline


Ignore:
Timestamp:
2012-04-01T21:56:25Z (8 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
master
Children:
71ca5a4
Parents:
a44ae3dd
Message:

kernel, arm32: Update implementer information.

Fix array access checks.

Location:
kernel/arch/arm32
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/arm32/include/cpu.h

    ra44ae3dd r79e84c9  
    4141
    4242
    43 /** Struct representing ARM CPU identifiaction. */
     43/** Struct representing ARM CPU identification. */
    4444typedef struct {
    4545        /** Implementator (vendor) number. */
  • kernel/arch/arm32/src/cpu/cpu.c

    ra44ae3dd r79e84c9  
    4444/** Implementators (vendor) names */
    4545static const char *imp_data[] = {
    46         "?",                                    /* IMP_DATA_START_OFFSET */
    47         "ARM Ltd",                              /* 0x41 */
    48         "",                                     /* 0x42 */
    49         "",                                     /* 0x43 */
    50         "Digital Equipment Corporation",        /* 0x44 */
    51         "", "", "", "", "", "", "", "", "", "", /* 0x45 - 0x4e */
    52         "", "", "", "", "", "", "", "", "", "", /* 0x4f - 0x58 */
    53         "", "", "", "", "", "", "", "", "", "", /* 0x59 - 0x62 */
    54         "", "", "", "", "", "",                 /* 0x63 - 0x68 */
    55         "Intel Corporation"                     /* 0x69 */
     46        "?",                                     /* IMP_DATA_START_OFFSET */
     47        "ARM Limited",                           /* 0x41 */
     48        "", "",                                  /* 0x42 - 0x43 */
     49        "Digital Equipment Corporation",         /* 0x44 */
     50        "", "", "", "", "", "", "", "",          /* 0x45 - 0x4c */
     51        "Motorola, Freescale Semicondutor Inc.", /* 0x4d */
     52        "", "", "",                              /* 0x4e - 0x50 */
     53        "Qualcomm Inc.",                         /* 0x51 */
     54        "", "", "", "",                          /* 0x52 - 0x55 */
     55        "Marvell Semiconductor",                 /* 0x56 */
     56        "", "", "", "", "", "", "", "", "", "",  /* 0x57 - 0x60 */
     57        "", "", "", "", "", "", "", "",          /* 0x61 - 0x68 */
     58        "Intel Corporation"                      /* 0x69 */
    5659};
    5760
     
    112115        cpu_arch_t * cpu_arch = &m->arch;
    113116
    114         if ((cpu_arch->imp_num) > 0 &&
    115             (cpu_arch->imp_num < (imp_data_length + IMP_DATA_START_OFFSET))) {
     117        const unsigned imp_offset = cpu_arch->imp_num - IMP_DATA_START_OFFSET;
     118
     119        if (imp_offset < imp_data_length) {
    116120                vendor = imp_data[cpu_arch->imp_num - IMP_DATA_START_OFFSET];
    117121        }
    118122
    119         if ((cpu_arch->arch_num) > 0 &&
    120             (cpu_arch->arch_num < arch_data_length)) {
     123        // TODO CPUs with arch_num == 0xf use CPUID scheme for identification
     124        if (cpu_arch->arch_num < arch_data_length) {
    121125                architecture = arch_data[cpu_arch->arch_num];
    122126        }
Note: See TracChangeset for help on using the changeset viewer.