This commit is contained in:
ceriel 1991-09-20 18:14:05 +00:00
parent f03c37528e
commit 0b83bf33e8
214 changed files with 8614 additions and 0 deletions

15
mach/sparc/ce/.distr Normal file
View file

@ -0,0 +1,15 @@
EM_table
EM_table.x
Makefile
back.src
cache.c
cache.c.x
ce.src
cegpp
mach.c
mach.h
mach_em.h
misc.h
ms_reg.h
proto.make
push_pop.h

4631
mach/sparc/ce/EM_table.x Normal file

File diff suppressed because it is too large Load diff

13
mach/sparc/ce/Makefile Normal file
View file

@ -0,0 +1,13 @@
SED = sed
M4 = m4
CPP = /lib/cpp
all: EM_table cache.c
distr: all
EM_table: EM_table.x cegpp
$(CPP) < EM_table.x -P | $(M4) | $(SED) -f cegpp > $@
cache.c: cache.c.x cegpp
$(SED) -f cegpp cache.c.x > $@

View file

@ -0,0 +1,9 @@
Makefile
back.h
con_str.c
const.h
do_open.c
gen_str.c
header.h
rom_str.c
symboldef.c

View file

@ -0,0 +1,101 @@
# $Header$
# requires a definition for TARGET_HOME, SRC_DIR, CFLAGS, CC
CEG=$(TARGET_HOME)/lib.bin/ceg
SOURCE=$(CEG)/ce_back/as_back
IDIRS=-I.\
-I$(SRC_DIR)\
-I..\
-I$(TARGET_HOME)/h\
-I$(TARGET_HOME)/modules/h
all : bottom.o con1.o con2.o con4.o end_back.o gen1.o gen2.o\
gen4.o init_back.o reloc1.o reloc2.o reloc4.o bss.o\
rom1.o rom2.o rom4.o set_global.o set_local.o switchseg.o symboldef.o \
do_open.o do_close.o text1.o text2.o text4.o con_str.o gen_str.o rom_str.o
bottom.o : $(SRC_DIR)/mach.h back.h header.h $(SOURCE)/bottom.c
$(CC) $(CFLAGS) -c $(IDIRS) $(SOURCE)/bottom.c
bss.o : $(SRC_DIR)/mach.h back.h header.h $(SOURCE)/bss.c
$(CC) $(CFLAGS) -c $(IDIRS) $(SOURCE)/bss.c
text1.o : $(SRC_DIR)/mach.h back.h header.h $(SOURCE)/text1.c
$(CC) $(CFLAGS) -c $(IDIRS) $(SOURCE)/text1.c
text2.o : $(SRC_DIR)/mach.h back.h header.h $(SOURCE)/text2.c
$(CC) $(CFLAGS) -c $(IDIRS) $(SOURCE)/text2.c
text4.o : $(SRC_DIR)/mach.h back.h header.h $(SOURCE)/text4.c
$(CC) $(CFLAGS) -c $(IDIRS) $(SOURCE)/text4.c
con1.o : $(SRC_DIR)/mach.h back.h header.h $(SOURCE)/con1.c
$(CC) $(CFLAGS) -c $(IDIRS) $(SOURCE)/con1.c
con2.o : $(SRC_DIR)/mach.h back.h header.h $(SOURCE)/con2.c
$(CC) $(CFLAGS) -c $(IDIRS) $(SOURCE)/con2.c
con4.o : $(SRC_DIR)/mach.h back.h header.h $(SOURCE)/con4.c
$(CC) $(CFLAGS) -c $(IDIRS) $(SOURCE)/con4.c
do_open.o : back.h header.h $(SRC_DIR)/mach.h do_open.c
$(CC) $(CFLAGS) -c $(IDIRS) do_open.c
do_close.o : back.h header.h $(SRC_DIR)/mach.h $(SOURCE)/do_close.c
$(CC) $(CFLAGS) -c $(IDIRS) $(SOURCE)/do_close.c
gen1.o : back.h header.h $(SRC_DIR)/mach.h $(SOURCE)/gen1.c
$(CC) $(CFLAGS) -c $(IDIRS) $(SOURCE)/gen1.c
gen2.o : back.h header.h $(SRC_DIR)/mach.h $(SOURCE)/gen2.c
$(CC) $(CFLAGS) -c $(IDIRS) $(SOURCE)/gen2.c
gen4.o : back.h header.h $(SRC_DIR)/mach.h $(SOURCE)/gen4.c
$(CC) $(CFLAGS) -c $(IDIRS) $(SOURCE)/gen4.c
init_back.o : header.h back.h $(SRC_DIR)/mach.h $(SOURCE)/init_back.c
$(CC) $(CFLAGS) -c $(IDIRS) $(SOURCE)/init_back.c
end_back.o : header.h back.h $(SRC_DIR)/mach.h $(SOURCE)/end_back.c
$(CC) $(CFLAGS) -c $(IDIRS) $(SOURCE)/end_back.c
reloc1.o : back.h header.h $(SRC_DIR)/mach.h $(SOURCE)/reloc1.c
$(CC) $(CFLAGS) -c $(IDIRS) $(SOURCE)/reloc1.c
reloc2.o : back.h header.h $(SRC_DIR)/mach.h $(SOURCE)/reloc2.c
$(CC) $(CFLAGS) -c $(IDIRS) $(SOURCE)/reloc2.c
reloc4.o : back.h header.h $(SRC_DIR)/mach.h $(SOURCE)/reloc4.c
$(CC) $(CFLAGS) -c $(IDIRS) $(SOURCE)/reloc4.c
rom1.o : back.h header.h $(SRC_DIR)/mach.h $(SOURCE)/rom1.c
$(CC) $(CFLAGS) -c $(IDIRS) $(SOURCE)/rom1.c
rom2.o : back.h header.h $(SRC_DIR)/mach.h $(SOURCE)/rom2.c
$(CC) $(CFLAGS) -c $(IDIRS) $(SOURCE)/rom2.c
rom4.o : back.h header.h $(SRC_DIR)/mach.h $(SOURCE)/rom4.c
$(CC) $(CFLAGS) -c $(IDIRS) $(SOURCE)/rom4.c
set_global.o : header.h back.h $(SRC_DIR)/mach.h $(SOURCE)/set_global.c
$(CC) $(CFLAGS) -c $(IDIRS) $(SOURCE)/set_global.c
set_local.o : header.h back.h $(SRC_DIR)/mach.h $(SOURCE)/set_local.c
$(CC) $(CFLAGS) -c $(IDIRS) $(SOURCE)/set_local.c
switchseg.o : header.h back.h $(SRC_DIR)/mach.h $(SOURCE)/switchseg.c
$(CC) $(CFLAGS) -c $(IDIRS) $(SOURCE)/switchseg.c
symboldef.o : header.h back.h $(SRC_DIR)/mach.h symboldef.c
$(CC) $(CFLAGS) -c $(IDIRS) symboldef.c
con_str.o : header.h back.h $(SRC_DIR)/mach.h con_str.c
$(CC) $(CFLAGS) -c $(IDIRS) con_str.c
gen_str.o : header.h back.h $(SRC_DIR)/mach.h gen_str.c
$(CC) $(CFLAGS) -c $(IDIRS) gen_str.c
rom_str.o : header.h back.h $(SRC_DIR)/mach.h rom_str.c
$(CC) $(CFLAGS) -c $(IDIRS) rom_str.c

View file

@ -0,0 +1,69 @@
#include <em.h>
#include <system.h>
#define codefile B_codefile
#define cur_seg B_cur_seg
#define saved B_saved
#define labeltje B_labeltje
#define name B_name
#define output_back B_output_back
/* Macros to change interface names */
#define common B_common
#define con1 B_con1
#define con2 B_con2
#define con4 B_con4
#define con_str B_con_str
#define rom1 B_rom1
#define rom2 B_rom2
#define rom4 B_rom4
#define rom_str B_rom_str
#define text1 B_txt1
#define text2 B_txt2
#define text4 B_txt4
#define close_back B_close_back
#define open_back B_open_back
#define end_back B_end_back
#define init_back B_init_back
#define extnd_pro B_ex_pro
#define extnd_start B_ex_start
#define extnd_name B_ex_name
#define extnd_dnam B_ex_dnam
#define extnd_dlb B_ex_dlb
#define extnd_ilb B_ex_ilb
#define extnd_hol B_ex_hol
#define extnd_part B_ex_part
#define extnd_cont B_ex_cont
#define extnd_main B_ex_main
#define gen1 B_gen1
#define gen2 B_gen2
#define gen4 B_gen4
#define gen_str B_gen_str
#define save_label B_save_label
#define dump_label B_dump_label
#define align_word B_align_word
#define reloc1 B_rlc1
#define reloc2 B_rlc2
#define reloc4 B_rlc4
#define set_global_visible B_stglobvis
#define set_local_visible B_stlocvis
#define symbol_definition B_symdef
#define switchseg B_switchseg
extern File *codefile;
extern char *extnd_name(), *extnd_dnam(), *extnd_dlb(), *extnd_ilb(),
*extnd_hol(), *extnd_ext(), *extnd_pro(), *extnd_start(),
*extnd_part(), *extnd_cont(), *extnd_main();
#define swtxt() switchseg( SEGTXT)
#define bss(n) fprint(codefile, BSS_FMT, (long)(n))
#define SEGTXT 0
#define SEGROM 1
#define SEGCON 2
#define SEGBSS 3
#define SEGHOL -1 /* Does not exist */
#define ABSOLUTE 1

View file

@ -0,0 +1,8 @@
#include "header.h"
con_str(s,n)
char *s;
int n;
{
gen_str( s,n);
}

View file

@ -0,0 +1,2 @@
#define TRUE 1
#define FALSE 0

View file

@ -0,0 +1,11 @@
#include "header.h"
open_back( filename)
char *filename;
{
if ( filename == (char *) 0)
codefile= STDOUT;
else
return( sys_open( filename, OP_WRITE, &codefile));
return 1;
}

View file

@ -0,0 +1,27 @@
#include "header.h"
gen_str( s,n)
char *s;
int n;
{
unsigned char c;
switch ( cur_seg) {
case SEGTXT :
case SEGCON :
case SEGROM :
fprint( codefile, "%s\"", STR_FMT);
while (n--)
{
c= *s++;
if (isprint(c) && c != '"')
fprint(codefile, "%c", c);
else
fprint(codefile, "\\%03o", c);
}
fprint( codefile, "\"\n");
break;
case SEGBSS : bss( (arith) 1);
break;
default : fprint( STDERR, "gen1 unkown seg %d\n", cur_seg);
}
}

View file

@ -0,0 +1,4 @@
#include "mach.h"
#include "back.h"
extern int cur_seg;

View file

@ -0,0 +1,8 @@
#include "header.h"
rom_str( s,n)
char *s;
int n;
{
gen_str( s,n);
}

View file

@ -0,0 +1,9 @@
#include "header.h"
symbol_definition( s)
char *s;
{
if (cur_seg == SEGTXT)
flush_cache(); /* EXTRA */
fprint( codefile, SYMBOL_DEF_FMT, s);
}

1287
mach/sparc/ce/cache.c.x Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,7 @@
C_con_scon.c
C_cst.c
C_mes_begin.c
C_mes_end.c
C_rom_scon.c
misc.c
ms_reg.c

View file

@ -0,0 +1,14 @@
#define CODE_EXPANDER
#include <em.h>
#include "mach.h"
#include "back.h"
C_con_scon( s, n)
char *s;
arith n;
{
switchseg( SEGCON);
dump_label();
con_str( s, n);
}

View file

@ -0,0 +1,8 @@
#define CODE_EXPANDER
#include <em.h>
/* in ms_reg.c
C_cst( l)
arith l;
{
} */

View file

@ -0,0 +1,8 @@
#define CODE_EXPANDER
#include <em.h>
/* in ms_reg.c
C_mes_begin( ms)
int ms;
{
} */

View file

@ -0,0 +1,7 @@
#define CODE_EXPANDER
#include <em.h>
/* in ms_reg.c
C_mes_end()
{
} */

View file

@ -0,0 +1,14 @@
#define CODE_EXPANDER
#include <em.h>
#include "mach.h"
#include "back.h"
C_rom_scon( s, n)
char *s;
arith n;
{
switchseg( SEGROM);
dump_label();
rom_str( s,n);
}

View file

@ -0,0 +1,54 @@
/*
misc.c
*/
#include "mach.h"
int power_of_2(n, ref_exp)
int n, *ref_exp;
{
int exp;
exp= 0;
if (n<0)
n= -n;
if (!n)
return 0;
while (!(n % 2))
{
n= n/2;
exp++;
}
if (n != 1)
return 0;
if (ref_exp)
*ref_exp= exp;
return 1;
}
int uns_power_of_2(n, ref_exp)
unsigned n, *ref_exp;
{
int exp;
exp= 0;
if (!n)
return 0;
while (!(n % 2))
{
n= n/2;
exp++;
}
if (n != 1)
return 0;
if (ref_exp)
*ref_exp= exp;
return 1;
}

View file

@ -0,0 +1,338 @@
/* catch register messages. BEWARE: code uses plain printf's (fprint's)
* to generate code. This is not compatible with the usual procedure
* used in the EM_table
*/
#define CODE_EXPANDER
#include <em.h>
#include <em_reg.h>
#include <em_mes.h>
#include "push_pop.h"
#include "mach.h"
#include <stdio.h>
#define MAX_NR_REGS 12
#define MAX_NR_FLTS MAX_NR_FLT_REGS /* depends on using float or doubles */
#define RM_OFFSET 0
#define RM_SIZE 1
#define RM_TYPE 2
#define RM_COUNT 3
typedef struct reg_info {
int offset;
int size; /* 4 or 8 */
int pri;
reg_t reg, reg2; /* reg2 used for doubles only */
} reg_info;
reg_info reg_dat[MAX_NR_REGS], flt_dat[MAX_NR_FLTS];
int current_reg_mes[RM_COUNT+4];
int in_reg_mes = 0; /* boolean */
int reg_mes_nr;
int worst_reg_pri, worst_flt_pri; /* reset by C_prolog (to some large number) */
int nr_reg_vars, nr_flt_vars; /* dito (both to 0) */
init_reg_man()
{
worst_reg_pri = worst_flt_pri = (unsigned)-1/2;
nr_reg_vars = nr_flt_vars = 0;
}
reg_t my_alloc_reg(pri,loc)
int pri, *loc;
{
reg_t S1;
int i;
if ((S1 = alloc_reg_var()) == NULL)
if (current_reg_mes[RM_COUNT] > worst_reg_pri) {
for (i = 0; i < nr_reg_vars; i++)
if (reg_dat[i].pri <= worst_reg_pri) {
*loc = i;
S1 = reg_dat[i].reg;
break;
}
worst_reg_pri = (unsigned)-1/2;
for (i = 0; i < nr_reg_vars; i++)
if (reg_dat[i].pri <= worst_reg_pri)
worst_reg_pri = reg_dat[i].pri;
} else
return NULL; /* SORRY, FULL HOUSE! */
else
*loc = nr_reg_vars++;
return S1;
}
reg_t my_alloc_double(pri,loc,r2)
int pri, *loc;
reg_t *r2;
/* implementation note: my_alloc_double only reclaims other doubles
* when a better candidate is given. It never reclaims floats, even if
* the current double is a mich better candidate.
*/
{
reg_t S1;
int i;
if ((S1 = alloc_double_var(r2)) == NULL)
if (current_reg_mes[RM_COUNT] > worst_flt_pri) {
for (i = 0; i < nr_flt_vars; i++)
if (flt_dat[i].pri <= worst_flt_pri &&
flt_dat[i].size == EM_DSIZE) {
*loc = i;
S1 = flt_dat[i].reg;
*r2 = flt_dat[i].reg2;
break;
}
worst_flt_pri = (unsigned)-1/2;
for (i = 0; i < nr_flt_vars; i++)
if (flt_dat[i].pri < worst_flt_pri)
worst_flt_pri = flt_dat[i].pri;
} else
return NULL; /* SORRY, FULL HOUSE! */
else
*loc = nr_flt_vars++;
return S1;
}
reg_t my_alloc_float(pri,loc)
int pri, *loc;
/* just as for my_alloc_double, my_alloc_float never reclaims a double,
* even though this me be useful and easy. Sorry.
*/
{
reg_t S1;
int i;
if ((S1 = alloc_float_var()) == NULL)
if (current_reg_mes[RM_COUNT] > worst_flt_pri) {
for (i = 0; i < nr_flt_vars; i++)
if (flt_dat[i].pri <= worst_flt_pri &&
flt_dat[i].size == EM_WSIZE) {
*loc = i;
S1 = flt_dat[i].reg;
break;
}
worst_flt_pri = (unsigned)-1/2;
for (i = 0; i < nr_flt_vars; i++)
if (flt_dat[i].pri <= worst_flt_pri)
worst_flt_pri = flt_dat[i].pri;
} else
return NULL; /* SORRY, FULL HOUSE! */
else
*loc = nr_flt_vars++;
return S1;
}
free_all_reg_vars()
{
int i;
for (i = 0; i < nr_reg_vars; i++)
free_reg(reg_dat[i].reg);
for (i = 0; i < nr_flt_vars; i++)
switch (flt_dat[i].size) {
case EM_WSIZE: free_reg(flt_dat[i].reg); break;
case EM_DSIZE: free_double_reg(flt_dat[i].reg); break;
}
check_cache();
}
alloc_all_reg_vars()
{
int i;
for (i = 0; i < nr_reg_vars; i++)
forced_alloc_reg(reg_dat[i].reg);
for (i = 0; i < nr_flt_vars; i++)
switch (flt_dat[i].size) {
case EM_WSIZE: forced_alloc_reg(flt_dat[i].reg); break;
case EM_DSIZE:
forced_alloc_reg(flt_dat[i].reg);
forced_alloc_reg(flt_dat[i].reg2);
break;
}
check_cache();
}
params_to_regs() /* copy required parameters to registers */
{
int i, j;
for (i = 0; i < nr_reg_vars; i++)
if (reg_dat[i].offset > 0)
fprint(codefile, "ld [%%l1+%d], %s\n",
reg_dat[i].offset, reg_dat[i].reg);
for (i = 0; i < nr_flt_vars; i++)
if (flt_dat[i].offset > 0)
{
fprint(codefile, "ld [%%l1+%d], %s\n",
flt_dat[i].offset, flt_dat[i].reg);
if (flt_dat[i].size == EM_DSIZE)
fprint(codefile, "ld [%%l1+%d], %s\n",
flt_dat[i].offset + 4, flt_dat[i].reg2);
}
}
cmp_flt_dat(e1, e2)
reg_info *e1, *e2;
{
return (e1->offset - e2->offset);
}
save_float_regs()
{
int i;
int offset;
qsort(flt_dat, nr_flt_vars, sizeof(flt_dat[0]), cmp_flt_dat);
for (i = 0, offset= 0; i < nr_flt_vars; i++, offset += 8)
if ((i+1 < nr_flt_vars &&
flt_dat[i].offset == flt_dat[i+1].offset-4 &&
flt_dat[i].size == EM_FSIZE &&
flt_dat[i+1].size == EM_FSIZE)
|| (flt_dat[i].size == EM_DSIZE)) {
fprint(codefile, "std %s, [%%fp + %d]\n",
flt_dat[i].reg, FLTSAV_OFFSET + offset);
if (flt_dat[i].size != EM_DSIZE)
++i;
} else
fprint(codefile, "st %s, [%%fp + %d]\n",
flt_dat[i].reg, FLTSAV_OFFSET + offset);
}
load_float_regs()
{
int i;
int offset;
for (i = 0, offset= 0; i < nr_flt_vars; i++, offset += 8)
if ((i+1 < nr_flt_vars &&
flt_dat[i].offset == flt_dat[i+1].offset-4 &&
flt_dat[i].size == EM_FSIZE &&
flt_dat[i+1].size == EM_FSIZE)
|| (flt_dat[i].size == EM_DSIZE)) {
fprint(codefile, "ldd [%%fp + %d], %s\n",
FLTSAV_OFFSET + offset, flt_dat[i].reg);
if (flt_dat[i].size != EM_DSIZE)
++i;
} else
fprint(codefile, "ld [%%fp + %d], %s\n",
FLTSAV_OFFSET + offset, flt_dat[i].reg);
}
C_mes_begin( ms)
int ms;
{
reg_mes_nr = 0;
in_reg_mes = (ms == ms_reg);
if (ms == ms_gto)
fprint(codefile, "ta 3\n");
}
C_mes_end()
{
int pos;
reg_t S1, S2;
if (!in_reg_mes) /* end of some other mes */
return;
if (reg_mes_nr == 0) { /* end of reg_mes's */
save_float_regs();
params_to_regs();
if (debug)
dump_reg_tabs(codefile);
return;
}
if (current_reg_mes[RM_COUNT] == 0) /* never used, so ignore */
return;
if (current_reg_mes[RM_OFFSET] >= 0)
current_reg_mes[RM_OFFSET] += EM_BSIZE;
if (debug)
fprint(codefile, "\t\t! Got reg_mes: %d %d %d %d\n",
current_reg_mes[0], current_reg_mes[1],
current_reg_mes[2], current_reg_mes[3]);
if (current_reg_mes[RM_TYPE] == reg_float) {
switch(current_reg_mes[RM_SIZE]) {
case EM_WSIZE :
if ((S1 = my_alloc_float(current_reg_mes[RM_COUNT], &pos))
== NULL)
return;
break;
case EM_DSIZE:
if ((S1 = my_alloc_double(current_reg_mes[RM_COUNT], &pos, &S2))
== NULL)
return;
flt_dat[pos].reg2 = S2;
default: break;
}
flt_dat[pos].offset = current_reg_mes[RM_OFFSET];
flt_dat[pos].size = current_reg_mes[RM_SIZE];
flt_dat[pos].pri = current_reg_mes[RM_COUNT];
flt_dat[pos].reg = S1;
} else {
if (current_reg_mes[RM_SIZE] != EM_WSIZE)
return; /* IGNORE THESE */
if ((S1 = my_alloc_reg(current_reg_mes[RM_COUNT], &pos)) == NULL)
return; /* SORRY, FULL HOUSE! */
reg_dat[pos].offset = current_reg_mes[RM_OFFSET];
reg_dat[pos].size = current_reg_mes[RM_SIZE];
reg_dat[pos].pri = current_reg_mes[RM_COUNT];
reg_dat[pos].reg = S1;
}
}
C_cst( l)
arith l;
{
if (in_reg_mes)
current_reg_mes[reg_mes_nr++] = l;
}
dump_reg_tabs(stream)
FILE *stream;
{
int i;
fprint(stream, "!offset\tsize\tname (%d regvars)\n", nr_reg_vars);
for (i = 0; i < nr_reg_vars; i++)
fprint(stream, "! %d\t%d\t%s\n", reg_dat[i].offset, reg_dat[i].size,
reg_dat[i].reg);
fprint(stream, "!offset\tsize\tname (%d fltvars)\n", nr_flt_vars);
for (i = 0; i < nr_flt_vars; i++)
fprint(stream, "! %d\t%d\t%s\n", flt_dat[i].offset, flt_dat[i].size,
flt_dat[i].reg);
}
reg_t find_local(offset, reg2) /* WARNING: no size checking here! */
int offset;
reg_t *reg2;
{
int i;
if (reg2)
*reg2 = NULL;
for (i = 0; i < nr_reg_vars; i++)
if (reg_dat[i].offset == offset)
return reg_dat[i].reg;
for (i = 0; i < nr_flt_vars; i++)
if (flt_dat[i].offset == offset) {
if (flt_dat[i].size == EM_DSIZE)
if (reg2)
*reg2 = flt_dat[i].reg2;
return flt_dat[i].reg;
}
return NULL;
}

30
mach/sparc/ce/cegpp Normal file
View file

@ -0,0 +1,30 @@
# dit sed script zet regels van het type "sll $a, $$, $44" om in
# fprint(codefile, "sll %s, $, $44\n", a);
# en meer....
# Usage: sed -f $0 < EM_table.x > EM_table
# remember to include special thingies in "mach.h"
#n
s/==>/&\
code_combiner(/
s/\.[ ]*$/)\
&/
/^[ ]*"/{
s/%/%%/g
i\
fprint ( codefile,
s/\$\$/__NEVER_USED__/g
s/\$\([0-9][0-9]*\)/__NEVER_USED__\1/g
s/\$\$/%a/g
:a
s/\([^\$]*\)\$\([^\$][A-Za-z0-9_]*\)\(.*\)/\1%s\3\
\2/
t a
s/\n/,/g
s/__NEVER_USED__/$/g
s/";/"/
s/\([^"]*"[^"]*\)"\(.*\)/\1\\n"\2/
p
i\
);
D
}

35
mach/sparc/ce/mach.c Normal file
View file

@ -0,0 +1,35 @@
#define CODE_EXPANDER
#include "mach.h"
#include <back.h>
#include <system.h>
#ifdef DEBUG
arg_error( s, arg)
char *s;
int arg;
{
fprint( STDERR, "arg_error %s %d\n", s, arg);
}
#endif
/*
do_open( filename)
char *filename;
{
if ( filename == (char *)0 || !sys_open( filename, OP_WRITE, &codefile))
return( 0);
fprint( codefile, ".sect .text; .sect .rom; .sect .data; .sect .bss\n");
return( 1);
}
*/
#define IEEEFLOAT
#define FL_MSL_AT_LOW_ADDRESS 1
#define FL_MSW_AT_LOW_ADDRESS 1
#define FL_MSB_AT_LOW_ADDRESS 1
#include <con_float>
#include <cache.c>

20
mach/sparc/ce/mach.h Normal file
View file

@ -0,0 +1,20 @@
/*
mach.h
*/
#ifndef MACH_H
#define MACH_H
#include "ctype.h"
#include "mach_em.h"
#include "push_pop.h"
#include "ms_reg.h"
#include "misc.h"
#if RESOLV_debug
#define debug 0
#else
extern int debug;
#endif
#endif /* MACH_H */

59
mach/sparc/ce/mach_em.h Normal file
View file

@ -0,0 +1,59 @@
#define DEBUG 1
#include <sun4/asm_linkage.h>
#define BYTES_REVERSED
#define WORDS_REVERSED
#define ONE_BYTE int
#define TWO_BYTES int
#define FOUR_BYTES long
#define EM_WSIZE 4
#define EM_PSIZE 4
#define EM_FSIZE 4
#define EM_DSIZE 8
#define EM_BSIZE REGSAV
#define BSS_INIT 0
#define NAME_FMT "_%s"
#define DNAM_FMT "_%s"
#define DLB_FMT "L_%ld"
#define ILB_FMT "L%x_%lx"
#define HOL_FMT "hol%d"
#define STR_FMT ".ascii\t"
#define GENLAB 'L'
#define ALIGN_FMT ".align 4\n"
#define BYTE_FMT ".byte %ld\n"
#define WORD_FMT ".half %ld\n"
#define LONG_FMT ".word %ld\n"
#define BSS_FMT ".skip %ld\n"
#define SEGTXT_FMT ".seg \"text\"\n"
#define SEGDAT_FMT ".seg \"data\"\n"
#define SEGBSS_FMT ".seg \"bss\"\n"
#define SYMBOL_DEF_FMT "%s:\n"
#define GLOBAL_FMT ".global %s\n"
#define COMM_FMT ".reserve %s, %ld, \"bss\"\n"
#define LOCAL_FMT ""
#define RELOC1_FMT "ONLY LONGS CAN BE RELOCATED!"
#define RELOC2_FMT "ONLY LONGS CAN BE RELOCATED!"
#define RELOC4_FMT ".seg \"data\"\n.align 4\n.word %s+%d\n"
#define ALIGN_GAP 4
#define FLOATTRANS 8
#define MAX_NR_FLT_REGS 16
#define FLTSAV (MAX_NR_FLT_REGS * 4)
#define FLTSAV_OFFSET (WINDOWSIZE + FLOATTRANS)
#define REGSAV (WINDOWSIZE + FLOATTRANS + ALIGN_GAP + FLTSAV)
#define MATH_DIVIDE 1
#ifndef DEBUG
#define arg_error(s,i)
#endif

11
mach/sparc/ce/misc.h Normal file
View file

@ -0,0 +1,11 @@
/*
misc.h
*/
#ifndef MISC_H
#define MISC_H
_PROTOTYPE( int power_of_2, (int n, int *ref_exp));
#endif /* MISC_H */

10
mach/sparc/ce/ms_reg.h Normal file
View file

@ -0,0 +1,10 @@
/* ms_reg.h */
#ifndef MS_REG_H
#define MS_REG_H
#include "push_pop.h"
_PROTOTYPE(reg_t find_local, (int, reg_t*));
#endif

37
mach/sparc/ce/proto.make Normal file
View file

@ -0,0 +1,37 @@
# $Header$
#PARAMS do not remove this line!
MACH = sparc
OBJ = as
SRC_DIR = $(SRC_HOME)/mach/$(MACH)/ce
CEG = $(TARGET_HOME)/lib.bin/ceg/util
all:
( cd $(SRC_DIR); make )
make -f $(CEG)/make_asobj "OBJ="$(OBJ) "MACH="$(MACH)
install:
( cd $(SRC_DIR); make )
-mkdir $(TARGET_HOME)/lib.bin/sparc
make -f $(CEG)/make_asobj "OBJ="$(OBJ) "MACH="$(MACH) install
cmp:
( cd $(SRC_DIR); make )
-make -f $(CEG)/make_asobj "OBJ="$(OBJ) "MACH="$(MACH) cmp
pr:
@pr $(SRC_DIR)/proto.make $(SRC_DIR)/EM_table.x $(SRC_DIR)/mach.h \
$(SRC_DIR)/mach.c $(SRC_DIR)/cache.c.x
opr:
make pr | opr
# total cleanup
clean:
make -f $(CEG)/make_asobj "OBJ="$(OBJ) clean
# only remove ce, ceg, and back directories
dclean:
make -f $(CEG)/make_asobj "OBJ="$(OBJ) dclean

89
mach/sparc/ce/push_pop.h Normal file
View file

@ -0,0 +1,89 @@
/*
push_pop.h
*/
#ifndef PUSH_POP_H
#define PUSH_POP_H
#include "back.h"
#define NR_REGS 64
typedef char *reg_t;
typedef struct cache_elt {
reg_t reg, reg2;
char *ext;
arith cst;
} cache_elt;
#define REG_NUM(r) (((char(*)[8])(r))-regnam)
#define T_cst 1
#define T_ext 2
#define T_reg 4
#define T_float 8
#define T_reg2 16
#define T_float2 32
typedef char const_str_t[NR_REGS];
extern reg_t reg_g0, reg_g1, reg_g2, reg_g3, reg_g4, reg_g5, reg_g6, reg_g7;
extern reg_t reg_i0, reg_i1, reg_i2, reg_i3, reg_i4, reg_i5, reg_i6, reg_i7;
extern reg_t reg_l0, reg_l1, reg_l2, reg_l3, reg_l4, reg_l5, reg_l6, reg_l7;
extern reg_t reg_o0, reg_o1, reg_o2, reg_o3, reg_o4, reg_o5, reg_o6, reg_o7;
extern reg_t reg_f0;
extern reg_t reg_sp, reg_lb, reg_gap;
extern reg_t reg_tmp;
#ifdef __STDC__
#define _PROTOTYPE(x,y) x y
#else
#define _PROTOTYPE(x,y) x()
#endif
_PROTOTYPE(int const13, (int));
_PROTOTYPE(void init_cache, (void));
_PROTOTYPE(void free_reg, (reg_t));
_PROTOTYPE(void free_double, (reg_t)); /* ..._reg */
_PROTOTYPE(void forced_alloc_reg, (reg_t));
_PROTOTYPE(void soft_alloc_reg, (reg_t));
_PROTOTYPE(void change_reg, (reg_t));
_PROTOTYPE(int type_of_tos, (void));
_PROTOTYPE(void inc_tos, (arith));
_PROTOTYPE(void inc_tos_reg, (reg_t));
_PROTOTYPE(void push_const, (arith));
_PROTOTYPE(void push_reg, (reg_t));
_PROTOTYPE(void push_ext, (char *));
_PROTOTYPE(void flush_cache, (void));
static _PROTOTYPE(void flush_part_cache, (int c, int r, int f, int d));
static _PROTOTYPE(void subst_reg, (reg_t, reg_t));
_PROTOTYPE(void cache_need, (int));
static _PROTOTYPE(int cache_read, (int n, int i));
static _PROTOTYPE(void dump_cache, (File *stream));
_PROTOTYPE(void pop_nop, (int));
static _PROTOTYPE(void panic, (char*));
_PROTOTYPE(reg_t alloc_reg, (void));
_PROTOTYPE(reg_t alloc_reg_var, (void));
_PROTOTYPE(reg_t alloc_float, (void));
_PROTOTYPE(reg_t alloc_float_var, (void));
_PROTOTYPE(reg_t alloc_double, (reg_t *sub_reg));
_PROTOTYPE(reg_t alloc_double_var, (reg_t *sub_reg));
_PROTOTYPE(reg_t pop_reg, (void));
_PROTOTYPE(reg_t pop_reg_c13, (char*));
_PROTOTYPE(reg_t pop_reg_reg, (reg_t*));
_PROTOTYPE(reg_t pop_float, (void));
_PROTOTYPE(reg_t pop_double, (reg_t *sub_reg));
_PROTOTYPE(void pop_reg_as, (reg_t r));
static _PROTOTYPE(reg_t top_reg, (void));
static _PROTOTYPE(reg_t top_reg_c13, (char*));
_PROTOTYPE(arith pop_const, (char *n_str));
_PROTOTYPE(arith top_const, (void));
_PROTOTYPE(void dup_tos, (int n));
_PROTOTYPE(void exg_top, (int n));
#define code_combiner(x) x
#endif /* PUSH_POP_H */

5
mach/sparc/libsys/.distr Normal file
View file

@ -0,0 +1,5 @@
LIST
libmon_s.a
head_em.s
SYS.h
syscall.h

180
mach/sparc/libsys/LIST Normal file
View file

@ -0,0 +1,180 @@
libmon_s.a
_alarm.c
_brk.s
_close.s
_creat.s
_dup.s
_dup2.s
_execl.c
_execve.s
_exit.s
_fork.s
_fstat.s
_ftime.c
_getpid.s
_getrusage.s
_gettimday.s
_gtty.c
_ioctl.s
_kill.s
_link.s
_lseek.s
_open.s
_pause.c
_pipe.s
_read.s
_setitimer.s
_sigblock.s
_sigpause.s
_sigsetmask.s
_sigvec.c
_sigvecscall.s
_times.c
_unlink.s
_wait4.s
_write.s
accept.s
access.s
acct.s
adjtime.s
alarm.c
bind.s
brk.s
cerror.s
chdir.s
chmod.s
chown.s
chroot.s
cleanup.c
close.s
connect.s
creat.s
dup.s
dup2.s
execl.c
execle.c
execv.c
execve.s
exit.c
fchdir.s
fchmod.s
fchown.s
fchroot.s
fcntl.s
fif.s
flock.s
fork.s
fstat.s
fstatfs.s
fsync.s
ftime.c
ftruncate.s
getdents.s
getdirent.s
getdomnam.s
getdtabsiz.s
getegid.s
geteuid.s
getgid.s
getgroups.s
gethostname.s
getitimer.s
getmsg.s
getpeername.s
getpgrp.s
getpid.s
getpriority.s
getrlimit.s
getrusage.s
getsockname.s
getsockopt.s
gettimeofday.s
getuid.s
gtty.c
ioctl.s
kill.s
killpg.s
link.s
listen.s
lockf.c
lseek.s
lstat.s
mincore.s
mkdir.s
mknod.s
mmap.s
mount.s
mprotect.s
msync.s
munmap.s
nfssvc.s
nice.c
open.s
pause.c
pipe.s
plock.c
poll.s
profil.s
ptrace.s
putmsg.s
quotactl.s
read.s
readlink.s
readv.s
reboot.s
recv.s
recvfrom.s
recvmsg.s
rename.s
rmdir.s
sbrk.s
select.s
send.s
sendmsg.s
sendto.s
setdomnam.s
setgid.c
setgroups.s
sethostname.s
setitimer.s
setpgrp.s
setpriority.s
setregid.s
setreuid.s
setrlimit.s
setsockopt.s
settimeofday.s
setuid.c
shutdown.s
sigblock.s
signal.c
sigpause.s
sigsetmask.s
sigstack.s
sigtramp.s
sigvec.c
sigvec_scall.s
socket.s
socketpair.s
stat.s
statfs.s
stime.c
stty.c
swapon.s
symlink.s
tell.c
time.c
times.c
truncate.s
ulimit.c
umask.s
uname.c
unlink.s
unmount.s
utime.c
utimes.s
vadvise.s
vfork.s
wait4.s
write.s
writev.s

147
mach/sparc/libsys/SYS.h Normal file
View file

@ -0,0 +1,147 @@
/*
SYS.h
*/
#ifndef SYS_H
#define SYS_H
#include <syscall.h>
#define SYS_call_0(x) \
LABEL_(x); \
BODY(x)
#define _SYS_call_0(x) \
LABEL__(x); \
LABEL(x); \
BODY(x)
#define SYS_call_1(x) \
LABEL_(x); \
ENTRY1; \
BODY(x)
#define _SYS_call_1(x) \
LABEL__(x); \
ENTRY1; \
LABEL(x); \
BODY(x)
#define SYS_call_2(x) \
LABEL_(x); \
ENTRY2; \
BODY(x)
#define _SYS_call_2(x) \
LABEL__(x); \
ENTRY2; \
LABEL(x); \
BODY(x)
#define SYS_call_3(x) \
LABEL_(x); \
ENTRY3; \
BODY(x)
#define _SYS_call_3(x) \
LABEL__(x); \
ENTRY3; \
LABEL(x); \
BODY(x)
#define SYS_call_4(x) \
LABEL_(x); \
ENTRY4; \
BODY(x)
#define _SYS_call_4(x) \
LABEL__(x); \
ENTRY4; \
LABEL(x); \
BODY(x)
#define SYS_call_5(x) \
LABEL_(x); \
ENTRY5; \
BODY(x)
#define _SYS_call_5(x) \
LABEL__(x); \
ENTRY5; \
LABEL(x); \
BODY(x)
#define SYS_call_6(x) \
LABEL_(x); \
ENTRY6; \
BODY(x)
#define _SYS_call_6(x) \
LABEL__(x); \
ENTRY6; \
LABEL(x); \
BODY(x)
#define BODY(x) \
sys_call(x); \
ta %g0; \
bgeu 0f; \
sethi %hi(cerror), %o5; \
or %o5, %lo(cerror), %o5; \
jmp %o5; \
nop; \
0:; \
retl; \
nop
#if __STDC__
#define LABEL_(x) \
.global _ ## x; \
_ ## x:
#define LABEL__(x) \
.global __ ## x; \
__ ## x:
#else
#define LABEL_(x) \
.global _/**/x; \
_/**/x:
#define LABEL__(x) \
.global __/**/x; \
__/**/x:
#endif
#define LABEL(x) \
.global x; \
x:
#define ENTRY1 \
ld [%l0], %o0 \
#define ENTRY2 \
ENTRY1; \
ld [%l0+4], %o1 \
#define ENTRY3 \
ENTRY2; \
ld [%l0+8], %o2 \
#define ENTRY4 \
ENTRY3; \
ld [%l0+12], %o3 \
#define ENTRY5 \
ENTRY4; \
ld [%l0+16], %o4 \
#define ENTRY6 \
ENTRY5; \
ld [%l0+20], %o5 \
#if __STDC__
#define sys_call(x) \
mov SYS_ ## x, %g1
#else
#define sys_call(x) \
mov SYS_/**/x, %g1
#endif
#endif /* SYS_H */

View file

@ -0,0 +1,13 @@
unsigned
_alarm(n)
unsigned n;
{
struct { long l1,l2,l3,l4; } t1,t2;
t1.l1 = 0;
t1.l2 = 0;
t1.l4 = 0;
t1.l3 = n;
if (_setitimer(0,&t1,&t2) < 0) return -1;
if (t2.l4) t2.l3++;
return t2.l3;
}

46
mach/sparc/libsys/_brk.s Normal file
View file

@ -0,0 +1,46 @@
.global cerror, __brk, __sbrk, limhp, brk, sbrk
__brk:
ld [%l0], %o0
brk: inc 7, %o0
andn %o0, 7, %o0
mov %o0, %o2
mov 0x11, %g1
ta %g0
nop
bgeu 0f
nop
set cerror, %o5
jmp %o5
nop
0:
set limhp, %g1
st %o2, [%g1]
retl
nop
__sbrk:
ld [%l0], %o0
sbrk: inc 7, %o0
andn %o0, 7, %o0
set limhp, %o1
ld [%o1], %o2
inc 7, %o2
andn %o2, 7, %o3
add %o3, %o0, %o0
mov %o0, %o4
mov 0x11, %g1
ta %g0
nop
bgeu 0f
nop
set cerror, %o5
jmp %o5
nop
0:
set limhp, %g1
st %o4, [%g1]
mov %o3, %o0
retl
nop

View file

@ -0,0 +1,3 @@
#include "SYS.h"
_SYS_call_1(close)

View file

@ -0,0 +1,3 @@
#include "SYS.h"
_SYS_call_2(creat)

3
mach/sparc/libsys/_dup.s Normal file
View file

@ -0,0 +1,3 @@
#include "SYS.h"
_SYS_call_1(dup)

View file

@ -0,0 +1,3 @@
#include "SYS.h"
_SYS_call_2(dup2)

View file

@ -0,0 +1,8 @@
_execl(name,args)
char *name;
int args;
{
extern char **environ;
_execve(name,&args,environ);
}

View file

@ -0,0 +1,3 @@
#include "SYS.h"
_SYS_call_3(execve)

View file

@ -0,0 +1,7 @@
#include "SYS.h"
.global __exit
__exit:
ld [%l0], %o0
set SYS_exit, %g1
ta %g0

View file

@ -0,0 +1,3 @@
#include "SYS.h"
_SYS_call_0(fork)

View file

@ -0,0 +1,3 @@
#include "SYS.h"
_SYS_call_2(fstat)

View file

@ -0,0 +1,15 @@
#include <sys/types.h>
_ftime(p)
struct { time_t time; unsigned short millitm;
short timezone; short dstflag; } *p;
{
struct { long l1,l2; } t1,t2;
if (_gettimeofday(&t1,&t2) < 0) return -1;
p->time = t1.l1;
p->millitm = t1.l2/1000;
p->dstflag = t2.l2;
p->timezone = t2.l1;
return 0;
}

View file

@ -0,0 +1,3 @@
#include "SYS.h"
_SYS_call_0(getpid)

View file

@ -0,0 +1,3 @@
#include "SYS.h"
_SYS_call_2(getrusage)

View file

@ -0,0 +1,3 @@
#include "SYS.h"
_SYS_call_2(gettimeofday)

View file

@ -0,0 +1,8 @@
#include <sgtty.h>
int
_gtty(fildes,argp)
int fildes ;
struct sgttyb *argp ;
{
return _ioctl(fildes,TIOCGETP,argp) ;
}

View file

@ -0,0 +1,3 @@
#include "SYS.h"
_SYS_call_3(ioctl)

View file

@ -0,0 +1,3 @@
#include "SYS.h"
_SYS_call_2(kill)

View file

@ -0,0 +1,3 @@
#include "SYS.h"
_SYS_call_2(link)

View file

@ -0,0 +1,3 @@
#include "SYS.h"
_SYS_call_3(lseek)

View file

@ -0,0 +1,3 @@
#include "SYS.h"
_SYS_call_3(open)

View file

@ -0,0 +1,3 @@
_pause() {
_sigpause(_sigblock());
}

View file

@ -0,0 +1,3 @@
#include "SYS.h"
_SYS_call_1(pipe)

View file

@ -0,0 +1,3 @@
#include "SYS.h"
_SYS_call_3(read)

View file

@ -0,0 +1,4 @@
#include "SYS.h"
_SYS_call_3(setitimer)

View file

@ -0,0 +1,3 @@
#include "SYS.h"
_SYS_call_3(sigblock)

View file

@ -0,0 +1,3 @@
#include "SYS.h"
_SYS_call_1(sigpause)

View file

@ -0,0 +1,3 @@
#include "SYS.h"
_SYS_call_1(sigsetmask)

View file

@ -0,0 +1,36 @@
#include "syscall.h"
#include <errno.h>
struct sigvec { int (*handler)(); int mask,flags; };
int (*(_sigfunc[32]))();
extern int _sigtramp();
extern int errno;
sigvec(sig,vec,ovec)
register struct sigvec *vec;
struct sigvec *ovec;
{
struct sigvec tmp;
int (*old)();
if ((unsigned) sig >= 32) {
errno = EINVAL;
return -1;
}
old = _sigfunc[sig];
if (vec) {
tmp = *vec;
vec = &tmp;
if (vec->handler && vec->handler != (int (*)()) 1) {
_sigfunc[sig] = vec->handler;
vec->handler = _sigtramp;
}
}
if (_sigvec_scall(sig,vec,ovec) < 0) {
_sigfunc[sig] = old;
return -1;
}
if (ovec && ovec->handler == _sigtramp) {
ovec->handler = old;
}
return 0;
}

View file

@ -0,0 +1,5 @@
#include "SYS.h"
#define SYS_sigvec_scall SYS_sigvec
_SYS_call_3(sigvec_scall)

View file

@ -0,0 +1,16 @@
#include <sys/types.h>
#define Xval(xx) ((xx).l1*60+(xx).l2/(100000/6))
_times(bp)
struct { time_t l1,l2,l3,l4;} *bp;
{
struct { struct { long l1,l2; }s1,s2; long x[20]; } t;
if (_getrusage(0,&t) < 0) return -1;
bp->l1 = Xval(t.s1);
bp->l2 = Xval(t.s2);
if (_getrusage(-1,&t) < 0) return -1;
bp->l3 = Xval(t.s1);
bp->l4 = Xval(t.s2);
return 0;
}

View file

@ -0,0 +1,3 @@
#include "SYS.h"
_SYS_call_1(unlink)

View file

@ -0,0 +1,19 @@
#include "SYS.h"
.global __wait, __wait3
__wait:
mov 0, %o0
ld [%l0], %o1
mov 0, %o2
b wait4
mov 0, %o3
__wait3:
ld [%l0+8], %o3
ld [%l0+4], %o2
ld [%l0], %o1
b wait4
mov 0, %o0
_SYS_call_4(wait4)

View file

@ -0,0 +1,3 @@
#include "SYS.h"
_SYS_call_3(write)

View file

@ -0,0 +1,3 @@
#include "SYS.h"
SYS_call_3(accept)

View file

@ -0,0 +1,4 @@
#include "SYS.h"
SYS_call_2(access)

3
mach/sparc/libsys/acct.s Normal file
View file

@ -0,0 +1,3 @@
#include "SYS.h"
SYS_call_1(acct)

View file

@ -0,0 +1,3 @@
#include "SYS.h"
SYS_call_2(adjtime)

13
mach/sparc/libsys/alarm.c Normal file
View file

@ -0,0 +1,13 @@
unsigned
alarm(n)
unsigned n;
{
struct { long l1,l2,l3,l4; } t1,t2;
t1.l1 = 0;
t1.l2 = 0;
t1.l4 = 0;
t1.l3 = n;
if (setitimer(0,&t1,&t2) < 0) return -1;
if (t2.l4) t2.l3++;
return t2.l3;
}

4
mach/sparc/libsys/bind.s Normal file
View file

@ -0,0 +1,4 @@
#include "SYS.h"
SYS_call_3(bind)

6
mach/sparc/libsys/brk.s Normal file
View file

@ -0,0 +1,6 @@
.global _brk, __brk
_brk:
set __brk,%o7
jmp %o7
nop

View file

@ -0,0 +1,14 @@
.global _errno
.global cerror
cerror:
set _errno, %o5
st %o0, [%o5]
set -1, %o0
retl
nop
.seg "data"
_errno:
.long 0

View file

@ -0,0 +1,3 @@
#include "SYS.h"
SYS_call_1(chdir)

View file

@ -0,0 +1,3 @@
#include "SYS.h"
SYS_call_2(chmod)

View file

@ -0,0 +1,3 @@
#include "SYS.h"
SYS_call_3(chown)

View file

@ -0,0 +1,3 @@
#include "SYS.h"
SYS_call_1(chroot)

View file

@ -0,0 +1 @@
_cleanup() { }

View file

@ -0,0 +1,3 @@
#include "SYS.h"
SYS_call_1(close)

View file

@ -0,0 +1,4 @@
#include "SYS.h"
SYS_call_3(connect)

View file

@ -0,0 +1,3 @@
#include "SYS.h"
SYS_call_2(creat)

3
mach/sparc/libsys/dup.s Normal file
View file

@ -0,0 +1,3 @@
#include "SYS.h"
SYS_call_1(dup)

3
mach/sparc/libsys/dup2.s Normal file
View file

@ -0,0 +1,3 @@
#include "SYS.h"
SYS_call_2(dup2)

View file

@ -0,0 +1,8 @@
execl(name,args)
char *name;
int args;
{
extern char **environ;
execve(name,&args,environ);
}

View file

@ -0,0 +1,9 @@
execle(name,args)
char *name;
char *args;
{
char **p = &args;
while (*p++) ;
execve(name,&args,*p);
}

View file

@ -0,0 +1,7 @@
execv(name,args)
char *name;
char **args;
{
extern char **environ;
execve(name,args,environ);
}

View file

@ -0,0 +1,3 @@
#include "SYS.h"
SYS_call_3(execve)

5
mach/sparc/libsys/exit.c Normal file
View file

@ -0,0 +1,5 @@
exit(n)
{
_cleanup();
_exit(n);
}

View file

@ -0,0 +1,3 @@
#include "SYS.h"
SYS_call_1(fchdir)

View file

@ -0,0 +1,3 @@
#include "SYS.h"
SYS_call_2(fchmod)

View file

@ -0,0 +1,3 @@
#include "SYS.h"
SYS_call_3(fchown)

View file

@ -0,0 +1,3 @@
#include "SYS.h"
SYS_call_1(fchroot)

View file

@ -0,0 +1,4 @@
#include "SYS.h"
SYS_call_3(fcntl)

67
mach/sparc/libsys/fif.s Normal file
View file

@ -0,0 +1,67 @@
.global fif8, Fd0, Fd1, Fd80000000, Fs80000000, Fs0
.align 8
Fd0:
.double 0r0
Fd1:
.double 0r1
FxE15:
.word 0x43300000, 0x0 ! magic const: (a.b + x) - x == a.0
Fd80000000:
.align 8
.double 0r4294967296
Fs80000000:
.single 0r2147483648
Fs0:
.single 0r0
fif8:
ld [%l0], %f0
ld [%l0+4], %f1
ld [%l0+8], %f2
ld [%l0+12], %f3
fmuld %f0, %f2, %f0
fmovs %f0, %f6
fmovs %f1, %f7
set Fd0, %o0
ldd [%o0], %f8
fcmpd %f0, %f8
nop
fbuge,a 1f
mov %g0, %o1
set 1, %o1
fnegs %f0, %f0
1:
set FxE15, %o0
ldd [%o0], %f10
fcmpd %f0, %f10
nop
fbuge 2f
nop
faddd %f0, %f10, %f4
fsubd %f4, %f10, %f4
fsubd %f0, %f4, %f2
set Fd1, %o0
ldd [%o0], %f12
4: fcmpd %f2, %f12
nop
fbge,a 4b
fsubd %f2, %f12, %f2
5: fcmpd %f2, %f8
nop
fbl,a 5b
faddd %f2, %f12, %f2
fsubd %f0, %f2, %f0
2:
tst %o1
bz 3f
nop
fnegs %f0, %f0
3:
fsubd %f6, %f0, %f2
st %f0, [%l0]
st %f1, [%l0+4]
st %f2, [%l0+8]
st %f3, [%l0+12]
retl
nop

View file

@ -0,0 +1,3 @@
#include "SYS.h"
SYS_call_2(flock)

3
mach/sparc/libsys/fork.s Normal file
View file

@ -0,0 +1,3 @@
#include "SYS.h"
SYS_call_0(fork)

View file

@ -0,0 +1,3 @@
#include "SYS.h"
SYS_call_2(fstat)

View file

@ -0,0 +1,3 @@
#include "SYS.h"
SYS_call_2(fstatfs)

Some files were not shown because too many files have changed in this diff Show more