| author | |
| committer | |
| log | d5c73a44b796aaaebe748b1a8cb862c7a3dadae1 |
| tree | c9bf25e22208d5d84dd892a52bd4591968a111e0 |
| parent | fc20677fde9155c8dbd694eb157b63317623fbc6 |
| signature |
9 files changed, 117 insertions(+), 117 deletions(-)
test/standalone/build.zig.zon+2-2| ... | ... | @@ -37,8 +37,8 @@ |
| 37 | 37 | .issue_339 = .{ |
| 38 | 38 | .path = "issue_339", |
| 39 | 39 | }, |
| 40 | .issue_8550 = .{ | |
| 41 | .path = "issue_8550", | |
| 40 | .compile_asm = .{ | |
| 41 | .path = "compile_asm", | |
| 42 | 42 | }, |
| 43 | 43 | .issue_794 = .{ |
| 44 | 44 | .path = "issue_794", |
test/standalone/compile_asm/boot.S created+33| ... | ... | @@ -0,0 +1,33 @@ |
| 1 | .section ".text.boot" | |
| 2 | ||
| 3 | .global _start | |
| 4 | ||
| 5 | _start: | |
| 6 | mrc p15, #0, r1, c0, c0, #5 | |
| 7 | and r1, r1, #3 | |
| 8 | cmp r1, #0 | |
| 9 | bne halt | |
| 10 | ||
| 11 | mov sp, #0x8000 | |
| 12 | ||
| 13 | ldr r4, =__bss_start | |
| 14 | ldr r9, =__bss_end | |
| 15 | mov r5, #0 | |
| 16 | mov r6, #0 | |
| 17 | mov r7, #0 | |
| 18 | mov r8, #0 | |
| 19 | b 2f | |
| 20 | ||
| 21 | 1: | |
| 22 | stmia r4!, {r5-r8} | |
| 23 | ||
| 24 | 2: | |
| 25 | cmp r4, r9 | |
| 26 | blo 1b | |
| 27 | ||
| 28 | ldr r3, =main | |
| 29 | blx r3 | |
| 30 | ||
| 31 | halt: | |
| 32 | wfe | |
| 33 | b halt |
test/standalone/compile_asm/build.zig created+29| ... | ... | @@ -0,0 +1,29 @@ |
| 1 | const std = @import("std"); | |
| 2 | ||
| 3 | pub fn build(b: *std.Build) !void { | |
| 4 | const test_step = b.step("test", "Test it"); | |
| 5 | b.default_step = test_step; | |
| 6 | ||
| 7 | const optimize: std.builtin.OptimizeMode = .Debug; | |
| 8 | const target = b.resolveTargetQuery(.{ | |
| 9 | .os_tag = .freestanding, | |
| 10 | .cpu_arch = .arm, | |
| 11 | .cpu_model = .{ | |
| 12 | .explicit = &std.Target.arm.cpu.arm1176jz_s, | |
| 13 | }, | |
| 14 | }); | |
| 15 | ||
| 16 | const kernel = b.addExecutable(.{ | |
| 17 | .name = "kernel", | |
| 18 | .root_module = b.createModule(.{ | |
| 19 | .root_source_file = b.path("./main.zig"), | |
| 20 | .optimize = optimize, | |
| 21 | .target = target, | |
| 22 | }), | |
| 23 | }); | |
| 24 | kernel.root_module.addObjectFile(b.path("./boot.S")); | |
| 25 | kernel.setLinkerScript(b.path("./linker.ld")); | |
| 26 | b.installArtifact(kernel); | |
| 27 | ||
| 28 | test_step.dependOn(&kernel.step); | |
| 29 | } |
test/standalone/compile_asm/linker.ld created+42| ... | ... | @@ -0,0 +1,42 @@ |
| 1 | ENTRY(_start) | |
| 2 | ||
| 3 | SECTIONS | |
| 4 | { | |
| 5 | /* Starts at LOADER_ADDR. */ | |
| 6 | . = 0x8000; | |
| 7 | __start = .; | |
| 8 | __text_start = .; | |
| 9 | .text : | |
| 10 | { | |
| 11 | KEEP(*(.text.boot)) | |
| 12 | *(.text) | |
| 13 | } | |
| 14 | . = ALIGN(4096); /* align to page size */ | |
| 15 | __text_end = .; | |
| 16 | ||
| 17 | __rodata_start = .; | |
| 18 | .rodata : | |
| 19 | { | |
| 20 | *(.rodata) | |
| 21 | } | |
| 22 | . = ALIGN(4096); /* align to page size */ | |
| 23 | __rodata_end = .; | |
| 24 | ||
| 25 | __data_start = .; | |
| 26 | .data : | |
| 27 | { | |
| 28 | *(.data) | |
| 29 | } | |
| 30 | . = ALIGN(4096); /* align to page size */ | |
| 31 | __data_end = .; | |
| 32 | ||
| 33 | __bss_start = .; | |
| 34 | .bss : | |
| 35 | { | |
| 36 | bss = .; | |
| 37 | *(.bss) | |
| 38 | } | |
| 39 | . = ALIGN(4096); /* align to page size */ | |
| 40 | __bss_end = .; | |
| 41 | __end = .; | |
| 42 | } |
test/standalone/compile_asm/main.zig created+11| ... | ... | @@ -0,0 +1,11 @@ |
| 1 | export fn main(r0: u32, r1: u32, atags: u32) callconv(.c) noreturn { | |
| 2 | _ = r0; | |
| 3 | _ = r1; | |
| 4 | _ = atags; | |
| 5 | unreachable; // never gets run so it doesn't matter | |
| 6 | } | |
| 7 | pub fn panic(msg: []const u8, error_return_trace: ?*@import("std").builtin.StackTrace, _: ?usize) noreturn { | |
| 8 | _ = msg; | |
| 9 | _ = error_return_trace; | |
| 10 | while (true) {} | |
| 11 | } |
test/standalone/issue_8550/boot.S deleted-33| ... | ... | @@ -1,33 +0,0 @@ |
| 1 | .section ".text.boot" | |
| 2 | ||
| 3 | .global _start | |
| 4 | ||
| 5 | _start: | |
| 6 | mrc p15, #0, r1, c0, c0, #5 | |
| 7 | and r1, r1, #3 | |
| 8 | cmp r1, #0 | |
| 9 | bne halt | |
| 10 | ||
| 11 | mov sp, #0x8000 | |
| 12 | ||
| 13 | ldr r4, =__bss_start | |
| 14 | ldr r9, =__bss_end | |
| 15 | mov r5, #0 | |
| 16 | mov r6, #0 | |
| 17 | mov r7, #0 | |
| 18 | mov r8, #0 | |
| 19 | b 2f | |
| 20 | ||
| 21 | 1: | |
| 22 | stmia r4!, {r5-r8} | |
| 23 | ||
| 24 | 2: | |
| 25 | cmp r4, r9 | |
| 26 | blo 1b | |
| 27 | ||
| 28 | ldr r3, =main | |
| 29 | blx r3 | |
| 30 | ||
| 31 | halt: | |
| 32 | wfe | |
| 33 | b halt |
test/standalone/issue_8550/build.zig deleted-29| ... | ... | @@ -1,29 +0,0 @@ |
| 1 | const std = @import("std"); | |
| 2 | ||
| 3 | pub fn build(b: *std.Build) !void { | |
| 4 | const test_step = b.step("test", "Test it"); | |
| 5 | b.default_step = test_step; | |
| 6 | ||
| 7 | const optimize: std.builtin.OptimizeMode = .Debug; | |
| 8 | const target = b.resolveTargetQuery(.{ | |
| 9 | .os_tag = .freestanding, | |
| 10 | .cpu_arch = .arm, | |
| 11 | .cpu_model = .{ | |
| 12 | .explicit = &std.Target.arm.cpu.arm1176jz_s, | |
| 13 | }, | |
| 14 | }); | |
| 15 | ||
| 16 | const kernel = b.addExecutable(.{ | |
| 17 | .name = "kernel", | |
| 18 | .root_module = b.createModule(.{ | |
| 19 | .root_source_file = b.path("./main.zig"), | |
| 20 | .optimize = optimize, | |
| 21 | .target = target, | |
| 22 | }), | |
| 23 | }); | |
| 24 | kernel.root_module.addObjectFile(b.path("./boot.S")); | |
| 25 | kernel.setLinkerScript(b.path("./linker.ld")); | |
| 26 | b.installArtifact(kernel); | |
| 27 | ||
| 28 | test_step.dependOn(&kernel.step); | |
| 29 | } |
test/standalone/issue_8550/linker.ld deleted-42| ... | ... | @@ -1,42 +0,0 @@ |
| 1 | ENTRY(_start) | |
| 2 | ||
| 3 | SECTIONS | |
| 4 | { | |
| 5 | /* Starts at LOADER_ADDR. */ | |
| 6 | . = 0x8000; | |
| 7 | __start = .; | |
| 8 | __text_start = .; | |
| 9 | .text : | |
| 10 | { | |
| 11 | KEEP(*(.text.boot)) | |
| 12 | *(.text) | |
| 13 | } | |
| 14 | . = ALIGN(4096); /* align to page size */ | |
| 15 | __text_end = .; | |
| 16 | ||
| 17 | __rodata_start = .; | |
| 18 | .rodata : | |
| 19 | { | |
| 20 | *(.rodata) | |
| 21 | } | |
| 22 | . = ALIGN(4096); /* align to page size */ | |
| 23 | __rodata_end = .; | |
| 24 | ||
| 25 | __data_start = .; | |
| 26 | .data : | |
| 27 | { | |
| 28 | *(.data) | |
| 29 | } | |
| 30 | . = ALIGN(4096); /* align to page size */ | |
| 31 | __data_end = .; | |
| 32 | ||
| 33 | __bss_start = .; | |
| 34 | .bss : | |
| 35 | { | |
| 36 | bss = .; | |
| 37 | *(.bss) | |
| 38 | } | |
| 39 | . = ALIGN(4096); /* align to page size */ | |
| 40 | __bss_end = .; | |
| 41 | __end = .; | |
| 42 | } |
test/standalone/issue_8550/main.zig deleted-11| ... | ... | @@ -1,11 +0,0 @@ |
| 1 | export fn main(r0: u32, r1: u32, atags: u32) callconv(.c) noreturn { | |
| 2 | _ = r0; | |
| 3 | _ = r1; | |
| 4 | _ = atags; | |
| 5 | unreachable; // never gets run so it doesn't matter | |
| 6 | } | |
| 7 | pub fn panic(msg: []const u8, error_return_trace: ?*@import("std").builtin.StackTrace, _: ?usize) noreturn { | |
| 8 | _ = msg; | |
| 9 | _ = error_return_trace; | |
| 10 | while (true) {} | |
| 11 | } |