Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset d59c046 in mainline


Ignore:
Timestamp:
2013-02-20T20:53:42Z (9 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master
Children:
a4e23f8c
Parents:
005b765
Message:

Test for a user istate can be only done by looking at CS and its RPL.

Location:
kernel/arch
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/amd64/include/istate.h

    r005b765 rd59c046  
    6666} istate_t;
    6767
     68#define RPL_USER        3
     69
    6870/** Return true if exception happened while in userspace */
    6971NO_TRACE static inline int istate_from_uspace(istate_t *istate)
    7072{
    71         return !(istate->rip & UINT64_C(0x8000000000000000));
     73        return (istate->cs & RPL_USER) == RPL_USER;
    7274}
    7375
  • kernel/arch/ia32/include/istate.h

    r005b765 rd59c046  
    6868} istate_t;
    6969
     70#define RPL_USER        3
     71
    7072/** Return true if exception happened while in userspace */
    7173NO_TRACE static inline int istate_from_uspace(istate_t *istate)
    7274{
    73         return !(istate->eip & UINT32_C(0x80000000));
     75        return (istate->cs & RPL_USER) == RPL_USER;
    7476}
    7577
Note: See TracChangeset for help on using the changeset viewer.