mirror of
https://github.com/momo5502/emulator.git
synced 2026-01-11 08:36:16 +00:00
Memory 64 support
This commit is contained in:
20
.github/workflows/build.yml
vendored
20
.github/workflows/build.yml
vendored
@@ -170,6 +170,7 @@ jobs:
|
||||
- Android x86_64
|
||||
- Android arm64-v8a
|
||||
- Emscripten Web
|
||||
- Emscripten Web Memory 64
|
||||
- Emscripten Node.js
|
||||
configuration:
|
||||
- Debug
|
||||
@@ -218,6 +219,9 @@ jobs:
|
||||
- platform: Emscripten Web
|
||||
runner: ubuntu-24.04
|
||||
cmake-options: "-DMOMO_ENABLE_RUST_CODE=Off -DCMAKE_TOOLCHAIN_FILE=$(dirname $(which emcc))/cmake/Modules/Platform/Emscripten.cmake"
|
||||
- platform: Emscripten Web Memory 64
|
||||
runner: ubuntu-24.04
|
||||
cmake-options: "-DMOMO_ENABLE_RUST_CODE=Off -DMOMO_EMSCRIPTEN_MEMORY64=On -DCMAKE_TOOLCHAIN_FILE=$(dirname $(which emcc))/cmake/Modules/Platform/Emscripten.cmake"
|
||||
- platform: Emscripten Node.js
|
||||
runner: ubuntu-24.04
|
||||
cmake-options: "-DMOMO_EMSCRIPTEN_SUPPORT_NODEJS=On -DMOMO_ENABLE_RUST_CODE=Off -DCMAKE_TOOLCHAIN_FILE=$(dirname $(which emcc))/cmake/Modules/Platform/Emscripten.cmake"
|
||||
@@ -579,7 +583,13 @@ jobs:
|
||||
uses: pyTooling/download-artifact@v4
|
||||
with:
|
||||
name: Emscripten Web Release Artifacts
|
||||
path: build/release/artifacts
|
||||
path: build/release/artifacts/32
|
||||
|
||||
- name: Download Emscripten Web Memory 64 Artifacts
|
||||
uses: pyTooling/download-artifact@v4
|
||||
with:
|
||||
name: Emscripten Web Memory 64 Release Artifacts
|
||||
path: build/release/artifacts/64
|
||||
|
||||
- name: Download Windows Artifacts
|
||||
uses: pyTooling/download-artifact@v4
|
||||
@@ -601,8 +611,12 @@ jobs:
|
||||
|
||||
- name: Copy Files
|
||||
run: |
|
||||
cp ./build/release/artifacts/analyzer.js ./page/public/
|
||||
cp ./build/release/artifacts/analyzer.wasm ./page/public/
|
||||
mkdir -p ./page/public/32/
|
||||
mkdir -p ./page/public/64/
|
||||
cp ./build/release/artifacts/32/analyzer.js ./page/public/32/
|
||||
cp ./build/release/artifacts/32/analyzer.wasm ./page/public/32/
|
||||
cp ./build/release/artifacts/64/analyzer.js ./page/public/64/
|
||||
cp ./build/release/artifacts/64/analyzer.wasm ./page/public/64/
|
||||
|
||||
- name: Build Page
|
||||
run: cd ./page && npm i && npm run build
|
||||
|
||||
9
page/package-lock.json
generated
9
page/package-lock.json
generated
@@ -40,7 +40,8 @@
|
||||
"tailwind-merge": "^3.3.1",
|
||||
"tailwindcss": "^4.1.11",
|
||||
"tw-animate-css": "^1.3.4",
|
||||
"vaul": "^1.1.2"
|
||||
"vaul": "^1.1.2",
|
||||
"wasm-feature-detect": "^1.8.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@eslint/js": "^9.30.0",
|
||||
@@ -5941,6 +5942,12 @@
|
||||
"url": "https://github.com/sponsors/jonschlinkert"
|
||||
}
|
||||
},
|
||||
"node_modules/wasm-feature-detect": {
|
||||
"version": "1.8.0",
|
||||
"resolved": "https://registry.npmjs.org/wasm-feature-detect/-/wasm-feature-detect-1.8.0.tgz",
|
||||
"integrity": "sha512-zksaLKM2fVlnB5jQQDqKXXwYHLQUVH9es+5TOOHwGOVJOCeRBCiPjwSg+3tN2AdTCzjgli4jijCH290kXb/zWQ==",
|
||||
"license": "Apache-2.0"
|
||||
},
|
||||
"node_modules/which": {
|
||||
"version": "2.0.2",
|
||||
"resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz",
|
||||
|
||||
@@ -42,7 +42,8 @@
|
||||
"tailwind-merge": "^3.3.1",
|
||||
"tailwindcss": "^4.1.11",
|
||||
"tw-animate-css": "^1.3.4",
|
||||
"vaul": "^1.1.2"
|
||||
"vaul": "^1.1.2",
|
||||
"wasm-feature-detect": "^1.8.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@eslint/js": "^9.30.0",
|
||||
|
||||
@@ -9,7 +9,12 @@ onmessage = async (event) => {
|
||||
|
||||
switch (data.message) {
|
||||
case "run":
|
||||
runEmulation(payload.file, payload.options, payload.persist);
|
||||
runEmulation(
|
||||
payload.file,
|
||||
payload.options,
|
||||
payload.persist,
|
||||
payload.wasm64,
|
||||
);
|
||||
break;
|
||||
case "event":
|
||||
msgQueue.push(payload);
|
||||
@@ -65,7 +70,7 @@ function getMessageFromQueue() {
|
||||
return msgQueue.shift();
|
||||
}
|
||||
|
||||
function runEmulation(file, options, persist) {
|
||||
function runEmulation(file, options, persist, wasm64) {
|
||||
const mainArguments = [...options, "-e", "./root", file];
|
||||
|
||||
globalThis.Module = {
|
||||
@@ -87,5 +92,9 @@ function runEmulation(file, options, persist) {
|
||||
postRun: flushLines,
|
||||
};
|
||||
|
||||
importScripts("./analyzer.js");
|
||||
if (wasm64) {
|
||||
importScripts("./64/analyzer.js");
|
||||
} else {
|
||||
importScripts("./32/analyzer.js");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import { Settings } from "@/settings";
|
||||
|
||||
interface SettingsMenuProps {
|
||||
settings: Settings;
|
||||
allowWasm64: boolean;
|
||||
onChange: (settings: Settings) => void;
|
||||
}
|
||||
|
||||
@@ -105,6 +106,18 @@ export class SettingsMenu extends React.Component<SettingsMenuProps, Settings> {
|
||||
/>
|
||||
<Label htmlFor="settings-persist">Persist filesystem</Label>
|
||||
</div>
|
||||
|
||||
<div className="flex gap-6">
|
||||
<Checkbox
|
||||
id="settings-mem64"
|
||||
disabled={!this.props.allowWasm64}
|
||||
checked={this.state.wasm64}
|
||||
onCheckedChange={(checked: boolean) => {
|
||||
this.setState({ wasm64: checked });
|
||||
}}
|
||||
/>
|
||||
<Label htmlFor="settings-mem64">64-Bit WebAssembly</Label>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { createDefaultSettings, Settings, translateSettings } from "./settings";
|
||||
import { Settings, translateSettings } from "./settings";
|
||||
|
||||
import * as flatbuffers from "flatbuffers";
|
||||
import * as fbDebugger from "@/fb/debugger";
|
||||
@@ -84,7 +84,7 @@ export class Emulator {
|
||||
this.worker.onmessage = this._onMessage.bind(this);
|
||||
}
|
||||
|
||||
async start(settings: Settings = createDefaultSettings(), file: string) {
|
||||
async start(settings: Settings, file: string) {
|
||||
this._setState(EmulationState.Running);
|
||||
this.worker.postMessage({
|
||||
message: "run",
|
||||
@@ -92,6 +92,7 @@ export class Emulator {
|
||||
file,
|
||||
options: translateSettings(settings),
|
||||
persist: settings.persist,
|
||||
wasm64: settings.wasm64,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
@@ -5,6 +5,8 @@ import { Output } from "@/components/output";
|
||||
import { Emulator, EmulationState, isFinalState } from "./emulator";
|
||||
import { Filesystem, setupFilesystem } from "./filesystem";
|
||||
|
||||
import { memory64 } from "wasm-feature-detect";
|
||||
|
||||
import "./App.css";
|
||||
import {
|
||||
Popover,
|
||||
@@ -45,6 +47,7 @@ interface PlaygroundState {
|
||||
emulator: Emulator | null;
|
||||
application: string | undefined;
|
||||
drawerOpen: boolean;
|
||||
allowWasm64: boolean;
|
||||
}
|
||||
|
||||
function makePercentHandler(
|
||||
@@ -93,7 +96,12 @@ export class Playground extends React.Component<
|
||||
emulator: null,
|
||||
drawerOpen: false,
|
||||
application: undefined,
|
||||
allowWasm64: false,
|
||||
};
|
||||
|
||||
memory64().then((allowWasm64) => {
|
||||
this.setState({ allowWasm64 });
|
||||
});
|
||||
}
|
||||
|
||||
async resetFilesys() {
|
||||
@@ -272,6 +280,7 @@ export class Playground extends React.Component<
|
||||
<PopoverContent>
|
||||
<SettingsMenu
|
||||
settings={this.state.settings}
|
||||
allowWasm64={this.state.allowWasm64}
|
||||
onChange={(s) => {
|
||||
saveSettings(s);
|
||||
this.setState({ settings: s });
|
||||
|
||||
@@ -5,6 +5,7 @@ export interface Settings {
|
||||
bufferStdout: boolean;
|
||||
persist: boolean;
|
||||
execAccess: boolean;
|
||||
wasm64: boolean;
|
||||
}
|
||||
|
||||
export function createDefaultSettings(): Settings {
|
||||
@@ -15,6 +16,7 @@ export function createDefaultSettings(): Settings {
|
||||
bufferStdout: true,
|
||||
persist: false,
|
||||
execAccess: true,
|
||||
wasm64: false,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user