-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmodule.c
89 lines (70 loc) · 1.82 KB
/
module.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#include "linuxboot.h"
#include "types.h"
#include "riscos.h"
#include "linux.h"
#include "vcmessaging.h"
static void *module_globalPrivateWord=NULL;
#define KERNEL_FILENAME "SDFS:$.!Boot.Loader.kernel/img"
//#define KERNEL_FILENAME "SDFS:$.blinker01/bin"
#define INITRD_FILENAME "none"
#define CMDLINE "not passed yet"
#define ZIMAGE_MODE 0 // doesn't work
OSERROR *module_swi(int swiNumber, _kernel_swi_regs *r, void *privateWord)
{
OSERROR *result=NULL;
UNUSED(privateWord);
UNUSED(swiNumber);
UNUSED(r);
int output;
switch(swiNumber)
{
case BootLinux_Boot:
start_linux(r->r[1] /*KERNEL_FILENAME*/,INITRD_FILENAME,r->r[2] /*CMDLINE*/,r->r[0],ZIMAGE_MODE);
printf("Phew!\n");
break;
case BootLinux_Messaging:
//result=test_message(r);
break;
default:
break;
}
return result;
}
OSERROR *module_cmd(char *argString, int argc, int commandNumber, void *privateWord)
{
UNUSED(privateWord);
UNUSED(argString);
UNUSED(argc);
UNUSED(commandNumber);
start_linux(argString,"",CMDLINE,commandNumber,ZIMAGE_MODE);
return 0;
}
#if 0
void module_service(int serviceNumber, _kernel_swi_regs *r, void *privateWord)
{
UNUSED(serviceNumber);
UNUSED(r);
UNUSED(privateWord);
/* Only interested in Service_ShutDown */
xsyslog_irq_mode(TRUE);
noise_save_seed();
xsyslog_irq_mode(FALSE);
}
#endif
void module_finalise(void)
{
}
OSERROR *module_initialise(char *commandTail, int poduleBase, void *privateWord)
{
OSERROR *result;
UNUSED(commandTail);
UNUSED(poduleBase);
UNUSED(privateWord);
module_globalPrivateWord=privateWord;
/* if everything here went OK, we can attach the normal finalisation
* code - don't do this before here, as we might try to finalise
* something that hasn't been initialised
*/
atexit(module_finalise);
return 0;
}