Changeset 1f12fab in mainline for kernel/arch/sparc32/include


Ignore:
Timestamp:
2013-10-07T20:00:34Z (12 years ago)
Author:
Jakub Klama <jakub.klama@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
a73ebf0
Parents:
80d9d83
Message:

First attempt to implement preemptive trap handlers
and switch to userspace. Preemptive traps are needed
for at least page faults, as page fault handling code
can trigger window underflow/overflow exceptions.

This commit also introduces userspace window buffer
for saving userspace register windows (just as in
sparc64).

These changes are unfinished and far from working
correctly.

Location:
kernel/arch/sparc32/include/arch
Files:
1 added
5 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/sparc32/include/arch/arch.h

    r80d9d83 r1f12fab  
    4141#include <typedefs.h>
    4242
     43#define NWINDOWS        8
     44
    4345/* ASI assignments: */
    4446#define ASI_CACHEMISS   0x01
     
    6365} bootinfo_t;
    6466
    65 void arch_pre_main(bootinfo_t *bootinfo);
     67extern uintptr_t kernel_sp;
     68extern uintptr_t uspace_wbuf;
     69
     70extern void arch_pre_main(void *unused, bootinfo_t *bootinfo);
    6671
    6772#endif
  • kernel/arch/sparc32/include/arch/elf.h

    r80d9d83 r1f12fab  
    2727 */
    2828
    29 /** @addtogroup abs32le
     29/** @addtogroup sparc32
    3030 * @{
    3131 */
     
    3333 */
    3434
    35 #ifndef KERN_abs32le_ELF_H_
    36 #define KERN_abs32le_ELF_H_
     35#ifndef KERN_sparc32_ELF_H_
     36#define KERN_sparc32_ELF_H_
    3737
    38 #define ELF_MACHINE        EM_NO
    39 #define ELF_DATA_ENCODING  ELFDATA2LSB
     38#define ELF_MACHINE        EM_SPARC
     39#define ELF_DATA_ENCODING  ELFDATA2MSB
    4040#define ELF_CLASS          ELFCLASS32
    4141
  • kernel/arch/sparc32/include/arch/istate.h

    r80d9d83 r1f12fab  
    2727 */
    2828
    29 /** @addtogroup abs32leinterrupt
     29/** @addtogroup sparc32interrupt
    3030 * @{
    3131 */
     
    3333 */
    3434
    35 #ifndef KERN_abs32le_ISTATE_H_
    36 #define KERN_abs32le_ISTATE_H_
     35#ifndef KERN_sparc32_ISTATE_H_
     36#define KERN_sparc32_ISTATE_H_
    3737
    3838#include <trace.h>
     
    5454 */
    5555typedef struct istate {
    56         uintptr_t ip;
    57         uintptr_t fp;
     56        uintptr_t pstate;
     57        uintptr_t pc;
     58        uintptr_t npc;
    5859        uint32_t stack[];
    5960} istate_t;
     
    6465        /* On real hardware this checks whether the interrupted
    6566           context originated from user space. */
    66        
    67         return !(istate->ip & UINT32_C(0x80000000));
     67
     68        return !(istate->pc & UINT32_C(0x80000000));
    6869}
    6970
     
    7475        /* On real hardware this sets the instruction pointer. */
    7576       
    76         istate->ip = retaddr;
     77        istate->pc = retaddr;
    7778}
    7879
     
    8283        /* On real hardware this returns the instruction pointer. */
    8384       
    84         return istate->ip;
     85        return istate->pc;
    8586}
    8687
     
    9091        /* On real hardware this returns the frame pointer. */
    9192       
    92         return istate->fp;
     93        return 0;//istate->fp;
    9394}
    9495
  • kernel/arch/sparc32/include/arch/mm/tlb.h

    r80d9d83 r1f12fab  
    11/*
    2  * Copyright (c) 2010 Martin Decky
     2 * Copyright (c) 2013 Jakub Klama
    33 * All rights reserved.
    44 *
     
    2727 */
    2828
    29 /** @addtogroup abs32lemm
     29/** @addtogroup sparc32mm
    3030 * @{
    3131 */
     
    3333 */
    3434
    35 #ifndef KERN_abs32le_TLB_H_
    36 #define KERN_abs32le_TLB_H_
     35#ifndef KERN_sparc32_TLB_H_
     36#define KERN_sparc32_TLB_H_
     37
     38#define MMU_CONTROL             0x000
     39#define MMU_CONTEXT_TABLE       0x100
     40#define MMU_CONTEXT             0x200
     41#define MMU_FAULT_STATUS        0x300
     42#define MMU_FAULT_ADDRESS       0x400
    3743
    3844#endif
  • kernel/arch/sparc32/include/arch/proc/thread.h

    r80d9d83 r1f12fab  
    11/*
    2  * Copyright (c) 2010 Martin Decky
     2 * Copyright (c) 2013 Jakub Klama
    33 * All rights reserved.
    44 *
     
    2727 */
    2828
    29 /** @addtogroup abs32leproc
     29/** @addtogroup sparc32proc
    3030 * @{
    3131 */
     
    3333 */
    3434
    35 #ifndef KERN_abs32le_THREAD_H_
    36 #define KERN_abs32le_THREAD_H_
     35#ifndef KERN_sparc32_THREAD_H_
     36#define KERN_sparc32_THREAD_H_
    3737
    3838#include <typedefs.h>
    3939
    4040typedef struct {
     41        /** Buffer for register windows with userspace content. */
     42        uint8_t *uspace_window_buffer;
    4143} thread_arch_t;
    42 
    43 #define thr_constructor_arch(thr)
    44 #define thr_destructor_arch(thr)
    4544
    4645#endif
Note: See TracChangeset for help on using the changeset viewer.