Kernel Tree

Root folder: /arch/score/

 
boot/ = The location of the final kernel image
configs/ = The arch-dependent configuration parameters
include/                = Header files
Kconfig                 = Info to show on (make ARCH=score menuconfig)
Kconfig.debug = Info to show on (make ARCH=score menuconfig) for debugging
kernel/ = Kernel files
lib/ = Library functions
Makefile = Makefile used to generate the kernel image
mm/ = Mememory Management Unit files
 
 
- include/
- include/asm
 
- include/asm/asmmacro.h = Important assembly macros
 
SAVE_ALL = Save the context of all registers
RESTORE_ALL_RET = Restore all the context and return (rte instruction at the end, is this
 return from exception?)
 
- include/asm/asm-offsets.h = Reads from:
+ [generated] generated/asm-offsets.h,
  + kernel/asm-offsets.c
- include/asm/atomic.h = Reads from:
+ asm/cmpxchg.h
+ asm-generic/atomic.h
- include/asm/auxvec.h = Emtpy file
- include/asm/barrier.h = Leave this file as it is
- include/asm/bitops.h = Reads from:
+ asm/byteorder.h (Does this depend on the conf?)
+ asm-generic/bitops.h
+ asm-generic/bitops/__fls.h
- include/asm/bitsperlong.h = Reads from:
+ asm-generic/bitsperlong.h (Does this depend on the conf?)
- include/asm/bug.h     = Reads from:
+ asm-generic/bug.h
struct pt_regs; # Defined on /include/asm/ptrace.h. This defines the way the registers are stored on the stack during a syscall / exception.
 
- include/asm/bugs.h = Reads from:
+ asm-generic/bugs.h
- include/asm/byteorder.h = Reads from:
+ linux/byteorder/little_endian.h
- include/asm/cacheflush.h = Reads from:
+ linux/mm.h
[Implemented in arch/score/mm/cache.c]
flush_cache_all
flush_cache_mm
flush_cache_mm
flush_cache_range
flush_cache_page
flush_cache_sigtramp
flush_icache_range
flush_dcache_range
flush_dcache_page
 
[Implemented in arch/include/asm/cacacheflush.h, this same file]
flush_icache_page
copy_from_user_page = It uses memcpy, it seems that it references a general linux lib
copy_to_user_page = It uses memcpy, it seems that it references a general linux lib
 
- include/asm/cache.h
 
/* Not sure whether this makes sense or not. Let's think about this later */
 
#define L1_CACHE_SHIFT 4   
#define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT)
 
- include/asm/checksum.h = Reads from:
+ linux/in6.h
+ asm/uaccess.h
 
[Definitions, where are these functions implemented?!]
csum_partial
csum_partial_copy_from_user
csum_partial_copy
 
[Implementations, assembly]
csum_and_copy_to_user
csum_fold
ip_fast_csum
ip_tcpudp_nofold
csum_tcpudp_magic
ip_compute_csum
csum_ipv6_magic
 
- include/asm/cmpxchg.h = Reads from:
+ linux/irqflags.h
+ asm-generic/cmpxchg-local.h
 
[Implementations]
struct __xchg_dummy
#define __xg(x)
 
[Implementations]
__xchg = It calls local_irq_save(flags) and local_irq_restore(flags),
implemented in /arch/score/include/asm/irqflags.h
xchg
__cmpxchg = It calls local_irq_save(flags) and local_irq_restore(flags),
implemented in /arch/score/include/asm/irqflags.h
cmpxchg
 
#define __HAVE_ARCH_CMPXCHG 1
 
- include/asm/cputime.h = Reads from:
+ asm-generic/cputime.h
- include/asm/current.h = Reads from:
+ asm-generic/current.h
- include/asm/delay.h = Reads from:
+ asm-generic/param.h
[Implementations]
__dely
__udelay
#define udelay(usecs) __udelay(usecs)
 
- include/asm/device.h = Reads from:
+ asm-generic/device.h
 
- include/asm/div64.h = Reads from:
+ asm-generic/div64.h
- include/asm/dma.h = Reads from:
+ asm/io.h
#define MAX_DMA_ADDRESS (0)
 
- include/asm/dma-mapping.h = Reads from:
+ asm-generic/dma-mapping-broken.h
 
[I guess this implies that there is no DMA on the system]
 
- include/asm/elf.h = Reads from:
+ linux/ptrace.h
[I need to look at this file carefully!!!]
 
#define EM_SCORE7 135
/* Realocation types */
#define R_SCORE_NONE   0
#define R_SCORE_HI16   1
....
#define R_SCORE_IMM32 21
 
/* ELF register definitions */
typdef unsgiend long elf_greg_t
typedef elg_gregset_t elf_gregset_t[ELF_NGREG];
 
/* Score does not have fp regs. */
typedef double elf_fpreg_t;
typedef elffpreg_t elf_fpregset_t;
 
elf_check_arch
#define ELF_CLASS ELFCLASS64
#define ELF_DATA  ELFDATA2LSB
#define ELF_ARCH  EM_SCORE7
 
#define SET_PERSONALITY(ex)
 
struct trask_struct;
struct pt_regs;
 
#define CORE_DUMP_USE_REGSET
#define ELF_EXEC_PAGESIZE PAGE_SIZE
 
#define ELF_HWCAP (0)
 
#define ELF_PLATFORM (NULL)
 
#define ELF_PLAT_INIT(_r, load_addr)
 
#ifndef ELF_ET_DYN_BASE
  #define ELF_ET_DYN_BASE (TASK_SIZE / 3 * 2)
#endif
 
- include/asm/emergency-restart.h = Reads from:
+ asm-generic/emergency-restart.h
 
- include/asm/errno.h = Reads from:
+ asm-generic/errno.h
- include/asm/exec.h
 
[Implementation in arch/score/kernel/process.c]
extern unsigned long arch_align_stack();
 
- include/asm/fcntl.h = Reads from:
+ asm-generic/fcntl.h
 
- include/asm/fixmap.h               = Reads from:
+ asm/page.h
 
[There are some memory buffers (page sized) called fix-mapped addresses, we handle them here. I
need to look more at this file!!!]
 
#define PHY_RAM_BASE
#define PHY_IO_BASE
#define VIRTUAL_RAM_BASE
#define VIRTUAL_IO_BASE
#define RAM_SPACE_SIZE
#define IO_SPACE_SIZE
/* Kernel unmapped, chached 512MB */
#define KSEG1
 
enum fixed_addresses{...};
 
#define FIXADDR_TOP
#define FIXADDR_SIZE
#define FIXADDR_START
 
#define __fox_to_virt
#define __vort_to_fix
 
extern void __this_fixmap_does_not_exist
[Implementations]
fix_to_virt
virt_to_fix
 
- include/asm/ftrace.h = Empty file
 
- include/asm/futex.h = Reads from:
+ asm-generic/futex.h
 
- include/asm/hardirq.h = Reads from:
+ asm-generic/hardirq.h
 
- include/asm/hw_irq.h = Empty file
 
- include/asm/ioctl.h = Reads from:
+ asm-generic/ioctl.h
- include/asm/ioctls.h = Reads from:
+ asm-generic/ioctls.h
- include/asm/io.h = Reads from:
+ asm-generic/io.h
#define virt_to_bus virt_to_phys
#define bus_to_virt phys_to_virt
 
- include/asm/ipcbuf.h = Reads from asm-generic/ipcbuf.h
- include/asm/irqflags.h = Reads from linux/types.h
 
[Implementations, assembly]
arch_local_save_flags()  = returns flags (e.g., ZERO, NEG, POS, OVER, INTERRUPTS)
arch_local_irq_save()    = returns flags + disable interrupts 
arch_local_irq_restore() = writes flags + enable interrupts
arch_local_irq_enable()  = enables interrupts
arch_local_irq_disable() = disables interrupts
arch_irqs_disabled_flags = returns yes if the interrupts are disabled in the flags
arch_irqs_disabled       = returns the flags and checks if the interrupts are disabled
 
- include/asm/irq.h
 
#define EXCEPTION_VECTOR_BASE_ADDR
#define VECTOR_ADDRESS_OFFSET_MODE4
#define VECTOR_ADDRESS_OFFSET_MODE16
 
#define DEBUG_VECTOR_SIZE
#define DEBUG_VECTOR_BASE_ADDR
 
#define GENERAL_VECTOR_SIZE
#define GENERAL_VECTOR_BASE_ADDR
 
#define NR_IRQS
#define IRQ_VECTOR_SIZE
#define IRQ_VECTOR_BASE_ADDR
#define IRQ_VECTOR_END_ADDR
 
#define irq_canonicalize(irq) 
 
#define IRQ_TIMER (7)
 
[Implemented in /arch/score/kernel/entry.S]
extern void interrupt_exception_vector(void);
 
- include/asm/irq_regs.h = Reads from:
+ linux/thread_info.h
[Implementation]
get_irq_regs()
 
- include/asm/Kbuild = Reads from:
+ include/asm-generic/Kbuild.asm
header-y  +=
generic-y += clkdev.h
 
- include/asm/kdebug.h = Reads from:
+ include/asm-generic/kdebug.h
- include/asm/kmap_types.h = Reads from:
+ asm-generic/kmap_types.h
- include/asm/kvm_para.h = Reads from:
+ asm-generic/kvm_para.h
- include/asm/linkage.h = Reads from:
 
#define __ALIGN .align 2
#define __ALIGN_STR ".align 2"
 
- include/asm/local64.h = Reads from:
+ asm-generic/local64.h
- include/asm/local.h = Reads from:
+ asm-generic/local.h
- include/asm/mman.h = Reads from:
+ asm-generic/mman.h
- include/asm/mmu_context.h = Reads from:
+ linux/errno.h
+ linux/sched.h
+ linux/slab.h
+ asm-generic/mm_hooks.h
+ asm/cacheflush.h
+ asm/tlbflush.h
+ asm/scoreregs.h
 
[Look carefully at this file. This handles TLB accesses and virtual memory mappings. ASID bits 
have information about what process the vpn to ppn mapping belongs to]
 
extern unsigned long asid_cache;
extern unsigned long pgd_current;
 
#define TLBMISS_HANDLER_SETUP_PGD(pgd)
#define TLBMISS_HANDLER_SETUP() do {
  write_c0_context(0);
  TLBMISS_HANDLER_SETUP_PGD(swapper_pg_dir)
} while (0)
 
#define ASID_VERSION_MASK
#define ASID_FIRST_VERSION
 
#define ASID_INC
#define ASID_MASK
 
[Implementations]
enter_lazy_tlb()
get_new_mmu_context()
init_new_context()
switch_mm()
destroy_context()
deactivate_mm()
activate_mm()
 
- include/asm/mmu.h
 
typedef unsigned long mm_context_t;
 
- include/asm/module.h = Reads from:
+ linux/list.h
+ asm/uaccess.h
+ asm-generic/module.h
struct mod_arch_specific{
struct list_head dbe_list;
const struct exception_table_entry *dbe_start;
const struct exception_table_entry *dbe_end;
}
 
typedef uint8_t Elf64_Byte;
 
search_module_dbetables()
 
#define MODULE_PROC_FAMILY "SCORE7"
#define MODULE_KERNEL_TYPE "32BIT "
#define MODULE_KERNEL_SMTC ""
 
#define MODULE_ARCH_VERMAGIC
 
- include/asm/msgbuf.h = Reads from:
+ asm/generic/msgbug.h
- include/asm/mutex.h = Reads from:
+ asm-generic/mutex-dec.h
- include/asm/page.h = Reads from:
+ linux/pfn.h
+ linux/const.h
+ asm-generic/memory_model.h
+ asm-generic/getoder.h
[This file manages the pages. Look at this file carefully.]
 
#define PAGE_SHIFT
#degine PAGE_SIZE
#define PAGE_MASK
 
#define PAGE_UP(addr)
#define PAGE_DOWN(addr)
 
#define _ALIGN_UP
#define _ALIGN_DOWN
 
#define _ALIGN
 
#define PAGE_OFFSET
#define clear_page   = Use of memset
#define copy_page   = Use of memcpy
#define clear_user_page = Use of memset
#define copy_user_page = Use of memcpy
 
typedef struct { unsigned long pte; } pte_t; /* Page table entry */
typedef struct { unsigned long pgd; } pgd_t; /* PGD table entry */
typedef struct { unsigned long pgprot; } pgprot_t;
 
#define pte_val()
#define pgd_val()
#define pgprot_val(x)
 
#define __pte(x)
#define __pgd(x)
#define __pgprot(x)
 
extern unsigned long max_low_pfn;
extern unsgiend long min_low_pfn;
extern unsigned long max_pfn;
 
#define __pa(x)
#define __va(x)
 
#define phys_to_pfn(phys)
#define pfn_to_phys(pfn)
 
#define virt_to_pfn(vaddr)
#define pfn_to_virt(pfn)
 
#define virt_to_page(vaddr)
#define page_to_virt(page)
 
#define page_to_phys(page)
#define page_to_bus(page)
#define phys_to_page(paddr)
 
#define pfn_valid(pfn)
#define ARCH_PFN_OFFSET
 
#define ARCH_PFN_OFFSET
#define virt_addr_valid
 
#define VM_DATA_DEFAULT_FLAGS
 
- include/asm/param.h = Reads from:
+ asm-generic/paran.h
- include/asm/pci.h = Empty file
- include/asm/percpu.h = Reads from:
+ asm-generic/percpu.h
- include/asm/pgalloc.h = Reads from:
+ linux/mm.h
 
[This files handles the allocation of pages. Read it carefully.]
 
[Implementations]
pmd_populate_kernel
pmd_populate
#define pmd_pgtable(pmd)
pgd_alloc
pgd_free
pte_alloc_one_kernel
pte_alloc_one
pte_free_kernel
pte_free
#define __pte_free_tlb
#define check_pgt_cache
 
- include/asm/pgtable-bits.h
 
[This handles the bits of the page table entries]
 
#define _PAGE_ACCESSED
#define _PAGE_READ
#define _PAGE_WRITE
#define _PAGE_PRESENT
#define _PAGE_MODIFIED
#define _PAGE_FILE
 
#define _PAGE_GLOBAL
#define _PAGE_VALID
#define _PAGE_SILENT_READ
#define _PAGE_DIRTY
#define _PAGE_SILENT_WRITE
#define _PAGE_CACHE
#define _CACHE_MASK
#define _PAGE_BUFFERABLE
 
#define __READABLE
#define __WRITEABLE
#define _PAGE_CHG_MASK
 
- include/asm/pgtable.h = Reads from:
+ linux/const.h
+ asm-generic/pgtable-nopmd.h (Two level)
+ asm/fixmap.h (Special region in memory for pgt-related info?)
+ asm/setup.h
+ asm/pgtable-bits.h
[Tons of information. Really important file!]
 
- include/asm/poll.h = Reads from:
+ asm-generic/poll.h
 
- include/asm/posix_types.h = Reads from:
+ asm-generic/posix_types.h
- include/asm/processor.h = Reads from:
+ linux/cpumask.h
+ linux/threads.h
+ asm/segment.h
[This files contains the information of the threads. Basically, it handles 
what the task has to save when context switching.]
 
struct task_struct
extern void (*cpu_wait)(void)
extern long kernel_thread
extern void start_thread
extern unsigned long get_wchan
 
#define current_text_addr()
#define cpu_relax() barrier()
#define release_thread(thread) do {} while(0);
 
/* User space process size: 2GB. This is hardcoded into a dew places */
#define TASK_SIZE 0x7fff8000UL
 
#define TASK_UNMAPPED_BASE ((TASK_SIZE / 3) & ~(PAGE_SIZE))
 
#ifdef __KERNEL__
#define STACK_TOP TASK_SIZE
#define STACK_TOP_MAX TASK_SIZE
#endif
 
struct thread_struct{
  unsigned long reg0, reg2, reg3;
  ...
}
 
#define INIT_THREAD{
.reg0 = 0;
.reg2 = 0;
.reg3 = 0;
...
}
 
#define kstk_tos(tsk)
#define task_pt_regs(tsk)
#define KSTK_EIP(tsk) 
#define KSTK_ESP(tsk)
 
- include/asm/ptrace.h
 
[File for tracing system calls/exceptions]
 
#define PTRACE_GETREGS
#define PTRACE_SETREGS
 
#define PC
#define CONDITION
#define ECR
#define EMA
#define CEH
#define CEL
#define COUNTER
#define LDCR
#define STCR
#define PSR
 
#define SINGLESTEP16_INSN
#define SINGLESTEP32_INSN
#define BREAKPOINT16_INSN
#define BREAKPOINT32_INSN
 
#define INSN32_MASK
 
/* More masks */
...
...
 
/* This struct defines the way the registers are stored on 
   the stack during a system call/exception */
 
struct pt_regs{
  ...
  ...
}
 
struct task_struct;
 
#define user_mode(regs)
 
#define instruction_pointer(regs)
#define profile_pc(regs)
 
extern void do_syscall_trace() = Implementation on /arch/score/kernel/ptrace.c
extern int read_tsk_long() = Implementation on /arch/score/kernel/ptrace.c
extern int read_tsk_short() = Implementation on /arch/score/kernel/ptrace.c
 
#define arch_has_single_step() (1)
 
- include/asm/resource.h = Reads from:
+ asm-generic/resource.h
- include/asm/scatterlist.h = Reads from:
+ asm-generic/scatterlist.h
- include/asm/scoreregs.h = Reads from:
+ linux/linkage.h
[This file contains information about the timers. Basically, @s that map to the internal registers of the 
 devides.]
 
#define TIME0BASE
#define P_TIMER0_CTL
....
 
- include/asm/sections.h = Reads from:
+ asm-generic/sections.h
- include/asm/segment.h
 
[Be careful. PowerPC uses segments to address memory. However we do not need to do that]
 
typedef struct{
unsigned long seg;
} mm_segment_t;
 
#define KERNEL_DS
#define USER_DS KERNEL_DS
 
[Implementations]
#define get_ds()
#define get_fs()
#define set_fs(x)
#define segment_eq(a, b)
 
- include/asm/sembuf.h = Reads from:
+ asm-generic/sembuf.h
- include/asm/setup.h
 
#define COMMAND_LINE_SIZE 256
#define MEMORY_START 0
#define MEMORY_SIZE 0x2000000
 
extern void pagetable_init(void);
extern void pgd_init(unsigned long page);
extern setup_early_printk(void);
extern void cpu_cache_init(void);
extern tlb_init(void);
extern void handle_nmi(void);
extern void handle_adelinsn(void);
extern void handle_adedata(void);
extern void handle_ibe(void);
extern void handle_pel(void);
extern void handle_sys(void);
extern void handle_ccu(void);
extern void handle_ri(void);
extern void handle_tr(void);
extern void handle_ades(void);
extern void handle_cee(void);
extern void handle_cpe(void);
extern void handle_dve(void);
extern void handle_dbe(void);
extern void handle_reserved(void);
extern void handle_tlb_refill(void);
extern void handle_tlb_invaild(void);
extern void handle_mod(void);
extern void debug_exception_vector(void);
extern void general_exception_vector(void);
extern void interrupt_exception_vector(void);
 
- include/asm/shmbuf.h = Reads from:
+ asm-generic/shmbuf.h
- include/asm/shmparam.h = Reads from:
+ asm-generic/shmparam.h
- include/asm/sigcontext.h
 
/* To synchronize with the sigcontext fragment in arch/score/tools/offset.c */
 
struct sigcontect{
unsigned int            sc_regmask;
        unsigned int            sc_psr;
        unsigned int            sc_condition;
        unsigned long           sc_pc;
        unsigned long           sc_regs[32];
        unsigned int            sc_ssflags;
        unsigned int            sc_mdceh;
        unsigned int            sc_mdcel;
        unsigned int            sc_ecr;
        unsigned long           sc_ema;
        unsigned long           sc_sigset[4];
 
}
 
- include/asm/siginfo.h = Reads from:
+ asm-generic/siginfo.h
- include/asm/signal.h = Reads from:
+ asm-generic/signal.h
- include/asm/socket.h = Reads from:
+ asm-generic/socket.h
- include/asm/sockios.h = Reads from:
+ asm-generic/sockios.h
- include/asm/statfs.h = Reads from:
+ asm-generic/statfs.h
- include/asm/stat.h = Reads from:
+ asm-generic/stat.h
- include/asm/string.h
 
extern memset;
extern memcpy;
extern memmove;
 
- include/asm/swab.h = Reads from:
+ asm-generic/swab.h
- include/asm/switch_to.h
 
extern void *resume(void *last, void *next, void *next_ti);
 
[ resume implemented in /arch/score/kernel/entry.S]
#define switch_to(prev, next, last)
do {
  (last) = resume(prev, next, task_thread_info(next));
} while(0);
 
#define finish_arch_switch(prev) do{} while(0);
 
- include/asm/syscalls.h
 
[Implementations on arch/score/kernel/sys_score.c]
asmlinkage long score_clone(struct pt_regs *regs);
asmlinkage long score_execve(struct pt_regs *regs);
[Implementations on arch/score/kernel/signal.c]
asmlinkage long score_sigaltstack(struct pt_regs *regs);
asmlinkage long score_rt_sigreturn(struct pt_regs *regs);
 
- include/asm/termbits.h = Reads from:
+ asm-generic/termbits.h
- include/asm/termios.h = Reads from:
+ asm-generic/termios.h
- include/asm/thread_info.h = Reads from:
+ asm/processor.h
 
[This files handles the information about tasks. In a higher-level detail than task_struct. Look at it
 carefully.]
 
struct thread_info{
  struct task_struct *task; [This is defined on arch/score/include/asm/processor.h]
struct exec_domain *exec_domain;
unsigned long      flags;
unsigned long   tp_value;
__u32   cpu;
/* 0 => Preemtable */
int   preempt_count;
         /*
         * thread address space:
         * 0-0xBFFFFFFF for user-thead
         * 0-0xFFFFFFFF for kernel-thread
         */
mm_segment_t   addr_limit; [I shouldn't care about segments, flat memory model]
struct restart_block restart_block; [What is this?]
struct pt_regs   *regs;
}
 
#define INIT_THREAD_INFO(tsk){
.task = &tsk,
.exec_domain = &default_exec_domain,
.cpu = 0,
.preempt_count = 1,
.addr_limit = KERNEL_DS,
.restart_block = {.fn = do_no_restart_syscall,},
}
 
#define init_thread_info (init_thread_union.thread_info)
#define init_stack (init_thread_union.stack)
 
#define PREEMPT_ACTIVE          0x10000000
 
/* How to get the thread information struct from C. */
register struct thread_info *__current_thread_info __asm__("r28");
#define current_thread_info() __current_thread_info
 
#define TIF_SYSCALL_TRACE       0       /* syscall trace active */
#define TIF_SIGPENDING          1       /* signal pending */
#define TIF_NEED_RESCHED        2       /* rescheduling necessary */
#define TIF_NOTIFY_RESUME       5       /* callback before returning to user */
#define TIF_RESTORE_SIGMASK     9       /* restore signal mask in do_signal() */
#define TIF_MEMDIE              18      /* is terminating due to OOM killer */
 
#define _TIF_SYSCALL_TRACE      (1<<TIF_SYSCALL_TRACE)
#define _TIF_SIGPENDING         (1<<TIF_SIGPENDING)
#define _TIF_NEED_RESCHED       (1<<TIF_NEED_RESCHED)
#define _TIF_NOTIFY_RESUME      (1<<TIF_NOTIFY_RESUME)
 
#define _TIF_WORK_MASK          (0x0000ffff)
 
- include/asm/timex.h = Reads from:
+ asm-generic/timex.h
 
#define CLOCK_TICK_RATE 27000000 /* Timer input freq. */ [This is 27 MHz]
 
- include/asm/tlbflush.h = Reads from:
+ linux/mm.h
 
[Very important file for implementing the mmu. Need to look carefully at this!]
 
[Implementations on /arch/score/mm/tlb-score.c]
extern void local_flush_tlb_all(void);
extern void local_flush_tlb_mm(struct mm_struct *mm);
extern void local_flush_tlb_range(struct vm_area_struct *vma,
        unsigned long start, unsigned long end);
extern void local_flush_tlb_kernel_range(unsigned long start,
        unsigned long end);
extern void local_flush_tlb_page(struct vm_area_struct *vma,
        unsigned long page);
extern void local_flush_tlb_one(unsigned long vaddr);
 
[Implementations in inline assembly, I need to see what they do. They access control registers]
pevn_get();
pevn_set();
pectx_set();
pectx_get();
tlblock_get();
tlblock_set();
tlbpt_set();
tlbpt_get();
peaddr_set();
 
- include/asm/tlb.h = Reads from:
+ asm-generic/tlb.h
 
#define tlb_start_vma(tlb, vma)         do {} while (0)
#define tlb_end_vma(tlb, vma)           do {} while (0)
#define __tlb_remove_tlb_entry(tlb, ptep, address) do {} while (0)
[Implemened on arch/score/mm/tlb-score.c]
#define tlb_flush(tlb)                  flush_tlb_mm((tlb)->mm)
 
[Implemented on arch/score/mm/tlb-miss.S]
extern void score7_FTLB_refill_Handler(void);
 
- include/asm/topology.h = Reads from:
+ asm-generic/topology.h
- include/asm/types.h = Reads from:
+ asm-generic/types.h
- include/asm/uaccess.h = Reads from:
+ linux/kernel.h
+ linux/errno.h
+ linux/thread_info.h
 
[Not sure what this does but there are tons of assembly instructions. Check this carefully]
 
#define VERIFY_READ 0
#define VERIFY_WRITE 1
 
#define get_ds()
#define get_fs()
#define segment_eq(a,b)
 
#define __access_ok
#define access_ok
/* Write a value  from kernel to user */
#define put_user
/* Copy a value from user to kernel*/
#define get_user
 
...
...
More stuff to look at
 
- include/asm/ucontext.h = Reads from:
+ asm-generic/ucontext.h
- include/asm/unaligned.h = Reads from:
+ asm-generic/unaligned.h
- include/asm/unistd.h = Reads from:
+ asm-generic/unistd.h
#define __ARCH_WANT_SYSCALL_NO_AT
#define __ARCH_WANT_SYSCALL_NO_FLAGS
#define __ARCH_WANT_SYSCALL_OFF_T
#define __ARCH_WANT_SYSCALL_DEPRECATED
 
- include/asm/user.h
 
/* These are the registers that are available from user mode */ 
[Maybe is also how we pushed them on the stack?!]
struct user_regs_struct {
        unsigned long regs[32]; /* GPR */
 
        unsigned long cel;
        unsigned long ceh;
 
        unsigned long sr0;      /* cnt */
        unsigned long sr1;      /* lcr */
        unsigned long sr2;      /* scr */
 
        unsigned long cp0_epc;
        unsigned long cp0_ema;
        unsigned long cp0_psr;
        unsigned long cp0_ecr;
        unsigned long cp0_condition;
};
 
- include/uapi
- include/uapi/asm
- include/uapi/asm/Kbuild
 
# UAPI Header export list
include include/uapi/asm-generic/Kbuild.asm
 
- kernel/
- kernel/asm-offsets.c = Reads from:
+ linux/kbuild.h
+ linux/interrupt.h
+ linux/mm.h
+ linux/sched.h
+ asm-generic/cmpxchg-local.h
 
[This file defines de offsets of different fields within a struct and gives it
a name (e.g., #define ...). We should use the same technique.]
 
[On arch/score/include/asm/ptrace.h we have the following structure]
 
/*
 * This struct defines the way the registers are stored on the stack during a
 * system call/exception. As usual the registers k0/k1 aren't being saved.
 */
struct pt_regs {
        unsigned long pad0[6];  /* stack arguments */
        unsigned long orig_r4;
        unsigned long orig_r7;
        long is_syscall;
 
        unsigned long regs[32];
 
        unsigned long cel;
        unsigned long ceh;
 
        unsigned long sr0;      /* cnt */
        unsigned long sr1;      /* lcr */
        unsigned long sr2;      /* scr */
 
        unsigned long cp0_epc;
        unsigned long cp0_ema;
        unsigned long cp0_psr;
        unsigned long cp0_ecr;
        unsigned long cp0_condition;
};
 
[On arch/score/kernel/asm-offsets.c]
 
void output_ptreg_defines(void)
{
        COMMENT("SCORE pt_regs offsets.");
        OFFSET(PT_R0, pt_regs, regs[0]);
        OFFSET(PT_R1, pt_regs, regs[1]);
        OFFSET(PT_R2, pt_regs, regs[2]);
        OFFSET(PT_R3, pt_regs, regs[3]);
        OFFSET(PT_R4, pt_regs, regs[4]);
        OFFSET(PT_R5, pt_regs, regs[5]);
        OFFSET(PT_R6, pt_regs, regs[6]);
        OFFSET(PT_R7, pt_regs, regs[7]);
        OFFSET(PT_R8, pt_regs, regs[8]);
        OFFSET(PT_R9, pt_regs, regs[9]);
        OFFSET(PT_R10, pt_regs, regs[10]);
        OFFSET(PT_R11, pt_regs, regs[11]);
        OFFSET(PT_R12, pt_regs, regs[12]);
        OFFSET(PT_R13, pt_regs, regs[13]);
        OFFSET(PT_R14, pt_regs, regs[14]);
        OFFSET(PT_R15, pt_regs, regs[15]);
        OFFSET(PT_R16, pt_regs, regs[16]);
        OFFSET(PT_R17, pt_regs, regs[17]);
        OFFSET(PT_R18, pt_regs, regs[18]);
        OFFSET(PT_R19, pt_regs, regs[19]);
        OFFSET(PT_R20, pt_regs, regs[20]);
        OFFSET(PT_R21, pt_regs, regs[21]);
        OFFSET(PT_R22, pt_regs, regs[22]);
        OFFSET(PT_R23, pt_regs, regs[23]);
        OFFSET(PT_R24, pt_regs, regs[24]);
        OFFSET(PT_R25, pt_regs, regs[25]);
        OFFSET(PT_R26, pt_regs, regs[26]);
        OFFSET(PT_R27, pt_regs, regs[27]);
        OFFSET(PT_R28, pt_regs, regs[28]);
        OFFSET(PT_R29, pt_regs, regs[29]);
        OFFSET(PT_R30, pt_regs, regs[30]);
        OFFSET(PT_R31, pt_regs, regs[31]);
 
        OFFSET(PT_ORIG_R4, pt_regs, orig_r4);
        OFFSET(PT_ORIG_R7, pt_regs, orig_r7);
        OFFSET(PT_CEL, pt_regs, cel);
        OFFSET(PT_CEH, pt_regs, ceh);
        OFFSET(PT_SR0, pt_regs, sr0);
        OFFSET(PT_SR1, pt_regs, sr1);
        OFFSET(PT_SR2, pt_regs, sr2);
        OFFSET(PT_EPC, pt_regs, cp0_epc);
        OFFSET(PT_EMA, pt_regs, cp0_ema);
        OFFSET(PT_PSR, pt_regs, cp0_psr);
        OFFSET(PT_ECR, pt_regs, cp0_ecr);
        OFFSET(PT_CONDITION, pt_regs, cp0_condition);
        OFFSET(PT_IS_SYSCALL, pt_regs, is_syscall);
 
        DEFINE(PT_SIZE, sizeof(struct pt_regs));
        BLANK();
}
 
[There are many more like]
output_task_define() = For the task struct
output_thread_info_defines() = For the thread_info struct
output_mm_defines() = For the mm struct
output_sc_defines() = For the sc struct
 
[Also we define our signals]
output_signal_defined()
 
e.g,
 
DEFINE(_SIGHUP, SIGHUP); = SIGHUP definition is defined by Linux so we just copy it.
 
- kernel/entry.S
 
[EXTREMELY IMPORTANT FUNCTION. IT HAS THE ENTRY POINTS OF THE FUNCTIONS IN ASSEMBLY. MOST OF THE WORK
 HAS TO BE DONE HERE.]
 
[**** include/linux/sched.h implements the task_struct struct. This is used by the architecture
      independent scheduler to schedule tasks. However, it has a pointer to the architecture
      dependent thread_struct that is going to have all the necessary information to save during 
      a context switch besides other things. ****]
 
[Implementations]
.marco disable_irq
.macro enable_irq
general_exception
interrupt_exception
ENTRY(handle_nmi)
ENTRY(handle_adelinsn)
ENTRY(handle_ibe)
ENTRY(handle_pel)
ENTRY(handle_ccu)
ENTRY(handle_tr) = Handles a trap 
ENTRY(handle_adedata)
ENTRY(handle_cee)
ENTRY(handle_cpe)
ENTRY(handle_dbe)
ENTRY(handle_reserved)
 
ENTRY(ret_from_exception)
ENTRY(ret_from_irq)
ENTRY(__ret_from_irq)
 
resume_userspace:
 
resume_kernel:
need_resched:
 
ENTRY(ret_from_fork)
ENTRY(syscall_exit_work)
 
.macro save_context = Saves thread_struct general purpose registers
 
ENTRY(resume)
ENTRY(handle_sys)
ENTRY(syscall_return)
ENTRY(syscall_return_work)
ENTRY(syscall_trace_entry)
ENTRY(illegal_syscall)
 
ENTRY(sys_execve)
ENTRY(sys_clone)
ENTRY(sys_rt_sigreturn)
ENTRY(sys_sigaltstack)
ENTRY(sys_fork)
ENTRY(sys_vfork)
 
- kernel/head.S = Reads from:
+ linux/init.h
+ linux/linkage.h
+ asm/asm-offsets.h
 
[This is the entry point of the kernel. It's very similar to our boot. It sets up
 the kernel stack and jumps to start_kernel in init/main.c.]
 
- kernel/irq.c = Reads from:
+ linux/interrupt.h
+ linux/kernel_start.h
+ linux/seq_file.h
+ asm/io.h
 
[This file handles de interrupts. Tells Linux how to operate the score's PIC]
do_IRQ()
score_mask()
score_unmask()
init_IRQ() = This is called by init/main.c, start_kernel function
 
- kernel/Makefile = The Makefile to compile the kernel
- kernel/module.c = Reads from:
+ linux/moduleloader.h
+ linux/module.h
+ linux/vmalloc.h
[Not sure what this file does]
 
apply_relocate()
search_module_dbetables()
 
- kernel/process.c = Reads from:
+ linux/module.h
+ linux/reboot.h
+ linux/elfcore.h
+ linux/pm.h
+ linux/rcupdate.n
 
void (*pm_power_off)(void);
EXPORT_SYMBOL(pm_power_off);
 
void machine_restart();
void machine_halt();
void machine_power_off();
void __noreturn cpu_idle();
 
void ret_from_fork();
void start_thread();
void exit_thread();
void flush_thread(void);
 
void copy_thread();
void dump_fpu();
 
void __noreturn kernel_thread_helper();
long kernel_thread();
long thread_saved_pc();
long get_wchan();
long arch_align_stack();
 
- kernel/ptrace.c = Reads from:
+ linux/elf.h
+ linux/kernel.h
+ linux/mm.h
+ linux/ptrace.h
+ linux/regset.h
+ asm/uaccess.h
[This file helps debugging processes]
 
[Implementations]
genregs_get();
genregs_set();
 
[types]
score7_regset;
score7_regsets;
user_score_native_view
 
[Implementations]
task_user_regset_view();
read_tsk_long();
read_tsk_short();
write_tsk_short();
write_tsk_long();
user_enable_single_step();
user_disable_single_step();
ptrace_disable();
arch_ptrace();
do_syscall_trace();
 
 
- kernel/setup.c = Reads from:
+ asm-generic/sections.h
+ asm/setup.h
[Important file. This setups the machine. I guess It's called from start_kernel on init/main.c]
 
[Implementations]
bootmem_init();
resource_init(void);
setup_arch(); = This calls:
- cpu_cache_init();
- tlb_init();
- bootmem_init();
- paging_init();
- resource_init();
show_cpuinfo();
*c_start();
*c_next();
c_stop
 
[types]
cpuinfo_op
 
[Implementation]
topology_init();
 
 
- kernel/signal.c
 
[This file manages the signals.]
 
[type]
rt_sigfram;
 
[Implementations]
setup_sigcontext();
save_gp_reg();
restore_sigcontext();
restore_gp_reg();
 
*get_sigframe();
score_sigaltstack();
score_rt_sigreturn();
setup_rt_frame();
handle_signal();
do_signal();
do_notify_resume();
 
- kernel/sys_call_table.c = Reads from:
+ linux/syscalls.h
+ linux/signal.h
+ linux/unistd.h
+ asm/syscalls.h
#define __SYSCALL(nr, call)
 
void *sys_call_table[__NR_syscalls] = {
  #include <asm/unistd.h>
}
 
- kernel/sys_score.c = Reads from:
+ linux/file.h
+ linux/fs.h
+ linux/mm.h
+ linux/mman.h
+ linux/module.h
+ linux/slab.h
+ linux/unistd.h
+ linux/syscalls.h
+ asm/syscalls.h
 
[Implementations]
sys_mmap2();
sys_mmap();
score_fork();
score_clone();
score_vfork();
score_execve();
score_execve();
kernel_execve();
 
- kernel/time.c = Reads from:
+ linux/clockchips.h
+ linux/interrupt.h
+ asm/scoreregs.h
[This file sets up the timer.]
 
[Implementation]
timer_interrupt
 
[type]
timer_irq
 
[Implementations]
score_timer_set_next_event();
score_timer_set_mode();
 
[type]
score_clockevent
 
[Implementation]
time_init();   = This functions calls clockevents_register_device(), look at this function!
 
- kernel/traps.c = Reads from:
+ linux/module.h
+ linux/sched.h
+ asm/cacheflush.h
+ asm/irq.h
+ asm/irq_regs.h
[This file contains functions to debug when a trap occurs]
exception_handlers[32];
 
show_stack();
show_trace();
show_code();
show_regs();
show_registers();
dump_stack();
__die();
__die_if_kernel();
do_adelinsn();
do_adedata();
do_pel();
do_cee();
do_cpe();
do_be();
do_ov();
do_ri();
do_ccu();
do_reserved();
 
nmi_exception_handler();
set_exception_vector(); = Install CPU exception handler
trap_init(){
...
set_except_vector(1, handle_nmi);
        set_except_vector(2, handle_adelinsn);
        set_except_vector(3, handle_tlb_refill);
        set_except_vector(4, handle_tlb_invaild);
        set_except_vector(5, handle_ibe);
        set_except_vector(6, handle_pel);
        set_except_vector(7, handle_sys);
        set_except_vector(8, handle_ccu);
        set_except_vector(9, handle_ri);
        set_except_vector(10, handle_tr);
        set_except_vector(11, handle_adedata);
        set_except_vector(12, handle_adedata);
        set_except_vector(13, handle_tlb_refill);
        set_except_vector(14, handle_tlb_invaild);
        set_except_vector(15, handle_mod);
        set_except_vector(16, handle_cee);
        set_except_vector(17, handle_cpe);
        set_except_vector(18, handle_dbe);
...
}
 
 
- kernel/vmlinux.lds.S = This file tells the linker where and how to place our code.
 
[All this files contain libraries optimized for this architecture. If we remove all these files, our
kernel will reference the std implementations.]
- lib/
- lib/ashldi3.c
- lib/ashrdi3.c
- lib/checksum_copy.c
- lib/checksum.S
- lib/cmpdi2.c
- lib/libgcc.h
- lib/lshrdi3.c
- lib/Makefile
- lib/string.S
- lib/ucmpi2.c
 
- mm/
- mm/cache.c = Reads from:
+ linux/init.h
+ linux/linkage.h
+ linux/kernel.h
+ linux/mm.h
+ linux/module.h
+ linux/sched.h
+ linux/fs.h
+ asm/mmu_context.h
[This file manages the cache]
flush_data_cache_page
flush_dcache_page
__update_cache()
setup_protection_map()
cpu_cache_init()
flush_icache_all()
flush_dcache_all()
flush_cache_all()
flush_cache_mm()
flush_cache_range()
flush_cache_sigtramp()
flush_dcache_range()
flush_icache_range()
 
- mm/extable.c = Reads from:
+ linux/module.h
fixup_exception();
 
- mm/fault.c = Reads from:
+ linux/mm.h
+ linux/mman.h
+ linux/module.h
+ linux/signal.h
+ linux/sched.h
+ linux/string.h
+ linux/types.h
+ linux/types.h
+ linux/ptrace.h
 
[This files handles page faults]
do_page_fault()
 
- mm/init.c = Reads from:
+ linux/errno.h
+ linux/bootmem.h
+ linux/kernel.h
+ linux/gfp.h
+ linux/init.h
+ linux/mm.h
+ linux/mman.h
+ linux/pagemap.h
+ linux/proc_fs.h
+ linux/sched.h
+ linux/initrd.h
+ asm/sections.h
+ asm/tlb.h
[Initializes the mmu]
 
[Implementation]
setup_zero_page()
page_is_ram()
paging_init()
mem_init()
free_init_pages()
free_initrd_mem()
free_init_mem()
 
- mm/Makefile = Makefile to generate the objects of this folder
- mm/pgtable.c
- mm/tlb-miss.S
- mm/tlb-score.c