restracturing to platform
This commit is contained in:
parent
95e4d54042
commit
55c5f2dcf6
@ -1,5 +1,5 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
zig build-obj ./src/main.zig -fno-PIE -fno-PIC -fno-stack-check
|
zig build-obj ./src/platform/cosmopolitan/main.zig -fno-PIE -fno-PIC -fno-stack-check --mod nmvm::src/nmvm.zig --deps nmvm
|
||||||
ld.bfd main.o -o zig-out/bin/nmvm.com.dbg -T extern/cosmopolitan/ape.lds extern/cosmopolitan/crt.o extern/cosmopolitan/ape-copy-self.o \
|
ld.bfd main.o -o zig-out/bin/nmvm.com.dbg -T extern/cosmopolitan/ape.lds extern/cosmopolitan/crt.o extern/cosmopolitan/ape-copy-self.o \
|
||||||
extern/cosmopolitan/cosmopolitan.a -z common-page-size=0x1000 -z max-page-size=0x1000 --gc-sections
|
extern/cosmopolitan/cosmopolitan.a -z common-page-size=0x1000 -z max-page-size=0x1000 --gc-sections
|
||||||
|
@ -4,4 +4,4 @@ cd ./extern
|
|||||||
./get.sh
|
./get.sh
|
||||||
|
|
||||||
cd ../
|
cd ../
|
||||||
zig translate-c ./extern/cosmopolitan/cosmopolitan.h > ./src/cosmopolitan/cosmopolitan.zig
|
zig translate-c ./extern/cosmopolitan/cosmopolitan.h > ./src/platform/cosmopolitan/cosmopolitan.zig
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
pub usingnamespace @import("x86-64/jedino-jedro.zig");
|
pub usingnamespace @import("x86-64/jedino-jedro.zig");
|
||||||
pub usingnamespace @import("x86-64/ve-sistema.zig");
|
pub usingnamespace @import("x86-64/zov/ve-sistema.zig");
|
||||||
|
@ -1,12 +1,16 @@
|
|||||||
//! ve sistema (.ve-sistema:x86-64)
|
//! .zov.ve-sistema:x86-64
|
||||||
//!
|
//!
|
||||||
//! Provides entry opcodes for System V calling convention, optimized for specific prototypes.
|
//! Provides entry opcodes for System V calling convention, optimized for specific prototypes.
|
||||||
//!
|
//!
|
||||||
|
|
||||||
// https://refspecs.linuxbase.org/elf/x86_64-abi-0.99.pdf
|
// https://refspecs.linuxbase.org/elf/x86_64-abi-0.99.pdf
|
||||||
|
|
||||||
|
// todo: Provide opcode that would dynamically dispatch based on marshaled C prototypes,
|
||||||
|
// which will be sufficient for rare prototypes sporadically used, so to not bloat
|
||||||
|
// the binary with all possible permutations or ask for them on comptime, which is unreasonable.
|
||||||
|
|
||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
const tolmac = @import("../../tolmac.zig");
|
const tolmac = @import("../../../tolmac.zig");
|
||||||
|
|
||||||
/// Used for stack parameter passing.
|
/// Used for stack parameter passing.
|
||||||
pub const WordLimit = 128;
|
pub const WordLimit = 128;
|
||||||
@ -111,8 +115,8 @@ pub fn generateOpZovSysvFromPrototype(prototype: anytype) !*const fn () callconv
|
|||||||
;
|
;
|
||||||
|
|
||||||
var integer_allocation: usize = 0;
|
var integer_allocation: usize = 0;
|
||||||
const IntegerAllocations = [_][]const u8{ "rdi", "rsi", "rdx", "rcx", "r8", "r9", "stack" };
|
const IntegerAllocations = [_][]const u8{ "rdi", "rsi", "rdx", "rcx", "r8", "r9" };
|
||||||
// var sse_allocation: enum { xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7, stack } = .xmm0;
|
// var sse_allocation: enum { xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7 } = .xmm0;
|
||||||
|
|
||||||
var class_buffer = [_]Class{.void} ** ClassBufferLimit;
|
var class_buffer = [_]Class{.void} ** ClassBufferLimit;
|
||||||
|
|
1
src/nmvm.zig
Normal file
1
src/nmvm.zig
Normal file
@ -0,0 +1 @@
|
|||||||
|
pub const tolmac = @import("tolmac.zig");
|
@ -1,5 +1,5 @@
|
|||||||
const tolmac = @import("tolmac.zig");
|
const tolmac = @import("nmvm").tolmac;
|
||||||
const cosmo = @import("cosmopolitan/cosmopolitan.zig");
|
const cosmo = @import("cosmopolitan.zig");
|
||||||
|
|
||||||
fn printInt3(int: u64, other: u32, another: u16) callconv(.SysV) void {
|
fn printInt3(int: u64, other: u32, another: u16) callconv(.SysV) void {
|
||||||
@setAlignStack(16);
|
@setAlignStack(16);
|
||||||
@ -57,5 +57,5 @@ fn cosmopolitanMain(argc: c_int, argv: [*][*:0]u8) callconv(.SysV) c_int {
|
|||||||
}
|
}
|
||||||
|
|
||||||
test {
|
test {
|
||||||
_ = @import("tolmac.zig");
|
_ = @import("nmvm").tolmac;
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user