__clear_user function

SYM_FUNC_START(__clear_user)

        /* Enable access to user memory */
        li t6, SR_SUM
        csrs CSR_STATUS, t6

        add a3, a0, a1
        addi t0, a0, SZREG-1
        andi t1, a3, ~(SZREG-1)
        andi t0, t0, ~(SZREG-1)

'csrs       sstatus,t6' instruction turns on sstatus.sum = 1. 
This makes kernel space access user space memory 

SP:FFFFFFFF803062F4|__clear_user:   lui        t6,0x40       ; t6,64
SP:FFFFFFFF803062F8|                csrs       sstatus,t6
SP:FFFFFFFF803062FC|                add        a3,a0,a1

comment said 'Enable access to user memory'

Similar code is here:
 
SYM_FUNC_START(fallback_scalar_usercopy)
        /* Enable access to user memory */
        li      t6, SR_SUM
        csrs    CSR_STATUS, t6 

 

 

+ Recent posts