Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'libgloss/mcore/syscalls.S')
-rw-r--r--libgloss/mcore/syscalls.S64
1 files changed, 64 insertions, 0 deletions
diff --git a/libgloss/mcore/syscalls.S b/libgloss/mcore/syscalls.S
new file mode 100644
index 000000000..61a2847aa
--- /dev/null
+++ b/libgloss/mcore/syscalls.S
@@ -0,0 +1,64 @@
+.macro FUNC_START name
+ .text
+ .globl \name
+ .globl _\name
+\name:
+_\name:
+.endm
+
+FUNC_START _sbrk
+ mov r4, r2 // save increment
+ lrw r3, brkval
+ ldw r2, (r3) // get next spot
+
+ movi r5, 7
+ addi r2, 7 // round up to 8 bytes
+ andn r2, r5
+
+ addu r4, r2 // save updated pointer
+ stw r4, (r3)
+ jmp r15
+
+// brk() could go in here too...
+
+ .data
+ .import _end
+brkval: .long _end
+
+
+FUNC_START _exit
+ mov r1, r1 // accomodate simulator glitch...
+ .short 0x5000
+ br _exit // hard loop here
+
+// 0x5001 - printf
+// 0x5002 - scanf
+
+FUNC_START utime
+ .short 0x5003
+ jmp r15
+
+
+.macro stub name value
+FUNC_START \name
+ movi r1, \value
+ .short 0x50FF
+ jmp r15
+.endm
+
+stub _close 6
+stub _lseek 19
+stub _open 5
+stub _read 3
+stub _times 43
+stub _unlink 10
+stub _write 4
+
+//stub access 33
+//stub creat 8
+//stub link 9
+//stub time 13
+
+//stub profil 98 // movi r6, 2
+//stub lprofil 98 // movi r6, 4
+