File tree Expand file tree Collapse file tree 2 files changed +8
-17
lines changed Expand file tree Collapse file tree 2 files changed +8
-17
lines changed Original file line number Diff line number Diff line change @@ -40,21 +40,18 @@ func ticks() timeUnit {
4040 return timeUnit (ticksToNanoseconds (timeUnit (getArmSystemTick ())))
4141}
4242
43- var stdoutBuffer = make ([]byte , 0 , 120 )
43+ var stdoutBuffer = make ([]byte , 120 )
44+ var position = 0
4445
4546func putchar (c byte ) {
46- if c == '\n' || len (stdoutBuffer )+ 1 >= 120 {
47- NxOutputString ( string ( stdoutBuffer ))
48- stdoutBuffer = stdoutBuffer [: 0 ]
47+ if c == '\n' || position > len (stdoutBuffer ) {
48+ nxOutputString ( & stdoutBuffer [ 0 ], uint64 ( position ))
49+ position = 0
4950 return
5051 }
5152
52- stdoutBuffer = append (stdoutBuffer , c )
53- }
54-
55- func usleep (usec uint ) int {
56- sleepThread (uint64 (usec ) * 1000 )
57- return 0
53+ stdoutBuffer [position ] = c
54+ position ++
5855}
5956
6057func abort () {
Original file line number Diff line number Diff line change 44
55package runtime
66
7- import "unsafe"
8-
97const heapSize = 0x2000000 * 16 // Default by libnx
108
11- //go:extern _stack_top
12- var stackTopSymbol [0 ]byte
13-
149var (
1510 heapStart = uintptr (0 )
1611 heapEnd = uintptr (0 )
17- stackTop = uintptr (unsafe .Pointer (& stackTopSymbol ))
1812)
1913
2014//export setHeapSize
@@ -24,7 +18,7 @@ func preinit() {
2418 setHeapSize (& heapStart , heapSize )
2519
2620 if heapStart == 0 {
27- panic ("failed to allocate heap" )
21+ runtimePanic ("failed to allocate heap" )
2822 }
2923
3024 heapEnd = heapStart + heapSize
You can’t perform that action at this time.
0 commit comments