home *** CD-ROM | disk | FTP | other *** search
/ ARM Club 3 / TheARMClub_PDCD3.iso / hensa / unix / unixlib_1 / !UnixLib37_src_sys_s__kernel < prev    next >
Encoding:
Text File  |  1996-11-09  |  1.8 KB  |  64 lines

  1. ;----------------------------------------------------------------------------
  2. ;
  3. ; $Source: /unixb/home/unixlib/source/unixlib37/src/sys/s/RCS/_kernel,v $
  4. ; $Date: 1996/11/06 22:01:42 $
  5. ; $Revision: 1.3 $
  6. ; $State: Rel $
  7. ; $Author: unixlib $
  8. ;
  9. ; $Log: _kernel,v $
  10. ; Revision 1.3  1996/11/06 22:01:42  unixlib
  11. ; Yet more changes by NB, PB and SC.
  12. ;
  13. ; Revision 1.2  1996/10/30 21:59:00  unixlib
  14. ; Massive changes made by Nick Burret and Peter Burwood.
  15. ;
  16. ; Revision 1.1  1996/04/19 21:34:32  simon
  17. ; Initial revision
  18. ;
  19. ;----------------------------------------------------------------------------
  20.  
  21.     GET    Unix37:unixlib.s.asm_dec
  22.  
  23.     AREA    |C$$wrcode|,CODE
  24.  
  25. ; _kernel_swi for UnixLib
  26. ; This version provides the same programming contract as the version in
  27. ; the Shared C Library and hence follows the definition of the function
  28. ; in C:kernel.h.
  29. ;
  30. ; This version differs by working not placing the generated code onto
  31. ; the stack, but using self-modifying code inlined in the function.
  32. ; This version will work on all current ARM chips including the ARM 8
  33. ; and StrongARM. The self-modifying code works because the only
  34. ; instruction modified is a SWI and the instruction cache only uses
  35. ; the condition code field and the SWI instruction field (the top
  36. ; byte) which is preset. The SWI decoding code will load the SWI `comment'
  37. ; field of the SWI from the data cache.
  38. ;
  39. ; Unfortunately, DDT doesn't seem to like even that bit of self-modifying
  40. ; code on a StrongARM, so we use OS_CallASWIR12 (as all good boys and
  41. ; girls should).
  42.  
  43.  
  44.     IMPORT    |__seterr|
  45.     EXPORT    |_kernel_swi|
  46.  
  47. |_kernel_swi|
  48.     STMFD    sp!,{a3,v1-v6,lr}
  49.     BICS    ip,a1,#&80000000
  50.     ORRPL    ip,ip,#&20000        ; X bit
  51.     LDMIA    a2,{a1-v6}
  52.     SWI    XOS_CallASWIR12
  53.     LDR    ip,[sp,#0]
  54.     STMIA    ip,{a1-v6}
  55.     MOVVS    v1,a1
  56.     BLVS    |__seterr|
  57.     MOVVS    a1,v1
  58.     MOVVC    a1,#0
  59.     LDMIA    sp!,{a3,v1-v6,pc}^
  60.  
  61.     ; add kernel_last_oserror to pick up the saved error in __seterr ?
  62.  
  63.     END
  64.