Changeset 4d0f97d in mainline for kernel/arch/arm32/src


Ignore:
Timestamp:
2010-07-16T14:23:41Z (15 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
e2650d3
Parents:
aa0d227 (diff), 24697c3 (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 from lp:~jsvoboda/helenos/gta02. This adds support for the GTA02 platform. Fixes ticket #134.

Location:
kernel/arch/arm32/src
Files:
1 added
8 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/arm32/src/exc_handler.S

    raa0d227 r4d0f97d  
    9696        ldmfd r3!, {r4-r7}
    9797        stmfd r13!, {r4-r7}
    98         stmfd r13!, {r13, lr}^
     98        mov r4, r13
     99        stmfd r4, {r13, lr}^
     100        nop                     /* Cannot access r13 immediately after stm(2) */
     101        sub r13, r13, #8
    99102        stmfd r13!, {r2}
    100103
     
    137140
    138141        # return to user mode
    139         ldmfd r13!, {r13, lr}^
     142        mov r0, r13
     143        ldmfd r0, {r13, lr}^
     144        nop                     /* Cannot access r13 immediately after ldm(2) */
     145        add r13, r13, #8
    140146        b 2f
    141147
  • kernel/arch/arm32/src/interrupt.c

    raa0d227 r4d0f97d  
    4040#include <ddi/device.h>
    4141#include <interrupt.h>
    42 
    43 /** Initial size of a table holding interrupt handlers. */
    44 #define IRQ_COUNT 8
    4542
    4643/** Disable interrupts.
     
    105102void interrupt_init(void)
    106103{
    107         irq_init(IRQ_COUNT, IRQ_COUNT);
     104        size_t irq_count;
     105
     106        irq_count = machine_get_irq_count();
     107        irq_init(irq_count, irq_count);
     108
    108109        machine_timer_irq_start();
    109110}
  • kernel/arch/arm32/src/mach/integratorcp/integratorcp.c

    raa0d227 r4d0f97d  
    6060        icp_timer_irq_start,
    6161        icp_cpu_halt,
    62         icp_get_memory_size,
     62        icp_get_memory_extents,
    6363        icp_irq_exception,
    6464        icp_frame_init,
     
    214214}
    215215
    216 /** Returns the size of emulated memory.
    217  *
    218  * @return Size in bytes.
    219  */
    220 size_t icp_get_memory_size(void)
    221 {
     216/** Get extents of available memory.
     217 *
     218 * @param start         Place to store memory start address.
     219 * @param size          Place to store memory size.
     220 */
     221void icp_get_memory_extents(uintptr_t *start, uintptr_t *size)
     222{
     223        *start = 0;
     224
    222225        if (hw_map_init_called) {
    223                 return (sdram[((*(uint32_t *)icp_hw_map.sdramcr & ICP_SDRAM_MASK) >> 2)]);
     226                *size = (sdram[((*(uint32_t *)icp_hw_map.sdramcr &
     227                    ICP_SDRAM_MASK) >> 2)]);
    224228        } else {
    225                 return SDRAM_SIZE;
    226         }
    227        
     229                *size = SDRAM_SIZE;
     230        }
    228231}
    229232
  • kernel/arch/arm32/src/mach/testarm/testarm.c

    raa0d227 r4d0f97d  
    6060        gxemul_timer_irq_start,
    6161        gxemul_cpu_halt,
    62         gxemul_get_memory_size,
     62        gxemul_get_memory_extents,
    6363        gxemul_irq_exception,
    6464        gxemul_frame_init,
     
    185185}
    186186
    187 /** Returns the size of emulated memory.
    188  *
    189  * @return Size in bytes.
    190  */
    191 uintptr_t gxemul_get_memory_size(void)
    192 {
    193         return  *((uintptr_t *) (GXEMUL_MP_ADDRESS + GXEMUL_MP_MEMSIZE_OFFSET));
    194 }
    195 
     187/** Get extents of available memory.
     188 *
     189 * @param start         Place to store memory start address.
     190 * @param size          Place to store memory size.
     191 */
     192void gxemul_get_memory_extents(uintptr_t *start, uintptr_t *size)
     193{
     194        *start = 0;
     195        *size = *((uintptr_t *) (GXEMUL_MP_ADDRESS + GXEMUL_MP_MEMSIZE_OFFSET));
     196}
    196197
    197198/** Returns the mask of active interrupts. */
     
    210211        unsigned int i;
    211212
    212         for (i = 0; i < GXEMUL_IRQC_MAX_IRQ; i++) {
     213        for (i = 0; i < GXEMUL_IRQ_COUNT; i++) {
    213214                if (sources & (1 << i)) {
    214215                        irq_t *irq = irq_dispatch_and_lock(i);
  • kernel/arch/arm32/src/machine_func.c

    raa0d227 r4d0f97d  
    3939
    4040#include <arch/machine_func.h>
     41#include <arch/mach/gta02/gta02.h>
    4142#include <arch/mach/integratorcp/integratorcp.h>
    4243#include <arch/mach/testarm/testarm.h>
     
    4849void machine_ops_init(void)
    4950{
    50 #if defined(MACHINE_testarm)
     51#if defined(MACHINE_gta02)
     52        machine_ops = &gta02_machine_ops;
     53#elif defined(MACHINE_testarm)
    5154        machine_ops = &gxemul_machine_ops;
    5255#elif defined(MACHINE_integratorcp)
     
    7780}
    7881
    79 
    80 /** Returns size of available memory.
     82/** Get extents of available memory.
    8183 *
    82  *  @return Size of available memory.
     84 * @param start         Place to store memory start address.
     85 * @param size          Place to store memory size.
    8386 */
    84 uintptr_t machine_get_memory_size(void)
     87void machine_get_memory_extents(uintptr_t *start, uintptr_t *size)
    8588{
    86         return (machine_ops->machine_get_memory_size)();
     89        (machine_ops->machine_get_memory_extents)(start, size);
    8790}
    8891
     
    122125}
    123126
     127/** Get IRQ number range used by machine. */
     128size_t machine_get_irq_count(void)
     129{
     130        size_t irq_count;
     131 
     132#if defined(MACHINE_gta02)
     133        irq_count = GTA02_IRQ_COUNT;
     134#elif defined(MACHINE_testarm)
     135        irq_count = GXEMUL_IRQ_COUNT;
     136#elif defined(MACHINE_integratorcp)
     137        irq_count = ICP_IRQ_COUNT;
     138#else
     139#error Machine type not defined.
     140#endif
     141        return irq_count;
     142}
     143
    124144/** @}
    125145 */
  • kernel/arch/arm32/src/mm/frame.c

    raa0d227 r4d0f97d  
    3838#include <arch/machine_func.h>
    3939#include <config.h>
     40#include <align.h>
    4041
    4142/** Address of the last frame in the memory. */
     
    4546void frame_arch_init(void)
    4647{
    47         last_frame = machine_get_memory_size();
     48        uintptr_t mem_start, mem_size;
     49        uintptr_t first_frame;
     50        uintptr_t num_frames;
     51
     52        machine_get_memory_extents(&mem_start, &mem_size);
     53        first_frame = ALIGN_UP(mem_start, FRAME_SIZE);
     54        last_frame = ALIGN_DOWN(mem_start + mem_size, FRAME_SIZE);
     55        num_frames = (last_frame - first_frame) >> FRAME_WIDTH;
    4856       
    4957        /* All memory as one zone */
    50         zone_create(0, ADDR2PFN(last_frame),
     58        zone_create(first_frame >> FRAME_WIDTH, num_frames,
    5159            BOOT_PAGE_TABLE_START_FRAME + BOOT_PAGE_TABLE_SIZE_IN_FRAMES, 0);
    5260       
  • kernel/arch/arm32/src/mm/page.c

    raa0d227 r4d0f97d  
    5858        uintptr_t cur;
    5959        /* Kernel identity mapping */
    60         for (cur = 0; cur < last_frame; cur += FRAME_SIZE)
     60        for (cur = PHYSMEM_START_ADDR; cur < last_frame; cur += FRAME_SIZE)
    6161                page_mapping_insert(AS_KERNEL, PA2KA(cur), cur, flags);
    6262       
     
    6868#error "Only high exception vector supported now"
    6969#endif
     70        cur = ALIGN_DOWN(0x50008010, FRAME_SIZE);
     71        page_mapping_insert(AS_KERNEL, PA2KA(cur), cur, flags);
    7072
    7173        page_table_unlock(AS_KERNEL, true);
  • kernel/arch/arm32/src/userspace.c

    raa0d227 r4d0f97d  
    9797                "mov sp, %[ustate]\n"
    9898                "msr spsr_c, %[user_mode]\n"
    99                 "ldmfd sp!, {r0-r12, sp, lr}^\n"
     99                "ldmfd sp, {r0-r12, sp, lr}^\n"
     100                "nop\n"         /* Cannot access sp immediately after ldm(2) */
     101                "add sp, sp, #(15*4)\n"
    100102                "ldmfd sp!, {pc}^\n"
    101103                :: [ustate] "r" (&ustate), [user_mode] "r" (user_mode)
Note: See TracChangeset for help on using the changeset viewer.