Skip to content

Commit 8d9d0a7

Browse files
committed
port rtc to rust
1 parent 62fd36e commit 8d9d0a7

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
@@ -425,6 +425,14 @@ CPU.prototype.wasm_patch = function()
425425
this.get_apic_addr = get_import("get_apic_addr");
426426
this.get_ioapic_addr = get_import("get_ioapic_addr");
427427

428+
this.rtc_new = get_import("rtc_new");
429+
this.port_70_write = get_import("port_70_write");
430+
this.port_71_read = get_import("port_71_read");
431+
this.port_71_write = get_import("port_71_write");
432+
this.cmos_read = get_import("cmos_read");
433+
this.cmos_write = get_import("cmos_write");
434+
this.rtc_timer = get_import("rtc_timer");
435+
428436
this.zstd_create_ctx = get_import("zstd_create_ctx");
429437
this.zstd_get_src_ptr = get_import("zstd_get_src_ptr");
430438
this.zstd_free_ctx = get_import("zstd_free_ctx");

0 commit comments

Comments
 (0)