Check-in [846e1b33b2]

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

Overview
Comment:Instead of returning illegal nonsense values when reading from an unmapped memory location, throw an exception.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 846e1b33b21e68cb40774b59ce7b1c1009d25c7d
User & Date: stephanie.gawroriski 2019-06-15 14:16:17
Context
2019-06-15
14:39
Make the debug stuff more descriptive. check-in: 3d3ad815fb user: stephanie.gawroriski tags: trunk
14:16
Instead of returning illegal nonsense values when reading from an unmapped memory location, throw an exception. check-in: 846e1b33b2 user: stephanie.gawroriski tags: trunk
14:13
Add some string tests. check-in: 4e2d4e9b6f user: stephanie.gawroriski tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

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

73
74
75
76
77
78
79
80
81

82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
				csize = c.memRegionSize(),
				vaddr = __addr - cbase;
			
			if (vaddr >= 0 && vaddr < csize)
				return ((ReadableMemory)c).memReadByte(vaddr);
		}
		
		switch (__addr & 0x3)
		{

			case 0:		return (Constants.BAD_MAGIC >> 24) & 0xFF;
			case 1:		return (Constants.BAD_MAGIC >> 16) & 0xFF;
			case 2:		return (Constants.BAD_MAGIC >> 8) & 0xFF;
			default:
			case 3:		return (Constants.BAD_MAGIC) & 0xFF;
		}
		
		// Missed Read
		/*return 0xF0 | (__addr & 0x0F);*/
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2019/04/21
	 */
	@Override







|
<
>
|
<
<
<
<
<
<
<
<







73
74
75
76
77
78
79
80

81
82








83
84
85
86
87
88
89
				csize = c.memRegionSize(),
				vaddr = __addr - cbase;
			
			if (vaddr >= 0 && vaddr < csize)
				return ((ReadableMemory)c).memReadByte(vaddr);
		}
		
		// {@squirreljme.error AE0f Invalid read from unmapped or non-writable

		// memory! (The address)}
		throw new VMException(String.format("AE0f %08x", __addr));








	}
	
	/**
	 * {@inheritDoc}
	 * @since 2019/04/21
	 */
	@Override