Check-in [bc2baaa634]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Move the task handler to its own class.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: bc2baaa6341fdbaf11361d59e809db7b0036a82c
User & Date: stephanie.gawroriski 2019-10-06 11:57:30
Context
2019-10-06
13:02
Add class to store static globals; Rename ClientTaskManager to TaskManager. check-in: eb184c0f8d user: stephanie.gawroriski tags: trunk
11:57
Move the task handler to its own class. check-in: bc2baaa634 user: stephanie.gawroriski tags: trunk
07:06
Backup developer notes. check-in: a2ba55b187 user: squirreljme tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to runt/klib/supervisor/cc/squirreljme/jvm/Bootstrap.java.

9
10
11
12
13
14
15

16
17
18
19
20
21
22
..
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
..
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119

package cc.squirreljme.jvm;

import cc.squirreljme.jvm.lib.BootRom;
import cc.squirreljme.jvm.lib.BootRomLibrary;
import cc.squirreljme.jvm.task.ClientTask;
import cc.squirreljme.jvm.task.ClientTaskManager;


/**
 * This is the bootstrap entry point for the supervisor.
 *
 * @since 2019/05/25
 */
public final class Bootstrap
................................................................................
	 *
	 * @since 2019/05/25
	 */
	private Bootstrap()
	{
	}
	
	/**
	 * Handler for task system calls.
	 *
	 * @param __tid The task ID.
	 * @param __oldsfp The old static field pointer.
	 * @param __si The system call that was made.
	 * @param __a Argument.
	 * @param __b Argument.
	 * @param __c Argument.
	 * @param __d Argument.
	 * @param __e Argument.
	 * @param __f Argument.
	 * @param __g Argument.
	 * @param __h Argument.
	 * @return The result.
	 * @since 2019/10/05
	 */
	static final int __taskSysCall(int __tid, int __oldsfp, short __si,
		int __a, int __b, int __c, int __d, int __e, int __f, int __g, int __h)
	{
		todo.DEBUG.code('H', 't', __tid);
		todo.DEBUG.code('H', 's', __oldsfp);
		todo.DEBUG.code('H', 'd', __si);
		
		return Assembly.sysCallPV(__si, __a, __b, __c, __d, __e, __f, __g,
			__h);
	}
	
	/**
	 * Entry point for the bootstrap.
	 *
	 * @param __rambase The base RAM address.
	 * @param __ramsize The size of RAM.
	 * @param __rombase Base address of the ROM (for offset calculation).
	 * @param __romsize The size of ROM.
................................................................................
				config.loadString(ConfigRomType.JAVA_VM_VENDOR));
			todo.DEBUG.note("RAM/ROM (bytes): %d/%d", __ramsize, __romsize);
			
			// Spacer
			todo.DEBUG.note("");
			
			// Load system call handler
			todo.DEBUG.note("Setting task system call handler...");
			Assembly.sysCallP(SystemCallIndex.SUPERVISOR_PROPERTY_SET,
				SupervisorPropertyIndex.TASK_SYSCALL_STATIC_FIELD_POINTER,
				config.loadInteger(
					ConfigRomType.SYSCALL_STATIC_FIELD_POINTER));
			Assembly.sysCallP(SystemCallIndex.SUPERVISOR_PROPERTY_SET,
				SupervisorPropertyIndex.TASK_SYSCALL_METHOD_HANDLER,
				config.loadInteger(
					ConfigRomType.SYSCALL_CODE_POINTER));
			Assembly.sysCallP(SystemCallIndex.SUPERVISOR_PROPERTY_SET,
				SupervisorPropertyIndex.TASK_SYSCALL_METHOD_POOL_POINTER,
				config.loadInteger(
					ConfigRomType.SYSCALL_POOL_POINTER));
			todo.DEBUG.note("Okay.");
			
			// Initialize the client task manager
			todo.DEBUG.note("Initializing task manager...");
			ClientTaskManager ctm = new ClientTaskManager();
			todo.DEBUG.note("Okay.");
			
			// Spacer







>







 







<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<







 







|
<
<
<
<
<
<
<
<
<
<
<
<
<







9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
..
27
28
29
30
31
32
33




























34
35
36
37
38
39
40
..
65
66
67
68
69
70
71
72













73
74
75
76
77
78
79

package cc.squirreljme.jvm;

import cc.squirreljme.jvm.lib.BootRom;
import cc.squirreljme.jvm.lib.BootRomLibrary;
import cc.squirreljme.jvm.task.ClientTask;
import cc.squirreljme.jvm.task.ClientTaskManager;
import cc.squirreljme.jvm.task.TaskSysCallHandler;

/**
 * This is the bootstrap entry point for the supervisor.
 *
 * @since 2019/05/25
 */
public final class Bootstrap
................................................................................
	 *
	 * @since 2019/05/25
	 */
	private Bootstrap()
	{
	}
	




























	/**
	 * Entry point for the bootstrap.
	 *
	 * @param __rambase The base RAM address.
	 * @param __ramsize The size of RAM.
	 * @param __rombase Base address of the ROM (for offset calculation).
	 * @param __romsize The size of ROM.
................................................................................
				config.loadString(ConfigRomType.JAVA_VM_VENDOR));
			todo.DEBUG.note("RAM/ROM (bytes): %d/%d", __ramsize, __romsize);
			
			// Spacer
			todo.DEBUG.note("");
			
			// Load system call handler
			TaskSysCallHandler.initTaskHandler(config);













			
			// Initialize the client task manager
			todo.DEBUG.note("Initializing task manager...");
			ClientTaskManager ctm = new ClientTaskManager();
			todo.DEBUG.note("Okay.");
			
			// Spacer

Added runt/klib/supervisor/cc/squirreljme/jvm/task/TaskSysCallHandler.java.



























































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
89
90
91
92
93
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.jvm.task;

import cc.squirreljme.jvm.Assembly;
import cc.squirreljme.jvm.ConfigReader;
import cc.squirreljme.jvm.ConfigRomType;
import cc.squirreljme.jvm.SupervisorPropertyIndex;
import cc.squirreljme.jvm.SystemCallIndex;

/**
 * This is the handler for system calls within tasks.
 *
 * @since 2019/10/06
 */
public final class TaskSysCallHandler
{
	/**
	 * Not used.
	 *
	 * @since 2019/10/06
	 */
	private TaskSysCallHandler()
	{
	}
	
	/**
	 * Initializes and sets the task handler for system calls.
	 *
	 * @param __cr The configuration to use.
	 * @throws NullPointerException On null arguments.
	 * @since 2019/10/06
	 */
	public static final void initTaskHandler(ConfigReader __cr)
		throws NullPointerException
	{
		if (__cr == null)
			throw new NullPointerException("NARG");
			
		// Message
		todo.DEBUG.note("Setting task system call handler...");
		
		// Set handlers
		Assembly.sysCallP(SystemCallIndex.SUPERVISOR_PROPERTY_SET,
			SupervisorPropertyIndex.TASK_SYSCALL_STATIC_FIELD_POINTER,
			__cr.loadInteger(ConfigRomType.SYSCALL_STATIC_FIELD_POINTER));
		Assembly.sysCallP(SystemCallIndex.SUPERVISOR_PROPERTY_SET,
			SupervisorPropertyIndex.TASK_SYSCALL_METHOD_HANDLER,
			__cr.loadInteger(ConfigRomType.SYSCALL_CODE_POINTER));
		Assembly.sysCallP(SystemCallIndex.SUPERVISOR_PROPERTY_SET,
			SupervisorPropertyIndex.TASK_SYSCALL_METHOD_POOL_POINTER,
			__cr.loadInteger(ConfigRomType.SYSCALL_POOL_POINTER));
		
		// Message
		todo.DEBUG.note("Okay.");
	}
	
	/**
	 * Handler for task system calls.
	 *
	 * @param __tid The task ID.
	 * @param __oldsfp The old static field pointer.
	 * @param __si The system call that was made.
	 * @param __a Argument.
	 * @param __b Argument.
	 * @param __c Argument.
	 * @param __d Argument.
	 * @param __e Argument.
	 * @param __f Argument.
	 * @param __g Argument.
	 * @param __h Argument.
	 * @return The result.
	 * @since 2019/10/05
	 */
	public static final int taskSysCall(int __tid, int __oldsfp, short __si,
		int __a, int __b, int __c, int __d, int __e, int __f, int __g, int __h)
	{
		todo.DEBUG.code('H', 't', __tid);
		todo.DEBUG.code('H', 's', __oldsfp);
		todo.DEBUG.code('H', 'd', __si);
		
		return Assembly.sysCallPV(__si, __a, __b, __c, __d, __e, __f, __g,
			__h);
	}
}

Changes to runt/libs/tool-jarfile/dev/shadowtail/jarfile/JarMinimizer.java.

276
277
278
279
280
281
282




283
284

285
286
287
288
289
290
291
...
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
			// Get all the bootstrap information before it is written!
			int bootpool = booting.poolPointer();
			int bootsfbp = bootstrap.staticFieldAreaAddress();
			int bootmeth = booting.methodCodeAddress(
				new MethodName("__start"), null);
			int bootidba = bootstrap.findClass("[B").infoPointer();
			int bootidbd = bootstrap.findClass("[[B").infoPointer();




			int syscallm = booting.methodCodeAddress(
				new MethodName("__taskSysCall"), null);

			
			// Setup the BootRAM
			TableSectionOutputStream.Section bootram = out.addSection(
				bootstrap.initializer.toByteArray(), 4);
			
			// Boot memory offset, size
			header.writeSectionAddressInt(bootram);
................................................................................
			// Pool, sfa, code
			header.writeInt(bootpool);
			header.writeInt(bootsfbp);
			header.writeInt(bootmeth);
			
			// System call SFP, handler, and pool
			header.writeInt(bootsfbp);
			header.writeInt(syscallm);
			header.writeInt(bootpool);
			
			// classidba, classidbaa
			header.writeInt(bootidba);
			header.writeInt(bootidbd);
			
			// Debug
			if (JarMinimizer._ENABLE_DEBUG)







>
>
>
>
|
|
>







 







|
|







276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
...
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
			// Get all the bootstrap information before it is written!
			int bootpool = booting.poolPointer();
			int bootsfbp = bootstrap.staticFieldAreaAddress();
			int bootmeth = booting.methodCodeAddress(
				new MethodName("__start"), null);
			int bootidba = bootstrap.findClass("[B").infoPointer();
			int bootidbd = bootstrap.findClass("[[B").infoPointer();
			
			// Get the handler for system calls and such
			LoadedClassInfo tshclass = bootstrap.findClass(
				"cc/squirreljme/jvm/task/TaskSysCallHandler");
			int scmeth = tshclass.methodCodeAddress(
				new MethodName("taskSysCall"), null),
				scpool = tshclass.poolPointer();
			
			// Setup the BootRAM
			TableSectionOutputStream.Section bootram = out.addSection(
				bootstrap.initializer.toByteArray(), 4);
			
			// Boot memory offset, size
			header.writeSectionAddressInt(bootram);
................................................................................
			// Pool, sfa, code
			header.writeInt(bootpool);
			header.writeInt(bootsfbp);
			header.writeInt(bootmeth);
			
			// System call SFP, handler, and pool
			header.writeInt(bootsfbp);
			header.writeInt(scmeth);
			header.writeInt(scpool);
			
			// classidba, classidbaa
			header.writeInt(bootidba);
			header.writeInt(bootidbd);
			
			// Debug
			if (JarMinimizer._ENABLE_DEBUG)