-
-
Notifications
You must be signed in to change notification settings - Fork 140
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8b8a574
commit 1a4c326
Showing
14 changed files
with
799 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
[binaries] | ||
c = 'm68k-linux-mlibc-gcc' | ||
cpp = 'm68k-linux-mlibc-g++' | ||
exe_wrapper = 'qemu-m68k' | ||
|
||
[host_machine] | ||
system = 'linux' | ||
cpu_family = 'm68k' | ||
cpu = 'm68k' | ||
endian = 'big' | ||
|
||
[properties] | ||
skip_sanity_check = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
#include <sys/syscall.h> | ||
#include <bits/syscall.h> | ||
|
||
using sc_word_t = __sc_word_t; | ||
|
||
sc_word_t __do_syscall0(long sc) { | ||
register int sc_reg asm("d0") = sc; | ||
register sc_word_t ret asm("d0"); | ||
asm volatile ("trap #0" : "=r"(ret) : "r"(sc_reg) : "memory"); | ||
return ret; | ||
} | ||
|
||
sc_word_t __do_syscall1(long sc, | ||
sc_word_t arg1) { | ||
register int sc_reg asm("d0") = sc; | ||
register sc_word_t arg1_reg asm("d1") = arg1; | ||
register sc_word_t ret asm("d0"); | ||
asm volatile ("trap #0" : "=r"(ret) : | ||
"r"(sc_reg), | ||
"r"(arg1_reg) | ||
: "memory"); | ||
return ret; | ||
} | ||
|
||
sc_word_t __do_syscall2(long sc, | ||
sc_word_t arg1, sc_word_t arg2) { | ||
register int sc_reg asm("d0") = sc; | ||
register sc_word_t arg1_reg asm("d1") = arg1; | ||
register sc_word_t arg2_reg asm("d2") = arg2; | ||
register sc_word_t ret asm("d0"); | ||
asm volatile ("trap #0" : "=r"(ret) : | ||
"r"(sc_reg), | ||
"r"(arg1_reg), | ||
"r"(arg2_reg) | ||
: "memory"); | ||
return ret; | ||
} | ||
|
||
sc_word_t __do_syscall3(long sc, | ||
sc_word_t arg1, sc_word_t arg2, sc_word_t arg3) { | ||
register int sc_reg asm("d0") = sc; | ||
register sc_word_t arg1_reg asm("d1") = arg1; | ||
register sc_word_t arg2_reg asm("d2") = arg2; | ||
register sc_word_t arg3_reg asm("d3") = arg3; | ||
register sc_word_t ret asm("d0"); | ||
asm volatile ("trap #0" : "=r"(ret) : | ||
"r"(sc_reg), | ||
"r"(arg1_reg), | ||
"r"(arg2_reg), | ||
"r"(arg3_reg) | ||
: "memory"); | ||
return ret; | ||
} | ||
|
||
sc_word_t __do_syscall4(long sc, | ||
sc_word_t arg1, sc_word_t arg2, sc_word_t arg3, | ||
sc_word_t arg4) { | ||
register int sc_reg asm("d0") = sc; | ||
register sc_word_t arg1_reg asm("d1") = arg1; | ||
register sc_word_t arg2_reg asm("d2") = arg2; | ||
register sc_word_t arg3_reg asm("d3") = arg3; | ||
register sc_word_t arg4_reg asm("d4") = arg4; | ||
register sc_word_t ret asm("d0"); | ||
asm volatile ("trap #0" : "=r"(ret) : | ||
"r"(sc_reg), | ||
"r"(arg1_reg), | ||
"r"(arg2_reg), | ||
"r"(arg3_reg), | ||
"r"(arg4_reg) | ||
: "memory"); | ||
return ret; | ||
} | ||
|
||
sc_word_t __do_syscall5(long sc, | ||
sc_word_t arg1, sc_word_t arg2, sc_word_t arg3, | ||
sc_word_t arg4, sc_word_t arg5) { | ||
register int sc_reg asm("d0") = sc; | ||
register sc_word_t arg1_reg asm("d1") = arg1; | ||
register sc_word_t arg2_reg asm("d2") = arg2; | ||
register sc_word_t arg3_reg asm("d3") = arg3; | ||
register sc_word_t arg4_reg asm("d4") = arg4; | ||
register sc_word_t arg5_reg asm("d5") = arg5; | ||
register sc_word_t ret asm("d0"); | ||
asm volatile ("trap #0" : "=r"(ret) : | ||
"r"(sc_reg), | ||
"r"(arg1_reg), | ||
"r"(arg2_reg), | ||
"r"(arg3_reg), | ||
"r"(arg4_reg), | ||
"r"(arg5_reg) | ||
: "memory"); | ||
return ret; | ||
} | ||
|
||
sc_word_t __do_syscall6(long sc, | ||
sc_word_t arg1, sc_word_t arg2, sc_word_t arg3, | ||
sc_word_t arg4, sc_word_t arg5, sc_word_t arg6) { | ||
register int sc_reg asm("d0") = sc; | ||
register sc_word_t arg1_reg asm("d1") = arg1; | ||
register sc_word_t arg2_reg asm("d2") = arg2; | ||
register sc_word_t arg3_reg asm("d3") = arg3; | ||
register sc_word_t arg4_reg asm("d4") = arg4; | ||
register sc_word_t arg5_reg asm("d5") = arg5; | ||
register sc_word_t arg6_reg asm("a0") = arg6; | ||
register sc_word_t ret asm("d0"); | ||
asm volatile ("trap #0" : "=r"(ret) : | ||
"r"(sc_reg), | ||
"r"(arg1_reg), | ||
"r"(arg2_reg), | ||
"r"(arg3_reg), | ||
"r"(arg4_reg), | ||
"r"(arg5_reg), | ||
"r"(arg6_reg) | ||
: "memory" | ||
); | ||
return ret; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
|
||
.section .text | ||
.global __mlibc_do_asm_cp_syscall | ||
.global __mlibc_syscall_begin | ||
.global __mlibc_syscall_end | ||
.type __mlibc_do_asm_cp_syscall, "function" | ||
__mlibc_do_asm_cp_syscall: | ||
movem.l %d2-%d5, -(%sp) | ||
jbsr __m68k_read_tp@PLTPC | ||
/* cancelBits is at TP - 0x7030; LSB at -0x702d */ | ||
move.b -0x702d(%a0), %d0 | ||
__mlibc_syscall_begin: | ||
/* tcbCancelEnableBit && tcbCancelTriggerBit */ | ||
andi.b #0x5, %d0 | ||
cmpi.b #0x5, %d0 | ||
beq cancel | ||
movem.l 20(%sp), %d0-%d5/%a0 | ||
trap #0 | ||
__mlibc_syscall_end: | ||
movem.l (%sp)+, %d2-%d5 | ||
rts | ||
|
||
cancel: | ||
movem.l (%sp)+, %d2-%d5 | ||
jbsr __mlibc_do_cancel@PLTPC | ||
illegal | ||
|
||
.section .note.GNU-stack,"",%progbits |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
.section .text | ||
.global _start | ||
|
||
.type _start, %function | ||
.type main, %function | ||
.type __mlibc_entry, %function | ||
|
||
_start: | ||
suba.l %fp, %fp | ||
lea _GLOBAL_OFFSET_TABLE_@GOTPC (%pc), %a5 | ||
move.l main@GOT(%a5), -(%sp) | ||
move.l %sp, -(%sp) | ||
jbsr __mlibc_entry@PLTPC | ||
|
||
.section .note.GNU-stack,"",%progbits |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
.section .text | ||
.global _start | ||
|
||
.type _start, %function | ||
.type main, %function | ||
.type __mlibc_entry, %function | ||
|
||
_start: | ||
suba.l %fp, %fp | ||
move.l #main, -(%sp) | ||
move.l %sp, -(%sp) | ||
jsr __mlibc_entry | ||
|
||
.section .note.GNU-stack,"",%progbits |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
.section ".init" | ||
.global _init | ||
_init: | ||
|
||
.section ".fini" | ||
.globl _fini | ||
_fini: | ||
|
||
.section .note.GNU-stack,"",%progbits |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
.section .init | ||
rts | ||
|
||
.section .fini | ||
rts | ||
|
||
.section .note.GNU-stack,"",%progbits |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
.section .text | ||
|
||
.global __mlibc_signal_restore | ||
.type __mlibc_signal_restore, @function | ||
__mlibc_signal_restore: | ||
move.l (%sp)+, %d1 | ||
move.l #119, %d0 | ||
trap #0 | ||
illegal | ||
|
||
.global __mlibc_signal_restore_rt | ||
.type __mlibc_signal_restore_rt, @function | ||
__mlibc_signal_restore_rt: | ||
move.l (%sp)+, %d1 | ||
move.l #173, %d0 | ||
trap #0 | ||
illegal | ||
|
||
.section .note.GNU-stack,"",%progbits |
Oops, something went wrong.