diff options
author | Igor Pashev <pashev.igor@gmail.com> | 2013-01-27 23:51:56 +0000 |
---|---|---|
committer | Igor Pashev <pashev.igor@gmail.com> | 2013-01-27 23:51:56 +0000 |
commit | 6ab0c0f5bf14ed9c15370407b9ee7e0b4b089ae1 (patch) | |
tree | 926065cf45450116098db664e3c61dced9e1f21a /config/bsd | |
download | icon-upstream/9.4.3.tar.gz |
Initial upstream version 9.4.3upstream/9.4.3
Diffstat (limited to 'config/bsd')
-rw-r--r-- | config/bsd/Makedefs | 19 | ||||
-rw-r--r-- | config/bsd/alpha.s | 46 | ||||
-rw-r--r-- | config/bsd/define.h | 10 | ||||
-rw-r--r-- | config/bsd/i386.c | 23 | ||||
-rw-r--r-- | config/bsd/m68k.c | 25 | ||||
-rw-r--r-- | config/bsd/powerpc.s | 78 | ||||
-rw-r--r-- | config/bsd/sparc.c | 33 | ||||
-rw-r--r-- | config/bsd/status | 34 | ||||
-rw-r--r-- | config/bsd/vax.c | 38 |
9 files changed, 306 insertions, 0 deletions
diff --git a/config/bsd/Makedefs b/config/bsd/Makedefs new file mode 100644 index 0000000..10f9eed --- /dev/null +++ b/config/bsd/Makedefs @@ -0,0 +1,19 @@ +# CC C compiler +# CFLAGS flags for building C files +# CFDYN additional flags for dynamic functions +# RLINK flags for linking run-time system +# RLIBS libraries to link with run-time system +# TLIBS libraries to link for POSIX threads +# XLIBS libraries to link for graphics +# XPMDEFS definitions for building XPM library +# GDIR directory of graphics helper library + +CC = cc +CFLAGS = -O -I/usr/X11R6/include +CFDYN = -fPIC +RLINK = -Wl,-E +RLIBS = -lm +TLIBS = -lpthread +XLIBS = -Wl,-R/usr/X11R6/lib -L/usr/X11R6/lib -lX11 +XPMDEFS = -DZPIPE -I/usr/X11R6/include +GDIR = xpm diff --git a/config/bsd/alpha.s b/config/bsd/alpha.s new file mode 100644 index 0000000..6c9ba72 --- /dev/null +++ b/config/bsd/alpha.s @@ -0,0 +1,46 @@ +/* + * coswitch(old_cs, new_cs, first) for DEC Alpha architecture + * $16 $17 $18 + */ + .data +errmsg: .ascii "new_context() returned in coswitch\X00" + + .text + .globl coswitch + .ent coswitch +coswitch: + lda $sp, -72($sp) /* make room on stack */ + stq $sp, 0($16) /* save stack pointer */ + stq $9, 0($sp) /* save registers on stack */ + stq $10, 8($sp) + stq $11, 16($sp) + stq $12, 24($sp) + stq $13, 32($sp) + stq $14, 40($sp) + stq $15, 48($sp) + stq $27, 56($sp) + stq $26, 64($sp) /* return address */ + beq $18, first /* if first time */ + + ldq $sp, 0($17) /* load new stack pointer */ + ldq $9, 0($sp) /* load registers from stack */ + ldq $10, 8($sp) + ldq $11, 16($sp) + ldq $12, 24($sp) + ldq $13, 32($sp) + ldq $14, 40($sp) + ldq $15, 48($sp) + ldq $27, 56($sp) + ldq $26, 64($sp) /* return address */ + lda $sp, 72($sp) /* reset sp */ + jsr_coroutine $31, ($26), 0 /* jump into new_context */ + +first: + ldq $sp, 0($17) /* load stack pointer only */ + bis $31, $31, $16 /* r16 = 0 */ + bis $31, $31, $17 /* r17 = 0 */ + jsr $26, new_context /* new_context(0,0) */ + lda $16, errmsg + jsr $26, syserr /* shouldn't get here */ + + .end coswitch diff --git a/config/bsd/define.h b/config/bsd/define.h new file mode 100644 index 0000000..1859df0 --- /dev/null +++ b/config/bsd/define.h @@ -0,0 +1,10 @@ +/* + * Icon configuration file for BSD + */ + +#define UNIX 1 +#define LoadFunc + +#define CComp "gcc" +#define COpts "-O -I/usr/X11R6/include" +#define ICONC_XLIB "-Wl,-R/usr/X11R6/lib -L/usr/X11R6/lib -lX11" diff --git a/config/bsd/i386.c b/config/bsd/i386.c new file mode 100644 index 0000000..1eecd7c --- /dev/null +++ b/config/bsd/i386.c @@ -0,0 +1,23 @@ +/* + * coswitch for the i386 architecture + */ + +int +coswitch (int *old_cs, int *new_cs, int first) +{ + asm ("movl 8(%ebp),%eax"); + asm ("movl %esp,0(%eax)"); + asm ("movl %ebp,4(%eax)"); + asm ("movl 12(%ebp),%eax"); + + if (first == 0) { /* this is the first activation */ + asm ("movl 0(%eax),%esp"); + asm ("movl $0,%ebp"); + new_context (0, 0); + syserr ("new_context() returned in coswitch"); + } + else { + asm ("movl 0(%eax),%esp"); + asm ("movl 4(%eax),%ebp"); + } +} diff --git a/config/bsd/m68k.c b/config/bsd/m68k.c new file mode 100644 index 0000000..077922b --- /dev/null +++ b/config/bsd/m68k.c @@ -0,0 +1,25 @@ +/* + * coswitch for the m68k architecture + */ + +int +coswitch (int *old_cs, int *new_cs, int first) +{ + asm ("movl %a6@(8),%a0"); /* a0 = old */ + asm ("movl %a6@(12),%a1"); /* a1 = new */ + asm ("movl %a7,%a0@"); /* save sp in cstate[0] */ + asm ("movl %a6,%a0@(4)"); /* save a6 (fp) in cstate[0] */ + asm ("moveml #0x3cfc,%a0@(8)"); /* store d2-d7, a2-a6 in old->cstate */ + + if (first == 0) { /* this is first activation */ + asm ("movl %a1@,%a7"); + asm ("movl #0,%a6"); + new_context (0, 0); + syserr ("new_context() returned in coswitch"); + } + else { + asm ("movl %a1@,%a7"); /* restore sp */ + asm ("movl %a1@(4),%a6"); /* restore fp */ + asm ("moveml %a1@(8),#0x3cfc"); /* restore d2-d7, a2-a6 */ + } +} diff --git a/config/bsd/powerpc.s b/config/bsd/powerpc.s new file mode 100644 index 0000000..8044959 --- /dev/null +++ b/config/bsd/powerpc.s @@ -0,0 +1,78 @@ +# +# coswitch for the PowerPC architecture +# + + .file "rswitch.s" + + .data +errmsg: .string "new_context() returned in coswitch\n" + + .text + .align 2 + .globl coswitch + .type coswitch,@function + +coswitch: + stwu 1, -80(1) # allocate stack frame + + # Save Old Context: + stw 1, 0(3) # SP + mflr 0 + stw 0, 4(3) # LR (return address) + stw 14, 0(1) # GPRs 14-31 (save on stack) + stw 15, 4(1) + stw 16, 8(1) + stw 17, 12(1) + stw 18, 16(1) + stw 19, 20(1) + stw 20, 24(1) + stw 21, 28(1) + stw 22, 32(1) + stw 23, 36(1) + stw 24, 40(1) + stw 25, 44(1) + stw 26, 48(1) + stw 27, 52(1) + stw 28, 56(1) + stw 29, 60(1) + stw 30, 64(1) + stw 31, 68(1) + + cmpi 0, 5, 0 + beq first # if first time + + # Restore new context: + lwz 1, 0(4) # SP + lwz 0, 4(4) # LR + mtlr 0 + lwz 14, 0(1) # GPRs 14-31 (from stack) + lwz 15, 4(1) + lwz 16, 8(1) + lwz 17, 12(1) + lwz 18, 16(1) + lwz 19, 20(1) + lwz 20, 24(1) + lwz 21, 28(1) + lwz 22, 32(1) + lwz 23, 36(1) + lwz 24, 40(1) + lwz 25, 44(1) + lwz 26, 48(1) + lwz 27, 52(1) + lwz 28, 56(1) + lwz 29, 60(1) + lwz 30, 64(1) + lwz 31, 68(1) + + addic 1, 1, 80 # deallocate stack frame + blr # return into new context + +first: # First-time call: + lwz 1, 0(4) # SP as figured by Icon + addic 1, 1, -64 # save area for callee + addi 3, 0, 0 # arg1 + addi 4, 0, 0 # arg2 + bl new_context # new_context(0,0) + lis 3, errmsg@ha + la 3, errmsg@l(3) + bl syserr diff --git a/config/bsd/sparc.c b/config/bsd/sparc.c new file mode 100644 index 0000000..4f2215c --- /dev/null +++ b/config/bsd/sparc.c @@ -0,0 +1,33 @@ +/* + * coswitch for the SPARC architecture + */ + +int +coswitch (int *old_cs, int *new_cs, int first) +{ + asm("ta 0x03"); /* ST_FLUSH_WINDOWS in trap.h */ + asm("ld [%fp+0x44], %o0"); /* load old_cs into %o0 */ + asm("st %sp,[%o0]"); /* Save user stack pointer */ + asm("st %fp,[%o0+0x4]"); /* Save frame pointer */ + asm("st %i7,[%o0+0x8]"); /* Save return address */ + + if (first == 0) { /* this is the first activation */ + asm("ld [%fp+0x48], %o0"); /* load new_cs into %o0 */ + asm("ld [%o0], %o1"); /* load %o1 from cstate[0] */ + + /* Decrement new stack pointer value before loading it into sp. */ + /* The top 64 bytes of the stack are reserved for the kernel, to */ + /* save the 8 local and 8 in registers into, on context switches, */ + /* interrupts, traps, etc. */ + + asm("save %o1,-96, %sp"); /* load %sp from %o1 */ + new_context(0,0); + syserr("new_context() returned in coswitch"); + + } else { + asm("ld [%fp+0x48], %o0"); /* load new_cs into %o0 */ + asm("ld [%o0+0x4],%fp"); /* Load frame pointer */ + asm("ld [%o0+0x8],%i7"); /* Load return address */ + asm("ld [%o0],%sp"); /* Load user stack pointer */ + } +} diff --git a/config/bsd/status b/config/bsd/status new file mode 100644 index 0000000..e0fba53 --- /dev/null +++ b/config/bsd/status @@ -0,0 +1,34 @@ +System configuration: + + All BSD variants (FreeBSD, NetBSD, OpenBSD) except Macintosh + +Latest Icon version: + + Version 9.4.3 + +Installer: + + Gregg Townsend + Icon Project + The University of Arizona + +Missing features: + + None + +Known bugs: + + None + +Comments: + + This configuration is for FreeBSD, NetBSD, and OpenBSD. + For Darwin (Apple Macintosh), use the "macintosh" configuration. + + This configuration can use pthreads for context switching. + + Tested on FreeBSD 6.0-beta5 (i386 and amd64). + +Date: + + November 10, 2005 diff --git a/config/bsd/vax.c b/config/bsd/vax.c new file mode 100644 index 0000000..52d30f9 --- /dev/null +++ b/config/bsd/vax.c @@ -0,0 +1,38 @@ +/* + * coswitch for the VAX architecture + */ + +int +coswitch (int *old_cs, int *new_cs, int first) +{ + asm ("movl 4(%ap),%r0"); + asm ("movl 8(%ap),%r1"); + asm ("movl %sp,0(%r0)"); + asm ("movl %fp,4(%r0)"); + asm ("movl %ap,8(%r0)"); + asm ("movl %r11,16(%r0)"); + asm ("movl %r10,20(%r0)"); + asm ("movl %r9,24(%r0)"); + asm ("movl %r8,28(%r0)"); + asm ("movl %r7,32(%r0)"); + asm ("movl %r6,36(%r0)"); + + if (first == 0) { /* this is the first activation */ + asm ("movl 0(%r1),%sp"); + asm ("clrl %fp"); + asm ("clrl %ap"); + new_context (0,0); + syserr ("new_context() returned in coswitch"); + } + else { + asm ("movl 0(%r1),%sp"); + asm ("movl 4(%r1),%fp"); + asm ("movl 8(%r1),%ap"); + asm ("movl 16(%r1),%r11"); + asm ("movl 20(%r1),%r10"); + asm ("movl 24(%r1),%r9"); + asm ("movl 28(%r1),%r8"); + asm ("movl 32(%r1),%r7"); + asm ("movl 36(%r1),%r6"); + } +} |