Skip to content

Commit fc46e5e

Browse files
committed
port rtc to rust
1 parent 11cf7dd commit fc46e5e

6 files changed

Lines changed: 493 additions & 326 deletions

File tree

src/browser/starter.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,14 @@ export function V86(options)
6666
"cpu_event_halt": () => { this.emulator_bus.send("cpu-event-halt"); },
6767
"abort": function() { dbg_assert(false); },
6868
"microtick": v86.microtick,
69+
"get_epoch_milis": function () { return Date.now(); },
70+
"getDate": function (date) { return (new Date(date)).getUTCDate(); },
71+
"getDay": function (date) { return (new Date(date)).getUTCDay(); },
72+
"getFullYear": function (date) { return (new Date(date)).getUTCFullYear(); },
73+
"getMonth": function (date) { return (new Date(date)).getUTCMonth(); },
74+
"getHours": function (date) { return (new Date(date)).getUTCHours(); },
75+
"getMinutes": function (date) { return (new Date(date)).getUTCMinutes(); },
76+
"getSeconds": function (date) { return (new Date(date)).getUTCSeconds(); },
6977
"get_rand_int": function() { return get_rand_int(); },
7078
"stop_idling": function() { return cpu.stop_idling(); },
7179

src/cpu.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -433,6 +433,14 @@ CPU.prototype.wasm_patch = function()
433433
this.get_apic_addr = get_import("get_apic_addr");
434434
this.get_ioapic_addr = get_import("get_ioapic_addr");
435435

436+
this.rtc_new = get_import("rtc_new");
437+
this.port_70_write = get_import("port_70_write");
438+
this.port_71_read = get_import("port_71_read");
439+
this.port_71_write = get_import("port_71_write");
440+
this.cmos_read = get_import("cmos_read");
441+
this.cmos_write = get_import("cmos_write");
442+
this.rtc_timer = get_import("rtc_timer");
443+
436444
this.zstd_create_ctx = get_import("zstd_create_ctx");
437445
this.zstd_get_src_ptr = get_import("zstd_get_src_ptr");
438446
this.zstd_free_ctx = get_import("zstd_free_ctx");

0 commit comments

Comments
 (0)