LibPkg
call_swi.h
Go to the documentation of this file.
1 // This file is part of the LibPkg.
2 //
3 // Copyright 2003-2020 Graham Shaw
4 //
5 // Licensed under the Apache License, Version 2.0 (the "License");
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
8 //
9 // http://www.apache.org/licenses/LICENSE-2.0
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 
17 // Moved to LibPkg by Alan Buckley to remove the RTK dependency.
18 // Modified from RTK version to add extra exception information
19 // by Theo Markettos
20 
21 #ifndef _LIBPKG_OS_SWI
22 #define _LIBPKG_OS_SWI
23 
24 #include "kernel.h"
25 
26 #include "exception.h"
27 
28 namespace pkg {
29 namespace os {
30 
35 inline void call_swi(unsigned int number,_kernel_swi_regs* regs)
36 {
37  const int X=0x20000;
38  unsigned int r0=regs->r[0];
39  _kernel_oserror* err=_kernel_swi(X+number,regs,regs);
40  if (err) throw exception(err,number,r0);
41 }
42 
43 } /* namespace os */
44 } /* namespace pkg */
45 
46 #endif
void call_swi(unsigned int number, _kernel_swi_regs *regs)
Call a RISC OS software interrupt.
Definition: call_swi.h:35
An exception class to represent a RISC OS error block.
Definition: exception.h:33
The namespace used to hold the package management library.
Definition: auto_dir.cc:23

Reference Manual LibPkg Version 0.9.0 (4 Sep 2020)