Check-in [d13dde95bf]

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

Overview
Comment:Add memset() system call to possibly and more quickly wipe memory.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:d13dde95bf536b7fc3be9e9165cd50e74d11a1f5
User & Date: stephanie.gawroriski 2019-06-15 20:40:02
Context
2019-06-16
04:11
Add utility to export to PNM. check-in: 2c52c8ba0e user: stephanie.gawroriski tags: trunk
2019-06-15
20:40
Add memset() system call to possibly and more quickly wipe memory. check-in: d13dde95bf user: stephanie.gawroriski tags: trunk
20:31
Minor work. check-in: b623c22b59 user: stephanie.gawroriski tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to runt/apis/cldc-compact/cc/squirreljme/jvm/SystemCallIndex.java.

79
80
81
82
83
84
85








86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
	/** The pipe descriptor for stderr. */
	public static final short PD_OF_STDERR =
		15;
	
	/** Pipe descriptor: Write single byte. */
	public static final short PD_WRITE_BYTE =
		16;








	
	/** System call count. */
	public static final short NUM_SYSCALLS =
		17;
	
	/**
	 * Not used.
	 *
	 * @since 2019/05/23
	 */
	private SystemCallIndex()
	{
	}
}








>
>
>
>
>
>
>
>



|











79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
	/** The pipe descriptor for stderr. */
	public static final short PD_OF_STDERR =
		15;
	
	/** Pipe descriptor: Write single byte. */
	public static final short PD_WRITE_BYTE =
		16;
	
	/** Set memory. */
	public static final short MEM_SET =
		17;
	
	/** Mark memory as invalid. */
	public static final short MEM_MARK_INVALID =
		18;
	
	/** System call count. */
	public static final short NUM_SYSCALLS =
		19;
	
	/**
	 * Not used.
	 *
	 * @since 2019/05/23
	 */
	private SystemCallIndex()
	{
	}
}

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

98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
					// The next chunk of the current chunk is the new chunk
					Assembly.memWriteInt(seeker, CHUNK_NEXT_OFFSET,
						nextseek);
				}
				
				// Clear out memory since Java expects the data to be
				// initialized to zero always
				for (int i = CHUNK_LENGTH; i < want; i += 4)
					Assembly.memWriteInt(seeker, i, 0);
				
				// Use this chunk
				return rv;
			}
			
			// Go to the next chunk
			seeker = cnx;







|
<







98
99
100
101
102
103
104
105

106
107
108
109
110
111
112
					// The next chunk of the current chunk is the new chunk
					Assembly.memWriteInt(seeker, CHUNK_NEXT_OFFSET,
						nextseek);
				}
				
				// Clear out memory since Java expects the data to be
				// initialized to zero always
				Assembly.sysCallP(SystemCallIndex.MEM_SET, rv, 0, __sz);

				
				// Use this chunk
				return rv;
			}
			
			// Go to the next chunk
			seeker = cnx;

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

79
80
81
82
83
84
85








86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
	/** The pipe descriptor for stderr. */
	public static final short PD_OF_STDERR =
		15;
	
	/** Pipe descriptor: Write single byte. */
	public static final short PD_WRITE_BYTE =
		16;








	
	/** System call count. */
	public static final short NUM_SYSCALLS =
		17;
	
	/**
	 * Not used.
	 *
	 * @since 2019/05/23
	 */
	private SystemCallIndex()
	{
	}
}








>
>
>
>
>
>
>
>



|











79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
	/** The pipe descriptor for stderr. */
	public static final short PD_OF_STDERR =
		15;
	
	/** Pipe descriptor: Write single byte. */
	public static final short PD_WRITE_BYTE =
		16;
	
	/** Set memory. */
	public static final short MEM_SET =
		17;
	
	/** Mark memory as invalid. */
	public static final short MEM_MARK_INVALID =
		18;
	
	/** System call count. */
	public static final short NUM_SYSCALLS =
		19;
	
	/**
	 * Not used.
	 *
	 * @since 2019/05/23
	 */
	private SystemCallIndex()
	{
	}
}

Changes to runt/libs/summercoat-vm/cc/squirreljme/vm/summercoat/NativeCPU.java.

1062
1063
1064
1065
1066
1067
1068

1069
1070
1071
1072
1073
1074
1075
....
1230
1231
1232
1233
1234
1235
1236





















1237
1238
1239
1240
1241
1242
1243
						case SystemCallIndex.VMI_MEM_FREE:
						case SystemCallIndex.VMI_MEM_USED:
						case SystemCallIndex.VMI_MEM_MAX:
						case SystemCallIndex.PD_OF_STDIN:
						case SystemCallIndex.PD_OF_STDOUT:
						case SystemCallIndex.PD_OF_STDERR:
						case SystemCallIndex.PD_WRITE_BYTE:

							rv = 1;
							break;
						
						default:
							rv = 0;
							break;
					}
................................................................................
					else
					{
						rv = -1;
						err = SystemCallError.PIPE_DESCRIPTOR_INVALID;
					}
				}
				break;





















				
			default:
				// Returns no value but sets an error
				rv = -1;
				err = SystemCallError.UNSUPPORTED_SYSTEM_CALL;
				
				// If the ID is valid then a bad array access will be used







>







 







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
....
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
						case SystemCallIndex.VMI_MEM_FREE:
						case SystemCallIndex.VMI_MEM_USED:
						case SystemCallIndex.VMI_MEM_MAX:
						case SystemCallIndex.PD_OF_STDIN:
						case SystemCallIndex.PD_OF_STDOUT:
						case SystemCallIndex.PD_OF_STDERR:
						case SystemCallIndex.PD_WRITE_BYTE:
						case SystemCallIndex.MEM_SET:
							rv = 1;
							break;
						
						default:
							rv = 0;
							break;
					}
................................................................................
					else
					{
						rv = -1;
						err = SystemCallError.PIPE_DESCRIPTOR_INVALID;
					}
				}
				break;
				
				// Sets memory to byte value
			case SystemCallIndex.MEM_SET:
				{
					// Set memory
					WritableMemory memory = this.memory;
					
					// Get parameters
					int addr = __args[0],
						valu = __args[1],
						lens = __args[2];
					
					// Wipe
					for (int i = 0; i < lens; i++)
						memory.memWriteByte(addr + i, valu);
					
					// Is okay
					rv = 0;
					err = 0;
				}
				break;
				
			default:
				// Returns no value but sets an error
				rv = -1;
				err = SystemCallError.UNSUPPORTED_SYSTEM_CALL;
				
				// If the ID is valid then a bad array access will be used