Buildsystem changes for GCC
-Makefile updates -Update mkdep -Build fixes/warning cleanups for some programs -Restore leading underscores on global syms in kernel asm files -Increase ramdisk size
This commit is contained in:
parent
bcdaf033b5
commit
b0159ad168
|
|
@ -1,5 +1,9 @@
|
||||||
# Makefile for the boot monitor package.
|
# Makefile for the boot monitor package.
|
||||||
|
|
||||||
|
# XXX: Can only be built with ACK currently
|
||||||
|
CC:=${CC:C/^gcc/cc/}
|
||||||
|
COMPILER_TYPE:=ack
|
||||||
|
|
||||||
PROGS= bootblock cdbootblock bootexec boot masterboot \
|
PROGS= bootblock cdbootblock bootexec boot masterboot \
|
||||||
jumpboot installboot edparams
|
jumpboot installboot edparams
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ PROG= aal
|
||||||
SRCS= archiver.c print.c rd.c rd_arhdr.c rd_unsig2.c sprint.c \
|
SRCS= archiver.c print.c rd.c rd_arhdr.c rd_unsig2.c sprint.c \
|
||||||
wr_arhdr.c wr_bytes.c wr_int2.c wr_long.c wr_ranlib.c \
|
wr_arhdr.c wr_bytes.c wr_int2.c wr_long.c wr_ranlib.c \
|
||||||
format.c rd_bytes.c system.c write.c long2str.c
|
format.c rd_bytes.c system.c write.c long2str.c
|
||||||
CPPFLAGS+= -I${.CURDIR} -wo -DAAL -DSTB -DNDEBUG -DDISTRIBUTION
|
CPPFLAGS+= -I${.CURDIR} -DAAL -DSTB -DNDEBUG -DDISTRIBUTION
|
||||||
|
|
||||||
LINKS+= ${BINDIR}/aal ${BINDIR}/ar
|
LINKS+= ${BINDIR}/aal ${BINDIR}/ar
|
||||||
MAN=
|
MAN=
|
||||||
|
|
|
||||||
|
|
@ -793,4 +793,4 @@ enter_name(namep)
|
||||||
}
|
}
|
||||||
tnum++;
|
tnum++;
|
||||||
}
|
}
|
||||||
#endif AAL
|
#endif /* AAL */
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@
|
||||||
# define ACKM "minix"
|
# define ACKM "minix"
|
||||||
|
|
||||||
/* size of local machine, either 0 (for 16 bit address space), or 1 */
|
/* size of local machine, either 0 (for 16 bit address space), or 1 */
|
||||||
# undef BIGMACHINE 1
|
# undef BIGMACHINE
|
||||||
|
|
||||||
/* operating system, SYS_5, V7, BSD4_1 or BSD4_2; Do NOT delete the comment
|
/* operating system, SYS_5, V7, BSD4_1 or BSD4_2; Do NOT delete the comment
|
||||||
in the next line! */
|
in the next line! */
|
||||||
|
|
|
||||||
|
|
@ -44,4 +44,4 @@ extern File _sys_ftab[];
|
||||||
|
|
||||||
/* system's idea of block */
|
/* system's idea of block */
|
||||||
#define BUFSIZ 1024
|
#define BUFSIZ 1024
|
||||||
#endif __SYSTEM_INCLUDED__
|
#endif /* __SYSTEM_INCLUDED__ */
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
PROGS= anm asize
|
PROGS= anm asize
|
||||||
SRCS.anm= anm.c rd.c rd_arhdr.c rd_bytes.c rd_unsig2.c
|
SRCS.anm= anm.c rd.c rd_arhdr.c rd_bytes.c rd_unsig2.c
|
||||||
SRCS.asize= asize.c
|
SRCS.asize= asize.c
|
||||||
CPPFLAGS+= -I${.CURDIR} -wo
|
CPPFLAGS+= -I${.CURDIR}
|
||||||
MAN.anm=
|
MAN.anm=
|
||||||
MAN.asize=
|
MAN.asize=
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@
|
||||||
#
|
#
|
||||||
#DEFS = -DUNIX -DMALLOCH
|
#DEFS = -DUNIX -DMALLOCH
|
||||||
DEFS= -DUNIX -DUSG -DSTDLIB
|
DEFS= -DUNIX -DUSG -DSTDLIB
|
||||||
CPPFLAGS+= -i -f -wo ${DEFS}
|
CPPFLAGS+= ${DEFS}
|
||||||
|
|
||||||
PROGS= bsfilt cawf
|
PROGS= bsfilt cawf
|
||||||
SRCS.cawf= cawf.c device.c error.c expand.c expr.c getopt.c macsup.c nreq.c \
|
SRCS.cawf= cawf.c device.c error.c expand.c expr.c getopt.c macsup.c nreq.c \
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,6 @@
|
||||||
|
|
||||||
PROG= dis88
|
PROG= dis88
|
||||||
SRCS= disrel.c dismain.c distabs.c dishand.c disfp.c
|
SRCS= disrel.c dismain.c distabs.c dishand.c disfp.c
|
||||||
CPPFLAGS+= -wo
|
|
||||||
MAN=
|
MAN=
|
||||||
|
|
||||||
.include <minix.prog.mk>
|
.include <minix.prog.mk>
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,9 @@
|
||||||
# Makefile for elle
|
# Makefile for elle
|
||||||
|
|
||||||
|
# XXX: Can only be built with ACK currently
|
||||||
|
CC:=${CC:C/^gcc/cc/}
|
||||||
|
COMPILER_TYPE:=ack
|
||||||
|
|
||||||
PROGS= ellec elle
|
PROGS= ellec elle
|
||||||
SRCS.elle= eemain.c eecmds.c eesite.c eevini.c eedisp.c eeterm.c eeerr.c \
|
SRCS.elle= eemain.c eecmds.c eesite.c eevini.c eedisp.c eeterm.c eeerr.c \
|
||||||
eeques.c eebuff.c eefile.c eefed.c eeedit.c eebit.c eef1.c \
|
eeques.c eebuff.c eefile.c eefed.c eeedit.c eebit.c eef1.c \
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,6 @@
|
||||||
|
|
||||||
PROG= ftp
|
PROG= ftp
|
||||||
SRCS= ftp.c local.c file.c xfer.c other.c net.c crc.c
|
SRCS= ftp.c local.c file.c xfer.c other.c net.c crc.c
|
||||||
CPPFLAGS+= -DCRC_ONLY -m
|
CPPFLAGS+= -DCRC_ONLY
|
||||||
|
|
||||||
.include <minix.prog.mk>
|
.include <minix.prog.mk>
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,6 @@
|
||||||
|
|
||||||
PROG= in.ftpd
|
PROG= in.ftpd
|
||||||
SRCS= ftpd.c access.c file.c net.c
|
SRCS= ftpd.c access.c file.c net.c
|
||||||
CPPFLAGS+= -m
|
|
||||||
MAN= ftpd.8
|
MAN= ftpd.8
|
||||||
SCRIPTS= ftpdsh
|
SCRIPTS= ftpdsh
|
||||||
FILES= setup.anonftp
|
FILES= setup.anonftp
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
PROG= indent
|
PROG= indent
|
||||||
SRCS= args.c comment.c lexi.c indent.c parse.c io.c
|
SRCS= args.c comment.c lexi.c indent.c parse.c io.c
|
||||||
CPPFLAGS+= -wo -m
|
|
||||||
MAN=
|
MAN=
|
||||||
|
|
||||||
.include <minix.prog.mk>
|
.include <minix.prog.mk>
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
PROG= mined
|
PROG= mined
|
||||||
SRCS= mined1.c mined2.c
|
SRCS= mined1.c mined2.c
|
||||||
CPPFLAGS+= -wo
|
|
||||||
MAN=
|
MAN=
|
||||||
|
|
||||||
.include <minix.prog.mk>
|
.include <minix.prog.mk>
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ case $# in
|
||||||
s/.*"\(.*\)".*/\1/
|
s/.*"\(.*\)".*/\1/
|
||||||
s:^\./::' \
|
s:^\./::' \
|
||||||
-e '/^<built-in>$/d' \
|
-e '/^<built-in>$/d' \
|
||||||
-e '/^<command line>$/d' \
|
-e '/^<command.line>$/d' \
|
||||||
-e "s:^:$o\: :" | \
|
-e "s:^:$o\: :" | \
|
||||||
sort -u
|
sort -u
|
||||||
done
|
done
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
PROG= patch
|
PROG= patch
|
||||||
SRCS= patch.c pch.c inp.c util.c version.c
|
SRCS= patch.c pch.c inp.c util.c version.c
|
||||||
CPPFLAGS+= -DVOIDSIG -wo -DSMALL
|
CPPFLAGS+= -DVOIDSIG -DSMALL
|
||||||
MAN=
|
MAN=
|
||||||
|
|
||||||
.include <minix.prog.mk>
|
.include <minix.prog.mk>
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ size_t strncpy_from_user(char *addr, const char *user_name, size_t size)
|
||||||
|
|
||||||
/* void lock_kernel(void) { assert(0); } */
|
/* void lock_kernel(void) { assert(0); } */
|
||||||
/* void unlock_kernel(void) { assert(0); } */
|
/* void unlock_kernel(void) { assert(0); } */
|
||||||
void __asm__(char *str) { assert(0); }
|
/* void __asm__(char *str) { assert(0); } */
|
||||||
|
|
||||||
extern void *__vmalloc(unsigned long size, int gfp_mask, pgprot_t prot)
|
extern void *__vmalloc(unsigned long size, int gfp_mask, pgprot_t prot)
|
||||||
{ assert(0); }
|
{ assert(0); }
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@ size_t strncpy_from_user(char *addr, const char *user_name, size_t size);
|
||||||
void lock_kernel(void);
|
void lock_kernel(void);
|
||||||
void unlock_kernel(void);
|
void unlock_kernel(void);
|
||||||
|
|
||||||
void __asm__(char *str);
|
/* void __asm__(char *str); */
|
||||||
|
|
||||||
#define for_each_task(t) for(t= task_list; t; t=t->next)
|
#define for_each_task(t) for(t= task_list; t; t=t->next)
|
||||||
extern struct task_struct *task_list;
|
extern struct task_struct *task_list;
|
||||||
|
|
|
||||||
|
|
@ -61,7 +61,7 @@
|
||||||
#include "swifi.h"
|
#include "swifi.h"
|
||||||
|
|
||||||
#include "extra.h"
|
#include "extra.h"
|
||||||
|
#include <assert.h>
|
||||||
|
|
||||||
#define CRASH_INTERVAL 8192
|
#define CRASH_INTERVAL 8192
|
||||||
#define FI_MASK 0xfff
|
#define FI_MASK 0xfff
|
||||||
|
|
@ -310,9 +310,13 @@ sys_inject_fault(char * module_name,
|
||||||
addr1 = (unsigned long *) 0xf0212000;
|
addr1 = (unsigned long *) 0xf0212000;
|
||||||
addr2 = (unsigned long *) 0xf0212010;
|
addr2 = (unsigned long *) 0xf0212010;
|
||||||
PDEBUG(("%p=%lx, %p=%lx\n", addr1, *addr1, addr2, *addr2));
|
PDEBUG(("%p=%lx, %p=%lx\n", addr1, *addr1, addr2, *addr2));
|
||||||
|
/*
|
||||||
__asm__ ("movl $0xf0212000, %eax\n\t" \
|
__asm__ ("movl $0xf0212000, %eax\n\t" \
|
||||||
"movl $6, 0(%eax)\n\t" \
|
"movl $6, 0(%eax)\n\t" \
|
||||||
"movl $6, 4(%eax)\n\t");
|
"movl $6, 4(%eax)\n\t");
|
||||||
|
*/
|
||||||
|
/* Not implemented on MINIX */
|
||||||
|
assert(0);
|
||||||
addr1 = (unsigned long *) 0xf0212000;
|
addr1 = (unsigned long *) 0xf0212000;
|
||||||
addr2 = (unsigned long *) 0xf0212010;
|
addr2 = (unsigned long *) 0xf0212010;
|
||||||
PDEBUG(("after injecting fault\n"));
|
PDEBUG(("after injecting fault\n"));
|
||||||
|
|
@ -323,9 +327,13 @@ sys_inject_fault(char * module_name,
|
||||||
|
|
||||||
case DEBUGGER_FAULT:
|
case DEBUGGER_FAULT:
|
||||||
PDEBUG(("Debugger fault"));
|
PDEBUG(("Debugger fault"));
|
||||||
|
/*
|
||||||
__asm__ ("movl %cr4, %ecx\n\t" \
|
__asm__ ("movl %cr4, %ecx\n\t" \
|
||||||
"movl $42, %ecx; .byte 0x0f, 0x32\n\t" \
|
"movl $42, %ecx; .byte 0x0f, 0x32\n\t" \
|
||||||
"movl $377, %ecx; .byte 0x0f, 0x32\n\t");
|
"movl $377, %ecx; .byte 0x0f, 0x32\n\t");
|
||||||
|
*/
|
||||||
|
/* Not implemented on MINIX */
|
||||||
|
assert(0);
|
||||||
result = 0;
|
result = 0;
|
||||||
break;
|
break;
|
||||||
default: PDEBUG(("unknown fault type %ld\n", faultType)); break;
|
default: PDEBUG(("unknown fault type %ld\n", faultType)); break;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
PROG= synctree
|
PROG= synctree
|
||||||
CPPFLAGS+= -wo
|
|
||||||
MAN=
|
MAN=
|
||||||
|
|
||||||
.include <minix.prog.mk>
|
.include <minix.prog.mk>
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,9 @@
|
||||||
# yap Makefile
|
# yap Makefile
|
||||||
|
|
||||||
|
# XXX: Can only be built with ACK currently
|
||||||
|
CC:=${CC:C/^gcc/cc/}
|
||||||
|
COMPILER_TYPE:=ack
|
||||||
|
|
||||||
PROG= yap
|
PROG= yap
|
||||||
SRCS= assert.c commands.c display.c getcomm.c getline.c help.c \
|
SRCS= assert.c commands.c display.c getcomm.c getline.c help.c \
|
||||||
keys.c machine.c main.c options.c output.c pattern.c \
|
keys.c machine.c main.c options.c output.c pattern.c \
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
# Makefile for zmodem
|
# Makefile for zmodem
|
||||||
|
|
||||||
PROGS= rz sz
|
PROGS= rz sz
|
||||||
CPPFLAGS+= -DPOSIX -wo
|
CPPFLAGS+= -DPOSIX
|
||||||
MAN.rz=
|
MAN.rz=
|
||||||
MAN.sz=
|
MAN.sz=
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ PROGRAMS=at_wini bios_wini cdprobe dev2name floppy loadramdisk newroot \
|
||||||
pci sh service sysenv mfs
|
pci sh service sysenv mfs
|
||||||
EXTRA=system.conf passwd
|
EXTRA=system.conf passwd
|
||||||
|
|
||||||
|
CPPFLAGS+= -I${MINIXSRCDIR}/servers
|
||||||
MAKEDEV=/usr/bin/MAKEDEV
|
MAKEDEV=/usr/bin/MAKEDEV
|
||||||
|
|
||||||
all: image.c
|
all: image.c
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
boot
|
boot
|
||||||
200 400
|
500 400
|
||||||
d--755 0 0
|
d--755 0 0
|
||||||
bin d--755 0 0
|
bin d--755 0 0
|
||||||
at_wini ---755 0 0 at_wini
|
at_wini ---755 0 0 at_wini
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
CPPFLAGS+= -wo
|
||||||
|
|
||||||
.SUFFIXES: .o .e .S
|
.SUFFIXES: .o .e .S
|
||||||
|
|
||||||
# Treated like a C file
|
# Treated like a C file
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ MKDEP_SUFFIXES?= .o
|
||||||
# some of the rules involve .h sources, so remove them from mkdep line
|
# some of the rules involve .h sources, so remove them from mkdep line
|
||||||
|
|
||||||
.if defined(SRCS) # {
|
.if defined(SRCS) # {
|
||||||
_TRADITIONAL_CPP?=-traditional-cpp
|
#_TRADITIONAL_CPP?=-traditional-cpp
|
||||||
__acpp_flags= ${_TRADITIONAL_CPP}
|
__acpp_flags= ${_TRADITIONAL_CPP}
|
||||||
|
|
||||||
__DPSRCS.all= ${SRCS:C/\.(c|m|s|S|C|cc|cpp|cxx)$/.d/} \
|
__DPSRCS.all= ${SRCS:C/\.(c|m|s|S|C|cc|cpp|cxx)$/.d/} \
|
||||||
|
|
|
||||||
|
|
@ -1,2 +1 @@
|
||||||
AFLAGS+=-D__ASSEMBLY__ -D_EM_WSIZE=4 -D__minix
|
AFLAGS+=-D__ASSEMBLY__ -D_EM_WSIZE=4 -D__minix
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,9 +6,6 @@ _MINIX_OWN_MK_=1
|
||||||
MAKECONF?= /etc/make.conf
|
MAKECONF?= /etc/make.conf
|
||||||
.-include "${MAKECONF}"
|
.-include "${MAKECONF}"
|
||||||
|
|
||||||
#Set to ack by default
|
|
||||||
COMPILER_TYPE?=ack
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# CPU model, derived from MACHINE_ARCH
|
# CPU model, derived from MACHINE_ARCH
|
||||||
#
|
#
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,8 @@ AS?= as
|
||||||
AFLAGS?=
|
AFLAGS?=
|
||||||
COMPILE.s?= ${CC} ${AFLAGS} -c
|
COMPILE.s?= ${CC} ${AFLAGS} -c
|
||||||
LINK.s?= ${CC} ${AFLAGS} ${LDFLAGS}
|
LINK.s?= ${CC} ${AFLAGS} ${LDFLAGS}
|
||||||
COMPILE.S?= ${CC} ${AFLAGS} ${CPPFLAGS} -c -traditional-cpp
|
#COMPILE.S?= ${CC} ${AFLAGS} ${CPPFLAGS} -c -traditional-cpp
|
||||||
|
COMPILE.S?= ${CC} ${AFLAGS} ${CPPFLAGS} -c
|
||||||
LINK.S?= ${CC} ${AFLAGS} ${CPPFLAGS} ${LDFLAGS}
|
LINK.S?= ${CC} ${AFLAGS} ${CPPFLAGS} ${LDFLAGS}
|
||||||
|
|
||||||
CC?= cc
|
CC?= cc
|
||||||
|
|
@ -223,3 +224,11 @@ YACC.y?= ${YACC} ${YFLAGS}
|
||||||
# rm -f ${.TARGET}
|
# rm -f ${.TARGET}
|
||||||
# cp ${.IMPSRC} ${.TARGET}
|
# cp ${.IMPSRC} ${.TARGET}
|
||||||
# chmod a+x ${.TARGET}
|
# chmod a+x ${.TARGET}
|
||||||
|
|
||||||
|
# MINIX
|
||||||
|
.if !empty(CC:Mcc)
|
||||||
|
COMPILER_TYPE=ack
|
||||||
|
.elif !empty(CC:Mgcc)
|
||||||
|
COMPILER_TYPE=gnu
|
||||||
|
AR=gar
|
||||||
|
.endif
|
||||||
|
|
|
||||||
|
|
@ -12,13 +12,19 @@ SRCS+= start.c table.c main.c proc.c \
|
||||||
DPADD+= ${LIBTIMERS} ${LIBSYS}
|
DPADD+= ${LIBTIMERS} ${LIBSYS}
|
||||||
LDADD+= -ltimers -lsys
|
LDADD+= -ltimers -lsys
|
||||||
|
|
||||||
LDFLAGS+= -.o
|
.if ${COMPILER_TYPE} == "ack"
|
||||||
|
LDFLAGS+= -.o
|
||||||
|
.elif ${COMPILER_TYPE} == "gnu"
|
||||||
|
CPPFLAGS+= -fno-builtin -ffreestanding -fno-stack-protector
|
||||||
|
LDFLAGS+= -T arch/${ARCH}/kernel.lds
|
||||||
|
LDFLAGS+= -nostdlib
|
||||||
|
DPADD+= ${LIBC}
|
||||||
|
LDADD+= -lgcc -lc -lgcc
|
||||||
|
.endif
|
||||||
|
|
||||||
CPPFLAGS+= -I${.CURDIR}/arch/${ARCH}/include -I${MINIXSRCDIR}
|
CPPFLAGS+= -I${.CURDIR}/arch/${ARCH}/include -I${MINIXSRCDIR}
|
||||||
AFLAGS+= -I${.CURDIR}/arch/${ARCH}/include -I${MINIXSRCDIR}
|
AFLAGS+= -I${.CURDIR}/arch/${ARCH}/include -I${MINIXSRCDIR}
|
||||||
|
|
||||||
#Tell ASMCONV to prepend underscores to symbols
|
|
||||||
ASMCONVFLAGS+= -u
|
|
||||||
|
|
||||||
INSTALLFLAGS+= -S 0
|
INSTALLFLAGS+= -S 0
|
||||||
BINDIR= /usr/sbin
|
BINDIR= /usr/sbin
|
||||||
MAN=
|
MAN=
|
||||||
|
|
|
||||||
|
|
@ -3,29 +3,29 @@
|
||||||
#include "sconst.h"
|
#include "sconst.h"
|
||||||
#include "apic_asm.h"
|
#include "apic_asm.h"
|
||||||
|
|
||||||
.globl apic_hwint00 /* handlers for hardware interrupts */
|
.globl _apic_hwint00 /* handlers for hardware interrupts */
|
||||||
.globl apic_hwint01
|
.globl _apic_hwint01
|
||||||
.globl apic_hwint02
|
.globl _apic_hwint02
|
||||||
.globl apic_hwint03
|
.globl _apic_hwint03
|
||||||
.globl apic_hwint04
|
.globl _apic_hwint04
|
||||||
.globl apic_hwint05
|
.globl _apic_hwint05
|
||||||
.globl apic_hwint06
|
.globl _apic_hwint06
|
||||||
.globl apic_hwint07
|
.globl _apic_hwint07
|
||||||
.globl apic_hwint08
|
.globl _apic_hwint08
|
||||||
.globl apic_hwint09
|
.globl _apic_hwint09
|
||||||
.globl apic_hwint10
|
.globl _apic_hwint10
|
||||||
.globl apic_hwint11
|
.globl _apic_hwint11
|
||||||
.globl apic_hwint12
|
.globl _apic_hwint12
|
||||||
.globl apic_hwint13
|
.globl _apic_hwint13
|
||||||
.globl apic_hwint14
|
.globl _apic_hwint14
|
||||||
.globl apic_hwint15
|
.globl _apic_hwint15
|
||||||
|
|
||||||
.text
|
.text
|
||||||
#define APIC_IRQ_HANDLER(irq) \
|
#define APIC_IRQ_HANDLER(irq) \
|
||||||
push $irq ;\
|
push $irq ;\
|
||||||
call irq_handle /* intr_handle(irq_handlers[irq]) */ ;\
|
call _irq_handle /* intr_handle(irq_handlers[irq]) */ ;\
|
||||||
add $4, %esp ;\
|
add $4, %esp ;\
|
||||||
mov lapic_eoi_addr, %eax ;\
|
mov _lapic_eoi_addr, %eax ;\
|
||||||
movl $0, (%eax) ;\
|
movl $0, (%eax) ;\
|
||||||
|
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
|
|
@ -38,15 +38,15 @@
|
||||||
\
|
\
|
||||||
SAVE_PROCESS_CTX(0) ;\
|
SAVE_PROCESS_CTX(0) ;\
|
||||||
push %ebp ;\
|
push %ebp ;\
|
||||||
call context_stop ;\
|
call _context_stop ;\
|
||||||
add $4, %esp ;\
|
add $4, %esp ;\
|
||||||
movl $0, %ebp /* for stack trace */ ;\
|
movl $0, %ebp /* for stack trace */ ;\
|
||||||
APIC_IRQ_HANDLER(irq) ;\
|
APIC_IRQ_HANDLER(irq) ;\
|
||||||
jmp switch_to_user ;\
|
jmp _switch_to_user ;\
|
||||||
\
|
\
|
||||||
0: \
|
0: \
|
||||||
pusha ;\
|
pusha ;\
|
||||||
call context_stop_idle ;\
|
call _context_stop_idle ;\
|
||||||
APIC_IRQ_HANDLER(irq) ;\
|
APIC_IRQ_HANDLER(irq) ;\
|
||||||
CLEAR_IF(10*4(%esp)) ;\
|
CLEAR_IF(10*4(%esp)) ;\
|
||||||
popa ;\
|
popa ;\
|
||||||
|
|
@ -54,82 +54,82 @@
|
||||||
|
|
||||||
/* Each of these entry points is an expansion of the hwint_master macro */
|
/* Each of these entry points is an expansion of the hwint_master macro */
|
||||||
.balign 16
|
.balign 16
|
||||||
apic_hwint00:
|
_apic_hwint00:
|
||||||
/* Interrupt routine for irq 0 (the clock). */
|
/* Interrupt routine for irq 0 (the clock). */
|
||||||
apic_hwint(0)
|
apic_hwint(0)
|
||||||
|
|
||||||
.balign 16
|
.balign 16
|
||||||
apic_hwint01:
|
_apic_hwint01:
|
||||||
/* Interrupt routine for irq 1 (keyboard) */
|
/* Interrupt routine for irq 1 (keyboard) */
|
||||||
apic_hwint(1)
|
apic_hwint(1)
|
||||||
|
|
||||||
.balign 16
|
.balign 16
|
||||||
apic_hwint02:
|
_apic_hwint02:
|
||||||
/* Interrupt routine for irq 2 (cascade!) */
|
/* Interrupt routine for irq 2 (cascade!) */
|
||||||
apic_hwint(2)
|
apic_hwint(2)
|
||||||
|
|
||||||
.balign 16
|
.balign 16
|
||||||
apic_hwint03:
|
_apic_hwint03:
|
||||||
/* Interrupt routine for irq 3 (second serial) */
|
/* Interrupt routine for irq 3 (second serial) */
|
||||||
apic_hwint(3)
|
apic_hwint(3)
|
||||||
|
|
||||||
.balign 16
|
.balign 16
|
||||||
apic_hwint04:
|
_apic_hwint04:
|
||||||
/* Interrupt routine for irq 4 (first serial) */
|
/* Interrupt routine for irq 4 (first serial) */
|
||||||
apic_hwint(4)
|
apic_hwint(4)
|
||||||
|
|
||||||
.balign 16
|
.balign 16
|
||||||
apic_hwint05:
|
_apic_hwint05:
|
||||||
/* Interrupt routine for irq 5 (XT winchester) */
|
/* Interrupt routine for irq 5 (XT winchester) */
|
||||||
apic_hwint(5)
|
apic_hwint(5)
|
||||||
|
|
||||||
.balign 16
|
.balign 16
|
||||||
apic_hwint06:
|
_apic_hwint06:
|
||||||
/* Interrupt routine for irq 6 (floppy) */
|
/* Interrupt routine for irq 6 (floppy) */
|
||||||
apic_hwint(6)
|
apic_hwint(6)
|
||||||
|
|
||||||
.balign 16
|
.balign 16
|
||||||
apic_hwint07:
|
_apic_hwint07:
|
||||||
/* Interrupt routine for irq 7 (printer) */
|
/* Interrupt routine for irq 7 (printer) */
|
||||||
apic_hwint(7)
|
apic_hwint(7)
|
||||||
|
|
||||||
.balign 16
|
.balign 16
|
||||||
apic_hwint08:
|
_apic_hwint08:
|
||||||
/* Interrupt routine for irq 8 (realtime clock) */
|
/* Interrupt routine for irq 8 (realtime clock) */
|
||||||
apic_hwint(8)
|
apic_hwint(8)
|
||||||
|
|
||||||
.balign 16
|
.balign 16
|
||||||
apic_hwint09:
|
_apic_hwint09:
|
||||||
/* Interrupt routine for irq 9 (irq 2 redirected) */
|
/* Interrupt routine for irq 9 (irq 2 redirected) */
|
||||||
apic_hwint(9)
|
apic_hwint(9)
|
||||||
|
|
||||||
.balign 16
|
.balign 16
|
||||||
apic_hwint10:
|
_apic_hwint10:
|
||||||
/* Interrupt routine for irq 10 */
|
/* Interrupt routine for irq 10 */
|
||||||
apic_hwint(10)
|
apic_hwint(10)
|
||||||
|
|
||||||
.balign 16
|
.balign 16
|
||||||
apic_hwint11:
|
_apic_hwint11:
|
||||||
/* Interrupt routine for irq 11 */
|
/* Interrupt routine for irq 11 */
|
||||||
apic_hwint(11)
|
apic_hwint(11)
|
||||||
|
|
||||||
.balign 16
|
.balign 16
|
||||||
apic_hwint12:
|
_apic_hwint12:
|
||||||
/* Interrupt routine for irq 12 */
|
/* Interrupt routine for irq 12 */
|
||||||
apic_hwint(12)
|
apic_hwint(12)
|
||||||
|
|
||||||
.balign 16
|
.balign 16
|
||||||
apic_hwint13:
|
_apic_hwint13:
|
||||||
/* Interrupt routine for irq 13 (FPU exception) */
|
/* Interrupt routine for irq 13 (FPU exception) */
|
||||||
apic_hwint(13)
|
apic_hwint(13)
|
||||||
|
|
||||||
.balign 16
|
.balign 16
|
||||||
apic_hwint14:
|
_apic_hwint14:
|
||||||
/* Interrupt routine for irq 14 (AT winchester) */
|
/* Interrupt routine for irq 14 (AT winchester) */
|
||||||
apic_hwint(14)
|
apic_hwint(14)
|
||||||
|
|
||||||
.balign 16
|
.balign 16
|
||||||
apic_hwint15:
|
_apic_hwint15:
|
||||||
/* Interrupt routine for irq 15 */
|
/* Interrupt routine for irq 15 */
|
||||||
apic_hwint(15)
|
apic_hwint(15)
|
||||||
|
|
||||||
|
|
@ -137,7 +137,7 @@ apic_hwint15:
|
||||||
#define LAPIC_INTR_HANDLER(func) \
|
#define LAPIC_INTR_HANDLER(func) \
|
||||||
movl $func, %eax ;\
|
movl $func, %eax ;\
|
||||||
call *%eax /* call the actual handler */ ;\
|
call *%eax /* call the actual handler */ ;\
|
||||||
mov lapic_eoi_addr, %eax /* the end of handler*/ ;\
|
mov _lapic_eoi_addr, %eax /* the end of handler*/ ;\
|
||||||
movl $0, (%eax) ;
|
movl $0, (%eax) ;
|
||||||
|
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
|
|
@ -149,28 +149,28 @@ apic_hwint15:
|
||||||
\
|
\
|
||||||
SAVE_PROCESS_CTX(0) ;\
|
SAVE_PROCESS_CTX(0) ;\
|
||||||
push %ebp ;\
|
push %ebp ;\
|
||||||
call context_stop ;\
|
call _context_stop ;\
|
||||||
add $4, %esp ;\
|
add $4, %esp ;\
|
||||||
movl $0, %ebp /* for stack trace */ ;\
|
movl $0, %ebp /* for stack trace */ ;\
|
||||||
LAPIC_INTR_HANDLER(func) ;\
|
LAPIC_INTR_HANDLER(func) ;\
|
||||||
jmp switch_to_user ;\
|
jmp _switch_to_user ;\
|
||||||
\
|
\
|
||||||
0: \
|
0: \
|
||||||
pusha ;\
|
pusha ;\
|
||||||
call context_stop_idle ;\
|
call _context_stop_idle ;\
|
||||||
LAPIC_INTR_HANDLER(func) ;\
|
LAPIC_INTR_HANDLER(func) ;\
|
||||||
CLEAR_IF(10*4(%esp)) ;\
|
CLEAR_IF(10*4(%esp)) ;\
|
||||||
popa ;\
|
popa ;\
|
||||||
iret ;
|
iret ;
|
||||||
|
|
||||||
/* apic timer tick handlers */
|
/* apic timer tick handlers */
|
||||||
.globl lapic_bsp_timer_int_handler
|
.globl _lapic_bsp_timer_int_handler
|
||||||
lapic_bsp_timer_int_handler:
|
_lapic_bsp_timer_int_handler:
|
||||||
lapic_intr(bsp_timer_int_handler)
|
lapic_intr(_bsp_timer_int_handler)
|
||||||
|
|
||||||
.globl lapic_ap_timer_int_handler
|
.globl _lapic_ap_timer_int_handler
|
||||||
lapic_ap_timer_int_handler:
|
_lapic_ap_timer_int_handler:
|
||||||
lapic_intr(ap_timer_int_handler)
|
lapic_intr(_ap_timer_int_handler)
|
||||||
|
|
||||||
#ifdef CONFIG_APIC_DEBUG
|
#ifdef CONFIG_APIC_DEBUG
|
||||||
|
|
||||||
|
|
@ -183,15 +183,15 @@ lapic_intr_dummy_handler_msg:
|
||||||
#define lapic_intr_dummy_handler(vect) \
|
#define lapic_intr_dummy_handler(vect) \
|
||||||
pushl $vect; \
|
pushl $vect; \
|
||||||
push $lapic_intr_dummy_handler_msg; \
|
push $lapic_intr_dummy_handler_msg; \
|
||||||
call printf; \
|
call _printf; \
|
||||||
1: jmp 1b; /* never return */
|
1: jmp 1b; /* never return */
|
||||||
|
|
||||||
#define LAPIC_INTR_DUMMY_HANDLER(vect) \
|
#define LAPIC_INTR_DUMMY_HANDLER(vect) \
|
||||||
.balign LAPIC_INTR_DUMMY_HANDLER_SIZE; \
|
.balign LAPIC_INTR_DUMMY_HANDLER_SIZE; \
|
||||||
lapic_intr_dummy_handler_##vect: lapic_intr_dummy_handler(vect)
|
lapic_intr_dummy_handler_##vect: lapic_intr_dummy_handler(vect)
|
||||||
|
|
||||||
.globl lapic_intr_dummy_handles_start
|
.globl _lapic_intr_dummy_handles_start
|
||||||
lapic_intr_dummy_handles_start:
|
_lapic_intr_dummy_handles_start:
|
||||||
|
|
||||||
LAPIC_INTR_DUMMY_HANDLER(0)
|
LAPIC_INTR_DUMMY_HANDLER(0)
|
||||||
LAPIC_INTR_DUMMY_HANDLER(1)
|
LAPIC_INTR_DUMMY_HANDLER(1)
|
||||||
|
|
@ -450,8 +450,8 @@ LAPIC_INTR_DUMMY_HANDLER(253)
|
||||||
LAPIC_INTR_DUMMY_HANDLER(254)
|
LAPIC_INTR_DUMMY_HANDLER(254)
|
||||||
LAPIC_INTR_DUMMY_HANDLER(255)
|
LAPIC_INTR_DUMMY_HANDLER(255)
|
||||||
|
|
||||||
.globl lapic_intr_dummy_handles_end
|
.globl _lapic_intr_dummy_handles_end
|
||||||
lapic_intr_dummy_handles_end:
|
_lapic_intr_dummy_handles_end:
|
||||||
|
|
||||||
|
|
||||||
#endif /* CONFIG_APIC_DEBUG */
|
#endif /* CONFIG_APIC_DEBUG */
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,15 @@
|
||||||
.text
|
.text
|
||||||
|
|
||||||
#define LD_ST_REG(reg) ;\
|
#define LD_ST_REG(reg) ;\
|
||||||
.globl ld_##reg ;\
|
.globl _ld_##reg ;\
|
||||||
.globl st_##reg ;\
|
.globl _st_##reg ;\
|
||||||
;\
|
;\
|
||||||
ld_##reg: ;\
|
_ld_##reg: ;\
|
||||||
mov 4(%esp), %eax ;\
|
mov 4(%esp), %eax ;\
|
||||||
mov %eax, %reg ;\
|
mov %eax, %reg ;\
|
||||||
ret ;\
|
ret ;\
|
||||||
;\
|
;\
|
||||||
st_##reg: ;\
|
_st_##reg: ;\
|
||||||
mov %reg, %eax ;\
|
mov %reg, %eax ;\
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
|
|
||||||
52
kernel/arch/i386/kernel.lds
Normal file
52
kernel/arch/i386/kernel.lds
Normal file
|
|
@ -0,0 +1,52 @@
|
||||||
|
OUTPUT_ARCH("i386")
|
||||||
|
ENTRY(MINIX)
|
||||||
|
SECTIONS
|
||||||
|
{
|
||||||
|
. = 0x0;
|
||||||
|
_text = .;
|
||||||
|
begtext = .;
|
||||||
|
.text.head . : AT (0x0) {
|
||||||
|
*(.text.head)
|
||||||
|
}
|
||||||
|
.text . : AT (ADDR(.text) - 0x0000) {
|
||||||
|
*(.text)
|
||||||
|
*(.text.*)
|
||||||
|
. = ALIGN(4096);
|
||||||
|
}
|
||||||
|
_etext = .;
|
||||||
|
etext = .;
|
||||||
|
|
||||||
|
_data = .;
|
||||||
|
begdata = .;
|
||||||
|
.data . : AT (ADDR(.data) - 0x0000) {
|
||||||
|
_rodata = .;
|
||||||
|
/* kernel data starts with this magic number */
|
||||||
|
SHORT(0x526f);
|
||||||
|
*(.rodata)
|
||||||
|
*(.rodata.*)
|
||||||
|
_erodata = .;
|
||||||
|
*(.data)
|
||||||
|
*(.data.*)
|
||||||
|
}
|
||||||
|
_edata = .;
|
||||||
|
_bss = .;
|
||||||
|
begbss = .;
|
||||||
|
.bss . : AT (ADDR(.bss) - 0x0000) {
|
||||||
|
*(.bss)
|
||||||
|
*(.bss.*)
|
||||||
|
*(COMMON)
|
||||||
|
}
|
||||||
|
_ebss = .;
|
||||||
|
endbss = .;
|
||||||
|
_end = .;
|
||||||
|
end = .;
|
||||||
|
|
||||||
|
/DISCARD/ :
|
||||||
|
{
|
||||||
|
*(.eh_frame)
|
||||||
|
*(.comment)
|
||||||
|
*(.comment.*)
|
||||||
|
*(.note)
|
||||||
|
*(.note.*)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -13,41 +13,43 @@
|
||||||
* kernel. They are:
|
* kernel. They are:
|
||||||
*/
|
*/
|
||||||
|
|
||||||
.globl monitor /* exit Minix and return to the monitor */
|
.globl _monitor/* exit Minix and return to the monitor */
|
||||||
.globl int86 /* let the monitor make an 8086 interrupt call */
|
.globl _int86 /* let the monitor make an 8086 interrupt call */
|
||||||
.globl exit /* dummy for library routines */
|
#ifdef __ACK__
|
||||||
.globl _exit /* dummy for library routines */
|
.globl _exit /* dummy for library routines */
|
||||||
.globl __exit /* dummy for library routines */
|
.globl __exit /* dummy for library routines */
|
||||||
.globl __main /* dummy for GCC */
|
.globl ___exit /* dummy for library routines */
|
||||||
.globl phys_insw /* transfer data from (disk controller) port to memory */
|
#endif
|
||||||
.globl phys_insb /* likewise byte by byte */
|
.globl ___main /* dummy for GCC */
|
||||||
.globl phys_outsw /* transfer data from memory to (disk controller) port */
|
.globl _phys_insw /* transfer data from (disk controller) port to memory */
|
||||||
.globl phys_outsb /* likewise byte by byte */
|
.globl _phys_insb /* likewise byte by byte */
|
||||||
.globl phys_copy /* copy data from anywhere to anywhere in memory */
|
.globl _phys_outsw /* transfer data from memory to (disk controller) port */
|
||||||
.globl phys_copy_fault /* phys_copy pagefault */
|
.globl _phys_outsb /* likewise byte by byte */
|
||||||
.globl phys_copy_fault_in_kernel /* phys_copy pagefault in kernel */
|
.globl _phys_copy /* copy data from anywhere to anywhere in memory */
|
||||||
.globl phys_memset /* write pattern anywhere in memory */
|
.globl _phys_copy_fault /* phys_copy pagefault */
|
||||||
|
.globl _phys_copy_fault_in_kernel /* phys_copy pagefault in kernel */
|
||||||
|
.globl _phys_memset /* write pattern anywhere in memory */
|
||||||
.globl mem_rdw /* copy one word from [segment:offset] */
|
.globl mem_rdw /* copy one word from [segment:offset] */
|
||||||
.globl reset /* reset the system */
|
.globl _reset /* reset the system */
|
||||||
.globl halt_cpu/* halts the current cpu when idle */
|
.globl _halt_cpu/* halts the current cpu when idle */
|
||||||
.globl read_cpu_flags /* read the cpu flags */
|
.globl _read_cpu_flags /* read the cpu flags */
|
||||||
.globl read_cr0 /* read cr0 */
|
.globl _read_cr0 /* read cr0 */
|
||||||
.globl read_cr2 /* read cr2 */
|
.globl _read_cr2 /* read cr2 */
|
||||||
.globl getcr3val
|
.globl _getcr3val
|
||||||
.globl write_cr0 /* write a value in cr0 */
|
.globl _write_cr0 /* write a value in cr0 */
|
||||||
.globl read_cr3
|
.globl _read_cr3
|
||||||
.globl read_cr4
|
.globl _read_cr4
|
||||||
.globl write_cr4
|
.globl _write_cr4
|
||||||
|
|
||||||
.globl catch_pagefaults
|
.globl _catch_pagefaults
|
||||||
.globl read_ds
|
.globl _read_ds
|
||||||
.globl read_cs
|
.globl _read_cs
|
||||||
.globl read_ss
|
.globl _read_ss
|
||||||
.globl idt_reload /* reload idt when returning to monitor. */
|
.globl _idt_reload /* reload idt when returning to monitor. */
|
||||||
|
|
||||||
.globl fninit /* non-waiting FPU initialization */
|
.globl _fninit /* non-waiting FPU initialization */
|
||||||
.globl fnstsw /* store status word (non-waiting) */
|
.globl _fnstsw /* store status word (non-waiting) */
|
||||||
.globl fnstcw /* store control word (non-waiting) */
|
.globl _fnstcw /* store control word (non-waiting) */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The routines only guarantee to preserve the registers the C compiler
|
* The routines only guarantee to preserve the registers the C compiler
|
||||||
|
|
@ -62,8 +64,8 @@
|
||||||
/* PUBLIC void monitor(); */
|
/* PUBLIC void monitor(); */
|
||||||
/* Return to the monitor. */
|
/* Return to the monitor. */
|
||||||
|
|
||||||
monitor:
|
_monitor:
|
||||||
movl mon_sp, %esp /* restore monitor stack pointer */
|
movl _mon_sp, %esp /* restore monitor stack pointer */
|
||||||
movw $SS_SELECTOR, %dx /* monitor data segment */
|
movw $SS_SELECTOR, %dx /* monitor data segment */
|
||||||
mov %dx, %ds
|
mov %dx, %ds
|
||||||
mov %dx, %es
|
mov %dx, %es
|
||||||
|
|
@ -80,12 +82,12 @@ monitor:
|
||||||
/* int86 */
|
/* int86 */
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
/* PUBLIC void int86(); */
|
/* PUBLIC void int86(); */
|
||||||
int86:
|
_int86:
|
||||||
cmpb $0, mon_return /* is the monitor there? */
|
cmpb $0, _mon_return /* is the monitor there? */
|
||||||
jne 0f
|
jne 0f
|
||||||
movb $0x01, %ah /* an int 13 error seems appropriate */
|
movb $0x01, %ah /* an int 13 error seems appropriate */
|
||||||
movb %ah, reg86+0 /* reg86.w.f = 1 (set carry flag) */
|
movb %ah, _reg86+0 /* reg86.w.f = 1 (set carry flag) */
|
||||||
movb %ah, reg86+13 /* reg86.b.ah = 0x01 = "invalid command" */
|
movb %ah, _reg86+13 /* reg86.b.ah = 0x01 = "invalid command" */
|
||||||
ret
|
ret
|
||||||
0:
|
0:
|
||||||
push %ebp /* save C registers */
|
push %ebp /* save C registers */
|
||||||
|
|
@ -99,7 +101,7 @@ int86:
|
||||||
movb %al, %ah
|
movb %al, %ah
|
||||||
inb $INT_CTLMASK
|
inb $INT_CTLMASK
|
||||||
push %eax /* save interrupt masks */
|
push %eax /* save interrupt masks */
|
||||||
movl irq_use, %eax /* map of in-use IRQ's */
|
movl _irq_use, %eax /* map of in-use IRQ's */
|
||||||
and $~(1<<CLOCK_IRQ), %eax /* keep the clock ticking */
|
and $~(1<<CLOCK_IRQ), %eax /* keep the clock ticking */
|
||||||
outb $INT_CTLMASK /* enable all unused IRQ's and vv. */
|
outb $INT_CTLMASK /* enable all unused IRQ's and vv. */
|
||||||
movb %ah, %al
|
movb %ah, %al
|
||||||
|
|
@ -107,17 +109,17 @@ int86:
|
||||||
|
|
||||||
mov $SS_SELECTOR, %eax /* monitor data segment */
|
mov $SS_SELECTOR, %eax /* monitor data segment */
|
||||||
mov %ax, %ss
|
mov %ax, %ss
|
||||||
xchgl mon_sp, %esp /* switch stacks */
|
xchgl _mon_sp, %esp /* switch stacks */
|
||||||
push reg86+36 /* parameters used in INT call */
|
push _reg86+36 /* parameters used in INT call */
|
||||||
push reg86+32
|
push _reg86+32
|
||||||
push reg86+28
|
push _reg86+28
|
||||||
push reg86+24
|
push _reg86+24
|
||||||
push reg86+20
|
push _reg86+20
|
||||||
push reg86+16
|
push _reg86+16
|
||||||
push reg86+12
|
push _reg86+12
|
||||||
push reg86+8
|
push _reg86+8
|
||||||
push reg86+4
|
push _reg86+4
|
||||||
push reg86+0
|
push _reg86+0
|
||||||
mov %ax, %ds /* remaining data selectors */
|
mov %ax, %ds /* remaining data selectors */
|
||||||
mov %ax, %es
|
mov %ax, %es
|
||||||
mov %ax, %fs
|
mov %ax, %fs
|
||||||
|
|
@ -126,17 +128,17 @@ int86:
|
||||||
push $return /* kernel return address and selector */
|
push $return /* kernel return address and selector */
|
||||||
ljmpw *20+2*4+10*4+2*4(%esp)
|
ljmpw *20+2*4+10*4+2*4(%esp)
|
||||||
return:
|
return:
|
||||||
pop reg86+0
|
pop _reg86+0
|
||||||
pop reg86+4
|
pop _reg86+4
|
||||||
pop reg86+8
|
pop _reg86+8
|
||||||
pop reg86+12
|
pop _reg86+12
|
||||||
pop reg86+16
|
pop _reg86+16
|
||||||
pop reg86+20
|
pop _reg86+20
|
||||||
pop reg86+24
|
pop _reg86+24
|
||||||
pop reg86+28
|
pop _reg86+28
|
||||||
pop reg86+32
|
pop _reg86+32
|
||||||
pop reg86+36
|
pop _reg86+36
|
||||||
lgdt gdt+GDT_SELECTOR /* reload global descriptor table */
|
lgdt _gdt+GDT_SELECTOR /* reload global descriptor table */
|
||||||
ljmp $CS_SELECTOR, $csinit
|
ljmp $CS_SELECTOR, $csinit
|
||||||
csinit:
|
csinit:
|
||||||
mov $DS_SELECTOR, %eax
|
mov $DS_SELECTOR, %eax
|
||||||
|
|
@ -145,8 +147,8 @@ csinit:
|
||||||
mov %ax, %fs
|
mov %ax, %fs
|
||||||
mov %ax, %gs
|
mov %ax, %gs
|
||||||
mov %ax, %ss
|
mov %ax, %ss
|
||||||
xchgl mon_sp, %esp /* unswitch stacks */
|
xchgl _mon_sp, %esp /* unswitch stacks */
|
||||||
lidt gdt+IDT_SELECTOR /* reload interrupt descriptor table */
|
lidt _gdt+IDT_SELECTOR /* reload interrupt descriptor table */
|
||||||
|
|
||||||
#ifdef CONFIG_APIC
|
#ifdef CONFIG_APIC
|
||||||
cmpl $0x0, lapic_addr
|
cmpl $0x0, lapic_addr
|
||||||
|
|
@ -170,7 +172,7 @@ csinit:
|
||||||
shl $3, %eax
|
shl $3, %eax
|
||||||
mov %eax, %ebx
|
mov %eax, %ebx
|
||||||
add $TSS_SELECTOR, %eax
|
add $TSS_SELECTOR, %eax
|
||||||
addl gdt+DESC_ACCESS, %eax
|
addl _gdt+DESC_ACCESS, %eax
|
||||||
and $~0x02, %eax
|
and $~0x02, %eax
|
||||||
ltr %bx /* set TSS register */
|
ltr %bx /* set TSS register */
|
||||||
|
|
||||||
|
|
@ -185,7 +187,7 @@ csinit:
|
||||||
outb $INT2_CTLMASK
|
outb $INT2_CTLMASK
|
||||||
|
|
||||||
6:
|
6:
|
||||||
addl %ecx, lost_ticks /* record lost clock ticks */
|
addl %ecx, _lost_ticks /* record lost clock ticks */
|
||||||
|
|
||||||
popf /* restore flags */
|
popf /* restore flags */
|
||||||
pop %ebx /* restore C registers */
|
pop %ebx /* restore C registers */
|
||||||
|
|
@ -203,14 +205,15 @@ csinit:
|
||||||
* Actual calls to exit cannot occur in the kernel.
|
* Actual calls to exit cannot occur in the kernel.
|
||||||
* GNU CC likes to call ___main from main() for nonobvious reasons.
|
* GNU CC likes to call ___main from main() for nonobvious reasons.
|
||||||
*/
|
*/
|
||||||
|
#ifdef __ACK__
|
||||||
exit:
|
|
||||||
_exit:
|
_exit:
|
||||||
__exit:
|
__exit:
|
||||||
|
___exit:
|
||||||
sti
|
sti
|
||||||
jmp __exit
|
jmp ___exit
|
||||||
|
#endif
|
||||||
|
|
||||||
__main:
|
___main:
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -222,7 +225,7 @@ __main:
|
||||||
* Input an array from an I/O port. Absolute address version of insw().
|
* Input an array from an I/O port. Absolute address version of insw().
|
||||||
*/
|
*/
|
||||||
|
|
||||||
phys_insw:
|
_phys_insw:
|
||||||
push %ebp
|
push %ebp
|
||||||
mov %esp, %ebp
|
mov %esp, %ebp
|
||||||
cld
|
cld
|
||||||
|
|
@ -250,7 +253,7 @@ phys_insw:
|
||||||
* Input an array from an I/O port. Absolute address version of insb().
|
* Input an array from an I/O port. Absolute address version of insb().
|
||||||
*/
|
*/
|
||||||
|
|
||||||
phys_insb:
|
_phys_insb:
|
||||||
push %ebp
|
push %ebp
|
||||||
mov %esp, %ebp
|
mov %esp, %ebp
|
||||||
cld
|
cld
|
||||||
|
|
@ -278,7 +281,7 @@ phys_insb:
|
||||||
*/
|
*/
|
||||||
|
|
||||||
.balign 16
|
.balign 16
|
||||||
phys_outsw:
|
_phys_outsw:
|
||||||
push %ebp
|
push %ebp
|
||||||
mov %esp, %ebp
|
mov %esp, %ebp
|
||||||
cld
|
cld
|
||||||
|
|
@ -307,7 +310,7 @@ phys_outsw:
|
||||||
*/
|
*/
|
||||||
|
|
||||||
.balign 16
|
.balign 16
|
||||||
phys_outsb:
|
_phys_outsb:
|
||||||
push %ebp
|
push %ebp
|
||||||
mov %esp, %ebp
|
mov %esp, %ebp
|
||||||
cld
|
cld
|
||||||
|
|
@ -339,7 +342,7 @@ phys_outsb:
|
||||||
/* es edi esi eip src dst len */
|
/* es edi esi eip src dst len */
|
||||||
|
|
||||||
.balign 16
|
.balign 16
|
||||||
phys_copy:
|
_phys_copy:
|
||||||
cld
|
cld
|
||||||
push %esi
|
push %esi
|
||||||
push %edi
|
push %edi
|
||||||
|
|
@ -371,13 +374,13 @@ pc_small:
|
||||||
rep movsb %es:(%esi), %es:(%edi)
|
rep movsb %es:(%esi), %es:(%edi)
|
||||||
|
|
||||||
mov $0, %eax /* 0 means: no fault */
|
mov $0, %eax /* 0 means: no fault */
|
||||||
phys_copy_fault: /* kernel can send us here */
|
_phys_copy_fault: /* kernel can send us here */
|
||||||
pop %es
|
pop %es
|
||||||
pop %edi
|
pop %edi
|
||||||
pop %esi
|
pop %esi
|
||||||
ret
|
ret
|
||||||
|
|
||||||
phys_copy_fault_in_kernel: /* kernel can send us here */
|
_phys_copy_fault_in_kernel: /* kernel can send us here */
|
||||||
pop %es
|
pop %es
|
||||||
pop %edi
|
pop %edi
|
||||||
pop %esi
|
pop %esi
|
||||||
|
|
@ -408,8 +411,8 @@ phys_copy_fault_in_kernel: /* kernel can send us here */
|
||||||
*/
|
*/
|
||||||
|
|
||||||
.balign 16
|
.balign 16
|
||||||
.globl copy_msg_from_user
|
.globl _copy_msg_from_user
|
||||||
copy_msg_from_user:
|
_copy_msg_from_user:
|
||||||
push %gs
|
push %gs
|
||||||
|
|
||||||
mov 8(%esp), %eax
|
mov 8(%esp), %eax
|
||||||
|
|
@ -439,8 +442,8 @@ copy_msg_from_user:
|
||||||
mov %gs:8*4(%ecx), %eax
|
mov %gs:8*4(%ecx), %eax
|
||||||
mov %eax, 8*4(%edx)
|
mov %eax, 8*4(%edx)
|
||||||
|
|
||||||
.globl __copy_msg_from_user_end
|
.globl ___copy_msg_from_user_end
|
||||||
__copy_msg_from_user_end:
|
___copy_msg_from_user_end:
|
||||||
|
|
||||||
pop %gs
|
pop %gs
|
||||||
|
|
||||||
|
|
@ -461,8 +464,8 @@ __copy_msg_from_user_end:
|
||||||
*/
|
*/
|
||||||
|
|
||||||
.balign 16
|
.balign 16
|
||||||
.globl copy_msg_to_user
|
.globl _copy_msg_to_user
|
||||||
copy_msg_to_user:
|
_copy_msg_to_user:
|
||||||
push %gs
|
push %gs
|
||||||
|
|
||||||
mov 8(%esp), %eax
|
mov 8(%esp), %eax
|
||||||
|
|
@ -492,8 +495,8 @@ copy_msg_to_user:
|
||||||
mov 8*4(%ecx), %eax
|
mov 8*4(%ecx), %eax
|
||||||
mov %eax, %gs:8*4(%edx)
|
mov %eax, %gs:8*4(%edx)
|
||||||
|
|
||||||
.globl __copy_msg_to_user_end
|
.globl ___copy_msg_to_user_end
|
||||||
__copy_msg_to_user_end:
|
___copy_msg_to_user_end:
|
||||||
|
|
||||||
pop %gs
|
pop %gs
|
||||||
|
|
||||||
|
|
@ -508,8 +511,8 @@ __copy_msg_to_user_end:
|
||||||
* here to continue, clean up and report the error
|
* here to continue, clean up and report the error
|
||||||
*/
|
*/
|
||||||
.balign 16
|
.balign 16
|
||||||
.globl __user_copy_msg_pointer_failure
|
.globl ___user_copy_msg_pointer_failure
|
||||||
__user_copy_msg_pointer_failure:
|
___user_copy_msg_pointer_failure:
|
||||||
pop %gs
|
pop %gs
|
||||||
|
|
||||||
movl $-1, %eax
|
movl $-1, %eax
|
||||||
|
|
@ -525,7 +528,7 @@ __user_copy_msg_pointer_failure:
|
||||||
*/
|
*/
|
||||||
|
|
||||||
.balign 16
|
.balign 16
|
||||||
phys_memset:
|
_phys_memset:
|
||||||
push %ebp
|
push %ebp
|
||||||
mov %esp, %ebp
|
mov %esp, %ebp
|
||||||
push %esi
|
push %esi
|
||||||
|
|
@ -589,7 +592,7 @@ mem_rdw:
|
||||||
* Reset the system by loading IDT with offset 0 and interrupting.
|
* Reset the system by loading IDT with offset 0 and interrupting.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
reset:
|
_reset:
|
||||||
lidt idt_zero
|
lidt idt_zero
|
||||||
int $3 /* anything goes, the 386 will not like it */
|
int $3 /* anything goes, the 386 will not like it */
|
||||||
.data
|
.data
|
||||||
|
|
@ -606,7 +609,7 @@ idt_zero:
|
||||||
* reanables interrupts and puts the cpu in the halts state. Once an interrupt
|
* reanables interrupts and puts the cpu in the halts state. Once an interrupt
|
||||||
* is handled the execution resumes by disabling interrupts and continues
|
* is handled the execution resumes by disabling interrupts and continues
|
||||||
*/
|
*/
|
||||||
halt_cpu:
|
_halt_cpu:
|
||||||
sti
|
sti
|
||||||
hlt /* interrupts enabled only after this instruction is executed! */
|
hlt /* interrupts enabled only after this instruction is executed! */
|
||||||
/*
|
/*
|
||||||
|
|
@ -623,23 +626,23 @@ halt_cpu:
|
||||||
* Read CPU status flags from C.
|
* Read CPU status flags from C.
|
||||||
*/
|
*/
|
||||||
.balign 16
|
.balign 16
|
||||||
read_cpu_flags:
|
_read_cpu_flags:
|
||||||
pushf
|
pushf
|
||||||
mov (%esp), %eax
|
mov (%esp), %eax
|
||||||
add $4, %esp
|
add $4, %esp
|
||||||
ret
|
ret
|
||||||
|
|
||||||
read_ds:
|
_read_ds:
|
||||||
mov $0, %eax
|
mov $0, %eax
|
||||||
mov %ds, %ax
|
mov %ds, %ax
|
||||||
ret
|
ret
|
||||||
|
|
||||||
read_cs:
|
_read_cs:
|
||||||
mov $0, %eax
|
mov $0, %eax
|
||||||
mov %cs, %ax
|
mov %cs, %ax
|
||||||
ret
|
ret
|
||||||
|
|
||||||
read_ss:
|
_read_ss:
|
||||||
mov $0, %eax
|
mov $0, %eax
|
||||||
mov %ss, %ax
|
mov %ss, %ax
|
||||||
ret
|
ret
|
||||||
|
|
@ -648,18 +651,18 @@ read_ss:
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
/* fpu_routines */
|
/* fpu_routines */
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
fninit:
|
_fninit:
|
||||||
fninit
|
fninit
|
||||||
ret
|
ret
|
||||||
|
|
||||||
fnstsw:
|
_fnstsw:
|
||||||
xor %eax, %eax
|
xor %eax, %eax
|
||||||
|
|
||||||
/* DO NOT CHANGE THE OPERAND!!! gas2ack does not handle it yet */
|
/* DO NOT CHANGE THE OPERAND!!! gas2ack does not handle it yet */
|
||||||
fnstsw %ax
|
fnstsw %ax
|
||||||
ret
|
ret
|
||||||
|
|
||||||
fnstcw:
|
_fnstcw:
|
||||||
push %eax
|
push %eax
|
||||||
mov 8(%esp), %eax
|
mov 8(%esp), %eax
|
||||||
|
|
||||||
|
|
@ -672,7 +675,7 @@ fnstcw:
|
||||||
/* read_cr0 */
|
/* read_cr0 */
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
/* PUBLIC unsigned long read_cr0(void); */
|
/* PUBLIC unsigned long read_cr0(void); */
|
||||||
read_cr0:
|
_read_cr0:
|
||||||
push %ebp
|
push %ebp
|
||||||
mov %esp, %ebp
|
mov %esp, %ebp
|
||||||
mov %cr0, %eax
|
mov %cr0, %eax
|
||||||
|
|
@ -683,7 +686,7 @@ read_cr0:
|
||||||
/* write_cr0 */
|
/* write_cr0 */
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
/* PUBLIC void write_cr0(unsigned long value); */
|
/* PUBLIC void write_cr0(unsigned long value); */
|
||||||
write_cr0:
|
_write_cr0:
|
||||||
push %ebp
|
push %ebp
|
||||||
mov %esp, %ebp
|
mov %esp, %ebp
|
||||||
mov 8(%ebp), %eax
|
mov 8(%ebp), %eax
|
||||||
|
|
@ -697,7 +700,7 @@ write_cr0:
|
||||||
/* read_cr2 */
|
/* read_cr2 */
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
/* PUBLIC reg_t read_cr2(void); */
|
/* PUBLIC reg_t read_cr2(void); */
|
||||||
read_cr2:
|
_read_cr2:
|
||||||
mov %cr2, %eax
|
mov %cr2, %eax
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
|
@ -705,7 +708,7 @@ read_cr2:
|
||||||
/* read_cr3 */
|
/* read_cr3 */
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
/* PUBLIC unsigned long read_cr3(void); */
|
/* PUBLIC unsigned long read_cr3(void); */
|
||||||
read_cr3:
|
_read_cr3:
|
||||||
push %ebp
|
push %ebp
|
||||||
mov %esp, %ebp
|
mov %esp, %ebp
|
||||||
|
|
||||||
|
|
@ -718,7 +721,7 @@ read_cr3:
|
||||||
/* read_cr4 */
|
/* read_cr4 */
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
/* PUBLIC unsigned long read_cr4(void); */
|
/* PUBLIC unsigned long read_cr4(void); */
|
||||||
read_cr4:
|
_read_cr4:
|
||||||
push %ebp
|
push %ebp
|
||||||
mov %esp, %ebp
|
mov %esp, %ebp
|
||||||
|
|
||||||
|
|
@ -731,7 +734,7 @@ read_cr4:
|
||||||
/* write_cr4 */
|
/* write_cr4 */
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
/* PUBLIC void write_cr4(unsigned long value); */
|
/* PUBLIC void write_cr4(unsigned long value); */
|
||||||
write_cr4:
|
_write_cr4:
|
||||||
push %ebp
|
push %ebp
|
||||||
mov %esp, %ebp
|
mov %esp, %ebp
|
||||||
mov 8(%ebp), %eax
|
mov 8(%ebp), %eax
|
||||||
|
|
@ -746,7 +749,7 @@ write_cr4:
|
||||||
/* getcr3val */
|
/* getcr3val */
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
/* PUBLIC unsigned long getcr3val(void); */
|
/* PUBLIC unsigned long getcr3val(void); */
|
||||||
getcr3val:
|
_getcr3val:
|
||||||
mov %cr3, %eax
|
mov %cr3, %eax
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
|
@ -755,8 +758,8 @@ getcr3val:
|
||||||
*
|
*
|
||||||
* void ia32_msr_read(u32_t reg, u32_t * hi, u32_t * lo)
|
* void ia32_msr_read(u32_t reg, u32_t * hi, u32_t * lo)
|
||||||
*/
|
*/
|
||||||
.globl ia32_msr_read
|
.globl _ia32_msr_read
|
||||||
ia32_msr_read:
|
_ia32_msr_read:
|
||||||
push %ebp
|
push %ebp
|
||||||
mov %esp, %ebp
|
mov %esp, %ebp
|
||||||
|
|
||||||
|
|
@ -775,8 +778,8 @@ ia32_msr_read:
|
||||||
*
|
*
|
||||||
* void ia32_msr_write(u32_t reg, u32_t hi, u32_t lo)
|
* void ia32_msr_write(u32_t reg, u32_t hi, u32_t lo)
|
||||||
*/
|
*/
|
||||||
.globl ia32_msr_write
|
.globl _ia32_msr_write
|
||||||
ia32_msr_write:
|
_ia32_msr_write:
|
||||||
push %ebp
|
push %ebp
|
||||||
mov %esp, %ebp
|
mov %esp, %ebp
|
||||||
|
|
||||||
|
|
@ -793,8 +796,8 @@ ia32_msr_write:
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
/* PUBLIC void idt_reload (void); */
|
/* PUBLIC void idt_reload (void); */
|
||||||
.balign 16
|
.balign 16
|
||||||
idt_reload:
|
_idt_reload:
|
||||||
lidt gdt+IDT_SELECTOR /* reload interrupt descriptor table */
|
lidt _gdt+IDT_SELECTOR /* reload interrupt descriptor table */
|
||||||
ret
|
ret
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -805,8 +808,8 @@ idt_reload:
|
||||||
mov reg, %ax ;\
|
mov reg, %ax ;\
|
||||||
mov %ax, reg ;
|
mov %ax, reg ;
|
||||||
|
|
||||||
.globl reload_ds
|
.globl _reload_ds
|
||||||
reload_ds:
|
_reload_ds:
|
||||||
RELOAD_SEG_REG(%ds)
|
RELOAD_SEG_REG(%ds)
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
|
@ -820,8 +823,8 @@ reload_ds:
|
||||||
* not desirable
|
* not desirable
|
||||||
*/
|
*/
|
||||||
.balign 16
|
.balign 16
|
||||||
.globl switch_address_space
|
.globl _switch_address_space
|
||||||
switch_address_space:
|
_switch_address_space:
|
||||||
|
|
||||||
/* read the process pointer */
|
/* read the process pointer */
|
||||||
mov 4(%esp), %edx
|
mov 4(%esp), %edx
|
||||||
|
|
@ -841,6 +844,6 @@ switch_address_space:
|
||||||
cmp %ecx, %eax
|
cmp %ecx, %eax
|
||||||
je 0f
|
je 0f
|
||||||
mov %eax, %cr3
|
mov %eax, %cr3
|
||||||
mov %edx, ptproc
|
mov %edx, _ptproc
|
||||||
0:
|
0:
|
||||||
ret
|
ret
|
||||||
|
|
|
||||||
|
|
@ -64,50 +64,50 @@ begbss:
|
||||||
* the entity.
|
* the entity.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
.globl restore_user_context
|
.globl _restore_user_context
|
||||||
.globl reload_cr3
|
.globl _reload_cr3
|
||||||
|
|
||||||
.globl divide_error
|
.globl _divide_error
|
||||||
.globl single_step_exception
|
.globl _single_step_exception
|
||||||
.globl nmi
|
.globl _nmi
|
||||||
.globl breakpoint_exception
|
.globl _breakpoint_exception
|
||||||
.globl overflow
|
.globl _overflow
|
||||||
.globl bounds_check
|
.globl _bounds_check
|
||||||
.globl inval_opcode
|
.globl _inval_opcode
|
||||||
.globl copr_not_available
|
.globl _copr_not_available
|
||||||
.globl double_fault
|
.globl _double_fault
|
||||||
.globl copr_seg_overrun
|
.globl _copr_seg_overrun
|
||||||
.globl inval_tss
|
.globl _inval_tss
|
||||||
.globl segment_not_present
|
.globl _segment_not_present
|
||||||
.globl stack_exception
|
.globl _stack_exception
|
||||||
.globl general_protection
|
.globl _general_protection
|
||||||
.globl page_fault
|
.globl _page_fault
|
||||||
.globl copr_error
|
.globl _copr_error
|
||||||
.globl alignment_check
|
.globl _alignment_check
|
||||||
.globl machine_check
|
.globl _machine_check
|
||||||
.globl simd_exception
|
.globl _simd_exception
|
||||||
.globl params_size
|
.globl _params_size
|
||||||
.globl params_offset
|
.globl _params_offset
|
||||||
.globl mon_ds
|
.globl _mon_ds
|
||||||
.globl switch_to_user
|
.globl _switch_to_user
|
||||||
.globl lazy_fpu
|
.globl _lazy_fpu
|
||||||
|
|
||||||
.globl hwint00 /* handlers for hardware interrupts */
|
.globl _hwint00 /* handlers for hardware interrupts */
|
||||||
.globl hwint01
|
.globl _hwint01
|
||||||
.globl hwint02
|
.globl _hwint02
|
||||||
.globl hwint03
|
.globl _hwint03
|
||||||
.globl hwint04
|
.globl _hwint04
|
||||||
.globl hwint05
|
.globl _hwint05
|
||||||
.globl hwint06
|
.globl _hwint06
|
||||||
.globl hwint07
|
.globl _hwint07
|
||||||
.globl hwint08
|
.globl _hwint08
|
||||||
.globl hwint09
|
.globl _hwint09
|
||||||
.globl hwint10
|
.globl _hwint10
|
||||||
.globl hwint11
|
.globl _hwint11
|
||||||
.globl hwint12
|
.globl _hwint12
|
||||||
.globl hwint13
|
.globl _hwint13
|
||||||
.globl hwint14
|
.globl _hwint14
|
||||||
.globl hwint15
|
.globl _hwint15
|
||||||
|
|
||||||
/* Exported variables. */
|
/* Exported variables. */
|
||||||
.globl begbss
|
.globl begbss
|
||||||
|
|
@ -143,16 +143,16 @@ over_flags:
|
||||||
push %edi
|
push %edi
|
||||||
cmp $0, 4(%ebp) /* monitor return vector is */
|
cmp $0, 4(%ebp) /* monitor return vector is */
|
||||||
je noret /* nonzero if return possible */
|
je noret /* nonzero if return possible */
|
||||||
incl mon_return
|
incl _mon_return
|
||||||
noret:
|
noret:
|
||||||
movl %esp, mon_sp /* save stack pointer for later return */
|
movl %esp, _mon_sp /* save stack pointer for later return */
|
||||||
|
|
||||||
/* Copy the monitor global descriptor table to the address space of kernel and */
|
/* Copy the monitor global descriptor table to the address space of kernel and */
|
||||||
/* switch over to it. Prot_init() can then update it with immediate effect. */
|
/* switch over to it. Prot_init() can then update it with immediate effect. */
|
||||||
|
|
||||||
sgdt gdt+GDT_SELECTOR /* get the monitor gdtr */
|
sgdt _gdt+GDT_SELECTOR /* get the monitor gdtr */
|
||||||
movl gdt+GDT_SELECTOR+2, %esi /* absolute address of GDT */
|
movl _gdt+GDT_SELECTOR+2, %esi /* absolute address of GDT */
|
||||||
mov $gdt, %ebx /* address of kernel GDT */
|
mov $_gdt, %ebx /* address of kernel GDT */
|
||||||
mov $8*8, %ecx /* copying eight descriptors */
|
mov $8*8, %ecx /* copying eight descriptors */
|
||||||
copygdt:
|
copygdt:
|
||||||
movb %es:(%esi), %al
|
movb %es:(%esi), %al
|
||||||
|
|
@ -160,28 +160,28 @@ copygdt:
|
||||||
inc %esi
|
inc %esi
|
||||||
inc %ebx
|
inc %ebx
|
||||||
loop copygdt
|
loop copygdt
|
||||||
movl gdt+DS_SELECTOR+2, %eax /* base of kernel data */
|
movl _gdt+DS_SELECTOR+2, %eax /* base of kernel data */
|
||||||
and $0x00FFFFFF, %eax /* only 24 bits */
|
and $0x00FFFFFF, %eax /* only 24 bits */
|
||||||
add $gdt, %eax /* eax = vir2phys(gdt) */
|
add $_gdt, %eax /* eax = vir2phys(gdt) */
|
||||||
movl %eax, gdt+GDT_SELECTOR+2 /* set base of GDT */
|
movl %eax, _gdt+GDT_SELECTOR+2 /* set base of GDT */
|
||||||
lgdt gdt+GDT_SELECTOR /* switch over to kernel GDT */
|
lgdt _gdt+GDT_SELECTOR /* switch over to kernel GDT */
|
||||||
|
|
||||||
/* Locate boot parameters, set up kernel segment registers and stack. */
|
/* Locate boot parameters, set up kernel segment registers and stack. */
|
||||||
mov 8(%ebp), %ebx /* boot parameters offset */
|
mov 8(%ebp), %ebx /* boot parameters offset */
|
||||||
mov 12(%ebp), %edx /* boot parameters length */
|
mov 12(%ebp), %edx /* boot parameters length */
|
||||||
mov 16(%ebp), %eax /* address of a.out headers */
|
mov 16(%ebp), %eax /* address of a.out headers */
|
||||||
movl %eax, aout
|
movl %eax, _aout
|
||||||
mov %ds, %ax /* kernel data */
|
mov %ds, %ax /* kernel data */
|
||||||
mov %ax, %es
|
mov %ax, %es
|
||||||
mov %ax, %fs
|
mov %ax, %fs
|
||||||
mov %ax, %gs
|
mov %ax, %gs
|
||||||
mov %ax, %ss
|
mov %ax, %ss
|
||||||
mov $k_boot_stktop, %esp /* set sp to point to the top of kernel stack */
|
mov $_k_boot_stktop, %esp /* set sp to point to the top of kernel stack */
|
||||||
|
|
||||||
/* Save boot parameters into these global variables for i386 code */
|
/* Save boot parameters into these global variables for i386 code */
|
||||||
movl %edx, params_size
|
movl %edx, _params_size
|
||||||
movl %ebx, params_offset
|
movl %ebx, _params_offset
|
||||||
movl $SS_SELECTOR, mon_ds
|
movl $SS_SELECTOR, _mon_ds
|
||||||
|
|
||||||
/* Call C startup code to set up a proper environment to run main(). */
|
/* Call C startup code to set up a proper environment to run main(). */
|
||||||
push %edx
|
push %edx
|
||||||
|
|
@ -189,14 +189,14 @@ copygdt:
|
||||||
push $SS_SELECTOR
|
push $SS_SELECTOR
|
||||||
push $DS_SELECTOR
|
push $DS_SELECTOR
|
||||||
push $CS_SELECTOR
|
push $CS_SELECTOR
|
||||||
call cstart /* cstart(cs, ds, mds, parmoff, parmlen) */
|
call _cstart /* cstart(cs, ds, mds, parmoff, parmlen) */
|
||||||
add $5*4, %esp
|
add $5*4, %esp
|
||||||
|
|
||||||
/* Reload gdtr, idtr and the segment registers to global descriptor table set */
|
/* Reload gdtr, idtr and the segment registers to global descriptor table set */
|
||||||
/* up by prot_init(). */
|
/* up by prot_init(). */
|
||||||
|
|
||||||
lgdt gdt+GDT_SELECTOR
|
lgdt _gdt+GDT_SELECTOR
|
||||||
lidt gdt+IDT_SELECTOR
|
lidt _gdt+IDT_SELECTOR
|
||||||
|
|
||||||
ljmp $CS_SELECTOR, $csinit
|
ljmp $CS_SELECTOR, $csinit
|
||||||
csinit:
|
csinit:
|
||||||
|
|
@ -210,7 +210,7 @@ csinit:
|
||||||
ltr %ax
|
ltr %ax
|
||||||
push $0 /* set flags to known good state */
|
push $0 /* set flags to known good state */
|
||||||
popf /* esp, clear nested task and int enable */
|
popf /* esp, clear nested task and int enable */
|
||||||
jmp main /* main() */
|
jmp _main /* main() */
|
||||||
|
|
||||||
|
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
|
|
@ -220,7 +220,7 @@ csinit:
|
||||||
|
|
||||||
#define PIC_IRQ_HANDLER(irq) \
|
#define PIC_IRQ_HANDLER(irq) \
|
||||||
push $irq ;\
|
push $irq ;\
|
||||||
call irq_handle /* intr_handle(irq_handlers[irq]) */ ;\
|
call _irq_handle /* intr_handle(irq_handlers[irq]) */ ;\
|
||||||
add $4, %esp ;
|
add $4, %esp ;
|
||||||
|
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
|
|
@ -233,17 +233,17 @@ csinit:
|
||||||
\
|
\
|
||||||
SAVE_PROCESS_CTX(0) ;\
|
SAVE_PROCESS_CTX(0) ;\
|
||||||
push %ebp ;\
|
push %ebp ;\
|
||||||
call context_stop ;\
|
call _context_stop ;\
|
||||||
add $4, %esp ;\
|
add $4, %esp ;\
|
||||||
movl $0, %ebp /* for stack trace */ ;\
|
movl $0, %ebp /* for stack trace */ ;\
|
||||||
PIC_IRQ_HANDLER(irq) ;\
|
PIC_IRQ_HANDLER(irq) ;\
|
||||||
movb $END_OF_INT, %al ;\
|
movb $END_OF_INT, %al ;\
|
||||||
outb $INT_CTL /* reenable interrupts in master pic */ ;\
|
outb $INT_CTL /* reenable interrupts in master pic */ ;\
|
||||||
jmp switch_to_user ;\
|
jmp _switch_to_user ;\
|
||||||
\
|
\
|
||||||
0: \
|
0: \
|
||||||
pusha ;\
|
pusha ;\
|
||||||
call context_stop_idle ;\
|
call _context_stop_idle ;\
|
||||||
PIC_IRQ_HANDLER(irq) ;\
|
PIC_IRQ_HANDLER(irq) ;\
|
||||||
movb $END_OF_INT, %al ;\
|
movb $END_OF_INT, %al ;\
|
||||||
outb $INT_CTL /* reenable interrupts in master pic */ ;\
|
outb $INT_CTL /* reenable interrupts in master pic */ ;\
|
||||||
|
|
@ -253,42 +253,42 @@ csinit:
|
||||||
|
|
||||||
/* Each of these entry points is an expansion of the hwint_master macro */
|
/* Each of these entry points is an expansion of the hwint_master macro */
|
||||||
.balign 16
|
.balign 16
|
||||||
hwint00:
|
_hwint00:
|
||||||
/* Interrupt routine for irq 0 (the clock). */
|
/* Interrupt routine for irq 0 (the clock). */
|
||||||
hwint_master(0)
|
hwint_master(0)
|
||||||
|
|
||||||
.balign 16
|
.balign 16
|
||||||
hwint01:
|
_hwint01:
|
||||||
/* Interrupt routine for irq 1 (keyboard) */
|
/* Interrupt routine for irq 1 (keyboard) */
|
||||||
hwint_master(1)
|
hwint_master(1)
|
||||||
|
|
||||||
.balign 16
|
.balign 16
|
||||||
hwint02:
|
_hwint02:
|
||||||
/* Interrupt routine for irq 2 (cascade!) */
|
/* Interrupt routine for irq 2 (cascade!) */
|
||||||
hwint_master(2)
|
hwint_master(2)
|
||||||
|
|
||||||
.balign 16
|
.balign 16
|
||||||
hwint03:
|
_hwint03:
|
||||||
/* Interrupt routine for irq 3 (second serial) */
|
/* Interrupt routine for irq 3 (second serial) */
|
||||||
hwint_master(3)
|
hwint_master(3)
|
||||||
|
|
||||||
.balign 16
|
.balign 16
|
||||||
hwint04:
|
_hwint04:
|
||||||
/* Interrupt routine for irq 4 (first serial) */
|
/* Interrupt routine for irq 4 (first serial) */
|
||||||
hwint_master(4)
|
hwint_master(4)
|
||||||
|
|
||||||
.balign 16
|
.balign 16
|
||||||
hwint05:
|
_hwint05:
|
||||||
/* Interrupt routine for irq 5 (XT winchester) */
|
/* Interrupt routine for irq 5 (XT winchester) */
|
||||||
hwint_master(5)
|
hwint_master(5)
|
||||||
|
|
||||||
.balign 16
|
.balign 16
|
||||||
hwint06:
|
_hwint06:
|
||||||
/* Interrupt routine for irq 6 (floppy) */
|
/* Interrupt routine for irq 6 (floppy) */
|
||||||
hwint_master(6)
|
hwint_master(6)
|
||||||
|
|
||||||
.balign 16
|
.balign 16
|
||||||
hwint07:
|
_hwint07:
|
||||||
/* Interrupt routine for irq 7 (printer) */
|
/* Interrupt routine for irq 7 (printer) */
|
||||||
hwint_master(7)
|
hwint_master(7)
|
||||||
|
|
||||||
|
|
@ -301,18 +301,18 @@ hwint07:
|
||||||
\
|
\
|
||||||
SAVE_PROCESS_CTX(0) ;\
|
SAVE_PROCESS_CTX(0) ;\
|
||||||
push %ebp ;\
|
push %ebp ;\
|
||||||
call context_stop ;\
|
call _context_stop ;\
|
||||||
add $4, %esp ;\
|
add $4, %esp ;\
|
||||||
movl $0, %ebp /* for stack trace */ ;\
|
movl $0, %ebp /* for stack trace */ ;\
|
||||||
PIC_IRQ_HANDLER(irq) ;\
|
PIC_IRQ_HANDLER(irq) ;\
|
||||||
movb $END_OF_INT, %al ;\
|
movb $END_OF_INT, %al ;\
|
||||||
outb $INT_CTL /* reenable interrupts in master pic */ ;\
|
outb $INT_CTL /* reenable interrupts in master pic */ ;\
|
||||||
outb $INT2_CTL /* reenable slave 8259 */ ;\
|
outb $INT2_CTL /* reenable slave 8259 */ ;\
|
||||||
jmp switch_to_user ;\
|
jmp _switch_to_user ;\
|
||||||
\
|
\
|
||||||
0: \
|
0: \
|
||||||
pusha ;\
|
pusha ;\
|
||||||
call context_stop_idle ;\
|
call _context_stop_idle ;\
|
||||||
PIC_IRQ_HANDLER(irq) ;\
|
PIC_IRQ_HANDLER(irq) ;\
|
||||||
movb $END_OF_INT, %al ;\
|
movb $END_OF_INT, %al ;\
|
||||||
outb $INT_CTL /* reenable interrupts in master pic */ ;\
|
outb $INT_CTL /* reenable interrupts in master pic */ ;\
|
||||||
|
|
@ -323,42 +323,42 @@ hwint07:
|
||||||
|
|
||||||
/* Each of these entry points is an expansion of the hwint_slave macro */
|
/* Each of these entry points is an expansion of the hwint_slave macro */
|
||||||
.balign 16
|
.balign 16
|
||||||
hwint08:
|
_hwint08:
|
||||||
/* Interrupt routine for irq 8 (realtime clock) */
|
/* Interrupt routine for irq 8 (realtime clock) */
|
||||||
hwint_slave(8)
|
hwint_slave(8)
|
||||||
|
|
||||||
.balign 16
|
.balign 16
|
||||||
hwint09:
|
_hwint09:
|
||||||
/* Interrupt routine for irq 9 (irq 2 redirected) */
|
/* Interrupt routine for irq 9 (irq 2 redirected) */
|
||||||
hwint_slave(9)
|
hwint_slave(9)
|
||||||
|
|
||||||
.balign 16
|
.balign 16
|
||||||
hwint10:
|
_hwint10:
|
||||||
/* Interrupt routine for irq 10 */
|
/* Interrupt routine for irq 10 */
|
||||||
hwint_slave(10)
|
hwint_slave(10)
|
||||||
|
|
||||||
.balign 16
|
.balign 16
|
||||||
hwint11:
|
_hwint11:
|
||||||
/* Interrupt routine for irq 11 */
|
/* Interrupt routine for irq 11 */
|
||||||
hwint_slave(11)
|
hwint_slave(11)
|
||||||
|
|
||||||
.balign 16
|
.balign 16
|
||||||
hwint12:
|
_hwint12:
|
||||||
/* Interrupt routine for irq 12 */
|
/* Interrupt routine for irq 12 */
|
||||||
hwint_slave(12)
|
hwint_slave(12)
|
||||||
|
|
||||||
.balign 16
|
.balign 16
|
||||||
hwint13:
|
_hwint13:
|
||||||
/* Interrupt routine for irq 13 (FPU exception) */
|
/* Interrupt routine for irq 13 (FPU exception) */
|
||||||
hwint_slave(13)
|
hwint_slave(13)
|
||||||
|
|
||||||
.balign 16
|
.balign 16
|
||||||
hwint14:
|
_hwint14:
|
||||||
/* Interrupt routine for irq 14 (AT winchester) */
|
/* Interrupt routine for irq 14 (AT winchester) */
|
||||||
hwint_slave(14)
|
hwint_slave(14)
|
||||||
|
|
||||||
.balign 16
|
.balign 16
|
||||||
hwint15:
|
_hwint15:
|
||||||
/* Interrupt routine for irq 15 */
|
/* Interrupt routine for irq 15 */
|
||||||
hwint_slave(15)
|
hwint_slave(15)
|
||||||
|
|
||||||
|
|
@ -366,8 +366,8 @@ hwint15:
|
||||||
* IPC is only from a process to kernel
|
* IPC is only from a process to kernel
|
||||||
*/
|
*/
|
||||||
.balign 16
|
.balign 16
|
||||||
.globl ipc_entry
|
.globl _ipc_entry
|
||||||
ipc_entry:
|
_ipc_entry:
|
||||||
|
|
||||||
SAVE_PROCESS_CTX(0)
|
SAVE_PROCESS_CTX(0)
|
||||||
|
|
||||||
|
|
@ -385,28 +385,28 @@ ipc_entry:
|
||||||
|
|
||||||
/* stop user process cycles */
|
/* stop user process cycles */
|
||||||
push %ebp
|
push %ebp
|
||||||
call context_stop
|
call _context_stop
|
||||||
add $4, %esp
|
add $4, %esp
|
||||||
|
|
||||||
/* for stack trace */
|
/* for stack trace */
|
||||||
movl $0, %ebp
|
movl $0, %ebp
|
||||||
|
|
||||||
call do_ipc
|
call _do_ipc
|
||||||
|
|
||||||
/* restore the current process pointer and save the return value */
|
/* restore the current process pointer and save the return value */
|
||||||
add $3 * 4, %esp
|
add $3 * 4, %esp
|
||||||
pop %esi
|
pop %esi
|
||||||
mov %eax, AXREG(%esi)
|
mov %eax, AXREG(%esi)
|
||||||
|
|
||||||
jmp switch_to_user
|
jmp _switch_to_user
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* kernel call is only from a process to kernel
|
* kernel call is only from a process to kernel
|
||||||
*/
|
*/
|
||||||
.balign 16
|
.balign 16
|
||||||
.globl kernel_call_entry
|
.globl _kernel_call_entry
|
||||||
kernel_call_entry:
|
_kernel_call_entry:
|
||||||
|
|
||||||
SAVE_PROCESS_CTX(0)
|
SAVE_PROCESS_CTX(0)
|
||||||
|
|
||||||
|
|
@ -422,18 +422,18 @@ kernel_call_entry:
|
||||||
|
|
||||||
/* stop user process cycles */
|
/* stop user process cycles */
|
||||||
push %ebp
|
push %ebp
|
||||||
call context_stop
|
call _context_stop
|
||||||
add $4, %esp
|
add $4, %esp
|
||||||
|
|
||||||
/* for stack trace */
|
/* for stack trace */
|
||||||
movl $0, %ebp
|
movl $0, %ebp
|
||||||
|
|
||||||
call kernel_call
|
call _kernel_call
|
||||||
|
|
||||||
/* restore the current process pointer and save the return value */
|
/* restore the current process pointer and save the return value */
|
||||||
add $8, %esp
|
add $8, %esp
|
||||||
|
|
||||||
jmp switch_to_user
|
jmp _switch_to_user
|
||||||
|
|
||||||
|
|
||||||
.balign 16
|
.balign 16
|
||||||
|
|
@ -455,7 +455,7 @@ exception_entry_from_user:
|
||||||
|
|
||||||
/* stop user process cycles */
|
/* stop user process cycles */
|
||||||
push %ebp
|
push %ebp
|
||||||
call context_stop
|
call _context_stop
|
||||||
add $4, %esp
|
add $4, %esp
|
||||||
|
|
||||||
/* for stack trace clear %ebp */
|
/* for stack trace clear %ebp */
|
||||||
|
|
@ -468,9 +468,9 @@ exception_entry_from_user:
|
||||||
*/
|
*/
|
||||||
push %esp
|
push %esp
|
||||||
push $0 /* it's not a nested exception */
|
push $0 /* it's not a nested exception */
|
||||||
call exception_handler
|
call _exception_handler
|
||||||
|
|
||||||
jmp switch_to_user
|
jmp _switch_to_user
|
||||||
|
|
||||||
exception_entry_nested:
|
exception_entry_nested:
|
||||||
|
|
||||||
|
|
@ -479,7 +479,7 @@ exception_entry_nested:
|
||||||
add $(8 * 4), %eax
|
add $(8 * 4), %eax
|
||||||
push %eax
|
push %eax
|
||||||
pushl $1 /* it's a nested exception */
|
pushl $1 /* it's a nested exception */
|
||||||
call exception_handler
|
call _exception_handler
|
||||||
add $8, %esp
|
add $8, %esp
|
||||||
popa
|
popa
|
||||||
|
|
||||||
|
|
@ -491,7 +491,7 @@ exception_entry_nested:
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
/* restart */
|
/* restart */
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
restore_user_context:
|
_restore_user_context:
|
||||||
mov 4(%esp), %ebp /* will assume P_STACKBASE == 0 */
|
mov 4(%esp), %ebp /* will assume P_STACKBASE == 0 */
|
||||||
|
|
||||||
/* reconstruct the stack for iret */
|
/* reconstruct the stack for iret */
|
||||||
|
|
@ -526,13 +526,13 @@ restore_user_context:
|
||||||
pushl $0 ;\
|
pushl $0 ;\
|
||||||
EXCEPTION_ERR_CODE(vector)
|
EXCEPTION_ERR_CODE(vector)
|
||||||
|
|
||||||
divide_error:
|
_divide_error:
|
||||||
EXCEPTION_NO_ERR_CODE(DIVIDE_VECTOR)
|
EXCEPTION_NO_ERR_CODE(DIVIDE_VECTOR)
|
||||||
|
|
||||||
single_step_exception:
|
_single_step_exception:
|
||||||
EXCEPTION_NO_ERR_CODE(DEBUG_VECTOR)
|
EXCEPTION_NO_ERR_CODE(DEBUG_VECTOR)
|
||||||
|
|
||||||
nmi:
|
_nmi:
|
||||||
#ifndef CONFIG_WATCHDOG
|
#ifndef CONFIG_WATCHDOG
|
||||||
EXCEPTION_NO_ERR_CODE(NMI_VECTOR)
|
EXCEPTION_NO_ERR_CODE(NMI_VECTOR)
|
||||||
#else
|
#else
|
||||||
|
|
@ -565,7 +565,7 @@ nmi:
|
||||||
mov %si, %es
|
mov %si, %es
|
||||||
|
|
||||||
push %esp
|
push %esp
|
||||||
call nmi_watchdog_handler
|
call _nmi_watchdog_handler
|
||||||
add $4, %esp
|
add $4, %esp
|
||||||
|
|
||||||
/* restore all the important registers as they were before the trap */
|
/* restore all the important registers as they were before the trap */
|
||||||
|
|
@ -578,26 +578,26 @@ nmi:
|
||||||
iret
|
iret
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
breakpoint_exception:
|
_breakpoint_exception:
|
||||||
EXCEPTION_NO_ERR_CODE(BREAKPOINT_VECTOR)
|
EXCEPTION_NO_ERR_CODE(BREAKPOINT_VECTOR)
|
||||||
|
|
||||||
overflow:
|
_overflow:
|
||||||
EXCEPTION_NO_ERR_CODE(OVERFLOW_VECTOR)
|
EXCEPTION_NO_ERR_CODE(OVERFLOW_VECTOR)
|
||||||
|
|
||||||
bounds_check:
|
_bounds_check:
|
||||||
EXCEPTION_NO_ERR_CODE(BOUNDS_VECTOR)
|
EXCEPTION_NO_ERR_CODE(BOUNDS_VECTOR)
|
||||||
|
|
||||||
inval_opcode:
|
_inval_opcode:
|
||||||
EXCEPTION_NO_ERR_CODE(INVAL_OP_VECTOR)
|
EXCEPTION_NO_ERR_CODE(INVAL_OP_VECTOR)
|
||||||
|
|
||||||
copr_not_available:
|
_copr_not_available:
|
||||||
TEST_INT_IN_KERNEL(4, copr_not_available_in_kernel)
|
TEST_INT_IN_KERNEL(4, copr_not_available_in_kernel)
|
||||||
clts
|
clts
|
||||||
cld /* set direction flag to a known value */
|
cld /* set direction flag to a known value */
|
||||||
SAVE_PROCESS_CTX_NON_LAZY(0)
|
SAVE_PROCESS_CTX_NON_LAZY(0)
|
||||||
/* stop user process cycles */
|
/* stop user process cycles */
|
||||||
push %ebp
|
push %ebp
|
||||||
call context_stop
|
call _context_stop
|
||||||
pop %ebp
|
pop %ebp
|
||||||
lea P_MISC_FLAGS(%ebp), %ebx
|
lea P_MISC_FLAGS(%ebp), %ebx
|
||||||
movw (%ebx), %cx
|
movw (%ebx), %cx
|
||||||
|
|
@ -608,7 +608,7 @@ copr_not_available:
|
||||||
jmp copr_return
|
jmp copr_return
|
||||||
0: /* load FPU context for current process */
|
0: /* load FPU context for current process */
|
||||||
mov %ss:FP_SAVE_AREA_P(%ebp), %eax
|
mov %ss:FP_SAVE_AREA_P(%ebp), %eax
|
||||||
cmp $0, osfxsr_feature
|
cmp $0, _osfxsr_feature
|
||||||
jz fp_l_no_fxsr /* FXSR is not avaible. */
|
jz fp_l_no_fxsr /* FXSR is not avaible. */
|
||||||
|
|
||||||
/* DO NOT CHANGE THE OPERAND!!! gas2ack does not handle it yet */
|
/* DO NOT CHANGE THE OPERAND!!! gas2ack does not handle it yet */
|
||||||
|
|
@ -619,43 +619,43 @@ fp_l_no_fxsr:
|
||||||
frstor (%eax)
|
frstor (%eax)
|
||||||
copr_return:
|
copr_return:
|
||||||
orw $MF_USED_FPU, (%ebx) /* fpu was used during last execution */
|
orw $MF_USED_FPU, (%ebx) /* fpu was used during last execution */
|
||||||
jmp switch_to_user
|
jmp _switch_to_user
|
||||||
|
|
||||||
copr_not_available_in_kernel:
|
copr_not_available_in_kernel:
|
||||||
movl $0, (%esp)
|
movl $0, (%esp)
|
||||||
call panic
|
call _panic
|
||||||
|
|
||||||
double_fault:
|
_double_fault:
|
||||||
EXCEPTION_ERR_CODE(DOUBLE_FAULT_VECTOR)
|
EXCEPTION_ERR_CODE(DOUBLE_FAULT_VECTOR)
|
||||||
|
|
||||||
copr_seg_overrun:
|
_copr_seg_overrun:
|
||||||
EXCEPTION_NO_ERR_CODE(COPROC_SEG_VECTOR)
|
EXCEPTION_NO_ERR_CODE(COPROC_SEG_VECTOR)
|
||||||
|
|
||||||
inval_tss:
|
_inval_tss:
|
||||||
EXCEPTION_ERR_CODE(INVAL_TSS_VECTOR)
|
EXCEPTION_ERR_CODE(INVAL_TSS_VECTOR)
|
||||||
|
|
||||||
segment_not_present:
|
_segment_not_present:
|
||||||
EXCEPTION_ERR_CODE(SEG_NOT_VECTOR)
|
EXCEPTION_ERR_CODE(SEG_NOT_VECTOR)
|
||||||
|
|
||||||
stack_exception:
|
_stack_exception:
|
||||||
EXCEPTION_ERR_CODE(STACK_FAULT_VECTOR)
|
EXCEPTION_ERR_CODE(STACK_FAULT_VECTOR)
|
||||||
|
|
||||||
general_protection:
|
_general_protection:
|
||||||
EXCEPTION_ERR_CODE(PROTECTION_VECTOR)
|
EXCEPTION_ERR_CODE(PROTECTION_VECTOR)
|
||||||
|
|
||||||
page_fault:
|
_page_fault:
|
||||||
EXCEPTION_ERR_CODE(PAGE_FAULT_VECTOR)
|
EXCEPTION_ERR_CODE(PAGE_FAULT_VECTOR)
|
||||||
|
|
||||||
copr_error:
|
_copr_error:
|
||||||
EXCEPTION_NO_ERR_CODE(COPROC_ERR_VECTOR)
|
EXCEPTION_NO_ERR_CODE(COPROC_ERR_VECTOR)
|
||||||
|
|
||||||
alignment_check:
|
_alignment_check:
|
||||||
EXCEPTION_NO_ERR_CODE(ALIGNMENT_CHECK_VECTOR)
|
EXCEPTION_NO_ERR_CODE(ALIGNMENT_CHECK_VECTOR)
|
||||||
|
|
||||||
machine_check:
|
_machine_check:
|
||||||
EXCEPTION_NO_ERR_CODE(MACHINE_CHECK_VECTOR)
|
EXCEPTION_NO_ERR_CODE(MACHINE_CHECK_VECTOR)
|
||||||
|
|
||||||
simd_exception:
|
_simd_exception:
|
||||||
EXCEPTION_NO_ERR_CODE(SIMD_EXCEPTION_VECTOR)
|
EXCEPTION_NO_ERR_CODE(SIMD_EXCEPTION_VECTOR)
|
||||||
|
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
|
|
@ -666,13 +666,13 @@ simd_exception:
|
||||||
* Actualy lazy code is just few lines, which check MF_USED_FPU,
|
* Actualy lazy code is just few lines, which check MF_USED_FPU,
|
||||||
* another part is save_init_fpu().
|
* another part is save_init_fpu().
|
||||||
*/
|
*/
|
||||||
lazy_fpu:
|
_lazy_fpu:
|
||||||
push %ebp
|
push %ebp
|
||||||
mov %esp, %ebp
|
mov %esp, %ebp
|
||||||
push %eax
|
push %eax
|
||||||
push %ebx
|
push %ebx
|
||||||
push %ecx
|
push %ecx
|
||||||
cmp $0, fpu_presence /* Do we have FPU? */
|
cmp $0, _fpu_presence /* Do we have FPU? */
|
||||||
jz no_fpu_available
|
jz no_fpu_available
|
||||||
mov 8(%ebp), %eax /* Get pptr */
|
mov 8(%ebp), %eax /* Get pptr */
|
||||||
lea P_MISC_FLAGS(%eax), %ebx
|
lea P_MISC_FLAGS(%eax), %ebx
|
||||||
|
|
@ -680,7 +680,7 @@ lazy_fpu:
|
||||||
and $MF_USED_FPU, %cx
|
and $MF_USED_FPU, %cx
|
||||||
jz 0f /* Don't save FPU */
|
jz 0f /* Don't save FPU */
|
||||||
mov %ss:FP_SAVE_AREA_P(%eax), %eax
|
mov %ss:FP_SAVE_AREA_P(%eax), %eax
|
||||||
cmp $0, osfxsr_feature
|
cmp $0, _osfxsr_feature
|
||||||
jz fp_s_no_fxsr /* FXSR is not avaible. */
|
jz fp_s_no_fxsr /* FXSR is not avaible. */
|
||||||
|
|
||||||
/* DO NOT CHANGE THE OPERAND!!! gas2ack does not handle it yet */
|
/* DO NOT CHANGE THE OPERAND!!! gas2ack does not handle it yet */
|
||||||
|
|
@ -707,7 +707,7 @@ no_fpu_available:
|
||||||
/* reload_cr3 */
|
/* reload_cr3 */
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
/* PUBLIC void reload_cr3(void); */
|
/* PUBLIC void reload_cr3(void); */
|
||||||
reload_cr3:
|
_reload_cr3:
|
||||||
push %ebp
|
push %ebp
|
||||||
mov %esp, %ebp
|
mov %esp, %ebp
|
||||||
mov %cr3, %eax
|
mov %cr3, %eax
|
||||||
|
|
@ -730,7 +730,7 @@ reload_cr3:
|
||||||
/*
|
/*
|
||||||
* the kernel stack
|
* the kernel stack
|
||||||
*/
|
*/
|
||||||
.globl k_boot_stktop
|
.globl _k_boot_stktop
|
||||||
k_boot_stack:
|
_k_boot_stack:
|
||||||
.space 4096 /* kernel stack */ /* FIXME use macro here */
|
.space 4096 /* kernel stack */ /* FIXME use macro here */
|
||||||
k_boot_stktop: /* top of kernel stack */
|
_k_boot_stktop: /* top of kernel stack */
|
||||||
|
|
|
||||||
|
|
@ -142,7 +142,7 @@
|
||||||
#define SAVE_PROCESS_CTX(displ) \
|
#define SAVE_PROCESS_CTX(displ) \
|
||||||
SAVE_PROCESS_CTX_NON_LAZY(displ) ;\
|
SAVE_PROCESS_CTX_NON_LAZY(displ) ;\
|
||||||
push %ebp ;\
|
push %ebp ;\
|
||||||
call lazy_fpu ;\
|
call _lazy_fpu ;\
|
||||||
add $4, %esp ;
|
add $4, %esp ;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
# Makefile for liby
|
# Makefile for liby
|
||||||
|
|
||||||
CPPFLAGS+=-O -D_MINIX -D_POSIX_SOURCE -wo
|
CPPFLAGS+=-O -D_MINIX -D_POSIX_SOURCE
|
||||||
|
|
||||||
LIB= y
|
LIB= y
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,6 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
export COMPILER_TYPE=ack
|
export CC=cc
|
||||||
export ARCH=i386
|
export MAKEOBJDIR=obj-ack
|
||||||
|
|
||||||
if [ "$COMPILER_TYPE" = 'ack' ]; then
|
|
||||||
export CC=cc
|
|
||||||
export MAKEOBJDIR=obj-ack
|
|
||||||
elif [ "$COMPILER_TYPE" = 'gnu' ]; then
|
|
||||||
export CC=gcc
|
|
||||||
export AR=gar
|
|
||||||
export MAKEOBJDIR=obj-gnu
|
|
||||||
export PATH=$PATH:/usr/gnu/bin
|
|
||||||
fi
|
|
||||||
|
|
||||||
make $@
|
make $@
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,7 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
export COMPILER_TYPE=gnu
|
export CC=gcc
|
||||||
export ARCH=i386
|
export MAKEOBJDIR=obj-gnu
|
||||||
|
export PATH=$PATH:/usr/gnu/bin
|
||||||
if [ "$COMPILER_TYPE" = 'ack' ]; then
|
|
||||||
export CC=cc
|
|
||||||
export MAKEOBJDIR=obj-ack
|
|
||||||
elif [ "$COMPILER_TYPE" = 'gnu' ]; then
|
|
||||||
export CC=gcc
|
|
||||||
export AR=gar
|
|
||||||
export MAKEOBJDIR=obj-gnu
|
|
||||||
export PATH=$PATH:/usr/gnu/bin
|
|
||||||
fi
|
|
||||||
|
|
||||||
make $@
|
make $@
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ LIB= edit
|
||||||
DEFS=-DANSI_ARROWS -DHAVE_STDLIB -DHAVE_TCGETATTR -DHIDE -DUSE_DIRENT \
|
DEFS=-DANSI_ARROWS -DHAVE_STDLIB -DHAVE_TCGETATTR -DHIDE -DUSE_DIRENT \
|
||||||
-DHIST_SIZE=100 -DUSE_TERMCAP -DSYS_UNIX
|
-DHIST_SIZE=100 -DUSE_TERMCAP -DSYS_UNIX
|
||||||
|
|
||||||
CPPFLAGS+=-O -D_MINIX -D_POSIX_SOURCE ${DEFS} -wo
|
CPPFLAGS+=-O -D_MINIX -D_POSIX_SOURCE ${DEFS}
|
||||||
|
|
||||||
SRCS= editline.c complete.c sysunix.c
|
SRCS= editline.c complete.c sysunix.c
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ MAN=
|
||||||
BINDIR?= /usr/sbin
|
BINDIR?= /usr/sbin
|
||||||
INSTALLFLAGS+= -S 1050k
|
INSTALLFLAGS+= -S 1050k
|
||||||
|
|
||||||
CPPFLAGS= -I${MINIXSRCDIR}
|
CPPFLAGS+= -I${MINIXSRCDIR}
|
||||||
|
|
||||||
SUBDIR= service
|
SUBDIR= service
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user