FSIN,
FSINCOS,
FSQRT,
- FSTD, FSTS, FSTPX, FSTPD, FSTPS,
+ FSTD, FSTS, FSTP, FSTPX, FSTPD, FSTPS,
FSTCW,
FSTENV,
FSTSW,
int isanumber(const char *s);
extern int asm_mode32; /* In 32 bit mode if true. */
+extern int prepend_underscores; /* Prepend underscores to symbols */
#define use16() (!asm_mode32)
#define use32() ((int) asm_mode32)
#define set_use16() ((void) (asm_mode32= 0))
#define set_use32() ((void) (asm_mode32= 1))
+#define underscore_mode() (prepend_underscores)
+#define enable_underscore_mode() ((void)(prepend_underscores= 1))
+
extern int err_code; /* Exit code. */
#define set_error() ((void) (err_code= EXIT_FAILURE))
{ FSTCW, "fstcw" },
{ FSTD, "fstd" },
{ FSTENV, "fstenv" },
+ { FSTP, "fstp" },
{ FSTPD, "fstpd" },
{ FSTPS, "fstps" },
{ FSTPX, "fstpx" },
};
#define farjmp(o) ((o) == JMPF || (o) == CALLF)
+#define data_op(o) ((o) == DOT_DATA1 || (o) == DOT_DATA2 || (o) == DOT_DATA4)
+#define define_op(o) ((o) == DOT_DEFINE)
static FILE *ef;
static long eline= 1;
assert(e != nil);
- isglob = syms_is_global(e->name);
+ if (underscore_mode())
+ isglob = syms_is_global(e->name);
+ else
+ isglob = 0;
switch (e->operator) {
case ',':
- if (dialect == NCC && farjmp(a->opcode)) {
+ if (data_op(a->opcode) || define_op(a->opcode)
+ || (dialect == NCC && farjmp(a->opcode))) {
/* ACK jmpf seg:off -> NCC jmpf off,seg */
ack_put_expression(a, e->right, deref);
ack_printf(", ");
} else
if (a->opcode == DOT_LABEL) {
assert(a->args->operator == ':');
- if (syms_is_global(a->args->name))
+ if (underscore_mode() && syms_is_global(a->args->name))
ack_printf("_%s:", a->args->name);
else
ack_printf("%s:", a->args->name);
&& a->args->operator == ','
&& a->args->left->operator == 'W'
) {
- if (syms_is_global(a->args->left->name))
+ if (underscore_mode() && syms_is_global(a->args->left->name))
ack_printf(".define\t_%s; ", a->args->left->name);
else
ack_printf(".define\t%s; ", a->args->left->name);
/* we are translating from GNU */
if (a->args && a->args->operator == ','
/* don't swap ljmp prefixed with segment */
- && a->opcode != JMPF) {
+ && a->opcode != JMPF
+ && !data_op(a->opcode)
+ && !define_op(a->opcode)) {
expression_t * tmp;
tmp = a->args->right;
#include <string.h>
#include <errno.h>
#include <assert.h>
+#include <getopt.h>
#include "asmconv.h"
#include "asm86.h"
#include "languages.h"
/* "Invisible" globals. */
int asm_mode32= (sizeof(int) == 4);
int err_code= EXIT_SUCCESS;
+/* Prepend underscores to symbols */
+int prepend_underscores = 0;
int main(int argc, char **argv)
{
char *lang_parse, *lang_emit, *input_file, *output_file;
asm86_t *instr;
char banner[80];
-
- if (argc > 1 && argv[1][0] == '-' && argv[1][1] == 'm') {
- if (strcmp(argv[1], "-mi86") == 0) {
- set_use16();
- } else
- if (strcmp(argv[1], "-mi386") == 0) {
- set_use32();
- } else {
- fprintf(stderr, "asmconv: '%s': unknown machine\n",
- argv[1]+2);
- }
- argc--;
- argv++;
- }
-
- if (argc > 3) {
+ char c;
+ opterr = 0;
+
+ while ((c = getopt (argc, argv, "m:u")) != -1)
+ switch (c)
+ {
+ case 'm':
+ if (strcmp(optarg, "i86") == 0) {
+ set_use16();
+ } else
+ if (strcmp(optarg, "i386") == 0) {
+ set_use32();
+ }
+ else {
+ fprintf(stderr, "asmconv: '%s': unknown machine\n",
+ optarg);
+ exit(EXIT_FAILURE);
+ }
+ break;
+ case 'u':
+ enable_underscore_mode();
+ break;
+ default:
+ fprintf(stderr, "Usage: gas2ack [input-file [output-file]]\n");
+ exit(EXIT_FAILURE);
+ }
+
+ if ((argc - optind < 1) || (argc - optind > 2)) {
fprintf(stderr, "Usage: gas2ack [input-file [output-file]]\n");
exit(EXIT_FAILURE);
}
- input_file= argc < 1 ? nil : argv[1];
- output_file= argc < 2 ? nil : argv[2];
+ input_file= (argc - optind) < 1 ? nil : argv[optind];
+ output_file= (argc - optind) < 2 ? nil : argv[optind+1];
parse_init= gnu_parse_init;
get_instruction= gnu_get_instruction;
optype_t optype;
} mnemonic_t;
-static mnemonic_t mnemtab[] = { /* This array is sorted. */
+/***************************************************************
+ * *
+ * NOTE: You MUST keep this array sorted by the first column. *
+ * *
+ **************************************************************/
+static mnemonic_t mnemtab[] = {
{ ".ascii", DOT_ASCII, PSEUDO },
{ ".asciz", DOT_ASCIZ, PSEUDO },
{ ".assert", DOT_ASSERT, PSEUDO },
{ ".byte", DOT_DATA1, PSEUDO },
{ ".comm", DOT_COMM, PSEUDO },
{ ".data", DOT_DATA, PSEUDO },
- { ".data1", DOT_DATA1, PSEUDO },
- { ".data2", DOT_DATA2, PSEUDO },
- { ".data4", DOT_DATA4, PSEUDO },
{ ".end", DOT_END, PSEUDO },
{ ".extern", DOT_EXTERN, PSEUDO },
{ ".file", DOT_FILE, PSEUDO },
{ "cmc", CMC, WORD },
{ "cmpb", CMP, BYTE },
{ "cmpl", CMP, WORD },
- { "cmps", CMPS, WORD },
{ "cmpsb", CMPS, BYTE },
- { "cmpsl", CMPS, OWORD },
- { "cmpsw", CMPS, WORD },
+ { "cmpsl", CMPS, WORD },
+ { "cmpsw", CMPS, OWORD },
{ "cmpw", CMP, OWORD },
{ "cmpxchg", CMPXCHG, WORD },
{ "cpuid", CPUID, WORD },
{ "fisubs", FISUBS, WORD },
{ "fld1", FLD1, WORD },
{ "fldcw", FLDCW, WORD },
- { "fldd", FLDD, WORD },
{ "fldenv", FLDENV, WORD },
+ { "fldl", FLDD, WORD },
{ "fldl2e", FLDL2E, WORD },
{ "fldl2t", FLDL2T, WORD },
{ "fldlg2", FLDLG2, WORD },
{ "fnop", FNOP, WORD },
{ "fnsave", FNSAVE, WORD },
{ "fnstcw", FNSTCW, WORD },
- { "fnstsw", FNSTSW, WORD },
{ "fnstenv", FSTENV, WORD },
+ { "fnstsw", FNSTSW, WORD },
{ "fpatan", FPATAN, WORD },
{ "fprem", FPREM, WORD },
{ "fprem1", FPREM1, WORD },
{ "fsin", FSIN, WORD },
{ "fsincos", FSINCOS, WORD },
{ "fsqrt", FSQRT, WORD },
+ { "fstcw", FSTCW, WORD },
{ "fstd", FSTD, WORD },
- { "fstpd", FSTPD, WORD },
+ { "fstp", FSTP, WORD },
+ { "fstpl", FSTPD, WORD },
{ "fstps", FSTPS, WORD },
{ "fstpx", FSTPX, WORD },
{ "fsts", FSTS, WORD },
- { "fstcw", FSTCW, WORD },
{ "fstsw", FSTSW, WORD },
{ "fsubd", FSUBD, WORD },
{ "fsubp", FSUBP, WORD },
token_t *t;
int sreg;
+
if ((e= gnu_get_operand(a, pn, deref)) == nil) return nil;
t = get_token(*pn);
break;
case DOT_DEFINE:
case DOT_EXTERN:
- syms_add_global_csl(a->args);
+ if (underscore_mode())
+ syms_add_global_csl(a->args);
break;
case DOT_COMM:
- syms_add_global(a->args->left->name);
+ if (underscore_mode())
+ syms_add_global(a->args->left->name);
break;
case DOT_LCOMM:
- syms_add(a->args->left->name);
+ if(underscore_mode())
+ syms_add(a->args->left->name);
break;
case JMPF:
case CALLF:
a->args= e= new_expr();
e->operator= ':';
e->name= copystr(t->name);
- syms_add(t->name);
+ if (underscore_mode())
+ syms_add(t->name);
skip_token(2);
} else
if (t->type == T_WORD && get_token(1)->symbol == '=') {
a->args= new_expr();
a->args->operator= '=';
a->args->name= copystr(t->name);
- syms_add(t->name);
+ if (underscore_mode())
+ syms_add(t->name);
a->args->middle= e;
skip_token(n+1);
}
+20100303:
+ Gas2ack updates: Run 'make install' in commands/i386/gas2ack
20100215:
Make(1) has been replaced: Run 'make install' in commands/make
Mkdep updates: Copy commands/scripts/mkdep.sh to /usr/bin/mkdep
-.SUFFIXES: .o .e
+.SUFFIXES: .o .e .S
# Treated like a C file
.e.o:
# ${OBJCOPY} -x ${.TARGET}
# .endif
+ASMCONV=gas2ack
+AFLAGS+=-D__ASSEMBLY__ -D_EM_WSIZE=4 -D__minix -I/usr/src/include -w -wo
+CPP.s=${CC} -E ${AFLAGS}
+ASMCONVFLAGS+=-mi386
+
+# Need to convert ACK assembly files to GNU assembly before building
+.S.o:
+ ${_MKTARGET_COMPILE}
+ ${CPP.s} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -o ${.PREFIX}.gnu.s
+ ${ASMCONV} ${ASMCONVFLAGS} ${.PREFIX}.gnu.s ${.PREFIX}.ack.s
+ ${COMPILE.s} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.PREFIX}.ack.s -o ${.TARGET}
+ rm -rf ${.PREFIX}.ack.s ${.PREFIX}.gnu.s
-.SUFFIXES: .o .s .gs
+.SUFFIXES: .o .s
ASMCONV=asmconv
CPP.s=${CC} ${AFLAGS} -E -x assembler-with-cpp
ASMCONVFLAGS+=-mi386 ack gnu
-ASSEMBLE=gas ${AFLAGS}
# Need to convert ACK assembly files to GNU assembly before building
.s.o:
${ASMCONV} ${ASMCONVFLAGS} ${.PREFIX}.ack.s ${.PREFIX}.gnu.s
${COMPILE.s} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.PREFIX}.gnu.s -o ${.TARGET}
rm -rf ${.PREFIX}.ack.s ${.PREFIX}.gnu.s
-
-# GNU Assembly file
-.gs.o:
- ${_MKTARGET_COMPILE}
- ${ASSEMBLE} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET}
# How to build it
klib386.o: klib386.S
$(CC) $(CFLAGS) -E -D__ASSEMBLY__ -o $@.tmp $<
- gas2ack $@.tmp $@.s
+ gas2ack -u $@.tmp $@.s
$(CC) $(CFLAGS) -c -o $@ $@.s
mpx386.o: mpx386.S
$(CC) $(CFLAGS) -E -D__ASSEMBLY__ -o $@.tmp $<
- gas2ack $@.tmp $@.s
+ gas2ack -u $@.tmp $@.s
$(CC) $(CFLAGS) -c -o $@ $@.s
apic_asm.o: apic_asm.S
$(CC) $(CFLAGS) -E -D__ASSEMBLY__ -o $@.tmp $<
- gas2ack $@.tmp $@.s
+ gas2ack -u $@.tmp $@.s
$(CC) $(CFLAGS) -c -o $@ $@.s
$(HEAD): mpx386.o
.globl apic_hwint14
.globl apic_hwint15
+.text
#define APIC_IRQ_HANDLER(irq) \
push $irq ;\
call irq_handle /* intr_handle(irq_handlers[irq]) */ ;\
/* sections */
-.text; .data; .data; .bss
#include <minix/config.h>
#include <minix/const.h>
AFLAGS+= -O -D_MINIX -D_POSIX_SOURCE
-SRCS= crtso.s
+SRCS= crtso.S
OBJS= crtso.o
realall: ${OBJS}
--- /dev/null
+/* This is the C run-time start-off routine. It's job is to take the */
+/* arguments as put on the stack by EXEC, and to parse them and set them up the */
+/* way _main expects them. */
+/* It also initializes environ when this variable isn't defined by the */
+/* programmer. The detection of whether environ belong to us is rather */
+/* simplistic. We simply check for some magic value, but there is no other */
+/* way. */
+
+#include <sys/vm_i386.h>
+
+
+.globl begtext, begdata, begbss
+.text
+begtext:
+#ifdef __ACK__
+.rom
+#else
+.data
+#endif
+begrom:
+.data
+begdata:
+.bss
+begbss:
+
+.globl crtso, __penviron, __penvp, __fpu_present
+.globl __minix_datastart, __minix_mainjump, __minix_unmapzero
+.extern _main, _exit
+
+#if defined(__ELF__)
+.section .init
+#else
+.text
+#endif
+
+#if defined(__ELF__)
+.globl __start
+__start:
+#endif
+crtso:
+ xorl %ebp, %ebp /* clear for backtrace of core files */
+ movl (%esp), %eax /* argc */
+ leal 4(%esp), %edx /* argv */
+ leal 8(%esp,%eax,4), %ecx /* envp */
+
+/* Test if environ is in the initialized data area and is set to our */
+/* magic number. If so then it is not redefined by the user. */
+ movl $_environ, %ebx
+ cmpl $__edata, %ebx /* within initialized data? */
+ jae 0f
+ testb $3, %bl /* aligned? */
+ jne 0f
+ cmpl $0x53535353, (%ebx) /* is it our environ? */
+ jne 0f
+ movl %ebx, __penviron /* _penviron = &environ; */
+0:
+ movl __penviron, %ebx
+ movl %ecx, (%ebx) /* *_penviron = envp; */
+
+ push %ecx /* push envp */
+ push %edx /* push argv */
+ push %eax /* push argc */
+
+/* Test the EM bit of the MSW to determine if an FPU is present and */
+/* set __fpu_present if one is found. */
+ smsw %ax
+ testb $0x4, %al /* EM bit in MSW */
+ sete __fpu_present /* True if not set */
+ jmp __minix_mainjump
+
+.balign I386_PAGE_SIZE
+__minix_mainjump:
+ /* unmap zero pages */
+ call __minix_unmapzero
+
+ call _main /* main(argc, argv, envp) */
+
+ push %eax /* push exit status */
+ call _exit
+
+ hlt /* force a trap if exit fails */
+
+__minix_unmapzero:
+
+ /* unmap 0-page code */
+ push $I386_PAGE_SIZE
+ push $crtso
+ call _munmap_text /* unmap_text(crtso, I386_PAGE_SIZE) */
+ add $8, %esp
+
+#ifdef __ACK__
+ /*
+ * ack uses separate segments for text and data by default. We have a
+ * common segment when compiling using any other compiler
+ */
+
+ /* unmap 0-page data */
+ push $I386_PAGE_SIZE
+ push $romstart
+ call _munmap /* munmap(romstart, I386_PAGE_SIZE) */
+ add $8, %esp
+#endif
+
+ ret
+
+#ifdef __ACK__
+.rom
+romstart:
+.space I386_PAGE_SIZE
+__minix_datastart:
+.space 4
+#endif
+.data
+__penviron:
+.long __penvp /* Pointer to environ, or hidden pointer */
+
+.bss
+.lcomm __penvp, 4 /* Hidden environment vector */
+.lcomm __fpu_present, 4 /* FPU present flag */
+
+.extern endtext /* Force loading of end labels. */
+++ /dev/null
-#
-! This is the C run-time start-off routine. It's job is to take the
-! arguments as put on the stack by EXEC, and to parse them and set them up the
-! way _main expects them.
-! It also initializes _environ when this variable isn't defined by the
-! programmer. The detection of whether _environ belong to us is rather
-! simplistic. We simply check for some magic value, but there is no other
-! way.
-
-#include <sys/vm_i386.h>
-
-.sect .text; .sect .rom; .sect .data; .sect .bss
-
-.define begtext, begdata, begbss
-.sect .text
-begtext:
-.sect .rom
-begrom:
-.sect .data
-begdata:
-.sect .bss
-begbss:
-
-.define crtso, __penviron, __penvp, __fpu_present
-.define __minix_datastart, __minix_mainjump, __minix_unmapzero
-.extern _main, _exit
-.sect .text
-crtso:
- xor ebp, ebp ! clear for backtrace of core files
- mov eax, (esp) ! argc
- lea edx, 4(esp) ! argv
- lea ecx, 8(esp)(eax*4) ! envp
-
- ! Test if environ is in the initialized data area and is set to our
- ! magic number. If so then it is not redefined by the user.
- mov ebx, _environ
- cmp ebx, __edata ! within initialized data?
- jae 0f
- testb bl, 3 ! aligned?
- jnz 0f
- cmp (ebx), 0x53535353 ! is it our _environ?
- jne 0f
- mov (__penviron), ebx ! _penviron = &environ;
-0: mov ebx, (__penviron)
- mov (ebx), ecx ! *_penviron = envp;
-
- push ecx ! push envp
- push edx ! push argv
- push eax ! push argc
-
- ! Test the EM bit of the MSW to determine if an FPU is present and
- ! set __fpu_present if one is found.
- smsw ax
- testb al, 0x4 ! EM bit in MSW
- setz (__fpu_present) ! True if not set
- jmp __minix_mainjump
-
-.align I386_PAGE_SIZE
-__minix_mainjump:
- ! unmap zero pages
- call __minix_unmapzero
-
- call _main ! main(argc, argv, envp)
-
- push eax ! push exit status
- call _exit
-
- hlt ! force a trap if exit fails
-
-__minix_unmapzero:
-
- ! unmap 0-page code
- push I386_PAGE_SIZE
- push crtso
- call _munmap_text ! munmap_text(crtso, I386_PAGE_SIZE)
- add esp, 8
-
- ! unmap 0-page data
- push I386_PAGE_SIZE
- push romstart
- call _munmap ! munmap(romstart, I386_PAGE_SIZE)
- add esp, 8
-
- ret
-
-.sect .rom
-romstart:
- .space I386_PAGE_SIZE
-__minix_datastart:
- .space 4
-.sect .data
-__penviron:
- .data4 __penvp ! Pointer to environ, or hidden pointer
-
-.sect .bss
- .comm __penvp, 4 ! Hidden environment vector
- .comm __fpu_present, 4 ! FPU present flag
-
-.extern endtext ! Force loading of end labels.
.PATH: ${.CURDIR}/arch/${ARCH}/int64
SRCS+= \
- add64.s \
- add64u.s \
- cmp64.s \
- cv64u.s \
- cvu64.s \
- diff64.s \
- div64u.s \
- ex64.s \
- make64.s \
- mul64u.s \
- sub64.s \
- sub64u.s
+ add64.S \
+ add64u.S \
+ cmp64.S \
+ cv64u.S \
+ cvu64.S \
+ diff64.S \
+ div64u.S \
+ ex64.S \
+ make64.S \
+ mul64u.S \
+ sub64.S \
+ sub64u.S
--- /dev/null
+/* add64() - 64 bit addition Author: Kees J. Bot */
+/* 7 Dec 1995 */
+.text
+.globl _add64
+
+_add64:
+/* u64_t add64(u64_t i, u64_t j); */
+ movl 4(%esp), %eax
+ movl 8(%esp), %edx
+ addl 16(%esp), %edx
+ movl %edx, (%eax)
+ movl 12(%esp), %edx
+ adcl 20(%esp), %edx
+ movl %edx, 4(%eax)
+ ret
+
+/* */
+/* $PchId: add64.ack.s,v 1.2 1996/04/11 18:59:57 philip Exp $ */
+++ /dev/null
-! add64() - 64 bit addition Author: Kees J. Bot
-! 7 Dec 1995
-.sect .text
-.define _add64
-
-_add64: ! u64_t add64(u64_t i, u64_t j);
- mov eax, 4(esp)
- mov edx, 8(esp)
- add edx, 16(esp)
- mov (eax), edx
- mov edx, 12(esp)
- adc edx, 20(esp)
- mov 4(eax), edx
- ret
-
-!
-! $PchId: add64.ack.s,v 1.2 1996/04/11 18:59:57 philip Exp $
--- /dev/null
+/* add64u() - unsigned to 64 bit addition Author: Kees J. Bot */
+/* 7 Dec 1995 */
+.text
+.globl _add64u, _add64ul
+
+_add64u:
+/* u64_t add64u(u64_t i, unsigned j); */
+_add64ul:
+/* u64_t add64ul(u64_t i, unsigned long j); */
+ movl 4(%esp), %eax
+ movl 8(%esp), %edx
+ addl 16(%esp), %edx
+ movl %edx, (%eax)
+ movl 12(%esp), %edx
+ adcl $0, %edx
+ movl %edx, 4(%eax)
+ ret
+
+/* */
+/* $PchId: add64u.ack.s,v 1.2 1996/04/11 18:59:57 philip Exp $ */
+++ /dev/null
-! add64u() - unsigned to 64 bit addition Author: Kees J. Bot
-! 7 Dec 1995
-.sect .text
-.define _add64u, _add64ul
-
-_add64u: ! u64_t add64u(u64_t i, unsigned j);
-_add64ul: ! u64_t add64ul(u64_t i, unsigned long j);
- mov eax, 4(esp)
- mov edx, 8(esp)
- add edx, 16(esp)
- mov (eax), edx
- mov edx, 12(esp)
- adc edx, 0
- mov 4(eax), edx
- ret
-
-!
-! $PchId: add64u.ack.s,v 1.2 1996/04/11 18:59:57 philip Exp $
--- /dev/null
+/* cmp64*() - 64 bit compare Author: Kees J. Bot */
+/* 7 Dec 1995 */
+.text
+.globl _cmp64, _cmp64u, _cmp64ul
+
+_cmp64:
+/* int cmp64(u64_t i, u64_t j); */
+ movl %esp, %ecx
+0:
+ xorl %eax, %eax
+ movl 4(%ecx), %edx
+ subl 12(%ecx), %edx
+ movl 8(%ecx), %edx
+ sbbl 16(%ecx), %edx
+ sbbl %eax, %eax /* eax = - (i < j) */
+ movl 12(%ecx), %edx
+ subl 4(%ecx), %edx
+ movl 16(%ecx), %edx
+ sbbl 8(%ecx), %edx
+ adcl $0, %eax /* eax = (i > j) - (i < j) */
+ ret
+
+_cmp64u:
+/* int cmp64u(u64_t i, unsigned j); */
+_cmp64ul:
+/* int cmp64ul(u64_t i, unsigned long j); */
+ movl %esp, %ecx
+ push 16(%ecx)
+ movl $0, 16(%ecx)
+ call 0b
+ pop 16(%ecx)
+ ret
+
+/* */
+/* $PchId: cmp64.ack.s,v 1.2 1996/04/11 18:59:57 philip Exp $ */
+++ /dev/null
-! cmp64*() - 64 bit compare Author: Kees J. Bot
-! 7 Dec 1995
-.sect .text
-.define _cmp64, _cmp64u, _cmp64ul
-
-_cmp64: ! int cmp64(u64_t i, u64_t j);
- mov ecx, esp
-cmp64: xor eax, eax
- mov edx, 4(ecx)
- sub edx, 12(ecx)
- mov edx, 8(ecx)
- sbb edx, 16(ecx)
- sbb eax, eax ! eax = - (i < j)
- mov edx, 12(ecx)
- sub edx, 4(ecx)
- mov edx, 16(ecx)
- sbb edx, 8(ecx)
- adc eax, 0 ! eax = (i > j) - (i < j)
- ret
-
-_cmp64u: ! int cmp64u(u64_t i, unsigned j);
-_cmp64ul: ! int cmp64ul(u64_t i, unsigned long j);
- mov ecx, esp
- push 16(ecx)
- mov 16(ecx), 0
- call cmp64
- pop 16(ecx)
- ret
-
-!
-! $PchId: cmp64.ack.s,v 1.2 1996/04/11 18:59:57 philip Exp $
--- /dev/null
+/* cv64u() - 64 bit converted to unsigned Author: Kees J. Bot */
+/* 7 Dec 1995 */
+.text
+.globl _cv64u, _cv64ul
+
+_cv64u:
+/* unsigned cv64u(u64_t i); */
+_cv64ul:
+/* unsigned long cv64ul(u64_t i); */
+ movl 4(%esp), %eax
+ cmpl $0, 8(%esp) /* return ULONG_MAX if really big */
+ je 0f
+ movl $-1, %eax
+0:
+ ret
+
+/* */
+/* $PchId: cv64u.ack.s,v 1.2 1996/04/11 18:59:57 philip Exp $ */
+++ /dev/null
-! cv64u() - 64 bit converted to unsigned Author: Kees J. Bot
-! 7 Dec 1995
-.sect .text
-.define _cv64u, _cv64ul
-
-_cv64u: ! unsigned cv64u(u64_t i);
-_cv64ul: ! unsigned long cv64ul(u64_t i);
- mov eax, 4(esp)
- cmp 8(esp), 0 ! return ULONG_MAX if really big
- jz 0f
- mov eax, -1
-0: ret
-
-!
-! $PchId: cv64u.ack.s,v 1.2 1996/04/11 18:59:57 philip Exp $
--- /dev/null
+/* cvu64() - unsigned converted to 64 bit Author: Kees J. Bot */
+/* 7 Dec 1995 */
+.text
+.globl _cvu64, _cvul64
+
+_cvu64:
+/* u64_t cvu64(unsigned i); */
+_cvul64:
+/* u64_t cvul64(unsigned long i); */
+ movl 4(%esp), %eax
+ movl 8(%esp), %edx
+ movl %edx, (%eax)
+ movl $0, 4(%eax)
+ ret
+
+/* */
+/* $PchId: cvu64.ack.s,v 1.2 1996/04/11 18:59:57 philip Exp $ */
+++ /dev/null
-! cvu64() - unsigned converted to 64 bit Author: Kees J. Bot
-! 7 Dec 1995
-.sect .text
-.define _cvu64, _cvul64
-
-_cvu64: ! u64_t cvu64(unsigned i);
-_cvul64: ! u64_t cvul64(unsigned long i);
- mov eax, 4(esp)
- mov edx, 8(esp)
- mov (eax), edx
- mov 4(eax), 0
- ret
-
-!
-! $PchId: cvu64.ack.s,v 1.2 1996/04/11 18:59:57 philip Exp $
--- /dev/null
+/* diff64() - 64 bit subtraction giving unsigned Author: Kees J. Bot */
+/* 7 Dec 1995 */
+.text
+.globl _diff64
+
+_diff64:
+/* unsigned diff64(u64_t i, u64_t j); */
+ movl 4(%esp), %eax
+ subl 12(%esp), %eax
+ ret
+
+/* */
+/* $PchId: diff64.ack.s,v 1.2 1996/04/11 18:59:57 philip Exp $ */
+++ /dev/null
-! diff64() - 64 bit subtraction giving unsigned Author: Kees J. Bot
-! 7 Dec 1995
-.sect .text
-.define _diff64
-
-_diff64: ! unsigned diff64(u64_t i, u64_t j);
- mov eax, 4(esp)
- sub eax, 12(esp)
- ret
-
-!
-! $PchId: diff64.ack.s,v 1.2 1996/04/11 18:59:57 philip Exp $
--- /dev/null
+/* div64u() - 64 bit divided by unsigned giving unsigned long */
+/* Author: Kees J. Bot */
+/* 7 Dec 1995 */
+.text
+.globl _div64u, _rem64u
+
+_div64u:
+/* unsigned long div64u(u64_t i, unsigned j); */
+ xorl %edx, %edx
+ movl 8(%esp), %eax /* i = (ih<<32) + il */
+ divl 12(%esp) /* ih = q * j + r */
+ movl 4(%esp), %eax
+ divl 12(%esp) /* i / j = (q<<32) + ((r<<32) + il) / j */
+ ret
+
+_rem64u:
+/* unsigned rem64u(u64_t i, unsigned j); */
+ pop %ecx
+ call _div64u
+ movl %edx, %eax
+ jmp *%ecx
+
+/* */
+/* $PchId: div64u.ack.s,v 1.2 1996/04/11 18:59:57 philip Exp $ */
+++ /dev/null
-! div64u() - 64 bit divided by unsigned giving unsigned long
-! Author: Kees J. Bot
-! 7 Dec 1995
-.sect .text
-.define _div64u, _rem64u
-
-_div64u: ! unsigned long div64u(u64_t i, unsigned j);
- xor edx, edx
- mov eax, 8(esp) ! i = (ih<<32) + il
- div 12(esp) ! ih = q * j + r
- mov eax, 4(esp)
- div 12(esp) ! i / j = (q<<32) + ((r<<32) + il) / j
- ret
-
-_rem64u: ! unsigned rem64u(u64_t i, unsigned j);
- pop ecx
- call _div64u
- mov eax, edx
- jmp ecx
-
-!
-! $PchId: div64u.ack.s,v 1.2 1996/04/11 18:59:57 philip Exp $
--- /dev/null
+/* ex64*() - extract low or high 32 bits of a 64 bit number */
+/* Author: Kees J. Bot */
+/* 7 Dec 1995 */
+.text
+.globl _ex64lo, _ex64hi
+
+_ex64lo:
+/* unsigned long ex64lo(u64_t i); */
+ movl 4(%esp), %eax
+ ret
+
+_ex64hi:
+/* unsigned long ex64hi(u64_t i); */
+ movl 8(%esp), %eax
+ ret
+
+/* */
+/* $PchId: ex64.ack.s,v 1.2 1996/04/11 18:59:57 philip Exp $ */
+++ /dev/null
-! ex64*() - extract low or high 32 bits of a 64 bit number
-! Author: Kees J. Bot
-! 7 Dec 1995
-.sect .text
-.define _ex64lo, _ex64hi
-
-_ex64lo: ! unsigned long ex64lo(u64_t i);
- mov eax, 4(esp)
- ret
-
-_ex64hi: ! unsigned long ex64hi(u64_t i);
- mov eax, 8(esp)
- ret
-
-!
-! $PchId: ex64.ack.s,v 1.2 1996/04/11 18:59:57 philip Exp $
--- /dev/null
+/* make64() - make a 64 bit number from two 32 bit halves */
+/* Author: Kees J. Bot */
+/* 7 Dec 1995 */
+.text
+.globl _make64
+
+_make64:
+/* u64_t make64(unsigned long lo, unsigned long hi); */
+ movl 4(%esp), %eax
+ movl 8(%esp), %edx
+ movl %edx, (%eax)
+ movl 12(%esp), %edx
+ movl %edx, 4(%eax)
+ ret
+
+/* */
+/* $PchId: make64.ack.s,v 1.2 1996/04/11 18:59:57 philip Exp $ */
+++ /dev/null
-! make64() - make a 64 bit number from two 32 bit halves
-! Author: Kees J. Bot
-! 7 Dec 1995
-.sect .text
-.define _make64
-
-_make64: ! u64_t make64(unsigned long lo, unsigned long hi);
- mov eax, 4(esp)
- mov edx, 8(esp)
- mov (eax), edx
- mov edx, 12(esp)
- mov 4(eax), edx
- ret
-
-!
-! $PchId: make64.ack.s,v 1.2 1996/04/11 18:59:57 philip Exp $
--- /dev/null
+/* mul64u() - unsigned long by unsigned multiply giving 64 bit result */
+/* Author: Kees J. Bot */
+/* 7 Dec 1995 */
+.text
+.globl _mul64u
+
+_mul64u:
+/* u64_t mul64u(unsigned long i, unsigned j); */
+ movl 4(%esp), %ecx
+ movl 8(%esp), %eax
+ mull 12(%esp)
+ movl %eax, (%ecx)
+ movl %edx, 4(%ecx)
+ movl %ecx, %eax
+ ret
+
+/* */
+/* $PchId: mul64u.ack.s,v 1.2 1996/04/11 18:59:57 philip Exp $ */
+++ /dev/null
-! mul64u() - unsigned long by unsigned multiply giving 64 bit result
-! Author: Kees J. Bot
-! 7 Dec 1995
-.sect .text
-.define _mul64u
-
-_mul64u: ! u64_t mul64u(unsigned long i, unsigned j);
- mov ecx, 4(esp)
- mov eax, 8(esp)
- mul 12(esp)
- mov (ecx), eax
- mov 4(ecx), edx
- mov eax, ecx
- ret
-
-!
-! $PchId: mul64u.ack.s,v 1.2 1996/04/11 18:59:57 philip Exp $
--- /dev/null
+/* sub64() - 64 bit subtraction Author: Kees J. Bot */
+/* 7 Dec 1995 */
+.text
+.globl _sub64
+
+_sub64:
+/* u64_t sub64(u64_t i, u64_t j); */
+ movl 4(%esp), %eax
+ movl 8(%esp), %edx
+ subl 16(%esp), %edx
+ movl %edx, (%eax)
+ movl 12(%esp), %edx
+ sbbl 20(%esp), %edx
+ movl %edx, 4(%eax)
+ ret
+
+/* */
+/* $PchId: sub64.ack.s,v 1.2 1996/04/11 18:59:57 philip Exp $ */
+++ /dev/null
-! sub64() - 64 bit subtraction Author: Kees J. Bot
-! 7 Dec 1995
-.sect .text
-.define _sub64
-
-_sub64: ! u64_t sub64(u64_t i, u64_t j);
- mov eax, 4(esp)
- mov edx, 8(esp)
- sub edx, 16(esp)
- mov (eax), edx
- mov edx, 12(esp)
- sbb edx, 20(esp)
- mov 4(eax), edx
- ret
-
-!
-! $PchId: sub64.ack.s,v 1.2 1996/04/11 18:59:57 philip Exp $
--- /dev/null
+/* sub64() - unsigned from 64 bit subtraction Author: Kees J. Bot */
+/* 7 Dec 1995 */
+.text
+.globl _sub64u, _sub64ul
+
+_sub64u:
+/* u64_t sub64u(u64_t i, unsigned j); */
+_sub64ul:
+/* u64_t sub64ul(u64_t i, unsigned long j); */
+ movl 4(%esp), %eax
+ movl 8(%esp), %edx
+ subl 16(%esp), %edx
+ movl %edx, (%eax)
+ movl 12(%esp), %edx
+ sbbl $0, %edx
+ movl %edx, 4(%eax)
+ ret
+
+/* */
+/* $PchId: sub64u.ack.s,v 1.2 1996/04/11 18:59:57 philip Exp $ */
+++ /dev/null
-! sub64() - unsigned from 64 bit subtraction Author: Kees J. Bot
-! 7 Dec 1995
-.sect .text
-.define _sub64u, _sub64ul
-
-_sub64u: ! u64_t sub64u(u64_t i, unsigned j);
-_sub64ul: ! u64_t sub64ul(u64_t i, unsigned long j);
- mov eax, 4(esp)
- mov edx, 8(esp)
- sub edx, 16(esp)
- mov (eax), edx
- mov edx, 12(esp)
- sbb edx, 0
- mov 4(eax), edx
- ret
-
-!
-! $PchId: sub64u.ack.s,v 1.2 1996/04/11 18:59:57 philip Exp $
SRCS+= \
arch_compare.c \
arch_round.c \
- fpu_cw.s \
- fpu_sw.s \
- fpu_round.s \
+ fpu_cw.S \
+ fpu_sw.S \
+ fpu_round.S \
fegetround.c \
feholdexcept.c \
fesetround.c
--- /dev/null
+/* fpu_cw_get() - get FPU control word Author: Erik van der Kouwe */
+/* fpu_cw_set() - set FPU control word 9 Dec 2009 */
+.text
+.globl _fpu_cw_get
+.globl _fpu_cw_set
+
+/* u16_t fpu_cw_get(void) */
+_fpu_cw_get:
+/* clear unused bits just to be sure */
+ xor %eax, %eax
+ push %eax
+ fstcw (%esp)
+ pop %eax
+ ret
+
+/* void fpu_cw_set(u16_t fpu_cw) */
+_fpu_cw_set:
+/* load control word from parameter */
+ fldcw 4(%esp)
+ ret
+++ /dev/null
-! fpu_cw_get() - get FPU control word Author: Erik van der Kouwe
-! fpu_cw_set() - set FPU control word 9 Dec 2009
-.sect .text
-.define _fpu_cw_get
-.define _fpu_cw_set
-
-! u16_t fpu_cw_get(void)
-_fpu_cw_get:
- ! clear unused bits just to be sure
- xor eax, eax
- push eax
- fstcw (esp)
- pop eax
- ret
-
-! void fpu_cw_set(u16_t fpu_cw)
-_fpu_cw_set:
- ! load control word from parameter
- fldcw 4(esp)
- ret
--- /dev/null
+/* fpu_rndint() - round integer Author: Erik van der Kouwe */
+/* 17 Dec 2009 */
+.text
+.globl _fpu_rndint
+.globl _fpu_remainder
+
+/* void fpu_rndint(double *value) */
+_fpu_rndint:
+/* move the value onto the floating point stack */
+ mov 4(%esp), %eax
+ fldl (%eax)
+
+/* round it (beware of precision exception!) */
+ frndint
+
+/* store the result */
+ fstpl (%eax)
+ ret
+
+/* void fpu_remainder(double *x, double y) */
+_fpu_remainder:
+/* move the values onto the floating point stack */
+ fldl 8(%esp)
+ mov 4(%esp), %edx
+ fldl (%edx)
+
+/* compute remainder, multiple iterations may be needed */
+1:
+ fprem1
+.byte 0xdf, 0xe0 /* fnstsw ax */
+ sahf
+ jp 1b
+
+/* store the result and pop the divisor */
+ fstpl (%edx)
+ fstp %st
+ ret
+++ /dev/null
-! fpu_rndint() - round integer Author: Erik van der Kouwe
-! 17 Dec 2009
-.sect .text
-.define _fpu_rndint
-.define _fpu_remainder
-
-! void fpu_rndint(double *value)
-_fpu_rndint:
- ! move the value onto the floating point stack
- mov eax, 4(esp)
- fldd (eax)
-
- ! round it (beware of precision exception!)
- frndint
-
- ! store the result
- fstpd (eax)
- ret
-
-! void fpu_remainder(double *x, double y)
-_fpu_remainder:
- ! move the values onto the floating point stack
- fldd 8(esp)
- mov edx, 4(esp)
- fldd (edx)
-
- ! compute remainder, multiple iterations may be needed
-1: fprem1
- .data1 0xdf, 0xe0 ! fnstsw ax
- sahf
- jp 1b
-
- ! store the result and pop the divisor
- fstpd (edx)
- fstp st
- ret
--- /dev/null
+/* fpu_compare() - compare doubles Author: Erik van der Kouwe */
+/* fpu_sw_get() - get FPU status 17 Dec 2009 */
+/* fpu_xam() - examine double */
+.text
+.globl _fpu_compare
+.globl _fpu_sw_get
+.globl _fpu_xam
+
+/* u16_t fpu_compare(double x, double y) */
+_fpu_compare:
+/* move the values onto the floating point stack */
+ fldl 12(%esp)
+ fldl 4(%esp)
+
+/* compare values and return status word */
+ fcompp
+ jmp _fpu_sw_get
+
+/* u16_t fpu_sw_get(void) */
+_fpu_sw_get:
+/* clear unused high-order word and get status word */
+ xor %eax, %eax
+.byte 0xdf, 0xe0 /* fnstsw ax */
+ ret
+
+/* u16_t fpu_xam(double value) */
+_fpu_xam:
+/* move the value onto the floating point stack */
+ fldl 4(%esp)
+
+/* examine value and get status word */
+ fxam
+ call _fpu_sw_get
+
+/* pop the value */
+ fstp %st
+ ret
+++ /dev/null
-! fpu_compare() - compare doubles Author: Erik van der Kouwe
-! fpu_sw_get() - get FPU status 17 Dec 2009
-! fpu_xam() - examine double
-.sect .text
-.define _fpu_compare
-.define _fpu_sw_get
-.define _fpu_xam
-
-! u16_t fpu_compare(double x, double y)
-_fpu_compare:
- ! move the values onto the floating point stack
- fldd 12(esp)
- fldd 4(esp)
-
- ! compare values and return status word
- fcompp
- jmp _fpu_sw_get
-
-! u16_t fpu_sw_get(void)
-_fpu_sw_get:
- ! clear unused high-order word and get status word
- xor eax, eax
- .data1 0xdf, 0xe0 ! fnstsw ax
- ret
-
-! u16_t fpu_xam(double value)
-_fpu_xam:
- ! move the value onto the floating point stack
- fldd 4(esp)
-
- ! examine value and get status word
- fxam
- call _fpu_sw_get
-
- ! pop the value
- fstp st
- ret
-
.PATH: ${.CURDIR}/arch/${ARCH}/misc
SRCS+= \
- _cpuid.s \
+ _cpuid.S \
_cpufeature.c \
- alloca.s \
- get_bp.s \
- getprocessor.s \
- io_inb.s \
- io_inl.s \
- io_insb.s \
- io_insl.s \
- io_insw.s \
- io_intr.s \
- io_inw.s \
- io_outb.s \
- io_outl.s \
- io_outsb.s \
- io_outsl.s \
- io_outsw.s \
- io_outw.s \
- oneC_sum.s
+ alloca.S \
+ get_bp.S \
+ getprocessor.S \
+ io_inb.S \
+ io_inl.S \
+ io_insb.S \
+ io_insl.S \
+ io_insw.S \
+ io_intr.S \
+ io_inw.S \
+ io_outb.S \
+ io_outl.S \
+ io_outsb.S \
+ io_outsl.S \
+ io_outsw.S \
+ io_outw.S \
+ oneC_sum.S
--- /dev/null
+/* _cpuid() - interface to cpuid instruction */
+
+
+/* void _cpuid(u32_t *eax, u32_t *ebx, u32_t *ecx, u32_t *edx); */
+/* 0 for OK, nonzero for unsupported */
+
+.globl __cpuid
+
+.text
+__cpuid:
+/* save work registers */
+ push %ebp
+ push %ebx
+
+/* set eax parameter to cpuid and execute cpuid */
+ movl 12(%esp), %ebp
+ mov (%ebp), %eax
+ movl 16(%esp), %ebp
+ mov (%ebp), %ebx
+ movl 20(%esp), %ebp
+ mov (%ebp), %ecx
+ movl 24(%esp), %ebp
+ mov (%ebp), %edx
+
+.byte 0x0F, 0xA2 /* CPUID */
+
+/* store results in pointer arguments */
+ movl 12(%esp), %ebp
+ movl %eax, (%ebp)
+ movl 16(%esp), %ebp
+ movl %ebx, (%ebp)
+ movl 20(%esp), %ebp
+ movl %ecx, (%ebp)
+ movl 24(%esp), %ebp
+ movl %edx, (%ebp)
+
+/* restore registers */
+ pop %ebx
+ pop %ebp
+
+ ret
+++ /dev/null
-! _cpuid() - interface to cpuid instruction
-
-.sect .text; .sect .rom; .sect .data; .sect .bss
-.sect .text
-
-! void _cpuid(u32_t *eax, u32_t *ebx, u32_t *ecx, u32_t *edx);
-
-.define __cpuid
-
-__cpuid:
- ! save registers
- push ebp
- push ebx
-
- ! set parameters to cpuid and execute cpuid
- mov ebp, 12(esp)
- mov eax, (ebp)
- mov ebp, 16(esp)
- mov ebx, (ebp)
- mov ebp, 20(esp)
- mov ecx, (ebp)
- mov ebp, 24(esp)
- mov edx, (ebp)
- .data1 0x0F, 0xA2 ! CPUID
-
- ! store results in pointer arguments
- mov ebp, 12(esp)
- mov (ebp), eax
- mov ebp, 16(esp)
- mov (ebp), ebx
- mov ebp, 20(esp)
- mov (ebp), ecx
- mov ebp, 24(esp)
- mov (ebp), edx
-
- ! restore registers
- pop ebx
- pop ebp
-
- ret
--- /dev/null
+/* */
+/* alloca() - allocate space on the stack Author: Kees J. Bot */
+/* 2 Dec 1993 */
+
+.text
+.balign 16
+.globl _alloca
+_alloca:
+#if __ACK__
+ pop %ecx /* Return address */
+ pop %eax /* Bytes to allocate */
+ addl $2*4+3, %eax /* Add space for two saved register variables */
+ andb $0xFC, %al /* Align */
+ movl %esp, %ebx /* Keep current esp */
+ subl %eax, %esp /* Lower stack */
+ movl %esp, %eax /* Return value */
+ push 4(%ebx) /* Push what is probably the saved esi */
+ push (%ebx) /* Saved edi */
+/* Now ACK can still do: */
+/* pop edi; pop esi; leave; ret */
+ push %eax /* Dummy argument */
+ jmp *%ecx
+#else
+ pop %ecx /* Return address */
+ pop %eax /* Bytes to allocate */
+ addl $3, %eax
+ andb $0xFC, %al /* Align */
+ subl %eax, %esp /* Lower stack */
+ movl %esp, %eax /* Return value */
+ push %eax /* Dummy argument */
+ jmp *%ecx
+#endif
+++ /dev/null
-#
-! alloca() - allocate space on the stack Author: Kees J. Bot
-! 2 Dec 1993
-.sect .text; .sect .rom; .sect .data; .sect .bss
-
-.sect .text
- .align 16
-.define _alloca
-_alloca:
-#if __ACK__
- pop ecx ! Return address
- pop eax ! Bytes to allocate
- add eax, 2*4+3 ! Add space for two saved register variables
- andb al, 0xFC ! Align
- mov ebx, esp ! Keep current esp
- sub esp, eax ! Lower stack
- mov eax, esp ! Return value
- push 4(ebx) ! Push what is probably the saved esi
- push (ebx) ! Saved edi
- ! Now ACK can still do:
- ! pop edi; pop esi; leave; ret
- push eax ! Dummy argument
- jmp ecx
-#else
- pop ecx ! Return address
- pop eax ! Bytes to allocate
- add eax, 3
- andb al, 0xFC ! Align
- sub esp, eax ! Lower stack
- mov eax, esp ! Return value
- push eax ! Dummy argument
- jmp ecx
-#endif
--- /dev/null
+/* get_bp.s */
+/* */
+/* return EBP in EAX */
+/* */
+/* Created: Sep 7, 1992 by Philip Homburg */
+
+
+.text
+.globl _get_bp
+_get_bp:
+ movl %ebp, %eax
+ ret
+
+/* $PchId: get_bp.ack.s,v 1.3 1996/02/23 08:30:52 philip Exp $ */
+++ /dev/null
-! get_bp.s
-!
-! return EBP in EAX
-!
-! Created: Sep 7, 1992 by Philip Homburg
-
-.sect .text; .sect .rom; .sect .data; .sect .bss
-
-.sect .text
-.define _get_bp
-_get_bp:
- mov eax, ebp
- ret
-
-! $PchId: get_bp.ack.s,v 1.3 1996/02/23 08:30:52 philip Exp $
-
--- /dev/null
+/* getprocessor() - determine processor type Author: Kees J. Bot */
+/* 26 Jan 1994 */
+
+.text
+
+/* int getprocessor(void); */
+/* Return 386, 486, 586, ... */
+
+.globl _getprocessor
+
+_getprocessor:
+ push %ebp
+ movl %esp, %ebp
+ andl $0xFFFFFFFC, %esp /* Align stack to avoid AC fault */
+ movl $0x00040000, %ecx /* Try to flip the AC bit introduced on the 486 */
+ call flip
+ movl $386, %eax /* 386 if it didn't react to "flipping" */
+ je gotprocessor
+ movl $0x00200000, %ecx /* Try to flip the ID bit introduced on the 586 */
+ call flip
+ movl $486, %eax /* 486 if it didn't react */
+ je gotprocessor
+ pushf
+ pusha /* Save the world */
+ movl $1, %eax
+.byte 0x0F, 0xA2 /* CPUID instruction tells the processor type */
+ andb $0x0F, %ah /* Extract the family (5, 6, ...) */
+ movzbl %ah, %eax
+ cmpl $15, %eax /* 15: extended family */
+ jne direct
+ movl $6, %eax /* Make it 686 */
+direct:
+ imull $100, %eax /* 500, 600, ... */
+ addl $86, %eax /* 586, 686, ... */
+ movl %eax, 7*4(%esp) /* Pass eax through */
+ popa
+ popf
+gotprocessor:
+ leave
+ ret
+
+flip:
+ pushf /* Push eflags */
+ pop %eax /* eax = eflags */
+ movl %eax, %edx /* Save original eflags */
+ xorl %ecx, %eax /* Flip the bit to test */
+ push %eax /* Push modified eflags value */
+ popf /* Load modified eflags register */
+ pushf
+ pop %eax /* Get it again */
+ push %edx
+ popf /* Restore original eflags register */
+ xorl %edx, %eax /* See if the bit changed */
+ testl %ecx, %eax
+ ret
+++ /dev/null
-! getprocessor() - determine processor type Author: Kees J. Bot
-! 26 Jan 1994
-
-.sect .text; .sect .rom; .sect .data; .sect .bss
-.sect .text
-
-! int getprocessor(void);
-! Return 386, 486, 586, ...
-
-.define _getprocessor
-
-_getprocessor:
- push ebp
- mov ebp, esp
- and esp, 0xFFFFFFFC ! Align stack to avoid AC fault
- mov ecx, 0x00040000 ! Try to flip the AC bit introduced on the 486
- call flip
- mov eax, 386 ! 386 if it didn't react to "flipping"
- jz gotprocessor
- mov ecx, 0x00200000 ! Try to flip the ID bit introduced on the 586
- call flip
- mov eax, 486 ! 486 if it didn't react
- jz gotprocessor
- pushf
- pusha ! Save the world
- mov eax, 1
- .data1 0x0F, 0xA2 ! CPUID instruction tells the processor type
- andb ah, 0x0F ! Extract the family (5, 6, ...)
- movzxb eax, ah
- cmp eax, 15 ! 15: extended family
- jne direct
- mov eax, 6 ! Make it 686
-direct:
- imul eax, 100 ! 500, 600, ...
- add eax, 86 ! 586, 686, ...
- mov 7*4(esp), eax ! Pass eax through
- popa
- popf
-gotprocessor:
- leave
- ret
-
-flip:
- pushf ! Push eflags
- pop eax ! eax = eflags
- mov edx, eax ! Save original eflags
- xor eax, ecx ! Flip the bit to test
- push eax ! Push modified eflags value
- popf ! Load modified eflags register
- pushf
- pop eax ! Get it again
- push edx
- popf ! Restore original eflags register
- xor eax, edx ! See if the bit changed
- test eax, ecx
- ret
--- /dev/null
+/* inb() - Input one byte Author: Kees J. Bot */
+/* 18 Mar 1996 */
+/* unsigned inb(U16_t port); */
+
+.text
+.globl _inb
+_inb:
+ push %ebp
+ movl %esp, %ebp
+ movl 8(%ebp), %edx /* port */
+ xorl %eax, %eax
+ inb %dx /* read 1 byte */
+ pop %ebp
+ ret
+++ /dev/null
-! inb() - Input one byte Author: Kees J. Bot
-! 18 Mar 1996
-! unsigned inb(U16_t port);
-
-.sect .text
-.define _inb
-_inb:
- push ebp
- mov ebp, esp
- mov edx, 8(ebp) ! port
- xor eax, eax
- inb dx ! read 1 byte
- pop ebp
- ret
--- /dev/null
+/* inl() - Input one dword Author: Kees J. Bot */
+/* 18 Mar 1996 */
+/* unsigned inl(U16_t port); */
+
+.text
+.globl _inl
+_inl:
+ push %ebp
+ movl %esp, %ebp
+ movl 8(%ebp), %edx /* port */
+ inl %dx /* read 1 dword */
+ pop %ebp
+ ret
+++ /dev/null
-! inl() - Input one dword Author: Kees J. Bot
-! 18 Mar 1996
-! unsigned inl(U16_t port);
-
-.sect .text
-.define _inl
-_inl:
- push ebp
- mov ebp, esp
- mov edx, 8(ebp) ! port
- in dx ! read 1 dword
- pop ebp
- ret
--- /dev/null
+/* insb() - Input a byte array Author: Kees J. Bot */
+/* 18 Mar 1996 */
+/* void insb(U16_t port, void *buf, size_t count); */
+
+.text
+.globl _insb
+_insb:
+ push %ebp
+ movl %esp, %ebp
+ cld
+ push %edi
+ movl 8(%ebp), %edx /* port */
+ movl 12(%ebp), %edi /* buf */
+ movl 16(%ebp), %ecx /* byte count */
+ rep insb /* input many bytes */
+ pop %edi
+ pop %ebp
+ ret
+++ /dev/null
-! insb() - Input a byte array Author: Kees J. Bot
-! 18 Mar 1996
-! void insb(U16_t port, void *buf, size_t count);
-
-.sect .text
-.define _insb
-_insb:
- push ebp
- mov ebp, esp
- cld
- push edi
- mov edx, 8(ebp) ! port
- mov edi, 12(ebp) ! buf
- mov ecx, 16(ebp) ! byte count
- rep insb ! input many bytes
- pop edi
- pop ebp
- ret
--- /dev/null
+/* insl() - Input a dword array Author: Kees J. Bot */
+/* 18 Mar 1996 */
+/* void insl(U16_t port, void *buf, size_t count); */
+
+.text
+.globl _insl
+_insl:
+ push %ebp
+ movl %esp, %ebp
+ cld
+ push %edi
+ movl 8(%ebp), %edx /* port */
+ movl 12(%ebp), %edi /* buf */
+ movl 16(%ebp), %ecx /* byte count */
+ shrl $2, %ecx /* dword count */
+ rep insl /* input many dwords */
+ pop %edi
+ pop %ebp
+ ret
+++ /dev/null
-! insl() - Input a dword array Author: Kees J. Bot
-! 18 Mar 1996
-! void insl(U16_t port, void *buf, size_t count);
-
-.sect .text
-.define _insl
-_insl:
- push ebp
- mov ebp, esp
- cld
- push edi
- mov edx, 8(ebp) ! port
- mov edi, 12(ebp) ! buf
- mov ecx, 16(ebp) ! byte count
- shr ecx, 2 ! dword count
- rep ins ! input many dwords
- pop edi
- pop ebp
- ret
--- /dev/null
+/* insw() - Input a word array Author: Kees J. Bot */
+/* 18 Mar 1996 */
+/* void insw(U16_t port, void *buf, size_t count); */
+
+.text
+.globl _insw
+_insw:
+ push %ebp
+ movl %esp, %ebp
+ cld
+ push %edi
+ movl 8(%ebp), %edx /* port */
+ movl 12(%ebp), %edi /* buf */
+ movl 16(%ebp), %ecx /* byte count */
+ shrl $1, %ecx /* word count */
+ rep insw /* input many words */
+ pop %edi
+ pop %ebp
+ ret
+++ /dev/null
-! insw() - Input a word array Author: Kees J. Bot
-! 18 Mar 1996
-! void insw(U16_t port, void *buf, size_t count);
-
-.sect .text
-.define _insw
-_insw:
- push ebp
- mov ebp, esp
- cld
- push edi
- mov edx, 8(ebp) ! port
- mov edi, 12(ebp) ! buf
- mov ecx, 16(ebp) ! byte count
- shr ecx, 1 ! word count
-rep o16 ins ! input many words
- pop edi
- pop ebp
- ret
--- /dev/null
+/* intr_disable(), intr_enable - Disable/Enable hardware interrupts. */
+/* Author: Kees J. Bot */
+/* 18 Mar 1996 */
+/* void intr_disable(void); */
+/* void intr_enable(void); */
+
+.text
+.globl _intr_disable
+_intr_disable:
+ cli
+ ret
+
+.globl _intr_enable
+_intr_enable:
+ sti
+ ret
+++ /dev/null
-! intr_disable(), intr_enable - Disable/Enable hardware interrupts.
-! Author: Kees J. Bot
-! 18 Mar 1996
-! void intr_disable(void);
-! void intr_enable(void);
-
-.sect .text
-.define _intr_disable
-_intr_disable:
- cli
- ret
-
-.define _intr_enable
-_intr_enable:
- sti
- ret
--- /dev/null
+/* inw() - Input one word Author: Kees J. Bot */
+/* 18 Mar 1996 */
+/* unsigned inw(U16_t port); */
+
+.text
+.globl _inw
+_inw:
+ push %ebp
+ movl %esp, %ebp
+ movl 8(%ebp), %edx /* port */
+ xorl %eax, %eax
+ inw %dx /* read 1 word */
+ pop %ebp
+ ret
+++ /dev/null
-! inw() - Input one word Author: Kees J. Bot
-! 18 Mar 1996
-! unsigned inw(U16_t port);
-
-.sect .text
-.define _inw
-_inw:
- push ebp
- mov ebp, esp
- mov edx, 8(ebp) ! port
- xor eax, eax
- o16 in dx ! read 1 word
- pop ebp
- ret
--- /dev/null
+/* outb() - Output one byte Author: Kees J. Bot */
+/* 18 Mar 1996 */
+/* void outb(U16_t port, U8_t value); */
+
+.text
+.globl _outb
+_outb:
+ push %ebp
+ movl %esp, %ebp
+ movl 8(%ebp), %edx /* port */
+ movl 8+4(%ebp), %eax /* value */
+ outb %dx /* output 1 byte */
+ pop %ebp
+ ret
+++ /dev/null
-! outb() - Output one byte Author: Kees J. Bot
-! 18 Mar 1996
-! void outb(U16_t port, U8_t value);
-
-.sect .text
-.define _outb
-_outb:
- push ebp
- mov ebp, esp
- mov edx, 8(ebp) ! port
- mov eax, 8+4(ebp) ! value
- outb dx ! output 1 byte
- pop ebp
- ret
--- /dev/null
+/* outl() - Output one dword Author: Kees J. Bot */
+/* 18 Mar 1996 */
+/* void outl(U16_t port, u32_t value); */
+
+.text
+.globl _outl
+_outl:
+ push %ebp
+ movl %esp, %ebp
+ movl 8(%ebp), %edx /* port */
+ movl 8+4(%ebp), %eax /* value */
+ outl %dx /* output 1 dword */
+ pop %ebp
+ ret
+++ /dev/null
-! outl() - Output one dword Author: Kees J. Bot
-! 18 Mar 1996
-! void outl(U16_t port, u32_t value);
-
-.sect .text
-.define _outl
-_outl:
- push ebp
- mov ebp, esp
- mov edx, 8(ebp) ! port
- mov eax, 8+4(ebp) ! value
- out dx ! output 1 dword
- pop ebp
- ret
--- /dev/null
+/* outsb() - Output a byte array Author: Kees J. Bot */
+/* 18 Mar 1996 */
+/* void outsb(U16_t port, void *buf, size_t count); */
+
+.text
+.globl _outsb
+_outsb:
+ push %ebp
+ movl %esp, %ebp
+ cld
+ push %esi
+ movl 8(%ebp), %edx /* port */
+ movl 12(%ebp), %esi /* buf */
+ movl 16(%ebp), %ecx /* byte count */
+ rep outsb /* output many bytes */
+ pop %esi
+ pop %ebp
+ ret
+++ /dev/null
-! outsb() - Output a byte array Author: Kees J. Bot
-! 18 Mar 1996
-! void outsb(U16_t port, void *buf, size_t count);
-
-.sect .text
-.define _outsb
-_outsb:
- push ebp
- mov ebp, esp
- cld
- push esi
- mov edx, 8(ebp) ! port
- mov esi, 12(ebp) ! buf
- mov ecx, 16(ebp) ! byte count
- rep outsb ! output many bytes
- pop esi
- pop ebp
- ret
--- /dev/null
+/* outsl() - Output a dword array Author: Kees J. Bot */
+/* 18 Mar 1996 */
+/* void outsl(U16_t port, void *buf, size_t count); */
+
+.text
+.globl _outsl
+_outsl:
+ push %ebp
+ movl %esp, %ebp
+ cld
+ push %esi
+ movl 8(%ebp), %edx /* port */
+ movl 12(%ebp), %esi /* buf */
+ movl 16(%ebp), %ecx /* byte count */
+ shrl $2, %ecx /* dword count */
+ rep outsl /* output many dwords */
+ pop %esi
+ pop %ebp
+ ret
+++ /dev/null
-! outsl() - Output a dword array Author: Kees J. Bot
-! 18 Mar 1996
-! void outsl(U16_t port, void *buf, size_t count);
-
-.sect .text
-.define _outsl
-_outsl:
- push ebp
- mov ebp, esp
- cld
- push esi
- mov edx, 8(ebp) ! port
- mov esi, 12(ebp) ! buf
- mov ecx, 16(ebp) ! byte count
- shr ecx, 2 ! dword count
- rep outs ! output many dwords
- pop esi
- pop ebp
- ret
--- /dev/null
+/* outsw() - Output a word array Author: Kees J. Bot */
+/* 18 Mar 1996 */
+/* void outsw(U16_t port, void *buf, size_t count); */
+
+.text
+.globl _outsw
+_outsw:
+ push %ebp
+ movl %esp, %ebp
+ cld
+ push %esi
+ movl 8(%ebp), %edx /* port */
+ movl 12(%ebp), %esi /* buf */
+ movl 16(%ebp), %ecx /* byte count */
+ shrl $1, %ecx /* word count */
+ rep outsw /* output many words */
+ pop %esi
+ pop %ebp
+ ret
+++ /dev/null
-! outsw() - Output a word array Author: Kees J. Bot
-! 18 Mar 1996
-! void outsw(U16_t port, void *buf, size_t count);
-
-.sect .text
-.define _outsw
-_outsw:
- push ebp
- mov ebp, esp
- cld
- push esi
- mov edx, 8(ebp) ! port
- mov esi, 12(ebp) ! buf
- mov ecx, 16(ebp) ! byte count
- shr ecx, 1 ! word count
-rep o16 outs ! output many words
- pop esi
- pop ebp
- ret
--- /dev/null
+/* outw() - Output one word Author: Kees J. Bot */
+/* 18 Mar 1996 */
+/* void outw(U16_t port, U16_t value); */
+
+.text
+.globl _outw
+_outw:
+ push %ebp
+ movl %esp, %ebp
+ movl 8(%ebp), %edx /* port */
+ movl 8+4(%ebp), %eax /* value */
+ outw %dx /* output 1 word */
+ pop %ebp
+ ret
+++ /dev/null
-! outw() - Output one word Author: Kees J. Bot
-! 18 Mar 1996
-! void outw(U16_t port, U16_t value);
-
-.sect .text
-.define _outw
-_outw:
- push ebp
- mov ebp, esp
- mov edx, 8(ebp) ! port
- mov eax, 8+4(ebp) ! value
- o16 out dx ! output 1 word
- pop ebp
- ret
--- /dev/null
+/* oneC_sum() - One complement`s checksum Author: Kees J. Bot */
+/* 9 May 1995 */
+/* See RFC 1071, "Computing the Internet checksum" */
+/* See also the C version of this code. */
+
+.text
+
+.globl _oneC_sum
+.balign 16
+_oneC_sum:
+ push %ebp
+ movl %esp, %ebp
+ push %esi
+ push %edi
+ movzwl 8(%ebp), %eax /* Checksum of previous block */
+ movl 12(%ebp), %esi /* Data to compute checksum over */
+ movl 16(%ebp), %edi /* Number of bytes */
+
+ xorl %edx, %edx
+ xorb %cl, %cl
+align:
+ testl $3, %esi /* Is the data aligned? */
+ je aligned
+ testl %edi, %edi
+ je 0f
+ movb (%esi), %dl /* Rotate the first unaligned bytes */
+ decl %edi /* into the edx register */
+0:
+ incl %esi
+ rorl $8, %edx
+ rorl $8, %eax /* Rotate the checksum likewise */
+ addb $8, %cl /* Number of bits rotated */
+ jmp align
+aligned:
+ addl %edx, %eax /* Summate the unaligned bytes */
+ adcl $0, %eax /* Add carry back in for one`s complement */
+
+ jmp add6test
+.balign 16
+add6:
+ addl (%esi), %eax /* Six times unrolled loop, see below */
+ adcl 4(%esi), %eax
+ adcl 8(%esi), %eax
+ adcl 12(%esi), %eax
+ adcl 16(%esi), %eax
+ adcl 20(%esi), %eax
+ adcl $0, %eax
+ addl $24, %esi
+add6test:
+ subl $24, %edi
+ jae add6
+ addl $24, %edi
+
+ jmp add1test
+.balign 16
+add1:
+ addl (%esi), %eax /* while ((edi -= 4) >= 0) */
+ adcl $0, %eax /* eax += *esi++; */
+ addl $4, %esi /* edi += 4; */
+add1test:
+ subl $4, %edi
+ jae add1
+ addl $4, %edi
+
+ je done /* Are there extra bytes? */
+ movl (%esi), %edx /* Load extra bytes in a full dword */
+ andl mask-4(,%edi,4), %edx /* Mask off excess */
+ addl %edx, %eax /* Add in the last bits */
+ adcl $0, %eax
+done:
+ roll %cl, %eax /* Undo the rotation at the beginning */
+ movl %eax, %edx
+ shrl $16, %eax
+ addw %dx, %ax /* Add the two words in eax to form */
+ adcw $0, %ax /* a 16 bit sum */
+ pop %edi
+ pop %esi
+ pop %ebp
+ ret
+
+#ifdef __ACK__
+.rom
+#else
+.data
+#endif
+.balign 4
+mask:
+.long 0x000000FF, 0x0000FFFF, 0x00FFFFFF
+
+/* */
+/* $PchId: oneC_sum.ack.s,v 1.2 1996/03/12 19:33:51 philip Exp $ */
+++ /dev/null
-! oneC_sum() - One complement`s checksum Author: Kees J. Bot
-! 9 May 1995
-! See RFC 1071, "Computing the Internet checksum"
-! See also the C version of this code.
-
-.sect .text
-
-.define _oneC_sum
- .align 16
-_oneC_sum:
- push ebp
- mov ebp, esp
- push esi
- push edi
- movzx eax, 8(ebp) ! Checksum of previous block
- mov esi, 12(ebp) ! Data to compute checksum over
- mov edi, 16(ebp) ! Number of bytes
-
- xor edx, edx
- xorb cl, cl
-align: test esi, 3 ! Is the data aligned?
- jz aligned
- test edi, edi
- jz 0f
- movb dl, (esi) ! Rotate the first unaligned bytes
- dec edi ! into the edx register
-0: inc esi
- ror edx, 8
- ror eax, 8 ! Rotate the checksum likewise
- addb cl, 8 ! Number of bits rotated
- jmp align
-aligned:add eax, edx ! Summate the unaligned bytes
- adc eax, 0 ! Add carry back in for one`s complement
-
- jmp add6test
- .align 16
-add6: add eax, (esi) ! Six times unrolled loop, see below
- adc eax, 4(esi)
- adc eax, 8(esi)
- adc eax, 12(esi)
- adc eax, 16(esi)
- adc eax, 20(esi)
- adc eax, 0
- add esi, 24
-add6test:
- sub edi, 24
- jae add6
- add edi, 24
-
- jmp add1test
- .align 16
-add1: add eax, (esi) ! while ((edi -= 4) >= 0)
- adc eax, 0 ! eax += *esi++;
- add esi, 4 ! edi += 4;
-add1test:
- sub edi, 4
- jae add1
- add edi, 4
-
- jz done ! Are there extra bytes?
- mov edx, (esi) ! Load extra bytes in a full dword
- and edx, mask-4(edi*4) ! Mask off excess
- add eax, edx ! Add in the last bits
- adc eax, 0
-done: rol eax, cl ! Undo the rotation at the beginning
- mov edx, eax
- shr eax, 16
- o16 add ax, dx ! Add the two words in eax to form
- o16 adc ax, 0 ! a 16 bit sum
- pop edi
- pop esi
- pop ebp
- ret
-
-.sect .rom
- .align 4
-mask: .data4 0x000000FF, 0x0000FFFF, 0x00FFFFFF
-
-!
-! $PchId: oneC_sum.ack.s,v 1.2 1996/03/12 19:33:51 philip Exp $
.PATH: ${.CURDIR}/arch/${ARCH}/rts
SRCS+= \
- __sigreturn.s \
- _ipc.s \
- _senda.s \
- brksize.s
+ __sigreturn.S \
+ _ipc.S \
+ _senda.S \
+ brksize.S
--- /dev/null
+/* This routine is the low-level code for returning from signals. */
+/* It calls __sigreturn, which is the normal "system call" routine. */
+/* Both ___sigreturn and __sigreturn are needed. */
+.text
+.globl ___sigreturn
+.extern __sigreturn
+___sigreturn:
+ addl $16, %esp
+ jmp __sigreturn
+++ /dev/null
-! This routine is the low-level code for returning from signals.
-! It calls __sigreturn, which is the normal "system call" routine.
-! Both ___sigreturn and __sigreturn are needed.
-.sect .text; .sect .rom; .sect .data; .sect .bss
-.sect .text
-.define ___sigreturn
-.extern __sigreturn
-___sigreturn:
- add esp, 16
- jmp __sigreturn
--- /dev/null
+.globl __notify, __send, __senda, __sendnb, __receive, __sendrec, __do_kernel_call
+
+/* See src/kernel/ipc.h for C definitions */
+ SEND = 1
+ RECEIVE = 2
+ SENDREC = 3
+ NOTIFY = 4
+ SENDNB = 5
+ IPCVEC = 33 /* ipc trap to kernel */
+ KERVEC = 32 /* syscall trap to kernel */
+
+ SRC_DST = 8 /* source/ destination process */
+ MESSAGE = 12 /* message pointer */
+
+/**========================================================================* */
+/* IPC assembly routines * */
+/**========================================================================* */
+/* all message passing routines save ebp, but destroy eax and ecx. */
+.text
+__send:
+ push %ebp
+ movl %esp, %ebp
+ push %ebx
+ movl SRC_DST(%ebp), %eax /* eax = dest-src */
+ movl MESSAGE(%ebp), %ebx /* ebx = message pointer */
+ movl $SEND, %ecx /* _send(dest, ptr) */
+ int $IPCVEC /* trap to the kernel */
+ pop %ebx
+ pop %ebp
+ ret
+
+__receive:
+ push %ebp
+ movl %esp, %ebp
+ push %ebx
+ movl SRC_DST(%ebp), %eax /* eax = dest-src */
+ movl MESSAGE(%ebp), %ebx /* ebx = message pointer */
+ movl $RECEIVE, %ecx /* _receive(src, ptr) */
+ int $IPCVEC /* trap to the kernel */
+ pop %ebx
+ pop %ebp
+ ret
+
+__sendrec:
+ push %ebp
+ movl %esp, %ebp
+ push %ebx
+ movl SRC_DST(%ebp), %eax /* eax = dest-src */
+ movl MESSAGE(%ebp), %ebx /* ebx = message pointer */
+ movl $SENDREC, %ecx /* _sendrec(srcdest, ptr) */
+ int $IPCVEC /* trap to the kernel */
+ pop %ebx
+ pop %ebp
+ ret
+
+__notify:
+ push %ebp
+ movl %esp, %ebp
+ push %ebx
+ movl SRC_DST(%ebp), %eax /* eax = destination */
+ movl $NOTIFY, %ecx /* _notify(srcdst) */
+ int $IPCVEC /* trap to the kernel */
+ pop %ebx
+ pop %ebp
+ ret
+
+__sendnb:
+ push %ebp
+ movl %esp, %ebp
+ push %ebx
+ movl SRC_DST(%ebp), %eax /* eax = dest-src */
+ movl MESSAGE(%ebp), %ebx /* ebx = message pointer */
+ movl $SENDNB, %ecx /* _sendnb(dest, ptr) */
+ int $IPCVEC /* trap to the kernel */
+ pop %ebx
+ pop %ebp
+ ret
+
+__do_kernel_call:
+ /* pass the message pointer to kernel in the %eax register */
+ movl 4(%esp), %eax
+ int $KERVEC
+ ret
+++ /dev/null
-.sect .text; .sect .rom; .sect .data; .sect .bss
-.define __notify, __send, __senda, __sendnb, __receive, __sendrec, __do_kernel_call
-
-! See src/kernel/ipc.h for C definitions
-SEND = 1
-RECEIVE = 2
-SENDREC = 3
-NOTIFY = 4
-SENDNB = 5
-IPCVEC = 33 ! ipc trap to kernel
-KERVEC = 32 ! syscall trap to kernel
-
-SRC_DST = 8 ! source/ destination process
-MESSAGE = 12 ! message pointer
-
-!*========================================================================*
-! IPC assembly routines *
-!*========================================================================*
-! all message passing routines save ebp, but destroy eax and ecx.
-.sect .text
-__send:
- push ebp
- mov ebp, esp
- push ebx
- mov eax, SRC_DST(ebp) ! eax = dest-src
- mov ebx, MESSAGE(ebp) ! ebx = message pointer
- mov ecx, SEND ! _send(dest, ptr)
- int IPCVEC ! trap to the kernel
- pop ebx
- pop ebp
- ret
-
-__receive:
- push ebp
- mov ebp, esp
- push ebx
- mov eax, SRC_DST(ebp) ! eax = dest-src
- mov ebx, MESSAGE(ebp) ! ebx = message pointer
- mov ecx, RECEIVE ! _receive(src, ptr)
- int IPCVEC ! trap to the kernel
- pop ebx
- pop ebp
- ret
-
-__sendrec:
- push ebp
- mov ebp, esp
- push ebx
- mov eax, SRC_DST(ebp) ! eax = dest-src
- mov ebx, MESSAGE(ebp) ! ebx = message pointer
- mov ecx, SENDREC ! _sendrec(srcdest, ptr)
- int IPCVEC ! trap to the kernel
- pop ebx
- pop ebp
- ret
-
-__notify:
- push ebp
- mov ebp, esp
- push ebx
- mov eax, SRC_DST(ebp) ! eax = destination
- mov ecx, NOTIFY ! _notify(srcdst)
- int IPCVEC ! trap to the kernel
- pop ebx
- pop ebp
- ret
-
-__sendnb:
- push ebp
- mov ebp, esp
- push ebx
- mov eax, SRC_DST(ebp) ! eax = dest-src
- mov ebx, MESSAGE(ebp) ! ebx = message pointer
- mov ecx, SENDNB ! _sendnb(dest, ptr)
- int IPCVEC ! trap to the kernel
- pop ebx
- pop ebp
- ret
-
-__do_kernel_call:
- ! pass the message pointer to kernel in the %eax register
- mov eax, 4(esp)
- int KERVEC
- ret
--- /dev/null
+.globl __senda
+
+ SENDA = 16
+ SYSVEC = 33
+
+ MSGTAB = 8 /* message table */
+ TABCOUNT = 12 /* number of entries in message table */
+
+.text
+
+__senda:
+ push %ebp
+ movl %esp, %ebp
+ push %ebx
+ movl TABCOUNT(%ebp), %eax /* eax = count */
+ movl MSGTAB(%ebp), %ebx /* ebx = table */
+ movl $SENDA, %ecx /* _senda(table, count) */
+ int $SYSVEC /* trap to the kernel */
+ pop %ebx
+ pop %ebp
+ ret
+++ /dev/null
-.sect .text; .sect .rom; .sect .data; .sect .bss
-.define __senda
-
-SENDA = 16
-SYSVEC = 33
-
-MSGTAB = 8 ! message table
-TABCOUNT = 12 ! number of entries in message table
-
-.sect .text
-
-__senda:
- push ebp
- mov ebp, esp
- push ebx
- mov eax, TABCOUNT(ebp) ! eax = count
- mov ebx, MSGTAB(ebp) ! ebx = table
- mov ecx, SENDA ! _senda(table, count)
- int SYSVEC ! trap to the kernel
- pop ebx
- pop ebp
- ret
--- /dev/null
+.globl __brksize
+.data
+.extern endbss, __brksize
+__brksize:
+.long endbss
+++ /dev/null
-.sect .text; .sect .rom; .sect .data; .sect .bss
-.define __brksize
-.sect .data
-.extern endbss, __brksize
-__brksize: .data4 endbss
.PATH: ${.CURDIR}/arch/${ARCH}/string
SRCS+= \
- _memmove.s \
- _strncat.s \
- _strncmp.s \
- _strncpy.s \
- _strnlen.s \
- bcmp.s \
- bcopy.s \
- bzero.s \
- index.s \
- memchr.s \
- memcmp.s \
- memcpy.s \
- memmove.s \
- memset.s \
- rindex.s \
- strcat.s \
- strchr.s \
- strcmp.s \
- strcpy.s \
- strlen.s \
- strncat.s \
- strncmp.s \
- strncpy.s \
- strnlen.s \
- strrchr.s
+ _memmove.S \
+ _strncat.S \
+ _strncmp.S \
+ _strncpy.S \
+ _strnlen.S \
+ bcmp.S \
+ bcopy.S \
+ bzero.S \
+ index.S \
+ memchr.S \
+ memcmp.S \
+ memcpy.S \
+ memmove.S \
+ memset.S \
+ rindex.S \
+ strcat.S \
+ strchr.S \
+ strcmp.S \
+ strcpy.S \
+ strlen.S \
+ strncat.S \
+ strncmp.S \
+ strncpy.S \
+ strnlen.S \
+ strrchr.S
--- /dev/null
+/* _memmove() Author: Kees J. Bot */
+/* 2 Jan 1994 */
+
+/* void *_memmove(void *s1, const void *s2, size_t n) */
+/* Copy a chunk of memory. Handle overlap. */
+/* */
+.text
+.globl __memmove, __memcpy
+.balign 16
+__memmove:
+ push %ebp
+ movl %esp, %ebp
+ push %esi
+ push %edi
+ movl 8(%ebp), %edi /* String s1 */
+ movl 12(%ebp), %esi /* String s2 */
+ movl 16(%ebp), %ecx /* Length */
+ movl %edi, %eax
+ subl %esi, %eax
+ cmpl %ecx, %eax
+ jb downwards /* if (s2 - s1) < n then copy downwards */
+__memcpy:
+ cld /* Clear direction bit: upwards */
+ cmpl $16, %ecx
+ jb upbyte /* Don't bother being smart with short arrays */
+ movl %esi, %eax
+ orl %edi, %eax
+ testb $1, %al
+ jne upbyte /* Bit 0 set, use byte copy */
+ testb $2, %al
+ jne upword /* Bit 1 set, use word copy */
+uplword:
+ shrdl $2, %ecx, %eax /* Save low 2 bits of ecx in eax */
+ shrl $2, %ecx
+
+ rep movsl /* Copy longwords. */
+ shldl $2, %eax, %ecx /* Restore excess count */
+upword:
+ shrl $1, %ecx
+
+ rep movsw /* Copy words */
+ adcl %ecx, %ecx /* One more byte? */
+upbyte:
+ rep movsb /* Copy bytes */
+done:
+ movl 8(%ebp), %eax /* Absolutely noone cares about this value */
+ pop %edi
+ pop %esi
+ pop %ebp
+ ret
+
+/* Handle bad overlap by copying downwards, don't bother to do word copies. */
+downwards:
+ std /* Set direction bit: downwards */
+ leal -1(%esi,%ecx,1), %esi
+ leal -1(%edi,%ecx,1), %edi
+
+ rep movsb /* Copy bytes */
+ cld
+ jmp done
+++ /dev/null
-! _memmove() Author: Kees J. Bot
-! 2 Jan 1994
-.sect .text; .sect .rom; .sect .data; .sect .bss
-
-! void *_memmove(void *s1, const void *s2, size_t n)
-! Copy a chunk of memory. Handle overlap.
-!
-.sect .text
-.define __memmove, __memcpy
- .align 16
-__memmove:
- push ebp
- mov ebp, esp
- push esi
- push edi
- mov edi, 8(ebp) ! String s1
- mov esi, 12(ebp) ! String s2
- mov ecx, 16(ebp) ! Length
- mov eax, edi
- sub eax, esi
- cmp eax, ecx
- jb downwards ! if (s2 - s1) < n then copy downwards
-__memcpy:
- cld ! Clear direction bit: upwards
- cmp ecx, 16
- jb upbyte ! Don't bother being smart with short arrays
- mov eax, esi
- or eax, edi
- testb al, 1
- jnz upbyte ! Bit 0 set, use byte copy
- testb al, 2
- jnz upword ! Bit 1 set, use word copy
-uplword:shrd eax, ecx, 2 ! Save low 2 bits of ecx in eax
- shr ecx, 2
- rep
- movs ! Copy longwords.
- shld ecx, eax, 2 ! Restore excess count
-upword: shr ecx, 1
- rep
- o16 movs ! Copy words
- adc ecx, ecx ! One more byte?
-upbyte: rep
- movsb ! Copy bytes
-done: mov eax, 8(ebp) ! Absolutely noone cares about this value
- pop edi
- pop esi
- pop ebp
- ret
-
-! Handle bad overlap by copying downwards, don't bother to do word copies.
-downwards:
- std ! Set direction bit: downwards
- lea esi, -1(esi)(ecx*1)
- lea edi, -1(edi)(ecx*1)
- rep
- movsb ! Copy bytes
- cld
- jmp done
--- /dev/null
+/* _strncat() Author: Kees J. Bot */
+/* 1 Jan 1994 */
+
+/* char *_strncat(char *s1, const char *s2, size_t edx) */
+/* Append string s2 to s1. */
+/* */
+.text
+.globl __strncat
+.balign 16
+__strncat:
+ push %ebp
+ movl %esp, %ebp
+ push %esi
+ push %edi
+ movl 8(%ebp), %edi /* String s1 */
+ movl $-1, %ecx
+ xorb %al, %al /* Null byte */
+ cld
+
+ repne scasb /* Look for the zero byte in s1 */
+ decl %edi /* Back one up (and clear 'Z' flag) */
+ push %edi /* Save end of s1 */
+ movl 12(%ebp), %edi /* edi = string s2 */
+ movl %edx, %ecx /* Maximum count */
+
+ repne scasb /* Look for the end of s2 */
+ jne no0
+ incl %ecx /* Exclude null byte */
+no0:
+ subl %ecx, %edx /* Number of bytes in s2 */
+ movl %edx, %ecx
+ movl 12(%ebp), %esi /* esi = string s2 */
+ pop %edi /* edi = end of string s1 */
+
+ rep movsb /* Copy bytes */
+ stosb /* Add a terminating null */
+ movl 8(%ebp), %eax /* Return s1 */
+ pop %edi
+ pop %esi
+ pop %ebp
+ ret
+++ /dev/null
-! _strncat() Author: Kees J. Bot
-! 1 Jan 1994
-.sect .text; .sect .rom; .sect .data; .sect .bss
-
-! char *_strncat(char *s1, const char *s2, size_t edx)
-! Append string s2 to s1.
-!
-.sect .text
-.define __strncat
- .align 16
-__strncat:
- push ebp
- mov ebp, esp
- push esi
- push edi
- mov edi, 8(ebp) ! String s1
- mov ecx, -1
- xorb al, al ! Null byte
- cld
- repne
- scasb ! Look for the zero byte in s1
- dec edi ! Back one up (and clear 'Z' flag)
- push edi ! Save end of s1
- mov edi, 12(ebp) ! edi = string s2
- mov ecx, edx ! Maximum count
- repne
- scasb ! Look for the end of s2
- jne no0
- inc ecx ! Exclude null byte
-no0: sub edx, ecx ! Number of bytes in s2
- mov ecx, edx
- mov esi, 12(ebp) ! esi = string s2
- pop edi ! edi = end of string s1
- rep
- movsb ! Copy bytes
- stosb ! Add a terminating null
- mov eax, 8(ebp) ! Return s1
- pop edi
- pop esi
- pop ebp
- ret
--- /dev/null
+/* strncmp() Author: Kees J. Bot */
+/* 1 Jan 1994 */
+
+/* int strncmp(const char *s1, const char *s2, size_t ecx) */
+/* Compare two strings. */
+/* */
+.text
+.globl __strncmp
+.balign 16
+__strncmp:
+ push %ebp
+ movl %esp, %ebp
+ push %esi
+ push %edi
+ testl %ecx, %ecx /* Max length is zero? */
+ je done
+ movl 8(%ebp), %esi /* esi = string s1 */
+ movl 12(%ebp), %edi /* edi = string s2 */
+ cld
+compare:
+ cmpsb /* Compare two bytes */
+ jne done
+ cmpb $0, -1(%esi) /* End of string? */
+ je done
+ decl %ecx /* Length limit reached? */
+ jne compare
+done:
+ seta %al /* al = (s1 > s2) */
+ setb %ah /* ah = (s1 < s2) */
+ subb %ah, %al
+ movsbl %al, %eax /* eax = (s1 > s2) - (s1 < s2), i.e. -1, 0, 1 */
+ pop %edi
+ pop %esi
+ pop %ebp
+ ret
+++ /dev/null
-! strncmp() Author: Kees J. Bot
-! 1 Jan 1994
-.sect .text; .sect .rom; .sect .data; .sect .bss
-
-! int strncmp(const char *s1, const char *s2, size_t ecx)
-! Compare two strings.
-!
-.sect .text
-.define __strncmp
- .align 16
-__strncmp:
- push ebp
- mov ebp, esp
- push esi
- push edi
- test ecx, ecx ! Max length is zero?
- je done
- mov esi, 8(ebp) ! esi = string s1
- mov edi, 12(ebp) ! edi = string s2
- cld
-compare:
- cmpsb ! Compare two bytes
- jne done
- cmpb -1(esi), 0 ! End of string?
- je done
- dec ecx ! Length limit reached?
- jne compare
-done: seta al ! al = (s1 > s2)
- setb ah ! ah = (s1 < s2)
- subb al, ah
- movsxb eax, al ! eax = (s1 > s2) - (s1 < s2), i.e. -1, 0, 1
- pop edi
- pop esi
- pop ebp
- ret
--- /dev/null
+/* _strncpy() Author: Kees J. Bot */
+/* 1 Jan 1994 */
+
+/* char *_strncpy(char *s1, const char *s2, size_t ecx) */
+/* Copy string s2 to s1. */
+/* */
+.text
+.globl __strncpy
+.balign 16
+__strncpy:
+ movl 12(%ebp), %edi /* edi = string s2 */
+ xorb %al, %al /* Look for a zero byte */
+ movl %ecx, %edx /* Save maximum count */
+ cld
+
+ repne scasb /* Look for end of s2 */
+ subl %ecx, %edx /* Number of bytes in s2 including null */
+ xchgl %edx, %ecx
+ movl 12(%ebp), %esi /* esi = string s2 */
+ movl 8(%ebp), %edi /* edi = string s1 */
+
+ rep movsb /* Copy bytes */
+ ret
+++ /dev/null
-! _strncpy() Author: Kees J. Bot
-! 1 Jan 1994
-.sect .text; .sect .rom; .sect .data; .sect .bss
-
-! char *_strncpy(char *s1, const char *s2, size_t ecx)
-! Copy string s2 to s1.
-!
-.sect .text
-.define __strncpy
- .align 16
-__strncpy:
- mov edi, 12(ebp) ! edi = string s2
- xorb al, al ! Look for a zero byte
- mov edx, ecx ! Save maximum count
- cld
- repne
- scasb ! Look for end of s2
- sub edx, ecx ! Number of bytes in s2 including null
- xchg ecx, edx
- mov esi, 12(ebp) ! esi = string s2
- mov edi, 8(ebp) ! edi = string s1
- rep
- movsb ! Copy bytes
- ret
--- /dev/null
+/* _strnlen() Author: Kees J. Bot */
+/* 1 Jan 1994 */
+
+/* size_t _strnlen(const char *s, size_t ecx) */
+/* Return the length of a string. */
+/* */
+.text
+.globl __strnlen
+.balign 16
+__strnlen:
+ push %ebp
+ movl %esp, %ebp
+ push %edi
+ movl 8(%ebp), %edi /* edi = string */
+ xorb %al, %al /* Look for a zero byte */
+ movl %ecx, %edx /* Save maximum count */
+ cmpb $1, %cl /* 'Z' bit must be clear if ecx = 0 */
+ cld
+
+ repne scasb /* Look for zero */
+ jne no0
+ incl %ecx /* Don't count zero byte */
+no0:
+ movl %edx, %eax
+ subl %ecx, %eax /* Compute bytes scanned */
+ pop %edi
+ pop %ebp
+ ret
+++ /dev/null
-! _strnlen() Author: Kees J. Bot
-! 1 Jan 1994
-.sect .text; .sect .rom; .sect .data; .sect .bss
-
-! size_t _strnlen(const char *s, size_t ecx)
-! Return the length of a string.
-!
-.sect .text
-.define __strnlen
- .align 16
-__strnlen:
- push ebp
- mov ebp, esp
- push edi
- mov edi, 8(ebp) ! edi = string
- xorb al, al ! Look for a zero byte
- mov edx, ecx ! Save maximum count
- cmpb cl, 1 ! 'Z' bit must be clear if ecx = 0
- cld
- repne
- scasb ! Look for zero
- jne no0
- inc ecx ! Don't count zero byte
-no0: mov eax, edx
- sub eax, ecx ! Compute bytes scanned
- pop edi
- pop ebp
- ret
--- /dev/null
+/* bcmp() Author: Kees J. Bot */
+/* 2 Jan 1994 */
+
+/* int bcmp(const void *s1, const void *s2, size_t n) */
+/* Compare two chunks of memory. */
+/* This is a BSD routine that escaped from the kernel. Don't use. */
+/* (Alas it is not without some use, it reports the number of bytes */
+/* after the bytes that are equal. So it can't be simply replaced.) */
+/* */
+.text
+.globl _bcmp
+.balign 16
+_bcmp:
+ push %ebp
+ movl %esp, %ebp
+ push 16(%ebp)
+ push 12(%ebp)
+ push 8(%ebp)
+ call _memcmp /* Let memcmp do the work */
+ testl %eax, %eax
+ je equal
+ subl 8(%ebp), %edx /* Memcmp was nice enough to leave "esi" in edx */
+ decl %edx /* Number of bytes that are equal */
+ movl 16(%ebp), %eax
+ subl %edx, %eax /* Number of bytes that are unequal */
+equal:
+ leave
+ ret
+++ /dev/null
-! bcmp() Author: Kees J. Bot
-! 2 Jan 1994
-.sect .text; .sect .rom; .sect .data; .sect .bss
-
-! int bcmp(const void *s1, const void *s2, size_t n)
-! Compare two chunks of memory.
-! This is a BSD routine that escaped from the kernel. Don't use.
-! (Alas it is not without some use, it reports the number of bytes
-! after the bytes that are equal. So it can't be simply replaced.)
-!
-.sect .text
-.define _bcmp
- .align 16
-_bcmp:
- push ebp
- mov ebp, esp
- push 16(ebp)
- push 12(ebp)
- push 8(ebp)
- call _memcmp ! Let memcmp do the work
- test eax, eax
- jz equal
- sub edx, 8(ebp) ! Memcmp was nice enough to leave "esi" in edx
- dec edx ! Number of bytes that are equal
- mov eax, 16(ebp)
- sub eax, edx ! Number of bytes that are unequal
-equal: leave
- ret
--- /dev/null
+/* bcopy() Author: Kees J. Bot */
+/* 2 Jan 1994 */
+
+/* void bcopy(const void *s1, void *s2, size_t n) */
+/* Copy a chunk of memory. Handle overlap. */
+/* This is a BSD routine that escaped from the kernel. Don't use. */
+/* */
+.text
+.globl _bcopy
+.balign 16
+_bcopy:
+ movl 4(%esp), %eax /* Exchange string arguments */
+ xchgl 8(%esp), %eax
+ movl %eax, 4(%esp)
+ jmp __memmove /* Call the proper routine */
+++ /dev/null
-! bcopy() Author: Kees J. Bot
-! 2 Jan 1994
-.sect .text; .sect .rom; .sect .data; .sect .bss
-
-! void bcopy(const void *s1, void *s2, size_t n)
-! Copy a chunk of memory. Handle overlap.
-! This is a BSD routine that escaped from the kernel. Don't use.
-!
-.sect .text
-.define _bcopy
- .align 16
-_bcopy:
- mov eax, 4(esp) ! Exchange string arguments
- xchg eax, 8(esp)
- mov 4(esp), eax
- jmp __memmove ! Call the proper routine
--- /dev/null
+/* bzero() Author: Kees J. Bot */
+/* 2 Jan 1994 */
+
+/* void bzero(void *s, size_t n) */
+/* Set a chunk of memory to zero. */
+/* This is a BSD routine that escaped from the kernel. Don't use. */
+/* */
+.text
+.globl _bzero
+.balign 16
+_bzero:
+ push %ebp
+ movl %esp, %ebp
+ push 12(%ebp) /* Size */
+ push $0 /* Zero */
+ push 8(%ebp) /* String */
+ call _memset /* Call the proper routine */
+ leave
+ ret
+++ /dev/null
-! bzero() Author: Kees J. Bot
-! 2 Jan 1994
-.sect .text; .sect .rom; .sect .data; .sect .bss
-
-! void bzero(void *s, size_t n)
-! Set a chunk of memory to zero.
-! This is a BSD routine that escaped from the kernel. Don't use.
-!
-.sect .text
-.define _bzero
- .align 16
-_bzero:
- push ebp
- mov ebp, esp
- push 12(ebp) ! Size
- push 0 ! Zero
- push 8(ebp) ! String
- call _memset ! Call the proper routine
- leave
- ret
--- /dev/null
+/* index() Author: Kees J. Bot */
+/* 2 Jan 1994 */
+
+/* char *index(const char *s, int c) */
+/* Look for a character in a string. Has suffered from a hostile */
+/* takeover by strchr(). */
+/* */
+.text
+.globl _index
+.balign 16
+_index:
+ jmp _strchr
+++ /dev/null
-! index() Author: Kees J. Bot
-! 2 Jan 1994
-.sect .text; .sect .rom; .sect .data; .sect .bss
-
-! char *index(const char *s, int c)
-! Look for a character in a string. Has suffered from a hostile
-! takeover by strchr().
-!
-.sect .text
-.define _index
- .align 16
-_index:
- jmp _strchr
--- /dev/null
+/* memchr() Author: Kees J. Bot */
+/* 2 Jan 1994 */
+
+/* void *memchr(const void *s, int c, size_t n) */
+/* Look for a character in a chunk of memory. */
+/* */
+.text
+.globl _memchr
+.balign 16
+_memchr:
+ push %ebp
+ movl %esp, %ebp
+ push %edi
+ movl 8(%ebp), %edi /* edi = string */
+ movb 12(%ebp), %al /* The character to look for */
+ movl 16(%ebp), %ecx /* Length */
+ cmpb $1, %cl /* 'Z' bit must be clear if ecx = 0 */
+ cld
+
+ repne scasb
+ jne failure
+ leal -1(%edi), %eax /* Found */
+ pop %edi
+ pop %ebp
+ ret
+failure:
+ xorl %eax, %eax
+ pop %edi
+ pop %ebp
+ ret
+++ /dev/null
-! memchr() Author: Kees J. Bot
-! 2 Jan 1994
-.sect .text; .sect .rom; .sect .data; .sect .bss
-
-! void *memchr(const void *s, int c, size_t n)
-! Look for a character in a chunk of memory.
-!
-.sect .text
-.define _memchr
- .align 16
-_memchr:
- push ebp
- mov ebp, esp
- push edi
- mov edi, 8(ebp) ! edi = string
- movb al, 12(ebp) ! The character to look for
- mov ecx, 16(ebp) ! Length
- cmpb cl, 1 ! 'Z' bit must be clear if ecx = 0
- cld
- repne
- scasb
- jne failure
- lea eax, -1(edi) ! Found
- pop edi
- pop ebp
- ret
-failure:xor eax, eax
- pop edi
- pop ebp
- ret
--- /dev/null
+/* memcmp() Author: Kees J. Bot */
+/* 2 Jan 1994 */
+
+/* int memcmp(const void *s1, const void *s2, size_t n) */
+/* Compare two chunks of memory. */
+/* */
+.text
+.globl _memcmp
+.balign 16
+_memcmp:
+ cld
+ push %ebp
+ movl %esp, %ebp
+ push %esi
+ push %edi
+ movl 8(%ebp), %esi /* String s1 */
+ movl 12(%ebp), %edi /* String s2 */
+ movl 16(%ebp), %ecx /* Length */
+ cmpl $16, %ecx
+ jb cbyte /* Don't bother being smart with short arrays */
+ movl %esi, %eax
+ orl %edi, %eax
+ testb $1, %al
+ jne cbyte /* Bit 0 set, use byte compare */
+ testb $2, %al
+ jne cword /* Bit 1 set, use word compare */
+clword:
+ shrdl $2, %ecx, %eax /* Save low two bits of ecx in eax */
+ shrl $2, %ecx
+
+ repe cmpsl /* Compare longwords */
+ subl $4, %esi
+ subl $4, %edi
+ incl %ecx /* Recompare the last longword */
+ shldl $2, %eax, %ecx /* And any excess bytes */
+ jmp last
+cword:
+ shrdl $1, %ecx, %eax /* Save low bit of ecx in eax */
+ shrl $1, %ecx
+
+ repe cmpsw /* Compare words */
+ subl $2, %esi
+ subl $2, %edi
+ incl %ecx /* Recompare the last word */
+ shldl $1, %eax, %ecx /* And one more byte? */
+cbyte:
+ testl %ecx, %ecx /* Set 'Z' flag if ecx = 0 */
+last:
+ repe cmpsb /* Look for the first differing byte */
+ seta %al /* al = (s1 > s2) */
+ setb %ah /* ah = (s1 < s2) */
+ subb %ah, %al
+ movsbl %al, %eax /* eax = (s1 > s2) - (s1 < s2), i.e. -1, 0, 1 */
+ movl %esi, %edx /* For bcmp() to play with */
+ pop %edi
+ pop %esi
+ pop %ebp
+ ret
+++ /dev/null
-! memcmp() Author: Kees J. Bot
-! 2 Jan 1994
-.sect .text; .sect .rom; .sect .data; .sect .bss
-
-! int memcmp(const void *s1, const void *s2, size_t n)
-! Compare two chunks of memory.
-!
-.sect .text
-.define _memcmp
- .align 16
-_memcmp:
- cld
- push ebp
- mov ebp, esp
- push esi
- push edi
- mov esi, 8(ebp) ! String s1
- mov edi, 12(ebp) ! String s2
- mov ecx, 16(ebp) ! Length
- cmp ecx, 16
- jb cbyte ! Don't bother being smart with short arrays
- mov eax, esi
- or eax, edi
- testb al, 1
- jnz cbyte ! Bit 0 set, use byte compare
- testb al, 2
- jnz cword ! Bit 1 set, use word compare
-clword: shrd eax, ecx, 2 ! Save low two bits of ecx in eax
- shr ecx, 2
- repe
- cmps ! Compare longwords
- sub esi, 4
- sub edi, 4
- inc ecx ! Recompare the last longword
- shld ecx, eax, 2 ! And any excess bytes
- jmp last
-cword: shrd eax, ecx, 1 ! Save low bit of ecx in eax
- shr ecx, 1
- repe
- o16 cmps ! Compare words
- sub esi, 2
- sub edi, 2
- inc ecx ! Recompare the last word
- shld ecx, eax, 1 ! And one more byte?
-cbyte: test ecx, ecx ! Set 'Z' flag if ecx = 0
-last: repe
- cmpsb ! Look for the first differing byte
- seta al ! al = (s1 > s2)
- setb ah ! ah = (s1 < s2)
- subb al, ah
- movsxb eax, al ! eax = (s1 > s2) - (s1 < s2), i.e. -1, 0, 1
- mov edx, esi ! For bcmp() to play with
- pop edi
- pop esi
- pop ebp
- ret
--- /dev/null
+/* memcpy() Author: Kees J. Bot */
+/* 2 Jan 1994 */
+
+/* void *memcpy(void *s1, const void *s2, size_t n) */
+/* Copy a chunk of memory. */
+/* This routine need not handle overlap, so it does not handle overlap. */
+/* One could simply call __memmove, the cost of the overlap check is */
+/* negligible, but you are dealing with a programmer who believes that if */
+/* anything can go wrong, it should go wrong. */
+/* */
+.text
+.globl _memcpy
+.balign 16
+_memcpy:
+ push %ebp
+ movl %esp, %ebp
+ push %esi
+ push %edi
+ movl 8(%ebp), %edi /* String s1 */
+ movl 12(%ebp), %esi /* String s2 */
+ movl 16(%ebp), %ecx /* Length */
+/* No overlap check here */
+ jmp __memcpy /* Call the part of __memmove that copies up */
+++ /dev/null
-! memcpy() Author: Kees J. Bot
-! 2 Jan 1994
-.sect .text; .sect .rom; .sect .data; .sect .bss
-
-! void *memcpy(void *s1, const void *s2, size_t n)
-! Copy a chunk of memory.
-! This routine need not handle overlap, so it does not handle overlap.
-! One could simply call __memmove, the cost of the overlap check is
-! negligible, but you are dealing with a programmer who believes that
-! if anything can go wrong, it should go wrong.
-!
-.sect .text
-.define _memcpy
- .align 16
-_memcpy:
- push ebp
- mov ebp, esp
- push esi
- push edi
- mov edi, 8(ebp) ! String s1
- mov esi, 12(ebp) ! String s2
- mov ecx, 16(ebp) ! Length
- ! No overlap check here
- jmp __memcpy ! Call the part of __memmove that copies up
--- /dev/null
+/* memmove() Author: Kees J. Bot */
+/* 2 Jan 1994 */
+
+/* void *memmove(void *s1, const void *s2, size_t n) */
+/* Copy a chunk of memory. Handle overlap. */
+/* */
+.text
+.globl _memmove
+.balign 16
+_memmove:
+ jmp __memmove /* Call common code */
+++ /dev/null
-! memmove() Author: Kees J. Bot
-! 2 Jan 1994
-.sect .text; .sect .rom; .sect .data; .sect .bss
-
-! void *memmove(void *s1, const void *s2, size_t n)
-! Copy a chunk of memory. Handle overlap.
-!
-.sect .text
-.define _memmove
- .align 16
-_memmove:
- jmp __memmove ! Call common code
--- /dev/null
+/* memset() Author: Kees J. Bot */
+/* 2 Jan 1994 */
+
+/* void *memset(void *s, int c, size_t n) */
+/* Set a chunk of memory to the same byte value. */
+/* */
+.text
+.globl _memset
+.balign 16
+_memset:
+ push %ebp
+ movl %esp, %ebp
+ push %edi
+ movl 8(%ebp), %edi /* The string */
+ movzbl 12(%ebp), %eax /* The fill byte */
+ movl 16(%ebp), %ecx /* Length */
+ cld
+ cmpl $16, %ecx
+ jb sbyte /* Don't bother being smart with short arrays */
+ testl $1, %edi
+ jne sbyte /* Bit 0 set, use byte store */
+ testl $2, %edi
+ jne sword /* Bit 1 set, use word store */
+slword:
+ movb %al, %ah
+ movl %eax, %edx
+ sall $16, %edx
+ orl %edx, %eax /* One byte to four bytes */
+ shrdl $2, %ecx, %edx /* Save low two bits of ecx in edx */
+ shrl $2, %ecx
+
+ rep stosl /* Store longwords. */
+ shldl $2, %edx, %ecx /* Restore low two bits */
+sword:
+ movb %al, %ah /* One byte to two bytes */
+ shrl $1, %ecx
+
+ rep stosw /* Store words */
+ adcl %ecx, %ecx /* One more byte? */
+sbyte:
+ rep stosb /* Store bytes */
+done:
+ movl 8(%ebp), %eax /* Return some value you have no need for */
+ pop %edi
+ pop %ebp
+ ret
+++ /dev/null
-! memset() Author: Kees J. Bot
-! 2 Jan 1994
-.sect .text; .sect .rom; .sect .data; .sect .bss
-
-! void *memset(void *s, int c, size_t n)
-! Set a chunk of memory to the same byte value.
-!
-.sect .text
-.define _memset
- .align 16
-_memset:
- push ebp
- mov ebp, esp
- push edi
- mov edi, 8(ebp) ! The string
- movzxb eax, 12(ebp) ! The fill byte
- mov ecx, 16(ebp) ! Length
- cld
- cmp ecx, 16
- jb sbyte ! Don't bother being smart with short arrays
- test edi, 1
- jnz sbyte ! Bit 0 set, use byte store
- test edi, 2
- jnz sword ! Bit 1 set, use word store
-slword: movb ah, al
- mov edx, eax
- sal edx, 16
- or eax, edx ! One byte to four bytes
- shrd edx, ecx, 2 ! Save low two bits of ecx in edx
- shr ecx, 2
- rep
- stos ! Store longwords.
- shld ecx, edx, 2 ! Restore low two bits
-sword: movb ah, al ! One byte to two bytes
- shr ecx, 1
- rep
- o16 stos ! Store words
- adc ecx, ecx ! One more byte?
-sbyte: rep
- stosb ! Store bytes
-done: mov eax, 8(ebp) ! Return some value you have no need for
- pop edi
- pop ebp
- ret
--- /dev/null
+/* rindex() Author: Kees J. Bot */
+/* 2 Jan 1994 */
+
+/* char *rindex(const char *s, int c) */
+/* Look for the last occurrence a character in a string. Has suffered */
+/* from a hostile takeover by strrchr(). */
+/* */
+.text
+.globl _rindex
+.balign 16
+_rindex:
+ jmp _strrchr
+++ /dev/null
-! rindex() Author: Kees J. Bot
-! 2 Jan 1994
-.sect .text; .sect .rom; .sect .data; .sect .bss
-
-! char *rindex(const char *s, int c)
-! Look for the last occurrence a character in a string. Has suffered
-! from a hostile takeover by strrchr().
-!
-.sect .text
-.define _rindex
- .align 16
-_rindex:
- jmp _strrchr
--- /dev/null
+/* strcat() Author: Kees J. Bot */
+/* 1 Jan 1994 */
+
+/* char *strcat(char *s1, const char *s2) */
+/* Append string s2 to s1. */
+/* */
+.text
+.globl _strcat
+.balign 16
+_strcat:
+ movl $-1, %edx /* Unlimited length */
+ jmp __strncat /* Common code */
+++ /dev/null
-! strcat() Author: Kees J. Bot
-! 1 Jan 1994
-.sect .text; .sect .rom; .sect .data; .sect .bss
-
-! char *strcat(char *s1, const char *s2)
-! Append string s2 to s1.
-!
-.sect .text
-.define _strcat
- .align 16
-_strcat:
- mov edx, -1 ! Unlimited length
- jmp __strncat ! Common code
--- /dev/null
+/* strchr() Author: Kees J. Bot */
+/* 1 Jan 1994 */
+
+/* char *strchr(const char *s, int c) */
+/* Look for a character in a string. */
+/* */
+.text
+.globl _strchr
+.balign 16
+_strchr:
+ push %ebp
+ movl %esp, %ebp
+ push %edi
+ cld
+ movl 8(%ebp), %edi /* edi = string */
+ movl $16, %edx /* Look at small chunks of the string */
+next:
+ shll $1, %edx /* Chunks become bigger each time */
+ movl %edx, %ecx
+ xorb %al, %al /* Look for the zero at the end */
+
+ repne scasb
+ pushf /* Remember the flags */
+ subl %edx, %ecx
+ negl %ecx /* Some or all of the chunk */
+ subl %ecx, %edi /* Step back */
+ movb 12(%ebp), %al /* The character to look for */
+
+ repne scasb
+ je found
+ popf /* Did we find the end of string earlier? */
+ jne next /* No, try again */
+ xorl %eax, %eax /* Return NULL */
+ pop %edi
+ pop %ebp
+ ret
+found:
+ pop %eax /* Get rid of those flags */
+ leal -1(%edi), %eax /* Address of byte found */
+ pop %edi
+ pop %ebp
+ ret
+++ /dev/null
-! strchr() Author: Kees J. Bot
-! 1 Jan 1994
-.sect .text; .sect .rom; .sect .data; .sect .bss
-
-! char *strchr(const char *s, int c)
-! Look for a character in a string.
-!
-.sect .text
-.define _strchr
- .align 16
-_strchr:
- push ebp
- mov ebp, esp
- push edi
- cld
- mov edi, 8(ebp) ! edi = string
- mov edx, 16 ! Look at small chunks of the string
-next: shl edx, 1 ! Chunks become bigger each time
- mov ecx, edx
- xorb al, al ! Look for the zero at the end
- repne
- scasb
- pushf ! Remember the flags
- sub ecx, edx
- neg ecx ! Some or all of the chunk
- sub edi, ecx ! Step back
- movb al, 12(ebp) ! The character to look for
- repne
- scasb
- je found
- popf ! Did we find the end of string earlier?
- jne next ! No, try again
- xor eax, eax ! Return NULL
- pop edi
- pop ebp
- ret
-found: pop eax ! Get rid of those flags
- lea eax, -1(edi) ! Address of byte found
- pop edi
- pop ebp
- ret
--- /dev/null
+/* strcmp() Author: Kees J. Bot */
+/* 1 Jan 1994 */
+
+/* int strcmp(const char *s1, const char *s2) */
+/* Compare two strings. */
+/* */
+.text
+.globl _strcmp
+.balign 16
+_strcmp:
+ movl $-1, %ecx /* Unlimited length */
+ jmp __strncmp /* Common code */
+++ /dev/null
-! strcmp() Author: Kees J. Bot
-! 1 Jan 1994
-.sect .text; .sect .rom; .sect .data; .sect .bss
-
-! int strcmp(const char *s1, const char *s2)
-! Compare two strings.
-!
-.sect .text
-.define _strcmp
- .align 16
-_strcmp:
- mov ecx, -1 ! Unlimited length
- jmp __strncmp ! Common code
--- /dev/null
+/* strcpy() Author: Kees J. Bot */
+/* 1 Jan 1994 */
+
+/* char *strcpy(char *s1, const char *s2) */
+/* Copy string s2 to s1. */
+/* */
+.text
+.globl _strcpy
+.balign 16
+_strcpy:
+ push %ebp
+ movl %esp, %ebp
+ push %esi
+ push %edi
+ movl $-1, %ecx /* Unlimited length */
+ call __strncpy /* Common code */
+ movl 8(%ebp), %eax /* Return s1 */
+ pop %edi
+ pop %esi
+ pop %ebp
+ ret
+++ /dev/null
-! strcpy() Author: Kees J. Bot
-! 1 Jan 1994
-.sect .text; .sect .rom; .sect .data; .sect .bss
-
-! char *strcpy(char *s1, const char *s2)
-! Copy string s2 to s1.
-!
-.sect .text
-.define _strcpy
- .align 16
-_strcpy:
- push ebp
- mov ebp, esp
- push esi
- push edi
- mov ecx, -1 ! Unlimited length
- call __strncpy ! Common code
- mov eax, 8(ebp) ! Return s1
- pop edi
- pop esi
- pop ebp
- ret
--- /dev/null
+/* strlen() Author: Kees J. Bot */
+/* 1 Jan 1994 */
+
+/* size_t strlen(const char *s) */
+/* Return the length of a string. */
+/* */
+.text
+.globl _strlen
+.balign 16
+_strlen:
+ movl $-1, %ecx /* Unlimited length */
+ jmp __strnlen /* Common code */
+++ /dev/null
-! strlen() Author: Kees J. Bot
-! 1 Jan 1994
-.sect .text; .sect .rom; .sect .data; .sect .bss
-
-! size_t strlen(const char *s)
-! Return the length of a string.
-!
-.sect .text
-.define _strlen
- .align 16
-_strlen:
- mov ecx, -1 ! Unlimited length
- jmp __strnlen ! Common code
--- /dev/null
+/* strncat() Author: Kees J. Bot */
+/* 1 Jan 1994 */
+
+/* size_t strncat(char *s1, const char *s2, size_t n) */
+/* Append string s2 to s1. */
+/* */
+.text
+.globl _strncat
+.balign 16
+_strncat:
+ movl 12(%esp), %edx /* Maximum length */
+ jmp __strncat /* Common code */
+++ /dev/null
-! strncat() Author: Kees J. Bot
-! 1 Jan 1994
-.sect .text; .sect .rom; .sect .data; .sect .bss
-
-! size_t strncat(char *s1, const char *s2, size_t n)
-! Append string s2 to s1.
-!
-.sect .text
-.define _strncat
- .align 16
-_strncat:
- mov edx, 12(esp) ! Maximum length
- jmp __strncat ! Common code
--- /dev/null
+/* strncmp() Author: Kees J. Bot */
+/* 1 Jan 1994 */
+
+/* int strncmp(const char *s1, const char *s2, size_t n) */
+/* Compare two strings. */
+/* */
+.text
+.globl _strncmp
+.balign 16
+_strncmp:
+ movl 12(%esp), %ecx /* Maximum length */
+ jmp __strncmp /* Common code */
+++ /dev/null
-! strncmp() Author: Kees J. Bot
-! 1 Jan 1994
-.sect .text; .sect .rom; .sect .data; .sect .bss
-
-! int strncmp(const char *s1, const char *s2, size_t n)
-! Compare two strings.
-!
-.sect .text
-.define _strncmp
- .align 16
-_strncmp:
- mov ecx, 12(esp) ! Maximum length
- jmp __strncmp ! Common code
--- /dev/null
+/* strncpy() Author: Kees J. Bot */
+/* 1 Jan 1994 */
+
+/* char *strncpy(char *s1, const char *s2, size_t n) */
+/* Copy string s2 to s1. */
+/* */
+.text
+.globl _strncpy
+.balign 16
+_strncpy:
+ push %ebp
+ movl %esp, %ebp
+ push %esi
+ push %edi
+ movl 16(%ebp), %ecx /* Maximum length */
+ call __strncpy /* Common code */
+ movl %edx, %ecx /* Number of bytes not copied */
+
+ rep stosb /* strncpy always copies n bytes by null padding */
+ movl 8(%ebp), %eax /* Return s1 */
+ pop %edi
+ pop %esi
+ pop %ebp
+ ret
+++ /dev/null
-! strncpy() Author: Kees J. Bot
-! 1 Jan 1994
-.sect .text; .sect .rom; .sect .data; .sect .bss
-
-! char *strncpy(char *s1, const char *s2, size_t n)
-! Copy string s2 to s1.
-!
-.sect .text
-.define _strncpy
- .align 16
-_strncpy:
- push ebp
- mov ebp, esp
- push esi
- push edi
- mov ecx, 16(ebp) ! Maximum length
- call __strncpy ! Common code
- mov ecx, edx ! Number of bytes not copied
- rep
- stosb ! strncpy always copies n bytes by null padding
- mov eax, 8(ebp) ! Return s1
- pop edi
- pop esi
- pop ebp
- ret
--- /dev/null
+/* strnlen() Author: Kees J. Bot */
+/* 1 Jan 1994 */
+
+/* size_t strnlen(const char *s, size_t n) */
+/* Return the length of a string. */
+/* */
+.text
+.globl _strnlen
+.balign 16
+_strnlen:
+ movl 8(%esp), %ecx /* Maximum length */
+ jmp __strnlen /* Common code */
+++ /dev/null
-! strnlen() Author: Kees J. Bot
-! 1 Jan 1994
-.sect .text; .sect .rom; .sect .data; .sect .bss
-
-! size_t strnlen(const char *s, size_t n)
-! Return the length of a string.
-!
-.sect .text
-.define _strnlen
- .align 16
-_strnlen:
- mov ecx, 8(esp) ! Maximum length
- jmp __strnlen ! Common code
--- /dev/null
+/* strrchr() Author: Kees J. Bot */
+/* 2 Jan 1994 */
+
+/* char *strrchr(const char *s, int c) */
+/* Look for the last occurrence a character in a string. */
+/* */
+.text
+.globl _strrchr
+.balign 16
+_strrchr:
+ push %ebp
+ movl %esp, %ebp
+ push %edi
+ movl 8(%ebp), %edi /* edi = string */
+ movl $-1, %ecx
+ xorb %al, %al
+ cld
+
+ repne scasb /* Look for the end of the string */
+ notl %ecx /* -1 - ecx = Length of the string + null */
+ decl %edi /* Put edi back on the zero byte */
+ movb 12(%ebp), %al /* The character to look for */
+ std /* Downwards search */
+
+ repne scasb
+ cld /* Direction bit back to default */
+ jne failure
+ leal 1(%edi), %eax /* Found it */
+ pop %edi
+ pop %ebp
+ ret
+failure:
+ xorl %eax, %eax /* Not there */
+ pop %edi
+ pop %ebp
+ ret
+++ /dev/null
-! strrchr() Author: Kees J. Bot
-! 2 Jan 1994
-.sect .text; .sect .rom; .sect .data; .sect .bss
-
-! char *strrchr(const char *s, int c)
-! Look for the last occurrence a character in a string.
-!
-.sect .text
-.define _strrchr
- .align 16
-_strrchr:
- push ebp
- mov ebp, esp
- push edi
- mov edi, 8(ebp) ! edi = string
- mov ecx, -1
- xorb al, al
- cld
- repne
- scasb ! Look for the end of the string
- not ecx ! -1 - ecx = Length of the string + null
- dec edi ! Put edi back on the zero byte
- movb al, 12(ebp) ! The character to look for
- std ! Downwards search
- repne
- scasb
- cld ! Direction bit back to default
- jne failure
- lea eax, 1(edi) ! Found it
- pop edi
- pop ebp
- ret
-failure:xor eax, eax ! Not there
- pop edi
- pop ebp
- ret
.PATH: ${.CURDIR}/gnu/arch/${ARCH}/rts
SRCS+= \
- __setjmp.gs \
- longjmp.gs
+ __setjmp.S \
+ longjmp.S
--- /dev/null
+/ __setjmp.gnu.s
+/
+/ Created: Oct 14, 1993 by Philip Homburg <philip@cs.vu.nl>
+
+.text
+.globl ___setjmp
+___setjmp:
+ movl 4(%esp), %eax /* jmp_buf */
+ movl %edx, 28(%eax) /* save edx */
+ movl 0(%esp), %edx
+ movl %edx, 8(%eax) /* save program counter */
+ movl %esp, 12(%eax) /* save stack pointer */
+ movl %ebp, 16(%eax) /* save frame pointer */
+ movl %ebx, 20(%eax)
+ movl %ecx, 24(%eax)
+ movl %esi, 32(%eax)
+ movl %edi, 36(%eax)
+
+ movl 8(%esp), %edx /* save mask? */
+ movl %edx, 0(%eax) /* save whether to restore mask */
+ testl %edx, %edx
+ jz 1f
+ leal 4(%eax), %edx /* pointer to sigset_t */
+ push %edx
+ call __newsigset /* save mask */
+ addl $4, %esp
+1:
+ movl $0, %eax
+ ret
+
+/ $PchId: __setjmp.gnu.s,v 1.4 1996/03/12 19:30:54 philip Exp $
+++ /dev/null
-/ __setjmp.gnu.s
-/
-/ Created: Oct 14, 1993 by Philip Homburg <philip@cs.vu.nl>
-
-.text
-.globl ___setjmp
-___setjmp:
- movl 4(%esp), %eax # jmp_buf
- movl %edx, 28(%eax) # save edx
- movl 0(%esp), %edx
- movl %edx, 8(%eax) # save program counter
- movl %esp, 12(%eax) # save stack pointer
- movl %ebp, 16(%eax) # save frame pointer
- movl %ebx, 20(%eax)
- movl %ecx, 24(%eax)
- movl %esi, 32(%eax)
- movl %edi, 36(%eax)
-
- movl 8(%esp), %edx # save mask?
- movl %edx, 0(%eax) # save whether to restore mask
- testl %edx, %edx
- jz 1f
- leal 4(%eax), %edx # pointer to sigset_t
- pushl %edx
- call ___newsigset # save mask
- addl $4, %esp
-1:
- movl $0, %eax
- ret
-
-/ $PchId: __setjmp.gnu.s,v 1.4 1996/03/12 19:30:54 philip Exp $
--- /dev/null
+/ longjmp.gnu.s
+/
+/ Created: Oct 15, 1993 by Philip Homburg <philip@cs.vu.nl>
+
+.text
+.globl _longjmp
+_longjmp:
+ movl 4(%esp), %eax /* jmp_buf */
+ cmpl $0, 0(%eax) /* save mask? */
+ je 1f
+ leal 4(%eax), %edx /* pointer to sigset_t */
+ push %edx
+ call __oldsigset /* restore mask */
+ addl $4, %esp
+ movl 4(%esp), %eax /* jmp_buf */
+1:
+ movl 8(%esp), %ecx /* result value */
+ movl 12(%eax), %esp /* restore stack pointer */
+
+ movl 8(%eax), %edx /* restore program counter */
+ movl %edx, 0(%esp)
+
+ push %ecx /* save result code */
+
+ movl 16(%eax), %ebp /* restore frame pointer */
+ movl 20(%eax), %ebx
+ movl 24(%eax), %ecx
+ movl 28(%eax), %edx
+ movl 32(%eax), %esi
+ movl 36(%eax), %edi
+ pop %eax
+ testl %eax, %eax
+ jz 1f
+ ret
+1: movl $1, %eax
+ ret
+
+/ $PchId: longjmp.gnu.s,v 1.4 1996/03/12 19:30:02 philip Exp $
+++ /dev/null
-/ longjmp.gnu.s
-/
-/ Created: Oct 15, 1993 by Philip Homburg <philip@cs.vu.nl>
-
-.text
-.globl _longjmp
-_longjmp:
- movl 4(%esp), %eax # jmp_buf
- cmpl $0, 0(%eax) # save mask?
- je 1f
- leal 4(%eax), %edx # pointer to sigset_t
- pushl %edx
- call ___oldsigset # restore mask
- addl $4, %esp
- movl 4(%esp), %eax # jmp_buf
-1:
- movl 8(%esp), %ecx # result value
- movl 12(%eax), %esp # restore stack pointer
-
- movl 8(%eax), %edx # restore program counter
- movl %edx, 0(%esp)
-
- pushl %ecx # save result code
-
- movl 16(%eax), %ebp # restore frame pointer
- movl 20(%eax), %ebx
- movl 24(%eax), %ecx
- movl 28(%eax), %edx
- movl 32(%eax), %esi
- movl 36(%eax), %edi
- pop %eax
- testl %eax, %eax
- jz 1f
- ret
-1: movl $1, %eax
- ret
-
-/ $PchId: longjmp.gnu.s,v 1.4 1996/03/12 19:30:02 philip Exp $
.PATH: ${.CURDIR}/syscall
SRCS+= \
- _exit.s \
- _pm_findproc.s \
- access.s \
- adddma.s \
- alarm.s \
- brk.s \
- cfgetispeed.s \
- cfgetospeed.s \
- cfsetispeed.s \
- cfsetospeed.s \
- chdir.s \
- chmod.s \
- chown.s \
- chroot.s \
- close.s \
- closedir.s \
- cprofile.s \
- creat.s \
- deldma.s \
- dup.s \
- dup2.s \
- execl.s \
- execle.s \
- execlp.s \
- execv.s \
- execve.s \
- execvp.s \
- fchown.s \
- fchmod.s \
- fcntl.s \
- fork.s \
- fpathconf.s \
- fstat.s \
- fstatfs.s \
- getcwd.s \
- getdents.s \
- getdma.s \
- getegid.s \
- geteuid.s \
- getgid.s \
- getgroups.s \
- getitimer.s \
- getnpid.s \
- getnuid.s \
- getngid.s \
- getnprocnr.s \
- getpgrp.s \
- getpid.s \
- getppid.s \
- getpprocnr.s \
- getprocnr.s \
- getsigset.s \
- getsysinfo.s \
- getuid.s \
- ioctl.s \
- isatty.s \
- kill.s \
- killpg.s \
- link.s \
- lseek.s \
- lseek64.s \
- lstat.s \
- mapdriver.s \
- mkdir.s \
- mkfifo.s \
- mknod.s \
- mmap.s \
- vm_getphys.s \
- vm_getrefcount.s \
- vm_remap.s \
- vm_unmap.s \
- vm_set_priv.s \
- vm_query_exit.s \
- mount.s \
- nanosleep.s \
- open.s \
- opendir.s \
- pathconf.s \
- pause.s \
- pipe.s \
- ptrace.s \
- read.s \
- readdir.s \
- readlink.s \
- reboot.s \
- rename.s \
- rewinddir.s \
- rmdir.s \
- sbrk.s \
- select.s \
- seekdir.s \
- setgid.s \
- setgroups.s \
- setitimer.s \
- setsid.s \
- setuid.s \
- sigaction.s \
- sigaddset.s \
- sigdelset.s \
- sigemptyset.s \
- sigfillset.s \
- sigismember.s \
- sigpending.s \
- sigprocmask.s \
- sigreturn.s \
- sigsuspend.s \
- sleep.s \
- sprofile.s \
- stat.s \
- stime.s \
- svrctl.s \
- symlink.s \
- sync.s \
- sysuname.s \
- tcdrain.s \
- tcflow.s \
- tcflush.s \
- tcgetattr.s \
- tcsendbreak.s \
- tcsetattr.s \
- time.s \
- times.s \
- truncate.s \
- umask.s \
- umount.s \
- uname.s \
- unlink.s \
- utime.s \
- vm_dmacalls.s \
- wait.s \
- waitpid.s \
- write.s
+ _exit.S \
+ _pm_findproc.S \
+ access.S \
+ adddma.S \
+ alarm.S \
+ brk.S \
+ cfgetispeed.S \
+ cfgetospeed.S \
+ cfsetispeed.S \
+ cfsetospeed.S \
+ chdir.S \
+ chmod.S \
+ chown.S \
+ chroot.S \
+ close.S \
+ closedir.S \
+ cprofile.S \
+ creat.S \
+ deldma.S \
+ dup.S \
+ dup2.S \
+ execl.S \
+ execle.S \
+ execlp.S \
+ execv.S \
+ execve.S \
+ execvp.S \
+ fchown.S \
+ fchmod.S \
+ fcntl.S \
+ fork.S \
+ fpathconf.S \
+ fstat.S \
+ fstatfs.S \
+ getcwd.S \
+ getdents.S \
+ getdma.S \
+ getegid.S \
+ geteuid.S \
+ getgid.S \
+ getgroups.S \
+ getitimer.S \
+ getnpid.S \
+ getnuid.S \
+ getngid.S \
+ getnprocnr.S \
+ getpgrp.S \
+ getpid.S \
+ getppid.S \
+ getpprocnr.S \
+ getprocnr.S \
+ getsigset.S \
+ getsysinfo.S \
+ getuid.S \
+ ioctl.S \
+ isatty.S \
+ kill.S \
+ killpg.S \
+ link.S \
+ lseek.S \
+ lseek64.S \
+ lstat.S \
+ mapdriver.S \
+ mkdir.S \
+ mkfifo.S \
+ mknod.S \
+ mmap.S \
+ vm_getphys.S \
+ vm_getrefcount.S \
+ vm_remap.S \
+ vm_unmap.S \
+ vm_set_priv.S \
+ vm_query_exit.S \
+ mount.S \
+ nanosleep.S \
+ open.S \
+ opendir.S \
+ pathconf.S \
+ pause.S \
+ pipe.S \
+ ptrace.S \
+ read.S \
+ readdir.S \
+ readlink.S \
+ reboot.S \
+ rename.S \
+ rewinddir.S \
+ rmdir.S \
+ sbrk.S \
+ select.S \
+ seekdir.S \
+ setgid.S \
+ setgroups.S \
+ setitimer.S \
+ setsid.S \
+ setuid.S \
+ sigaction.S \
+ sigaddset.S \
+ sigdelset.S \
+ sigemptyset.S \
+ sigfillset.S \
+ sigismember.S \
+ sigpending.S \
+ sigprocmask.S \
+ sigreturn.S \
+ sigsuspend.S \
+ sleep.S \
+ sprofile.S \
+ stat.S \
+ stime.S \
+ svrctl.S \
+ symlink.S \
+ sync.S \
+ sysuname.S \
+ tcdrain.S \
+ tcflow.S \
+ tcflush.S \
+ tcgetattr.S \
+ tcsendbreak.S \
+ tcsetattr.S \
+ time.S \
+ times.S \
+ truncate.S \
+ umask.S \
+ umount.S \
+ uname.S \
+ unlink.S \
+ utime.S \
+ vm_dmacalls.S \
+ wait.S \
+ waitpid.S \
+ write.S
-.sect .text
+.text
.extern ___exit
-.define __exit
-.align 2
+.globl __exit
+.balign 2
__exit:
jmp ___exit
-.sect .text
+.text
.extern ___pm_findproc
-.define __pm_findproc
-.align 2
+.globl __pm_findproc
+.balign 2
__pm_findproc:
jmp ___pm_findproc
-.sect .text
+.text
.extern __access
-.define _access
-.align 2
+.globl _access
+.balign 2
_access:
jmp __access
-.sect .text
+.text
.extern __adddma
-.define _adddma
-.align 2
+.globl _adddma
+.balign 2
_adddma:
jmp __adddma
-.sect .text
+.text
.extern __alarm
-.define _alarm
-.align 2
+.globl _alarm
+.balign 2
_alarm:
jmp __alarm
--- /dev/null
+.text
+.extern __brk
+.globl _brk
+.balign 2
+
+_brk:
+ jmp __brk
+++ /dev/null
-.sect .text
-.extern __brk
-.define _brk
-.align 2
-
-_brk:
- jmp __brk
-.sect .text
+.text
.extern __cfgetispeed
-.define _cfgetispeed
-.align 2
+.globl _cfgetispeed
+.balign 2
_cfgetispeed:
jmp __cfgetispeed
-.sect .text
+.text
.extern __cfgetospeed
-.define _cfgetospeed
-.align 2
+.globl _cfgetospeed
+.balign 2
_cfgetospeed:
jmp __cfgetospeed
-.sect .text
+.text
.extern __cfsetispeed
-.define _cfsetispeed
-.align 2
+.globl _cfsetispeed
+.balign 2
_cfsetispeed:
jmp __cfsetispeed
-.sect .text
+.text
.extern __cfsetospeed
-.define _cfsetospeed
-.align 2
+.globl _cfsetospeed
+.balign 2
_cfsetospeed:
jmp __cfsetospeed
-.sect .text
+.text
.extern __chdir
-.define _chdir
+.globl _chdir
.extern __fchdir
-.define _fchdir
-.align 2
+.globl _fchdir
+.balign 2
_chdir:
jmp __chdir
-.sect .text
+.text
.extern __chmod
-.define _chmod
-.align 2
+.globl _chmod
+.balign 2
_chmod:
jmp __chmod
-.sect .text
+.text
.extern __chown
-.define _chown
-.align 2
+.globl _chown
+.balign 2
_chown:
jmp __chown
-.sect .text
+.text
.extern __chroot
-.define _chroot
-.align 2
+.globl _chroot
+.balign 2
_chroot:
jmp __chroot
-.sect .text
+.text
.extern __close
-.define _close
-.align 2
+.globl _close
+.balign 2
_close:
jmp __close
-.sect .text
+.text
.extern __closedir
-.define _closedir
-.align 2
+.globl _closedir
+.balign 2
_closedir:
jmp __closedir
-.sect .text
+.text
.extern __cprofile
-.define _cprofile
-.align 2
+.globl _cprofile
+.balign 2
_cprofile:
jmp __cprofile
-.sect .text
+.text
.extern __creat
-.define _creat
-.align 2
+.globl _creat
+.balign 2
_creat:
jmp __creat
-.sect .text
+.text
.extern __deldma
-.define _deldma
-.align 2
+.globl _deldma
+.balign 2
_deldma:
jmp __deldma
--- /dev/null
+.text
+.extern __dup
+.globl _dup
+.balign 2
+
+_dup:
+ jmp __dup
+++ /dev/null
-.sect .text
-.extern __dup
-.define _dup
-.align 2
-
-_dup:
- jmp __dup
-.sect .text
+.text
.extern __dup2
-.define _dup2
-.align 2
+.globl _dup2
+.balign 2
_dup2:
jmp __dup2
-.sect .text
+.text
.extern __execl
-.define _execl
-.align 2
+.globl _execl
+.balign 2
_execl:
jmp __execl
-.sect .text
+.text
.extern __execle
-.define _execle
-.align 2
+.globl _execle
+.balign 2
_execle:
jmp __execle
-.sect .text
+.text
.extern __execlp
-.define _execlp
-.align 2
+.globl _execlp
+.balign 2
_execlp:
jmp __execlp
-.sect .text
+.text
.extern __execv
-.define _execv
-.align 2
+.globl _execv
+.balign 2
_execv:
jmp __execv
-.sect .text
+.text
.extern __execve
-.define _execve
-.align 2
+.globl _execve
+.balign 2
_execve:
jmp __execve
-.sect .text
+.text
.extern __execvp
-.define _execvp
-.align 2
+.globl _execvp
+.balign 2
_execvp:
jmp __execvp
-.sect .text
+.text
.extern __fchmod
-.define _fchmod
-.align 2
+.globl _fchmod
+.balign 2
_fchmod:
jmp __fchmod
-.sect .text
+.text
.extern __fchown
-.define _fchown
-.align 2
+.globl _fchown
+.balign 2
_fchown:
jmp __fchown
-.sect .text
+.text
.extern __fcntl
-.define _fcntl
-.align 2
+.globl _fcntl
+.balign 2
_fcntl:
jmp __fcntl
-.sect .text
+.text
.extern __fork
-.define _fork
-.align 2
+.globl _fork
+.balign 2
_fork:
jmp __fork
-.sect .text
+.text
.extern __fpathconf
-.define _fpathconf
-.align 2
+.globl _fpathconf
+.balign 2
_fpathconf:
jmp __fpathconf
-.sect .text
+.text
.extern __fstat
-.define _fstat
-.align 2
+.globl _fstat
+.balign 2
_fstat:
jmp __fstat
-.sect .text
+.text
.extern __fstatfs
-.define _fstatfs
-.align 2
+.globl _fstatfs
+.balign 2
_fstatfs:
jmp __fstatfs
-.sect .text
+.text
.extern __getcwd
-.define _getcwd
-.align 2
+.globl _getcwd
+.balign 2
_getcwd:
jmp __getcwd
-.sect .text
+.text
.extern __getdents
-.define _getdents
-.align 2
+.globl _getdents
+.balign 2
_getdents:
jmp __getdents
-.sect .text
+.text
.extern __getdma
-.define _getdma
-.align 2
+.globl _getdma
+.balign 2
_getdma:
jmp __getdma
-.sect .text
+.text
.extern __getegid
-.define _getegid
-.align 2
+.globl _getegid
+.balign 2
_getegid:
jmp __getegid
-.sect .text
+.text
.extern __geteuid
-.define _geteuid
-.align 2
+.globl _geteuid
+.balign 2
_geteuid:
jmp __geteuid
-.sect .text
+.text
.extern __getgid
-.define _getgid
-.align 2
+.globl _getgid
+.balign 2
_getgid:
jmp __getgid
-.sect .text
+.text
.extern __getgroups
-.define _getgroups
-.align 2
+.globl _getgroups
+.balign 2
_getgroups:
jmp __getgroups
--- /dev/null
+.text
+.extern __getitimer
+.globl _getitimer
+.balign 2
+
+_getitimer:
+ jmp __getitimer
+++ /dev/null
-.sect .text
-.extern __getitimer
-.define _getitimer
-.align 2
-
-_getitimer:
- jmp __getitimer
-.sect .text
+.text
.extern __getngid
-.define _getngid
-.align 2
+.globl _getngid
+.balign 2
_getngid:
jmp __getngid
-.sect .text
+.text
.extern __getnpid
-.define _getnpid
-.align 2
+.globl _getnpid
+.balign 2
_getnpid:
jmp __getnpid
-.sect .text
+.text
.extern __getnprocnr
-.define _getnprocnr
-.align 2
+.globl _getnprocnr
+.balign 2
_getnprocnr:
jmp __getnprocnr
-.sect .text
+.text
.extern __getnuid
-.define _getnuid
-.align 2
+.globl _getnuid
+.balign 2
_getnuid:
jmp __getnuid
-.sect .text
+.text
.extern __getpgrp
-.define _getpgrp
-.align 2
+.globl _getpgrp
+.balign 2
_getpgrp:
jmp __getpgrp
-.sect .text
+.text
.extern __getpid
-.define _getpid
-.align 2
+.globl _getpid
+.balign 2
_getpid:
jmp __getpid
-.sect .text
+.text
.extern __getppid
-.define _getppid
-.align 2
+.globl _getppid
+.balign 2
_getppid:
jmp __getppid
-.sect .text
+.text
.extern __getpprocnr
-.define _getpprocnr
-.align 2
+.globl _getpprocnr
+.balign 2
_getpprocnr:
jmp __getpprocnr
-.sect .text
+.text
.extern __getprocnr
-.define _getprocnr
-.align 2
+.globl _getprocnr
+.balign 2
_getprocnr:
jmp __getprocnr
-.sect .text
+.text
.extern __getsigset
-.define _getsigset
-.align 2
+.globl _getsigset
+.balign 2
_getsigset:
jmp __getsigset
-.sect .text
+.text
.extern __getsysinfo
-.define _getsysinfo
+.globl _getsysinfo
.extern __getsysinfo_up
-.define _getsysinfo_up
-.align 2
+.globl _getsysinfo_up
+.balign 2
_getsysinfo:
jmp __getsysinfo
-.sect .text
+.text
.extern __getuid
-.define _getuid
-.align 2
+.globl _getuid
+.balign 2
_getuid:
jmp __getuid
-.sect .text
+.text
.extern __ioctl
-.define _ioctl
-.align 2
+.globl _ioctl
+.balign 2
_ioctl:
jmp __ioctl
-.sect .text
+.text
.extern __isatty
-.define _isatty
-.align 2
+.globl _isatty
+.balign 2
_isatty:
jmp __isatty
-.sect .text
+.text
.extern __kill
-.define _kill
-.align 2
+.globl _kill
+.balign 2
_kill:
jmp __kill
-.sect .text
+.text
.extern __killpg
-.define _killpg
-.align 2
+.globl _killpg
+.balign 2
_killpg:
jmp __killpg
-.sect .text
+.text
.extern __link
-.define _link
-.align 2
+.globl _link
+.balign 2
_link:
jmp __link
-.sect .text
+.text
.extern __lseek
-.define _lseek
-.align 2
+.globl _lseek
+.balign 2
_lseek:
jmp __lseek
-.sect .text
+.text
.extern __lseek64
-.define _lseek64
-.align 2
+.globl _lseek64
+.balign 2
_lseek64:
jmp __lseek64
-.sect .text
+.text
.extern __lstat
-.define _lstat
-.align 2
+.globl _lstat
+.balign 2
_lstat:
jmp __lstat
-.sect .text
+.text
.extern __mapdriver
-.define _mapdriver
-.align 2
+.globl _mapdriver
+.balign 2
_mapdriver:
jmp __mapdriver
-.sect .text
+.text
.extern __mkdir
-.define _mkdir
-.align 2
+.globl _mkdir
+.balign 2
_mkdir:
jmp __mkdir
-.sect .text
+.text
.extern __mkfifo
-.define _mkfifo
-.align 2
+.globl _mkfifo
+.balign 2
_mkfifo:
jmp __mkfifo
-.sect .text
+.text
.extern __mknod
-.define _mknod
-.align 2
+.globl _mknod
+.balign 2
_mknod:
jmp __mknod
-.sect .text
+.text
.extern __mmap
-.define _mmap
+.globl _mmap
.extern __munmap
-.define _munmap
+.globl _munmap
.extern __munmap_text
-.define _munmap_text
-.align 2
+.globl _munmap_text
+.balign 2
_mmap:
jmp __mmap
-.sect .text
+.text
.extern __mount
-.define _mount
-.align 2
+.globl _mount
+.balign 2
_mount:
jmp __mount
-.sect .text
+.text
.extern __nanosleep
-.define _nanosleep
+.globl _nanosleep
_nanosleep:
jmp __nanosleep
-.sect .text
+.text
.extern __open
-.define _open
-.align 2
+.globl _open
+.balign 2
_open:
jmp __open
-.sect .text
+.text
.extern __opendir
-.define _opendir
-.align 2
+.globl _opendir
+.balign 2
_opendir:
jmp __opendir
-.sect .text
+.text
.extern __pathconf
-.define _pathconf
-.align 2
+.globl _pathconf
+.balign 2
_pathconf:
jmp __pathconf
-.sect .text
+.text
.extern __pause
-.define _pause
-.align 2
+.globl _pause
+.balign 2
_pause:
jmp __pause
-.sect .text
+.text
.extern __pipe
-.define _pipe
-.align 2
+.globl _pipe
+.balign 2
_pipe:
jmp __pipe
-.sect .text
+.text
.extern __ptrace
-.define _ptrace
-.align 2
+.globl _ptrace
+.balign 2
_ptrace:
jmp __ptrace
-.sect .text
+.text
.extern __read
-.define _read
-.align 2
+.globl _read
+.balign 2
_read:
jmp __read
-.sect .text
+.text
.extern __readdir
-.define _readdir
-.align 2
+.globl _readdir
+.balign 2
_readdir:
jmp __readdir
-.sect .text
+.text
.extern __readlink
-.define _readlink
-.align 2
+.globl _readlink
+.balign 2
_readlink:
jmp __readlink
-.sect .text
+.text
.extern __reboot
-.define _reboot
-.align 2
+.globl _reboot
+.balign 2
_reboot:
jmp __reboot
-.sect .text
+.text
.extern __rename
-.define _rename
-.align 2
+.globl _rename
+.balign 2
_rename:
jmp __rename
-.sect .text
+.text
.extern __rewinddir
-.define _rewinddir
-.align 2
+.globl _rewinddir
+.balign 2
_rewinddir:
jmp __rewinddir
-.sect .text
+.text
.extern __rmdir
-.define _rmdir
-.align 2
+.globl _rmdir
+.balign 2
_rmdir:
jmp __rmdir
-.sect .text
+.text
.extern __sbrk
-.define _sbrk
-.align 2
+.globl _sbrk
+.balign 2
_sbrk:
jmp __sbrk
-.sect .text
+.text
.extern __seekdir
-.define _seekdir
-.align 2
+.globl _seekdir
+.balign 2
_seekdir:
jmp __seekdir
-.sect .text
+.text
.extern __select
-.define _select
-.align 2
+.globl _select
+.balign 2
_select:
jmp __select
-.sect .text
+.text
.extern __setgid
-.define _setgid
-.define _setegid
-.align 2
+.globl _setgid
+.globl _setegid
+.balign 2
_setgid:
jmp __setgid
-.sect .text
+.text
.extern __setgroups
-.define _setgroups
-.align 2
+.globl _setgroups
+.balign 2
_setgroups:
jmp __setgroups
--- /dev/null
+.text
+.extern __setitimer
+.globl _setitimer
+.balign 2
+
+_setitimer:
+ jmp __setitimer
+++ /dev/null
-.sect .text
-.extern __setitimer
-.define _setitimer
-.align 2
-
-_setitimer:
- jmp __setitimer
-.sect .text
+.text
.extern __setsid
-.define _setsid
-.align 2
+.globl _setsid
+.balign 2
_setsid:
jmp __setsid
-.sect .text
+.text
.extern __setuid
-.define _setuid
-.define _seteuid
-.align 2
+.globl _setuid
+.globl _seteuid
+.balign 2
_setuid:
jmp __setuid
-.sect .text
+.text
.extern __sigaction
-.define _sigaction
-.align 2
+.globl _sigaction
+.balign 2
_sigaction:
jmp __sigaction
-.sect .text
+.text
.extern __sigaddset
-.define _sigaddset
-.align 2
+.globl _sigaddset
+.balign 2
_sigaddset:
jmp __sigaddset
-.sect .text
+.text
.extern __sigdelset
-.define _sigdelset
-.align 2
+.globl _sigdelset
+.balign 2
_sigdelset:
jmp __sigdelset
-.sect .text
+.text
.extern __sigemptyset
-.define _sigemptyset
-.align 2
+.globl _sigemptyset
+.balign 2
_sigemptyset:
jmp __sigemptyset
-.sect .text
+.text
.extern __sigfillset
-.define _sigfillset
-.align 2
+.globl _sigfillset
+.balign 2
_sigfillset:
jmp __sigfillset
-.sect .text
+.text
.extern __sigismember
-.define _sigismember
-.align 2
+.globl _sigismember
+.balign 2
_sigismember:
jmp __sigismember
-.sect .text
+.text
.extern __sigpending
-.define _sigpending
-.align 2
+.globl _sigpending
+.balign 2
_sigpending:
jmp __sigpending
-.sect .text
+.text
.extern __sigprocmask
-.define _sigprocmask
-.align 2
+.globl _sigprocmask
+.balign 2
_sigprocmask:
jmp __sigprocmask
-.sect .text
+.text
.extern __sigreturn
-.define _sigreturn
-.align 2
+.globl _sigreturn
+.balign 2
_sigreturn:
jmp __sigreturn
-.sect .text
+.text
.extern __sigsuspend
-.define _sigsuspend
-.align 2
+.globl _sigsuspend
+.balign 2
_sigsuspend:
jmp __sigsuspend
-.sect .text
+.text
.extern __sleep
-.define _sleep
-.align 2
+.globl _sleep
+.balign 2
_sleep:
jmp __sleep
-
-.sect .text
+.text
.extern __sprofile
-.define _sprofile
-.align 2
+.globl _sprofile
+.balign 2
_sprofile:
jmp __sprofile
-.sect .text
+.text
.extern __stat
-.define _stat
-.align 2
+.globl _stat
+.balign 2
_stat:
jmp __stat
-.sect .text
+.text
.extern __stime
-.define _stime
-.align 2
+.globl _stime
+.balign 2
_stime:
jmp __stime
-.sect .text
+.text
.extern __svrctl
-.define _svrctl
-.align 2
+.globl _svrctl
+.balign 2
_svrctl:
jmp __svrctl
-.sect .text
+.text
.extern __symlink
-.define _symlink
-.align 2
+.globl _symlink
+.balign 2
_symlink:
jmp __symlink
-.sect .text
+.text
.extern __sync
-.define _sync
-.align 2
+.globl _sync
+.balign 2
_sync:
jmp __sync
-.sect .text
+.text
.extern __sysuname
-.define _sysuname
-.align 2
+.globl _sysuname
+.balign 2
_sysuname:
jmp __sysuname
-.sect .text
+.text
.extern __tcdrain
-.define _tcdrain
-.align 2
+.globl _tcdrain
+.balign 2
_tcdrain:
jmp __tcdrain
-.sect .text
+.text
.extern __tcflow
-.define _tcflow
-.align 2
+.globl _tcflow
+.balign 2
_tcflow:
jmp __tcflow
-.sect .text
+.text
.extern __tcflush
-.define _tcflush
-.align 2
+.globl _tcflush
+.balign 2
_tcflush:
jmp __tcflush
-.sect .text
+.text
.extern __tcgetattr
-.define _tcgetattr
-.align 2
+.globl _tcgetattr
+.balign 2
_tcgetattr:
jmp __tcgetattr
-.sect .text
+.text
.extern __tcsendbreak
-.define _tcsendbreak
-.align 2
+.globl _tcsendbreak
+.balign 2
_tcsendbreak:
jmp __tcsendbreak
-.sect .text
+.text
.extern __tcsetattr
-.define _tcsetattr
-.align 2
+.globl _tcsetattr
+.balign 2
_tcsetattr:
jmp __tcsetattr
-.sect .text
+.text
.extern __time
-.define _time
-.align 2
+.globl _time
+.balign 2
_time:
jmp __time
-.sect .text
+.text
.extern __times
-.define _times
-.align 2
+.globl _times
+.balign 2
_times:
jmp __times
-.sect .text
+.text
.extern __truncate
.extern __ftruncate
-.define _truncate
-.define _ftruncate
-.align 2
+.globl _truncate
+.globl _ftruncate
+.balign 2
_truncate:
jmp __truncate
-.align 2
+.balign 2
_ftruncate:
jmp __ftruncate
-.sect .text
+.text
.extern __umask
-.define _umask
-.align 2
+.globl _umask
+.balign 2
_umask:
jmp __umask
-.sect .text
+.text
.extern __umount
-.define _umount
-.align 2
+.globl _umount
+.balign 2
_umount:
jmp __umount
-.sect .text
+.text
.extern __uname
-.define _uname
-.align 2
+.globl _uname
+.balign 2
_uname:
jmp __uname
-.sect .text
+.text
.extern __unlink
-.define _unlink
-.align 2
+.globl _unlink
+.balign 2
_unlink:
jmp __unlink
-.sect .text
+.text
.extern __utime
-.define _utime
-.align 2
+.globl _utime
+.balign 2
_utime:
jmp __utime
-.sect .text
+.text
.extern __vm_adddma
-.define _vm_adddma
+.globl _vm_adddma
.extern __vm_deldma
-.define _vm_deldma
+.globl _vm_deldma
.extern __vm_getdma
-.define _vm_getdma
-.align 2
+.globl _vm_getdma
+.balign 2
_vm_adddma:
jmp __vm_adddma
jmp __vm_deldma
_vm_getdma:
jmp __vm_getdma
-
-.sect .text
+.text
.extern __vm_getphys
-.define _vm_getphys
-.align 2
+.globl _vm_getphys
+.balign 2
_vm_getphys:
jmp __vm_getphys
-.sect .text
+.text
.extern __vm_getrefcount
-.define _vm_getrefcount
-.align 2
+.globl _vm_getrefcount
+.balign 2
_vm_getrefcount:
jmp __vm_getrefcount
--- /dev/null
+.text
+.extern __vm_query_exit
+.globl _vm_query_exit
+.balign 2
+
+_vm_query_exit:
+ jmp __vm_query_exit
+++ /dev/null
-.sect .text
-.extern __vm_query_exit
-.define _vm_query_exit
-.align 2
-
-_vm_query_exit:
- jmp __vm_query_exit
-.sect .text
+.text
.extern __vm_remap
-.define _vm_remap
-.align 2
+.globl _vm_remap
+.balign 2
_vm_remap:
jmp __vm_remap
--- /dev/null
+.text
+.extern __vm_set_priv
+.globl _vm_set_priv
+.balign 2
+
+_vm_set_priv:
+ jmp __vm_set_priv
+++ /dev/null
-.sect .text
-.extern __vm_set_priv
-.define _vm_set_priv
-.align 2
-
-_vm_set_priv:
- jmp __vm_set_priv
-.sect .text
+.text
.extern __vm_unmap
-.define _vm_unmap
-.align 2
+.globl _vm_unmap
+.balign 2
_vm_unmap:
jmp __vm_unmap
-.sect .text
+.text
.extern __wait
-.define _wait
-.align 2
+.globl _wait
+.balign 2
_wait:
jmp __wait
-.sect .text
+.text
.extern __waitpid
-.define _waitpid
-.align 2
+.globl _waitpid
+.balign 2
_waitpid:
jmp __waitpid
-.sect .text
+.text
.extern __write
-.define _write
-.align 2
+.globl _write
+.balign 2
_write:
jmp __write
LIB=end
SRCS= \
- edata.s \
- em_end.s \
- end.s \
- etext.s
+ edata.S \
+ em_end.S \
+ end.S \
+ etext.S
.if ${COMPILER_TYPE} == "gnu"
.include "${.CURDIR}/gnu/Makefile.inc"
--- /dev/null
+.text
+#if defined(__ACK__)
+.rom
+#else
+.data
+#endif
+.data
+.balign _EM_WSIZE
+.globl _edata
+_edata:
+++ /dev/null
-#
-.sect .text
-.sect .rom
-.sect .data
-.align _EM_WSIZE
-.define _edata
-_edata:
--- /dev/null
+.text
+.balign _EM_WSIZE
+.globl __etext, endtext
+__etext:
+endtext:
+#if defined(__ACK__)
+.rom
+#else
+.data
+#endif
+.balign _EM_WSIZE
+.globl endrom
+endrom:
+.data
+.balign _EM_WSIZE
+.globl __edata, enddata
+__edata:
+enddata:
+.bss
+.balign _EM_WSIZE
+#if defined(__ACK__)
+.end /* only for declaration of _end, __end or endbss. */
+.globl __end, endbss
+__end:
+endbss:
+#endif
+++ /dev/null
-#
-.sect .text
-.align _EM_WSIZE
-.define __etext, endtext
-__etext:
-endtext:
-.sect .rom
-.align _EM_WSIZE
-.define endrom
-endrom:
-.sect .data
-.align _EM_WSIZE
-.define __edata, enddata
-__edata:
-enddata:
-.sect .bss
-.align _EM_WSIZE
-.sect .end ! only for declaration of _end, __end or endbss.
-.define __end, endbss
-__end:
-endbss:
--- /dev/null
+.text
+#if defined(__ACK__)
+.rom
+#else
+.data
+#endif
+.data
+.bss
+#if defined(__ACK__)
+.end /* only for declaration of _end, __end or endbss. */
+.globl _end
+_end:
+#endif
+++ /dev/null
-.sect .text
-.sect .rom
-.sect .data
-.sect .bss
-.sect .end ! only for declaration of _end, __end or endbss.
-.define _end
-_end:
--- /dev/null
+.text
+.balign _EM_WSIZE
+.globl _etext
+_etext:
+++ /dev/null
-#
-.sect .text
-.align _EM_WSIZE
-.define _etext
-_etext:
# end sources
.PATH: ${.CURDIR}/gnu
-SRCS+=gnu_end.gs
+SRCS+=gnu_end.S
fkey_ctl.c \
tsc_util.c \
report.c \
- read_tsc.s \
+ read_tsc.S \
read_tsc_64.c \
ser_putc.c \
stacktrace.c \
--- /dev/null
+/* */
+/* sections */
+
+
+.globl _read_tsc /* read the cycle counter (Pentium and up) */
+.text
+/**===========================================================================* */
+/* PUBLIC void read_tsc(unsigned long *high, unsigned long *low); */
+/* Read the cycle counter of the CPU. Pentium and up. */
+.balign 16
+_read_tsc:
+ push %edx
+ push %eax
+.byte 0x0f /* this is the RDTSC instruction */
+.byte 0x31 /* it places the TSC in EDX:EAX */
+ push %ebp
+ movl 16(%esp), %ebp
+ movl %edx, (%ebp)
+ movl 20(%esp), %ebp
+ movl %eax, (%ebp)
+ pop %ebp
+ pop %eax
+ pop %edx
+ ret
+
+/**===========================================================================* */
+/* PUBLIC void read_host_time_ns(unsigned long *high, unsigned long *low); */
+/* access real time in ns from host in vmware. */
+.balign 16
+_read_host_time_ns:
+ pushl %edx
+ pushl %eax
+ pushl %ecx
+ movl $0x10001, %ecx
+.byte 0x0f /* this is the RDTSC instruction */
+.byte 0x31 /* it places the TSC in EDX:EAX */
+ pushl %ebp
+ movl 20(%esp), %ebp
+ movl %edx, (%ebp)
+ movl 24(%esp), %ebp
+ movl %eax, (%ebp)
+ popl %ebp
+ popl %ecx
+ popl %eax
+ popl %edx
+ ret
+++ /dev/null
-#
-! sections
-
-.sect .text; .sect .rom; .sect .data; .sect .bss
-
-.define _read_tsc ! read the cycle counter (Pentium and up)
-
-.sect .text
-!*===========================================================================*
-! PUBLIC void read_tsc(unsigned long *high, unsigned long *low);
-! Read the cycle counter of the CPU. Pentium and up.
-.align 16
-_read_tsc:
- push edx
- push eax
-.data1 0x0f ! this is the RDTSC instruction
-.data1 0x31 ! it places the TSC in EDX:EAX
- push ebp
- mov ebp, 16(esp)
- mov (ebp), edx
- mov ebp, 20(esp)
- mov (ebp), eax
- pop ebp
- pop eax
- pop edx
- ret
-
-!*===========================================================================*
-! PUBLIC void read_host_time_ns(unsigned long *high, unsigned long *low);
-! access real time in ns from host in vmware.
-.align 16
-_read_host_time_ns:
- push edx
- push eax
- push ecx
- mov ecx, 0x10001
-.data1 0x0f ! this is the RDPMC instruction
-.data1 0x33 ! it places the result in EDX:EAX
- push ebp
- mov ebp, 20(esp)
- mov (ebp), edx
- mov ebp, 24(esp)
- mov (ebp), eax
- pop ebp
- pop ecx
- pop eax
- pop edx
- ret
-
link.o misc.o path.o rpc.o time.o
AR=ar
-GAS2ACK=gas2ack
+GAS2ACK=gas2ack -u
all build: $(LIBNAME)