Changeset 75e1db0 in mainline for arch/sparc64/include/asm.h


Ignore:
Timestamp:
2005-12-19T22:41:07Z (19 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
d6e8529
Parents:
031e264
Message:

sparc64 work.
Implement interrupt_disable(), interrupt_enable(), interrupt_restore() and interrupt_read() functions.
Fix context save/restore to save/restore register %i7.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • arch/sparc64/include/asm.h

    r031e264 r75e1db0  
    3030#define __sparc64_ASM_H__
    3131
     32#include <typedefs.h>
    3233#include <arch/types.h>
     34#include <arch/register.h>
    3335#include <config.h>
     36
     37/** Read Processor State register.
     38 *
     39 * @return Value of PSTATE register.
     40 */
     41static inline __u64 pstate_read(void)
     42{
     43        __u64 v;
     44       
     45        __asm__ volatile ("rdpr %%pstate, %0\n" : "=r" (v));
     46       
     47        return v;
     48}
     49
     50/** Write Processor State register.
     51 *
     52 * @param New value of PSTATE register.
     53 */
     54static inline void pstate_write(__u64 v)
     55{
     56        __asm__ volatile ("wrpr %0, %1, %%pstate\n" : : "r" (v), "i" (0));
     57}
     58
    3459
    3560/** Enable interrupts.
     
    4166 */
    4267static inline ipl_t interrupts_enable(void) {
     68        pstate_reg_t pstate;
     69        __u64 value;
     70       
     71        value = pstate_read();
     72        pstate.value = value;
     73        pstate.ie = true;
     74        pstate_write(pstate.value);
     75       
     76        return (ipl_t) value;
    4377}
    4478
     
    5185 */
    5286static inline ipl_t interrupts_disable(void) {
     87        pstate_reg_t pstate;
     88        __u64 value;
     89       
     90        value = pstate_read();
     91        pstate.value = value;
     92        pstate.ie = false;
     93        pstate_write(pstate.value);
     94       
     95        return (ipl_t) value;
    5396}
    5497
     
    60103 */
    61104static inline void interrupts_restore(ipl_t ipl) {
     105        pstate_reg_t pstate;
     106       
     107        pstate.value = pstate_read();
     108        pstate.ie = ((pstate_reg_t) ipl).ie;
     109        pstate_write(pstate.value);
    62110}
    63111
     
    69117 */
    70118static inline ipl_t interrupts_read(void) {
     119        return (ipl_t) pstate_read();
    71120}
    72121
     
    81130        __address v;
    82131       
    83         __asm__ volatile ("and %%o6, %1, %0\n" : "=r" (v) : "r" (~(STACK_SIZE-1)));
     132        __asm__ volatile ("and %%sp, %1, %0\n" : "=r" (v) : "r" (~(STACK_SIZE-1)));
    84133       
    85134        return v;
Note: See TracChangeset for help on using the changeset viewer.