Changeset b52da8d7 in mainline


Ignore:
Timestamp:
2005-08-29T11:57:26Z (19 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
c245372b
Parents:
229d5fc1
Message:

Add some comments to IA-32 src/boot/boot.S and src/smp.S.

Make the boot stack start on page boundary.
This is required by get_stack_base().

Define 'THE' macro.

Implement preemption_disable() and preemption_enable().

Add memory barrier macros.
IA-32 macros need support for older processors.
Non IA-32 macros are dummy.

Reduction of many #include paths.

Files:
17 edited

Legend:

Unmodified
Added
Removed
  • arch/amd64/include/barrier.h

    r229d5fc1 rb52da8d7  
    3333#define CS_LEAVE_BARRIER()      __asm__ volatile ("" ::: "memory")
    3434
     35#define memory_barrier()
     36#define read_barrier()
     37#define write_barrier()
     38
    3539#endif
  • arch/ia32/include/asm.h

    r229d5fc1 rb52da8d7  
    3232#include <arch/types.h>
    3333#include <typedefs.h>
    34 #include <mm/page.h>
     34#include <config.h>
    3535#include <synch/spinlock.h>
    3636#include <arch/boot/memmap.h>
  • arch/ia32/include/barrier.h

    r229d5fc1 rb52da8d7  
    4444#define CS_LEAVE_BARRIER()      __asm__ volatile ("" ::: "memory")
    4545
     46#define memory_barrier()        __asm__ volatile ("mfence\n" ::: "memory")
     47#define read_barrier()          __asm__ volatile ("sfence\n" ::: "memory")
     48#define write_barrier()         __asm__ volatile ("lfence\n" ::: "memory")
     49
    4650#endif
  • arch/ia32/src/boot/boot.S

    r229d5fc1 rb52da8d7  
    4848        call memmap_arch_init
    4949       
    50         lgdt gdtr
     50        lgdt gdtr                       # initialize Global Descriptor Table register
     51        lidt idtr                       # initialize Interrupt Descriptor Table register
     52       
    5153        movl %cr0,%eax
    5254        orl $0x1,%eax
    53         movl %eax,%cr0
     55        movl %eax,%cr0                  # switch to protected mode
    5456        jmpl $8,$meeting_point
    5557meeting_point:
     
    6365        movw %ax,%ss
    6466
    65         lidt idtr
    66 
    67         call map_kernel
     67        call map_kernel                 # map kernel and turn paging on
    6868
    6969        movl $_hardcoded_ktext_size, hardcoded_ktext_size
     
    9595        movl %eax, %cr3
    9696       
    97         # turn on paging
     97        # turn paging on
    9898        movl %cr0, %ebx
    9999        orl $(1<<31), %ebx
  • arch/ia32/src/mm/frame.c

    r229d5fc1 rb52da8d7  
    3535#include <print.h>
    3636
    37 /*
    38  * TODO: use the memory map obtained from BIOS
    39  */
    4037void frame_arch_init(void)
    4138{
  • arch/ia32/src/smp/ap.S

    r229d5fc1 rb52da8d7  
    5151        movw %ax,%ds
    5252
    53         lgdt gdtr
     53        lgdt gdtr                       # initialize Global Descriptor Table register
     54        lidt idtr                       # initialize Interrupt Descriptor Table register
     55       
    5456        movl %cr0,%eax
    5557        orl $1,%eax
    56         movl %eax,%cr0
     58        movl %eax,%cr0                  # switch to protected mode
    5759        jmpl $KTEXT,$jump_to_kernel
    5860jump_to_kernel:
     
    6668        subl $0x80000000,%esp           # KA2PA(ctx.sp)
    6769
    68         lidt idtr
    69 
    70         call map_kernel
     70        call map_kernel                 # map kernel and turn paging on
    7171
    7272        jmpl $KTEXT,$main_ap
  • arch/ia64/include/barrier.h

    r229d5fc1 rb52da8d7  
    3636#define CS_LEAVE_BARRIER()      __asm__ volatile ("" ::: "memory")
    3737
     38#define memory_barrier()
     39#define read_barrier()
     40#define write_barrier()
     41
    3842#endif
  • arch/mips/include/barrier.h

    r229d5fc1 rb52da8d7  
    3636#define CS_LEAVE_BARRIER()      __asm__ volatile ("" ::: "memory")
    3737
     38#define memory_barrier()
     39#define read_barrier()
     40#define write_barrier()
     41
    3842#endif
  • arch/mips/include/cpu.h

    r229d5fc1 rb52da8d7  
    3030#define __mips_CPU_H__
    3131
    32 #include <typedefs.h>
    33 
    3432#define CPU_ID_ARCH     0
    3533
  • arch/mips/include/mm/page.h

    r229d5fc1 rb52da8d7  
    3434#include <arch/mm/frame.h>
    3535#include <arch/types.h>
    36 #include <arch.h>
    3736
    3837#define PAGE_SIZE       FRAME_SIZE
  • arch/ppc/include/barrier.h

    r229d5fc1 rb52da8d7  
    3333#define CS_LEAVE_BARRIER()      __asm__ volatile ("" ::: "memory")
    3434
     35#define memory_barrier()
     36#define read_barrier()
     37#define write_barrier()
     38
    3539#endif
  • include/arch.h

    r229d5fc1 rb52da8d7  
    3535#include <cpu.h>
    3636#include <arch/cpu.h>
     37#include <arch/asm.h>
     38
     39#include <proc/thread.h>
     40#include <proc/task.h>
    3741
    3842/*
     
    5963};
    6064
     65#define THE             ((the_t *)(get_stack_base()))   
     66
    6167extern void arch_pre_mm_init(void);
    6268extern void arch_post_mm_init(void);
  • include/cpu.h

    r229d5fc1 rb52da8d7  
    3131
    3232#include <arch/cpu.h>
    33 #include <proc/thread.h>
    34 #include <proc/task.h>
    3533#include <proc/scheduler.h>
    36 #include <time/clock.h>
    3734#include <synch/spinlock.h>
    3835#include <synch/waitq.h>
     
    4138#include <arch/context.h>
    4239#include <config.h>
     40#include <list.h>
    4341
    4442#define CPU_STACK_SIZE  STACK_SIZE
  • include/proc/task.h

    r229d5fc1 rb52da8d7  
    3232#include <typedefs.h>
    3333#include <synch/spinlock.h>
    34 #include <proc/thread.h>
    35 #include <mm/vm.h>
    3634#include <list.h>
    3735
  • include/proc/thread.h

    r229d5fc1 rb52da8d7  
    3131
    3232#include <arch/thread.h>
    33 #include <proc/task.h>
    3433#include <synch/spinlock.h>
    3534#include <arch/context.h>
     
    3938#include <time/timeout.h>
    4039#include <synch/rwlock.h>
    41 #include <mm/page.h>
    4240#include <config.h>
    4341#include <list.h>
  • src/main/main.c

    r229d5fc1 rb52da8d7  
    9898        config.cpu_count = 1;
    9999        config.cpu_active = 1;
     100        size_t size, delta;
     101
     102        /*
     103         * Calculate 'size' that kernel and heap occupies in memory.
     104         */
     105        size = hardcoded_ktext_size + hardcoded_kdata_size + CONFIG_HEAP_SIZE;   
     106         
     107        /*
     108         * We need the boot stack to start on page boundary.
     109         * That is why 'delta' is calculated.
     110         */
     111        delta = PAGE_SIZE - ((hardcoded_load_address + size) % PAGE_SIZE);
     112        delta = (delta == PAGE_SIZE) ? 0 : delta;
     113       
     114        size += delta;
    100115
    101116        config.base = hardcoded_load_address;
    102117        config.memory_size = get_memory_size();
    103         config.kernel_size = hardcoded_ktext_size + hardcoded_kdata_size + CONFIG_HEAP_SIZE + CONFIG_STACK_SIZE;
     118        config.kernel_size = size + CONFIG_STACK_SIZE;
    104119
    105120        context_save(&ctx);
    106         context_set(&ctx, FADDR(main_bsp_separated_stack), config.base + hardcoded_ktext_size + hardcoded_kdata_size + CONFIG_HEAP_SIZE, CONFIG_STACK_SIZE);
     121        context_set(&ctx, FADDR(main_bsp_separated_stack), config.base + size, CONFIG_STACK_SIZE);
    107122        context_restore(&ctx);
    108123        /* not reached */
  • src/preempt/preemption.c

    r229d5fc1 rb52da8d7  
    2929#include <preemption.h>
    3030#include <arch.h>
    31 #include <arch/atomic.h>
     31#include <arch/asm.h>
    3232#include <arch/barrier.h>
     33#include <debug.h>
    3334
    3435void preemption_disable(void)
    3536{
     37        THE->preemption_disabled++;
     38        memory_barrier();
    3639}
    3740
    3841void preemption_enable(void)
    3942{
     43        ASSERT(THE->preemption_disabled);
     44        memory_barrier();
     45        THE->preemption_disabled--;
    4046}
Note: See TracChangeset for help on using the changeset viewer.