Macros for symbols used in both ASM and C

-The macros take care of prepending the leading underscore when
 necessary.
This commit is contained in:
Arun Thomas 2010-08-17 16:44:07 +00:00
parent c8cfcab5db
commit 9a21d1a2fd
209 changed files with 1511 additions and 1863 deletions

View file

@ -2,6 +2,6 @@ INCSDIR= /usr/include/i386
INCS= archtypes.h bios.h cmos.h cpu.h diskparm.h fpu.h int86.h \ INCS= archtypes.h bios.h cmos.h cpu.h diskparm.h fpu.h int86.h \
interrupt.h mcontext.h memory.h partition.h pci.h ports.h \ interrupt.h mcontext.h memory.h partition.h pci.h ports.h \
stackframe.h vm.h stackframe.h vm.h asm.h
.include <bsd.kinc.mk> .include <bsd.kinc.mk>

73
include/arch/i386/asm.h Normal file
View file

@ -0,0 +1,73 @@
/*-
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* William Jolitz.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)asm.h 5.5 (Berkeley) 5/7/91
*/
#ifndef _I386_ASM_H_
#define _I386_ASM_H_
#ifdef __ELF__
# define _C_LABEL(x) x
#else
# ifdef __STDC__
# define _C_LABEL(x) _ ## x
# else
# define _C_LABEL(x) _/**/x
# endif
#endif
#define _ASM_LABEL(x) x
/* allow overriding entrypoint alignment */
#if !defined(_ALIGN_TEXT)
# define _ALIGN_TEXT .balign 16
#endif
#ifdef __ACK__
#define _ENTRY(x) \
.text; _ALIGN_TEXT; .globl x; x:
#else
#define _ENTRY(x) \
.text; _ALIGN_TEXT; .globl x; .type x,@function; x:
#endif
#define _LABEL(x) \
.globl x; x:
#define ENTRY(y) _ENTRY(_C_LABEL(y))
#define NENTRY(y) _ENTRY(_C_LABEL(y))
#define ASENTRY(y) _ENTRY(_ASM_LABEL(y))
#define LABEL(y) _LABEL(_C_LABEL(y))
#define END(y) .size y, . - y
#define IMPORT(sym) \
.extern _C_LABEL(sym)
#endif /* !_I386_ASM_H_ */

View file

@ -2,30 +2,13 @@
#include "apic.h" #include "apic.h"
#include "sconst.h" #include "sconst.h"
#include "apic_asm.h" #include "apic_asm.h"
#include <machine/asm.h>
.globl _apic_hwint00 /* handlers for hardware interrupts */
.globl _apic_hwint01
.globl _apic_hwint02
.globl _apic_hwint03
.globl _apic_hwint04
.globl _apic_hwint05
.globl _apic_hwint06
.globl _apic_hwint07
.globl _apic_hwint08
.globl _apic_hwint09
.globl _apic_hwint10
.globl _apic_hwint11
.globl _apic_hwint12
.globl _apic_hwint13
.globl _apic_hwint14
.globl _apic_hwint15
.text
#define APIC_IRQ_HANDLER(irq) \ #define APIC_IRQ_HANDLER(irq) \
push $irq ;\ push $irq ;\
call _irq_handle /* intr_handle(irq_handlers[irq]) */ ;\ call _C_LABEL(irq_handle) /* intr_handle(irq_handlers[irq]) */ ;\
add $4, %esp ;\ add $4, %esp ;\
mov _lapic_eoi_addr, %eax ;\ mov _C_LABEL(lapic_eoi_addr), %eax ;\
movl $0, (%eax) ;\ movl $0, (%eax) ;\
/*===========================================================================*/ /*===========================================================================*/
@ -38,98 +21,83 @@
\ \
SAVE_PROCESS_CTX(0) ;\ SAVE_PROCESS_CTX(0) ;\
push %ebp ;\ push %ebp ;\
call _context_stop ;\ call _C_LABEL(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 _C_LABEL(switch_to_user) ;\
\ \
0: \ 0: \
pusha ;\ pusha ;\
call _context_stop_idle ;\ call _C_LABEL(context_stop_idle) ;\
APIC_IRQ_HANDLER(irq) ;\ APIC_IRQ_HANDLER(irq) ;\
CLEAR_IF(10*4(%esp)) ;\ CLEAR_IF(10*4(%esp)) ;\
popa ;\ popa ;\
iret ; iret ;
/* Handlers for hardware interrupts */
/* 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 ENTRY(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 ENTRY(apic_hwint01)
_apic_hwint01:
/* Interrupt routine for irq 1 (keyboard) */ /* Interrupt routine for irq 1 (keyboard) */
apic_hwint(1) apic_hwint(1)
.balign 16 ENTRY(apic_hwint02)
_apic_hwint02:
/* Interrupt routine for irq 2 (cascade!) */ /* Interrupt routine for irq 2 (cascade!) */
apic_hwint(2) apic_hwint(2)
.balign 16 ENTRY(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 ENTRY(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 ENTRY(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 ENTRY(apic_hwint06)
_apic_hwint06:
/* Interrupt routine for irq 6 (floppy) */ /* Interrupt routine for irq 6 (floppy) */
apic_hwint(6) apic_hwint(6)
.balign 16 ENTRY(apic_hwint07)
_apic_hwint07:
/* Interrupt routine for irq 7 (printer) */ /* Interrupt routine for irq 7 (printer) */
apic_hwint(7) apic_hwint(7)
.balign 16 ENTRY(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 ENTRY(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 ENTRY(apic_hwint10)
_apic_hwint10:
/* Interrupt routine for irq 10 */ /* Interrupt routine for irq 10 */
apic_hwint(10) apic_hwint(10)
.balign 16 ENTRY(apic_hwint11)
_apic_hwint11:
/* Interrupt routine for irq 11 */ /* Interrupt routine for irq 11 */
apic_hwint(11) apic_hwint(11)
.balign 16 ENTRY(apic_hwint12)
_apic_hwint12:
/* Interrupt routine for irq 12 */ /* Interrupt routine for irq 12 */
apic_hwint(12) apic_hwint(12)
.balign 16 ENTRY(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 ENTRY(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 ENTRY(apic_hwint15)
_apic_hwint15:
/* Interrupt routine for irq 15 */ /* Interrupt routine for irq 15 */
apic_hwint(15) apic_hwint(15)
@ -137,7 +105,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 _C_LABEL(lapic_eoi_addr), %eax /* the end of handler*/ ;\
movl $0, (%eax) ; movl $0, (%eax) ;
/*===========================================================================*/ /*===========================================================================*/
@ -149,28 +117,26 @@ _apic_hwint15:
\ \
SAVE_PROCESS_CTX(0) ;\ SAVE_PROCESS_CTX(0) ;\
push %ebp ;\ push %ebp ;\
call _context_stop ;\ call _C_LABEL(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 _C_LABEL(switch_to_user) ;\
\ \
0: \ 0: \
pusha ;\ pusha ;\
call _context_stop_idle ;\ call _C_LABEL(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 ENTRY(lapic_bsp_timer_int_handler)
_lapic_bsp_timer_int_handler: lapic_intr(_C_LABEL(bsp_timer_int_handler))
lapic_intr(_bsp_timer_int_handler)
.globl _lapic_ap_timer_int_handler ENTRY(lapic_ap_timer_int_handler)
_lapic_ap_timer_int_handler: lapic_intr(_C_LABEL(ap_timer_int_handler))
lapic_intr(_ap_timer_int_handler)
#ifdef CONFIG_APIC_DEBUG #ifdef CONFIG_APIC_DEBUG
@ -183,275 +149,271 @@ 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 _C_LABEL(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 LABEL(lapic_intr_dummy_handles_start)
_lapic_intr_dummy_handles_start: LAPIC_INTR_DUMMY_HANDLER(0)
LAPIC_INTR_DUMMY_HANDLER(1)
LAPIC_INTR_DUMMY_HANDLER(0) LAPIC_INTR_DUMMY_HANDLER(2)
LAPIC_INTR_DUMMY_HANDLER(1) LAPIC_INTR_DUMMY_HANDLER(3)
LAPIC_INTR_DUMMY_HANDLER(2) LAPIC_INTR_DUMMY_HANDLER(4)
LAPIC_INTR_DUMMY_HANDLER(3) LAPIC_INTR_DUMMY_HANDLER(5)
LAPIC_INTR_DUMMY_HANDLER(4) LAPIC_INTR_DUMMY_HANDLER(6)
LAPIC_INTR_DUMMY_HANDLER(5) LAPIC_INTR_DUMMY_HANDLER(7)
LAPIC_INTR_DUMMY_HANDLER(6) LAPIC_INTR_DUMMY_HANDLER(8)
LAPIC_INTR_DUMMY_HANDLER(7) LAPIC_INTR_DUMMY_HANDLER(9)
LAPIC_INTR_DUMMY_HANDLER(8) LAPIC_INTR_DUMMY_HANDLER(10)
LAPIC_INTR_DUMMY_HANDLER(9) LAPIC_INTR_DUMMY_HANDLER(11)
LAPIC_INTR_DUMMY_HANDLER(10) LAPIC_INTR_DUMMY_HANDLER(12)
LAPIC_INTR_DUMMY_HANDLER(11) LAPIC_INTR_DUMMY_HANDLER(13)
LAPIC_INTR_DUMMY_HANDLER(12) LAPIC_INTR_DUMMY_HANDLER(14)
LAPIC_INTR_DUMMY_HANDLER(13) LAPIC_INTR_DUMMY_HANDLER(15)
LAPIC_INTR_DUMMY_HANDLER(14) LAPIC_INTR_DUMMY_HANDLER(16)
LAPIC_INTR_DUMMY_HANDLER(15) LAPIC_INTR_DUMMY_HANDLER(17)
LAPIC_INTR_DUMMY_HANDLER(16) LAPIC_INTR_DUMMY_HANDLER(18)
LAPIC_INTR_DUMMY_HANDLER(17) LAPIC_INTR_DUMMY_HANDLER(19)
LAPIC_INTR_DUMMY_HANDLER(18) LAPIC_INTR_DUMMY_HANDLER(20)
LAPIC_INTR_DUMMY_HANDLER(19) LAPIC_INTR_DUMMY_HANDLER(21)
LAPIC_INTR_DUMMY_HANDLER(20) LAPIC_INTR_DUMMY_HANDLER(22)
LAPIC_INTR_DUMMY_HANDLER(21) LAPIC_INTR_DUMMY_HANDLER(23)
LAPIC_INTR_DUMMY_HANDLER(22) LAPIC_INTR_DUMMY_HANDLER(24)
LAPIC_INTR_DUMMY_HANDLER(23) LAPIC_INTR_DUMMY_HANDLER(25)
LAPIC_INTR_DUMMY_HANDLER(24) LAPIC_INTR_DUMMY_HANDLER(26)
LAPIC_INTR_DUMMY_HANDLER(25) LAPIC_INTR_DUMMY_HANDLER(27)
LAPIC_INTR_DUMMY_HANDLER(26) LAPIC_INTR_DUMMY_HANDLER(28)
LAPIC_INTR_DUMMY_HANDLER(27) LAPIC_INTR_DUMMY_HANDLER(29)
LAPIC_INTR_DUMMY_HANDLER(28) LAPIC_INTR_DUMMY_HANDLER(30)
LAPIC_INTR_DUMMY_HANDLER(29) LAPIC_INTR_DUMMY_HANDLER(31)
LAPIC_INTR_DUMMY_HANDLER(30) LAPIC_INTR_DUMMY_HANDLER(32)
LAPIC_INTR_DUMMY_HANDLER(31) LAPIC_INTR_DUMMY_HANDLER(33)
LAPIC_INTR_DUMMY_HANDLER(32) LAPIC_INTR_DUMMY_HANDLER(34)
LAPIC_INTR_DUMMY_HANDLER(33) LAPIC_INTR_DUMMY_HANDLER(35)
LAPIC_INTR_DUMMY_HANDLER(34) LAPIC_INTR_DUMMY_HANDLER(36)
LAPIC_INTR_DUMMY_HANDLER(35) LAPIC_INTR_DUMMY_HANDLER(37)
LAPIC_INTR_DUMMY_HANDLER(36) LAPIC_INTR_DUMMY_HANDLER(38)
LAPIC_INTR_DUMMY_HANDLER(37) LAPIC_INTR_DUMMY_HANDLER(39)
LAPIC_INTR_DUMMY_HANDLER(38) LAPIC_INTR_DUMMY_HANDLER(40)
LAPIC_INTR_DUMMY_HANDLER(39) LAPIC_INTR_DUMMY_HANDLER(41)
LAPIC_INTR_DUMMY_HANDLER(40) LAPIC_INTR_DUMMY_HANDLER(42)
LAPIC_INTR_DUMMY_HANDLER(41) LAPIC_INTR_DUMMY_HANDLER(43)
LAPIC_INTR_DUMMY_HANDLER(42) LAPIC_INTR_DUMMY_HANDLER(44)
LAPIC_INTR_DUMMY_HANDLER(43) LAPIC_INTR_DUMMY_HANDLER(45)
LAPIC_INTR_DUMMY_HANDLER(44) LAPIC_INTR_DUMMY_HANDLER(46)
LAPIC_INTR_DUMMY_HANDLER(45) LAPIC_INTR_DUMMY_HANDLER(47)
LAPIC_INTR_DUMMY_HANDLER(46) LAPIC_INTR_DUMMY_HANDLER(48)
LAPIC_INTR_DUMMY_HANDLER(47) LAPIC_INTR_DUMMY_HANDLER(49)
LAPIC_INTR_DUMMY_HANDLER(48) LAPIC_INTR_DUMMY_HANDLER(50)
LAPIC_INTR_DUMMY_HANDLER(49) LAPIC_INTR_DUMMY_HANDLER(51)
LAPIC_INTR_DUMMY_HANDLER(50) LAPIC_INTR_DUMMY_HANDLER(52)
LAPIC_INTR_DUMMY_HANDLER(51) LAPIC_INTR_DUMMY_HANDLER(53)
LAPIC_INTR_DUMMY_HANDLER(52) LAPIC_INTR_DUMMY_HANDLER(54)
LAPIC_INTR_DUMMY_HANDLER(53) LAPIC_INTR_DUMMY_HANDLER(55)
LAPIC_INTR_DUMMY_HANDLER(54) LAPIC_INTR_DUMMY_HANDLER(56)
LAPIC_INTR_DUMMY_HANDLER(55) LAPIC_INTR_DUMMY_HANDLER(57)
LAPIC_INTR_DUMMY_HANDLER(56) LAPIC_INTR_DUMMY_HANDLER(58)
LAPIC_INTR_DUMMY_HANDLER(57) LAPIC_INTR_DUMMY_HANDLER(59)
LAPIC_INTR_DUMMY_HANDLER(58) LAPIC_INTR_DUMMY_HANDLER(60)
LAPIC_INTR_DUMMY_HANDLER(59) LAPIC_INTR_DUMMY_HANDLER(61)
LAPIC_INTR_DUMMY_HANDLER(60) LAPIC_INTR_DUMMY_HANDLER(62)
LAPIC_INTR_DUMMY_HANDLER(61) LAPIC_INTR_DUMMY_HANDLER(63)
LAPIC_INTR_DUMMY_HANDLER(62) LAPIC_INTR_DUMMY_HANDLER(64)
LAPIC_INTR_DUMMY_HANDLER(63) LAPIC_INTR_DUMMY_HANDLER(65)
LAPIC_INTR_DUMMY_HANDLER(64) LAPIC_INTR_DUMMY_HANDLER(66)
LAPIC_INTR_DUMMY_HANDLER(65) LAPIC_INTR_DUMMY_HANDLER(67)
LAPIC_INTR_DUMMY_HANDLER(66) LAPIC_INTR_DUMMY_HANDLER(68)
LAPIC_INTR_DUMMY_HANDLER(67) LAPIC_INTR_DUMMY_HANDLER(69)
LAPIC_INTR_DUMMY_HANDLER(68) LAPIC_INTR_DUMMY_HANDLER(70)
LAPIC_INTR_DUMMY_HANDLER(69) LAPIC_INTR_DUMMY_HANDLER(71)
LAPIC_INTR_DUMMY_HANDLER(70) LAPIC_INTR_DUMMY_HANDLER(72)
LAPIC_INTR_DUMMY_HANDLER(71) LAPIC_INTR_DUMMY_HANDLER(73)
LAPIC_INTR_DUMMY_HANDLER(72) LAPIC_INTR_DUMMY_HANDLER(74)
LAPIC_INTR_DUMMY_HANDLER(73) LAPIC_INTR_DUMMY_HANDLER(75)
LAPIC_INTR_DUMMY_HANDLER(74) LAPIC_INTR_DUMMY_HANDLER(76)
LAPIC_INTR_DUMMY_HANDLER(75) LAPIC_INTR_DUMMY_HANDLER(77)
LAPIC_INTR_DUMMY_HANDLER(76) LAPIC_INTR_DUMMY_HANDLER(78)
LAPIC_INTR_DUMMY_HANDLER(77) LAPIC_INTR_DUMMY_HANDLER(79)
LAPIC_INTR_DUMMY_HANDLER(78) LAPIC_INTR_DUMMY_HANDLER(80)
LAPIC_INTR_DUMMY_HANDLER(79) LAPIC_INTR_DUMMY_HANDLER(81)
LAPIC_INTR_DUMMY_HANDLER(80) LAPIC_INTR_DUMMY_HANDLER(82)
LAPIC_INTR_DUMMY_HANDLER(81) LAPIC_INTR_DUMMY_HANDLER(83)
LAPIC_INTR_DUMMY_HANDLER(82) LAPIC_INTR_DUMMY_HANDLER(84)
LAPIC_INTR_DUMMY_HANDLER(83) LAPIC_INTR_DUMMY_HANDLER(85)
LAPIC_INTR_DUMMY_HANDLER(84) LAPIC_INTR_DUMMY_HANDLER(86)
LAPIC_INTR_DUMMY_HANDLER(85) LAPIC_INTR_DUMMY_HANDLER(87)
LAPIC_INTR_DUMMY_HANDLER(86) LAPIC_INTR_DUMMY_HANDLER(88)
LAPIC_INTR_DUMMY_HANDLER(87) LAPIC_INTR_DUMMY_HANDLER(89)
LAPIC_INTR_DUMMY_HANDLER(88) LAPIC_INTR_DUMMY_HANDLER(90)
LAPIC_INTR_DUMMY_HANDLER(89) LAPIC_INTR_DUMMY_HANDLER(91)
LAPIC_INTR_DUMMY_HANDLER(90) LAPIC_INTR_DUMMY_HANDLER(92)
LAPIC_INTR_DUMMY_HANDLER(91) LAPIC_INTR_DUMMY_HANDLER(93)
LAPIC_INTR_DUMMY_HANDLER(92) LAPIC_INTR_DUMMY_HANDLER(94)
LAPIC_INTR_DUMMY_HANDLER(93) LAPIC_INTR_DUMMY_HANDLER(95)
LAPIC_INTR_DUMMY_HANDLER(94) LAPIC_INTR_DUMMY_HANDLER(96)
LAPIC_INTR_DUMMY_HANDLER(95) LAPIC_INTR_DUMMY_HANDLER(97)
LAPIC_INTR_DUMMY_HANDLER(96) LAPIC_INTR_DUMMY_HANDLER(98)
LAPIC_INTR_DUMMY_HANDLER(97) LAPIC_INTR_DUMMY_HANDLER(99)
LAPIC_INTR_DUMMY_HANDLER(98) LAPIC_INTR_DUMMY_HANDLER(100)
LAPIC_INTR_DUMMY_HANDLER(99) LAPIC_INTR_DUMMY_HANDLER(101)
LAPIC_INTR_DUMMY_HANDLER(100) LAPIC_INTR_DUMMY_HANDLER(102)
LAPIC_INTR_DUMMY_HANDLER(101) LAPIC_INTR_DUMMY_HANDLER(103)
LAPIC_INTR_DUMMY_HANDLER(102) LAPIC_INTR_DUMMY_HANDLER(104)
LAPIC_INTR_DUMMY_HANDLER(103) LAPIC_INTR_DUMMY_HANDLER(105)
LAPIC_INTR_DUMMY_HANDLER(104) LAPIC_INTR_DUMMY_HANDLER(106)
LAPIC_INTR_DUMMY_HANDLER(105) LAPIC_INTR_DUMMY_HANDLER(107)
LAPIC_INTR_DUMMY_HANDLER(106) LAPIC_INTR_DUMMY_HANDLER(108)
LAPIC_INTR_DUMMY_HANDLER(107) LAPIC_INTR_DUMMY_HANDLER(109)
LAPIC_INTR_DUMMY_HANDLER(108) LAPIC_INTR_DUMMY_HANDLER(110)
LAPIC_INTR_DUMMY_HANDLER(109) LAPIC_INTR_DUMMY_HANDLER(111)
LAPIC_INTR_DUMMY_HANDLER(110) LAPIC_INTR_DUMMY_HANDLER(112)
LAPIC_INTR_DUMMY_HANDLER(111) LAPIC_INTR_DUMMY_HANDLER(113)
LAPIC_INTR_DUMMY_HANDLER(112) LAPIC_INTR_DUMMY_HANDLER(114)
LAPIC_INTR_DUMMY_HANDLER(113) LAPIC_INTR_DUMMY_HANDLER(115)
LAPIC_INTR_DUMMY_HANDLER(114) LAPIC_INTR_DUMMY_HANDLER(116)
LAPIC_INTR_DUMMY_HANDLER(115) LAPIC_INTR_DUMMY_HANDLER(117)
LAPIC_INTR_DUMMY_HANDLER(116) LAPIC_INTR_DUMMY_HANDLER(118)
LAPIC_INTR_DUMMY_HANDLER(117) LAPIC_INTR_DUMMY_HANDLER(119)
LAPIC_INTR_DUMMY_HANDLER(118) LAPIC_INTR_DUMMY_HANDLER(120)
LAPIC_INTR_DUMMY_HANDLER(119) LAPIC_INTR_DUMMY_HANDLER(121)
LAPIC_INTR_DUMMY_HANDLER(120) LAPIC_INTR_DUMMY_HANDLER(122)
LAPIC_INTR_DUMMY_HANDLER(121) LAPIC_INTR_DUMMY_HANDLER(123)
LAPIC_INTR_DUMMY_HANDLER(122) LAPIC_INTR_DUMMY_HANDLER(124)
LAPIC_INTR_DUMMY_HANDLER(123) LAPIC_INTR_DUMMY_HANDLER(125)
LAPIC_INTR_DUMMY_HANDLER(124) LAPIC_INTR_DUMMY_HANDLER(126)
LAPIC_INTR_DUMMY_HANDLER(125) LAPIC_INTR_DUMMY_HANDLER(127)
LAPIC_INTR_DUMMY_HANDLER(126) LAPIC_INTR_DUMMY_HANDLER(128)
LAPIC_INTR_DUMMY_HANDLER(127) LAPIC_INTR_DUMMY_HANDLER(129)
LAPIC_INTR_DUMMY_HANDLER(128) LAPIC_INTR_DUMMY_HANDLER(130)
LAPIC_INTR_DUMMY_HANDLER(129) LAPIC_INTR_DUMMY_HANDLER(131)
LAPIC_INTR_DUMMY_HANDLER(130) LAPIC_INTR_DUMMY_HANDLER(132)
LAPIC_INTR_DUMMY_HANDLER(131) LAPIC_INTR_DUMMY_HANDLER(133)
LAPIC_INTR_DUMMY_HANDLER(132) LAPIC_INTR_DUMMY_HANDLER(134)
LAPIC_INTR_DUMMY_HANDLER(133) LAPIC_INTR_DUMMY_HANDLER(135)
LAPIC_INTR_DUMMY_HANDLER(134) LAPIC_INTR_DUMMY_HANDLER(136)
LAPIC_INTR_DUMMY_HANDLER(135) LAPIC_INTR_DUMMY_HANDLER(137)
LAPIC_INTR_DUMMY_HANDLER(136) LAPIC_INTR_DUMMY_HANDLER(138)
LAPIC_INTR_DUMMY_HANDLER(137) LAPIC_INTR_DUMMY_HANDLER(139)
LAPIC_INTR_DUMMY_HANDLER(138) LAPIC_INTR_DUMMY_HANDLER(140)
LAPIC_INTR_DUMMY_HANDLER(139) LAPIC_INTR_DUMMY_HANDLER(141)
LAPIC_INTR_DUMMY_HANDLER(140) LAPIC_INTR_DUMMY_HANDLER(142)
LAPIC_INTR_DUMMY_HANDLER(141) LAPIC_INTR_DUMMY_HANDLER(143)
LAPIC_INTR_DUMMY_HANDLER(142) LAPIC_INTR_DUMMY_HANDLER(144)
LAPIC_INTR_DUMMY_HANDLER(143) LAPIC_INTR_DUMMY_HANDLER(145)
LAPIC_INTR_DUMMY_HANDLER(144) LAPIC_INTR_DUMMY_HANDLER(146)
LAPIC_INTR_DUMMY_HANDLER(145) LAPIC_INTR_DUMMY_HANDLER(147)
LAPIC_INTR_DUMMY_HANDLER(146) LAPIC_INTR_DUMMY_HANDLER(148)
LAPIC_INTR_DUMMY_HANDLER(147) LAPIC_INTR_DUMMY_HANDLER(149)
LAPIC_INTR_DUMMY_HANDLER(148) LAPIC_INTR_DUMMY_HANDLER(150)
LAPIC_INTR_DUMMY_HANDLER(149) LAPIC_INTR_DUMMY_HANDLER(151)
LAPIC_INTR_DUMMY_HANDLER(150) LAPIC_INTR_DUMMY_HANDLER(152)
LAPIC_INTR_DUMMY_HANDLER(151) LAPIC_INTR_DUMMY_HANDLER(153)
LAPIC_INTR_DUMMY_HANDLER(152) LAPIC_INTR_DUMMY_HANDLER(154)
LAPIC_INTR_DUMMY_HANDLER(153) LAPIC_INTR_DUMMY_HANDLER(155)
LAPIC_INTR_DUMMY_HANDLER(154) LAPIC_INTR_DUMMY_HANDLER(156)
LAPIC_INTR_DUMMY_HANDLER(155) LAPIC_INTR_DUMMY_HANDLER(157)
LAPIC_INTR_DUMMY_HANDLER(156) LAPIC_INTR_DUMMY_HANDLER(158)
LAPIC_INTR_DUMMY_HANDLER(157) LAPIC_INTR_DUMMY_HANDLER(159)
LAPIC_INTR_DUMMY_HANDLER(158) LAPIC_INTR_DUMMY_HANDLER(160)
LAPIC_INTR_DUMMY_HANDLER(159) LAPIC_INTR_DUMMY_HANDLER(161)
LAPIC_INTR_DUMMY_HANDLER(160) LAPIC_INTR_DUMMY_HANDLER(162)
LAPIC_INTR_DUMMY_HANDLER(161) LAPIC_INTR_DUMMY_HANDLER(163)
LAPIC_INTR_DUMMY_HANDLER(162) LAPIC_INTR_DUMMY_HANDLER(164)
LAPIC_INTR_DUMMY_HANDLER(163) LAPIC_INTR_DUMMY_HANDLER(165)
LAPIC_INTR_DUMMY_HANDLER(164) LAPIC_INTR_DUMMY_HANDLER(166)
LAPIC_INTR_DUMMY_HANDLER(165) LAPIC_INTR_DUMMY_HANDLER(167)
LAPIC_INTR_DUMMY_HANDLER(166) LAPIC_INTR_DUMMY_HANDLER(168)
LAPIC_INTR_DUMMY_HANDLER(167) LAPIC_INTR_DUMMY_HANDLER(169)
LAPIC_INTR_DUMMY_HANDLER(168) LAPIC_INTR_DUMMY_HANDLER(170)
LAPIC_INTR_DUMMY_HANDLER(169) LAPIC_INTR_DUMMY_HANDLER(171)
LAPIC_INTR_DUMMY_HANDLER(170) LAPIC_INTR_DUMMY_HANDLER(172)
LAPIC_INTR_DUMMY_HANDLER(171) LAPIC_INTR_DUMMY_HANDLER(173)
LAPIC_INTR_DUMMY_HANDLER(172) LAPIC_INTR_DUMMY_HANDLER(174)
LAPIC_INTR_DUMMY_HANDLER(173) LAPIC_INTR_DUMMY_HANDLER(175)
LAPIC_INTR_DUMMY_HANDLER(174) LAPIC_INTR_DUMMY_HANDLER(176)
LAPIC_INTR_DUMMY_HANDLER(175) LAPIC_INTR_DUMMY_HANDLER(177)
LAPIC_INTR_DUMMY_HANDLER(176) LAPIC_INTR_DUMMY_HANDLER(178)
LAPIC_INTR_DUMMY_HANDLER(177) LAPIC_INTR_DUMMY_HANDLER(179)
LAPIC_INTR_DUMMY_HANDLER(178) LAPIC_INTR_DUMMY_HANDLER(180)
LAPIC_INTR_DUMMY_HANDLER(179) LAPIC_INTR_DUMMY_HANDLER(181)
LAPIC_INTR_DUMMY_HANDLER(180) LAPIC_INTR_DUMMY_HANDLER(182)
LAPIC_INTR_DUMMY_HANDLER(181) LAPIC_INTR_DUMMY_HANDLER(183)
LAPIC_INTR_DUMMY_HANDLER(182) LAPIC_INTR_DUMMY_HANDLER(184)
LAPIC_INTR_DUMMY_HANDLER(183) LAPIC_INTR_DUMMY_HANDLER(185)
LAPIC_INTR_DUMMY_HANDLER(184) LAPIC_INTR_DUMMY_HANDLER(186)
LAPIC_INTR_DUMMY_HANDLER(185) LAPIC_INTR_DUMMY_HANDLER(187)
LAPIC_INTR_DUMMY_HANDLER(186) LAPIC_INTR_DUMMY_HANDLER(188)
LAPIC_INTR_DUMMY_HANDLER(187) LAPIC_INTR_DUMMY_HANDLER(189)
LAPIC_INTR_DUMMY_HANDLER(188) LAPIC_INTR_DUMMY_HANDLER(190)
LAPIC_INTR_DUMMY_HANDLER(189) LAPIC_INTR_DUMMY_HANDLER(191)
LAPIC_INTR_DUMMY_HANDLER(190) LAPIC_INTR_DUMMY_HANDLER(192)
LAPIC_INTR_DUMMY_HANDLER(191) LAPIC_INTR_DUMMY_HANDLER(193)
LAPIC_INTR_DUMMY_HANDLER(192) LAPIC_INTR_DUMMY_HANDLER(194)
LAPIC_INTR_DUMMY_HANDLER(193) LAPIC_INTR_DUMMY_HANDLER(195)
LAPIC_INTR_DUMMY_HANDLER(194) LAPIC_INTR_DUMMY_HANDLER(196)
LAPIC_INTR_DUMMY_HANDLER(195) LAPIC_INTR_DUMMY_HANDLER(197)
LAPIC_INTR_DUMMY_HANDLER(196) LAPIC_INTR_DUMMY_HANDLER(198)
LAPIC_INTR_DUMMY_HANDLER(197) LAPIC_INTR_DUMMY_HANDLER(199)
LAPIC_INTR_DUMMY_HANDLER(198) LAPIC_INTR_DUMMY_HANDLER(200)
LAPIC_INTR_DUMMY_HANDLER(199) LAPIC_INTR_DUMMY_HANDLER(201)
LAPIC_INTR_DUMMY_HANDLER(200) LAPIC_INTR_DUMMY_HANDLER(202)
LAPIC_INTR_DUMMY_HANDLER(201) LAPIC_INTR_DUMMY_HANDLER(203)
LAPIC_INTR_DUMMY_HANDLER(202) LAPIC_INTR_DUMMY_HANDLER(204)
LAPIC_INTR_DUMMY_HANDLER(203) LAPIC_INTR_DUMMY_HANDLER(205)
LAPIC_INTR_DUMMY_HANDLER(204) LAPIC_INTR_DUMMY_HANDLER(206)
LAPIC_INTR_DUMMY_HANDLER(205) LAPIC_INTR_DUMMY_HANDLER(207)
LAPIC_INTR_DUMMY_HANDLER(206) LAPIC_INTR_DUMMY_HANDLER(208)
LAPIC_INTR_DUMMY_HANDLER(207) LAPIC_INTR_DUMMY_HANDLER(209)
LAPIC_INTR_DUMMY_HANDLER(208) LAPIC_INTR_DUMMY_HANDLER(210)
LAPIC_INTR_DUMMY_HANDLER(209) LAPIC_INTR_DUMMY_HANDLER(211)
LAPIC_INTR_DUMMY_HANDLER(210) LAPIC_INTR_DUMMY_HANDLER(212)
LAPIC_INTR_DUMMY_HANDLER(211) LAPIC_INTR_DUMMY_HANDLER(213)
LAPIC_INTR_DUMMY_HANDLER(212) LAPIC_INTR_DUMMY_HANDLER(214)
LAPIC_INTR_DUMMY_HANDLER(213) LAPIC_INTR_DUMMY_HANDLER(215)
LAPIC_INTR_DUMMY_HANDLER(214) LAPIC_INTR_DUMMY_HANDLER(216)
LAPIC_INTR_DUMMY_HANDLER(215) LAPIC_INTR_DUMMY_HANDLER(217)
LAPIC_INTR_DUMMY_HANDLER(216) LAPIC_INTR_DUMMY_HANDLER(218)
LAPIC_INTR_DUMMY_HANDLER(217) LAPIC_INTR_DUMMY_HANDLER(219)
LAPIC_INTR_DUMMY_HANDLER(218) LAPIC_INTR_DUMMY_HANDLER(220)
LAPIC_INTR_DUMMY_HANDLER(219) LAPIC_INTR_DUMMY_HANDLER(221)
LAPIC_INTR_DUMMY_HANDLER(220) LAPIC_INTR_DUMMY_HANDLER(222)
LAPIC_INTR_DUMMY_HANDLER(221) LAPIC_INTR_DUMMY_HANDLER(223)
LAPIC_INTR_DUMMY_HANDLER(222) LAPIC_INTR_DUMMY_HANDLER(224)
LAPIC_INTR_DUMMY_HANDLER(223) LAPIC_INTR_DUMMY_HANDLER(225)
LAPIC_INTR_DUMMY_HANDLER(224) LAPIC_INTR_DUMMY_HANDLER(226)
LAPIC_INTR_DUMMY_HANDLER(225) LAPIC_INTR_DUMMY_HANDLER(227)
LAPIC_INTR_DUMMY_HANDLER(226) LAPIC_INTR_DUMMY_HANDLER(228)
LAPIC_INTR_DUMMY_HANDLER(227) LAPIC_INTR_DUMMY_HANDLER(229)
LAPIC_INTR_DUMMY_HANDLER(228) LAPIC_INTR_DUMMY_HANDLER(230)
LAPIC_INTR_DUMMY_HANDLER(229) LAPIC_INTR_DUMMY_HANDLER(231)
LAPIC_INTR_DUMMY_HANDLER(230) LAPIC_INTR_DUMMY_HANDLER(232)
LAPIC_INTR_DUMMY_HANDLER(231) LAPIC_INTR_DUMMY_HANDLER(233)
LAPIC_INTR_DUMMY_HANDLER(232) LAPIC_INTR_DUMMY_HANDLER(234)
LAPIC_INTR_DUMMY_HANDLER(233) LAPIC_INTR_DUMMY_HANDLER(235)
LAPIC_INTR_DUMMY_HANDLER(234) LAPIC_INTR_DUMMY_HANDLER(236)
LAPIC_INTR_DUMMY_HANDLER(235) LAPIC_INTR_DUMMY_HANDLER(237)
LAPIC_INTR_DUMMY_HANDLER(236) LAPIC_INTR_DUMMY_HANDLER(238)
LAPIC_INTR_DUMMY_HANDLER(237) LAPIC_INTR_DUMMY_HANDLER(239)
LAPIC_INTR_DUMMY_HANDLER(238) LAPIC_INTR_DUMMY_HANDLER(240)
LAPIC_INTR_DUMMY_HANDLER(239) LAPIC_INTR_DUMMY_HANDLER(241)
LAPIC_INTR_DUMMY_HANDLER(240) LAPIC_INTR_DUMMY_HANDLER(242)
LAPIC_INTR_DUMMY_HANDLER(241) LAPIC_INTR_DUMMY_HANDLER(243)
LAPIC_INTR_DUMMY_HANDLER(242) LAPIC_INTR_DUMMY_HANDLER(244)
LAPIC_INTR_DUMMY_HANDLER(243) LAPIC_INTR_DUMMY_HANDLER(245)
LAPIC_INTR_DUMMY_HANDLER(244) LAPIC_INTR_DUMMY_HANDLER(246)
LAPIC_INTR_DUMMY_HANDLER(245) LAPIC_INTR_DUMMY_HANDLER(247)
LAPIC_INTR_DUMMY_HANDLER(246) LAPIC_INTR_DUMMY_HANDLER(248)
LAPIC_INTR_DUMMY_HANDLER(247) LAPIC_INTR_DUMMY_HANDLER(249)
LAPIC_INTR_DUMMY_HANDLER(248) LAPIC_INTR_DUMMY_HANDLER(250)
LAPIC_INTR_DUMMY_HANDLER(249) LAPIC_INTR_DUMMY_HANDLER(251)
LAPIC_INTR_DUMMY_HANDLER(250) LAPIC_INTR_DUMMY_HANDLER(252)
LAPIC_INTR_DUMMY_HANDLER(251) LAPIC_INTR_DUMMY_HANDLER(253)
LAPIC_INTR_DUMMY_HANDLER(252) LAPIC_INTR_DUMMY_HANDLER(254)
LAPIC_INTR_DUMMY_HANDLER(253) LAPIC_INTR_DUMMY_HANDLER(255)
LAPIC_INTR_DUMMY_HANDLER(254) LABEL(lapic_intr_dummy_handles_end)
LAPIC_INTR_DUMMY_HANDLER(255)
.globl _lapic_intr_dummy_handles_end
_lapic_intr_dummy_handles_end:
#endif /* CONFIG_APIC_DEBUG */ #endif /* CONFIG_APIC_DEBUG */

View file

@ -1,15 +1,12 @@
.text #include <machine/asm.h>
#define LD_ST_REG(reg) ;\ #define LD_ST_REG(reg) ;\
.globl _ld_##reg ;\ ENTRY(ld_##reg) ;\
.globl _st_##reg ;\
;\
_ld_##reg: ;\
mov 4(%esp), %eax ;\ mov 4(%esp), %eax ;\
mov %eax, %reg ;\ mov %eax, %reg ;\
ret ;\ ret ;\
;\ ;\
_st_##reg: ;\ ENTRY(st_##reg) ;\
mov %reg, %eax ;\ mov %reg, %eax ;\
ret ret

View file

@ -1,10 +1,9 @@
/* inb() - Input one byte Author: Kees J. Bot */ /* inb() - Input one byte Author: Kees J. Bot */
/* 18 Mar 1996 */ /* 18 Mar 1996 */
/* unsigned inb(U16_t port); */ /* unsigned inb(U16_t port); */
#include <machine/asm.h>
.text ENTRY(inb)
.globl _inb
_inb:
push %ebp push %ebp
movl %esp, %ebp movl %esp, %ebp
movl 8(%ebp), %edx /* port */ movl 8(%ebp), %edx /* port */

View file

@ -1,10 +1,9 @@
/* inl() - Input one dword Author: Kees J. Bot */ /* inl() - Input one dword Author: Kees J. Bot */
/* 18 Mar 1996 */ /* 18 Mar 1996 */
/* unsigned inl(U16_t port); */ /* unsigned inl(U16_t port); */
#include <machine/asm.h>
.text ENTRY(inl)
.globl _inl
_inl:
push %ebp push %ebp
movl %esp, %ebp movl %esp, %ebp
movl 8(%ebp), %edx /* port */ movl 8(%ebp), %edx /* port */

View file

@ -3,14 +3,12 @@
/* 18 Mar 1996 */ /* 18 Mar 1996 */
/* void intr_disable(void); */ /* void intr_disable(void); */
/* void intr_enable(void); */ /* void intr_enable(void); */
#include <machine/asm.h>
.text ENTRY(intr_disable)
.globl _intr_disable
_intr_disable:
cli cli
ret ret
.globl _intr_enable ENTRY(intr_enable)
_intr_enable:
sti sti
ret ret

View file

@ -1,10 +1,9 @@
/* inw() - Input one word Author: Kees J. Bot */ /* inw() - Input one word Author: Kees J. Bot */
/* 18 Mar 1996 */ /* 18 Mar 1996 */
/* unsigned inw(U16_t port); */ /* unsigned inw(U16_t port); */
#include <machine/asm.h>
.text ENTRY(inw)
.globl _inw
_inw:
push %ebp push %ebp
movl %esp, %ebp movl %esp, %ebp
movl 8(%ebp), %edx /* port */ movl 8(%ebp), %edx /* port */

View file

@ -1,10 +1,9 @@
/* outb() - Output one byte Author: Kees J. Bot */ /* outb() - Output one byte Author: Kees J. Bot */
/* 18 Mar 1996 */ /* 18 Mar 1996 */
/* void outb(U16_t port, U8_t value); */ /* void outb(U16_t port, U8_t value); */
#include <machine/asm.h>
.text ENTRY(outb)
.globl _outb
_outb:
push %ebp push %ebp
movl %esp, %ebp movl %esp, %ebp
movl 8(%ebp), %edx /* port */ movl 8(%ebp), %edx /* port */

View file

@ -1,10 +1,9 @@
/* outl() - Output one dword Author: Kees J. Bot */ /* outl() - Output one dword Author: Kees J. Bot */
/* 18 Mar 1996 */ /* 18 Mar 1996 */
/* void outl(U16_t port, u32_t value); */ /* void outl(U16_t port, u32_t value); */
#include <machine/asm.h>
.text ENTRY(outl)
.globl _outl
_outl:
push %ebp push %ebp
movl %esp, %ebp movl %esp, %ebp
movl 8(%ebp), %edx /* port */ movl 8(%ebp), %edx /* port */

View file

@ -1,10 +1,9 @@
/* outw() - Output one word Author: Kees J. Bot */ /* outw() - Output one word Author: Kees J. Bot */
/* 18 Mar 1996 */ /* 18 Mar 1996 */
/* void outw(U16_t port, U16_t value); */ /* void outw(U16_t port, U16_t value); */
#include <machine/asm.h>
.text ENTRY(outw)
.globl _outw
_outw:
push %ebp push %ebp
movl %esp, %ebp movl %esp, %ebp
movl 8(%ebp), %edx /* port */ movl 8(%ebp), %edx /* port */

View file

@ -3,6 +3,7 @@
#include <minix/config.h> #include <minix/config.h>
#include <minix/const.h> #include <minix/const.h>
#include <machine/asm.h>
#include <machine/interrupt.h> #include <machine/interrupt.h>
#include <i386/vm.h> #include <i386/vm.h>
#include "archconst.h" #include "archconst.h"
@ -12,52 +13,9 @@
/* /*
* This file contains a number of assembly code utility routines needed by the * This file contains a number of assembly code utility routines needed by the
* kernel. They are: * kernel.
*/ */
.globl _monitor/* exit Minix and return to the monitor */
.globl _int86 /* let the monitor make an 8086 interrupt call */
#ifdef __ACK__
.globl _exit /* dummy for library routines */
.globl __exit /* dummy for library routines */
.globl ___exit /* dummy for library routines */
#endif
.globl ___main /* dummy for GCC */
.globl _phys_insw /* transfer data from (disk controller) port to memory */
.globl _phys_insb /* likewise byte by byte */
.globl _phys_outsw /* transfer data from memory to (disk controller) port */
.globl _phys_outsb /* likewise byte by byte */
.globl _phys_copy /* copy data from anywhere to 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 _reset /* reset the system */
.globl _halt_cpu/* halts the current cpu when idle */
.globl _read_cpu_flags /* read the cpu flags */
.globl _read_cr0 /* read cr0 */
.globl _read_cr2 /* read cr2 */
.globl _getcr3val
.globl _write_cr0 /* write a value in cr0 */
.globl _read_cr3
.globl _write_cr3
.globl _read_cr4
.globl _write_cr4
.globl _catch_pagefaults
.globl _read_ds
.globl _read_cs
.globl _read_ss
.globl _idt_reload /* reload idt when returning to monitor. */
.globl _fninit /* non-waiting FPU initialization */
.globl _fnstsw /* store status word (non-waiting) */
.globl _fnstcw /* store control word (non-waiting) */
.globl _fxsave
.globl _fnsave
.globl _fxrstor
.globl _frstor
.globl _clts
/* /*
* The routines only guarantee to preserve the registers the C compiler * The routines only guarantee to preserve the registers the C compiler
@ -65,15 +23,13 @@
* direction bit in the flags). * direction bit in the flags).
*/ */
.text
/*===========================================================================*/ /*===========================================================================*/
/* monitor */ /* monitor */
/*===========================================================================*/ /*===========================================================================*/
/* PUBLIC void monitor(); */ /* PUBLIC void monitor(); */
/* Return to the monitor. */ /* exit Minix and return to the monitor */
ENTRY(monitor)
_monitor: movl _C_LABEL(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
@ -90,12 +46,13 @@ _monitor:
/* int86 */ /* int86 */
/*===========================================================================*/ /*===========================================================================*/
/* PUBLIC void int86(); */ /* PUBLIC void int86(); */
_int86: /* let the monitor make an 8086 interrupt call */
cmpb $0, _mon_return /* is the monitor there? */ ENTRY(int86)
cmpb $0, _C_LABEL(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, _C_LABEL(reg86)+0 /* reg86.w.f = 1 (set carry flag) */
movb %ah, _reg86+13 /* reg86.b.ah = 0x01 = "invalid command" */ movb %ah, _C_LABEL(reg86)+13 /* reg86.b.ah = 0x01 = "invalid command" */
ret ret
0: 0:
push %ebp /* save C registers */ push %ebp /* save C registers */
@ -109,7 +66,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 _C_LABEL(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
@ -117,17 +74,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 _C_LABEL(mon_sp), %esp /* switch stacks */
push _reg86+36 /* parameters used in INT call */ push _C_LABEL(reg86)+36 /* parameters used in INT call */
push _reg86+32 push _C_LABEL(reg86)+32
push _reg86+28 push _C_LABEL(reg86)+28
push _reg86+24 push _C_LABEL(reg86)+24
push _reg86+20 push _C_LABEL(reg86)+20
push _reg86+16 push _C_LABEL(reg86)+16
push _reg86+12 push _C_LABEL(reg86)+12
push _reg86+8 push _C_LABEL(reg86)+8
push _reg86+4 push _C_LABEL(reg86)+4
push _reg86+0 push _C_LABEL(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
@ -136,17 +93,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 _C_LABEL(reg86)+0
pop _reg86+4 pop _C_LABEL(reg86)+4
pop _reg86+8 pop _C_LABEL(reg86)+8
pop _reg86+12 pop _C_LABEL(reg86)+12
pop _reg86+16 pop _C_LABEL(reg86)+16
pop _reg86+20 pop _C_LABEL(reg86)+20
pop _reg86+24 pop _C_LABEL(reg86)+24
pop _reg86+28 pop _C_LABEL(reg86)+28
pop _reg86+32 pop _C_LABEL(reg86)+32
pop _reg86+36 pop _C_LABEL(reg86)+36
lgdt _gdt+GDT_SELECTOR /* reload global descriptor table */ lgdt _C_LABEL(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
@ -155,8 +112,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 _C_LABEL(mon_sp), %esp /* unswitch stacks */
lidt _gdt+IDT_SELECTOR /* reload interrupt descriptor table */ lidt _C_LABEL(gdt)+IDT_SELECTOR /* reload interrupt descriptor table */
#ifdef CONFIG_APIC #ifdef CONFIG_APIC
cmpl $0x0, lapic_addr cmpl $0x0, lapic_addr
@ -180,7 +137,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 _C_LABEL(gdt)+DESC_ACCESS, %eax
and $~0x02, %eax and $~0x02, %eax
ltr %bx /* set TSS register */ ltr %bx /* set TSS register */
@ -195,7 +152,7 @@ csinit:
outb $INT2_CTLMASK outb $INT2_CTLMASK
6: 6:
addl %ecx, _lost_ticks /* record lost clock ticks */ addl %ecx, _C_LABEL(lost_ticks) /* record lost clock ticks */
popf /* restore flags */ popf /* restore flags */
pop %ebx /* restore C registers */ pop %ebx /* restore C registers */
@ -214,14 +171,14 @@ csinit:
* GNU CC likes to call ___main from main() for nonobvious reasons. * GNU CC likes to call ___main from main() for nonobvious reasons.
*/ */
#ifdef __ACK__ #ifdef __ACK__
_exit: ENTRY(exit)
__exit: ENTRY(_exit)
___exit: ENTRY(__exit)
sti sti
jmp ___exit jmp _C_LABEL(__exit)
#endif #endif
___main: ENTRY(__main)
ret ret
@ -232,8 +189,8 @@ ___main:
* PUBLIC void phys_insw(Port_t port, phys_bytes buf, size_t count); * PUBLIC void phys_insw(Port_t port, phys_bytes buf, size_t count);
* 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().
*/ */
/* transfer data from (disk controller) port to memory */
_phys_insw: ENTRY(phys_insw)
push %ebp push %ebp
mov %esp, %ebp mov %esp, %ebp
cld cld
@ -260,8 +217,8 @@ _phys_insw:
* PUBLIC void phys_insb(Port_t port, phys_bytes buf, size_t count); * PUBLIC void phys_insb(Port_t port, phys_bytes buf, size_t count);
* 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().
*/ */
/* transfer data from (disk controller) port to memory byte by byte */
_phys_insb: ENTRY(phys_insb)
push %ebp push %ebp
mov %esp, %ebp mov %esp, %ebp
cld cld
@ -287,9 +244,8 @@ _phys_insb:
* PUBLIC void phys_outsw(Port_t port, phys_bytes buf, size_t count); * PUBLIC void phys_outsw(Port_t port, phys_bytes buf, size_t count);
* Output an array to an I/O port. Absolute address version of outsw(). * Output an array to an I/O port. Absolute address version of outsw().
*/ */
/* transfer data from memory to (disk controller) port */
.balign 16 ENTRY(phys_outsw)
_phys_outsw:
push %ebp push %ebp
mov %esp, %ebp mov %esp, %ebp
cld cld
@ -316,9 +272,8 @@ _phys_outsw:
* PUBLIC void phys_outsb(Port_t port, phys_bytes buf, size_t count); * PUBLIC void phys_outsb(Port_t port, phys_bytes buf, size_t count);
* Output an array to an I/O port. Absolute address version of outsb(). * Output an array to an I/O port. Absolute address version of outsb().
*/ */
/* transfer data from memory to (disk controller) port byte by byte */
.balign 16 ENTRY(phys_outsb)
_phys_outsb:
push %ebp push %ebp
mov %esp, %ebp mov %esp, %ebp
cld cld
@ -343,14 +298,11 @@ _phys_outsb:
/* /*
* PUBLIC phys_bytes phys_copy(phys_bytes source, phys_bytes destination, * PUBLIC phys_bytes phys_copy(phys_bytes source, phys_bytes destination,
* phys_bytes bytecount); * phys_bytes bytecount);
* Copy a block of physical memory. * Copy a block of data from anywhere to anywhere in physical memory.
*/ */
PC_ARGS = 4+4+4+4 /* 4 + 4 + 4 */ PC_ARGS = 4+4+4+4 /* 4 + 4 + 4 */
/* es edi esi eip src dst len */ /* es edi esi eip src dst len */
ENTRY(phys_copy)
.balign 16
_phys_copy:
cld cld
push %esi push %esi
push %edi push %edi
@ -382,13 +334,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 */ LABEL(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 */ LABEL(phys_copy_fault_in_kernel) /* kernel can send us here */
pop %es pop %es
pop %edi pop %edi
pop %esi pop %esi
@ -417,10 +369,7 @@ _phys_copy_fault_in_kernel: /* kernel can send us here */
* wrong pointers from userspace and the caller should return an error to * wrong pointers from userspace and the caller should return an error to
* userspace as if wrong values or request were passed to the kernel * userspace as if wrong values or request were passed to the kernel
*/ */
ENTRY(copy_msg_from_user)
.balign 16
.globl _copy_msg_from_user
_copy_msg_from_user:
push %gs push %gs
mov 8(%esp), %eax mov 8(%esp), %eax
@ -450,8 +399,7 @@ _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 LABEL(__copy_msg_from_user_end)
___copy_msg_from_user_end:
pop %gs pop %gs
@ -470,10 +418,7 @@ ___copy_msg_from_user_end:
* *
* All the other copy_msg_from_user() comments apply here as well! * All the other copy_msg_from_user() comments apply here as well!
*/ */
ENTRY(copy_msg_to_user)
.balign 16
.globl _copy_msg_to_user
_copy_msg_to_user:
push %gs push %gs
mov 8(%esp), %eax mov 8(%esp), %eax
@ -503,8 +448,7 @@ _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 LABEL(__copy_msg_to_user_end)
___copy_msg_to_user_end:
pop %gs pop %gs
@ -518,9 +462,7 @@ ___copy_msg_to_user_end:
* called from has to handle this situation. The exception handler redirect us * called from has to handle this situation. The exception handler redirect us
* here to continue, clean up and report the error * here to continue, clean up and report the error
*/ */
.balign 16 ENTRY(__user_copy_msg_pointer_failure)
.globl ___user_copy_msg_pointer_failure
___user_copy_msg_pointer_failure:
pop %gs pop %gs
movl $-1, %eax movl $-1, %eax
@ -534,9 +476,7 @@ ___user_copy_msg_pointer_failure:
* phys_bytes bytecount); * phys_bytes bytecount);
* Fill a block of physical memory with pattern. * Fill a block of physical memory with pattern.
*/ */
ENTRY(phys_memset)
.balign 16
_phys_memset:
push %ebp push %ebp
mov %esp, %ebp mov %esp, %ebp
push %esi push %esi
@ -581,9 +521,7 @@ fill_done:
* PUBLIC u16_t mem_rdw(U16_t segment, u16_t *offset); * PUBLIC u16_t mem_rdw(U16_t segment, u16_t *offset);
* Load and return word at far pointer segment:offset. * Load and return word at far pointer segment:offset.
*/ */
ENTRY(mem_rdw)
.balign 16
_mem_rdw:
mov %ds, %cx mov %ds, %cx
mov 4(%esp), %ds mov 4(%esp), %ds
mov 4+4(%esp), %eax /* offset */ mov 4+4(%esp), %eax /* offset */
@ -599,8 +537,7 @@ _mem_rdw:
* PUBLIC void reset(); * PUBLIC void reset();
* Reset the system by loading IDT with offset 0 and interrupting. * Reset the system by loading IDT with offset 0 and interrupting.
*/ */
ENTRY(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
@ -617,7 +554,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: ENTRY(halt_cpu)
sti sti
hlt /* interrupts enabled only after this instruction is executed! */ hlt /* interrupts enabled only after this instruction is executed! */
/* /*
@ -633,48 +570,50 @@ _halt_cpu:
* PUBLIC unsigned long read_cpu_flags(void); * PUBLIC unsigned long read_cpu_flags(void);
* Read CPU status flags from C. * Read CPU status flags from C.
*/ */
.balign 16 ENTRY(read_cpu_flags)
_read_cpu_flags:
pushf pushf
mov (%esp), %eax mov (%esp), %eax
add $4, %esp add $4, %esp
ret ret
_read_ds: ENTRY(read_ds)
mov $0, %eax mov $0, %eax
mov %ds, %ax mov %ds, %ax
ret ret
_read_cs: ENTRY(read_cs)
mov $0, %eax mov $0, %eax
mov %cs, %ax mov %cs, %ax
ret ret
_read_ss: ENTRY(read_ss)
mov $0, %eax mov $0, %eax
mov %ss, %ax mov %ss, %ax
ret ret
/*===========================================================================*/ /*===========================================================================*/
/* fpu_routines */ /* fpu_routines */
/*===========================================================================*/ /*===========================================================================*/
_fninit:
/* non-waiting FPU initialization */
ENTRY(fninit)
fninit fninit
ret ret
_clts: ENTRY(clts)
clts clts
ret ret
_fnstsw: /* store status word (non-waiting) */
ENTRY(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: /* store control word (non-waiting) */
ENTRY(fnstcw)
push %eax push %eax
mov 8(%esp), %eax mov 8(%esp), %eax
@ -686,7 +625,7 @@ _fnstcw:
/*===========================================================================*/ /*===========================================================================*/
/* fxsave */ /* fxsave */
/*===========================================================================*/ /*===========================================================================*/
_fxsave: ENTRY(fxsave)
mov 4(%esp), %eax mov 4(%esp), %eax
fxsave (%eax) /* Do not change the operand! (gas2ack) */ fxsave (%eax) /* Do not change the operand! (gas2ack) */
ret ret
@ -694,7 +633,7 @@ _fxsave:
/*===========================================================================*/ /*===========================================================================*/
/* fnsave */ /* fnsave */
/*===========================================================================*/ /*===========================================================================*/
_fnsave: ENTRY(fnsave)
mov 4(%esp), %eax mov 4(%esp), %eax
fnsave (%eax) /* Do not change the operand! (gas2ack) */ fnsave (%eax) /* Do not change the operand! (gas2ack) */
fwait /* required for compatibility with processors prior pentium */ fwait /* required for compatibility with processors prior pentium */
@ -703,7 +642,7 @@ _fnsave:
/*===========================================================================*/ /*===========================================================================*/
/* fxrstor */ /* fxrstor */
/*===========================================================================*/ /*===========================================================================*/
_fxrstor: ENTRY(fxrstor)
mov 4(%esp), %eax mov 4(%esp), %eax
fxrstor (%eax) /* Do not change the operand! (gas2ack) */ fxrstor (%eax) /* Do not change the operand! (gas2ack) */
ret ret
@ -711,7 +650,7 @@ _fxrstor:
/*===========================================================================*/ /*===========================================================================*/
/* frstor */ /* frstor */
/*===========================================================================*/ /*===========================================================================*/
_frstor: ENTRY(frstor)
mov 4(%esp), %eax mov 4(%esp), %eax
frstor (%eax) /* Do not change the operand! (gas2ack) */ frstor (%eax) /* Do not change the operand! (gas2ack) */
ret ret
@ -721,7 +660,7 @@ _frstor:
/* read_cr0 */ /* read_cr0 */
/*===========================================================================*/ /*===========================================================================*/
/* PUBLIC unsigned long read_cr0(void); */ /* PUBLIC unsigned long read_cr0(void); */
_read_cr0: ENTRY(read_cr0)
push %ebp push %ebp
mov %esp, %ebp mov %esp, %ebp
mov %cr0, %eax mov %cr0, %eax
@ -732,7 +671,7 @@ _read_cr0:
/* write_cr0 */ /* write_cr0 */
/*===========================================================================*/ /*===========================================================================*/
/* PUBLIC void write_cr0(unsigned long value); */ /* PUBLIC void write_cr0(unsigned long value); */
_write_cr0: ENTRY(write_cr0)
push %ebp push %ebp
mov %esp, %ebp mov %esp, %ebp
mov 8(%ebp), %eax mov 8(%ebp), %eax
@ -746,7 +685,7 @@ _write_cr0:
/* read_cr2 */ /* read_cr2 */
/*===========================================================================*/ /*===========================================================================*/
/* PUBLIC reg_t read_cr2(void); */ /* PUBLIC reg_t read_cr2(void); */
_read_cr2: ENTRY(read_cr2)
mov %cr2, %eax mov %cr2, %eax
ret ret
@ -754,7 +693,7 @@ _read_cr2:
/* read_cr3 */ /* read_cr3 */
/*===========================================================================*/ /*===========================================================================*/
/* PUBLIC unsigned long read_cr3(void); */ /* PUBLIC unsigned long read_cr3(void); */
_read_cr3: ENTRY(read_cr3)
push %ebp push %ebp
mov %esp, %ebp mov %esp, %ebp
@ -767,7 +706,7 @@ _read_cr3:
/* read_cr4 */ /* read_cr4 */
/*===========================================================================*/ /*===========================================================================*/
/* PUBLIC unsigned long read_cr4(void); */ /* PUBLIC unsigned long read_cr4(void); */
_read_cr4: ENTRY(read_cr4)
push %ebp push %ebp
mov %esp, %ebp mov %esp, %ebp
@ -780,7 +719,7 @@ _read_cr4:
/* write_cr4 */ /* write_cr4 */
/*===========================================================================*/ /*===========================================================================*/
/* PUBLIC void write_cr4(unsigned long value); */ /* PUBLIC void write_cr4(unsigned long value); */
_write_cr4: ENTRY(write_cr4)
push %ebp push %ebp
mov %esp, %ebp mov %esp, %ebp
mov 8(%ebp), %eax mov 8(%ebp), %eax
@ -796,7 +735,7 @@ _write_cr4:
/* write_cr3 */ /* write_cr3 */
/*===========================================================================*/ /*===========================================================================*/
/* PUBLIC void write_cr3(unsigned long value); */ /* PUBLIC void write_cr3(unsigned long value); */
_write_cr3: ENTRY(write_cr3)
push %ebp push %ebp
mov %esp, %ebp mov %esp, %ebp
mov 8(%ebp), %eax mov 8(%ebp), %eax
@ -811,7 +750,7 @@ _write_cr3:
/* getcr3val */ /* getcr3val */
/*===========================================================================*/ /*===========================================================================*/
/* PUBLIC unsigned long getcr3val(void); */ /* PUBLIC unsigned long getcr3val(void); */
_getcr3val: ENTRY(getcr3val)
mov %cr3, %eax mov %cr3, %eax
ret ret
@ -820,8 +759,7 @@ _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 ENTRY(ia32_msr_read)
_ia32_msr_read:
push %ebp push %ebp
mov %esp, %ebp mov %esp, %ebp
@ -840,8 +778,7 @@ _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 ENTRY(ia32_msr_write)
_ia32_msr_write:
push %ebp push %ebp
mov %esp, %ebp mov %esp, %ebp
@ -857,9 +794,9 @@ _ia32_msr_write:
/* idt_reload */ /* idt_reload */
/*===========================================================================*/ /*===========================================================================*/
/* PUBLIC void idt_reload (void); */ /* PUBLIC void idt_reload (void); */
.balign 16 /* reload idt when returning to monitor. */
_idt_reload: ENTRY(idt_reload)
lidt _gdt+IDT_SELECTOR /* reload interrupt descriptor table */ lidt _C_LABEL(gdt)+IDT_SELECTOR /* reload interrupt descriptor table */
ret ret
/* /*
@ -870,8 +807,7 @@ _idt_reload:
mov reg, %ax ;\ mov reg, %ax ;\
mov %ax, reg ; mov %ax, reg ;
.globl _reload_ds ENTRY(reload_ds)
_reload_ds:
RELOAD_SEG_REG(%ds) RELOAD_SEG_REG(%ds)
ret ret
@ -884,10 +820,7 @@ _reload_ds:
* same value in which case it would only result in an extra TLB flush which is * same value in which case it would only result in an extra TLB flush which is
* not desirable * not desirable
*/ */
.balign 16 ENTRY(switch_address_space)
.globl _switch_address_space
_switch_address_space:
/* read the process pointer */ /* read the process pointer */
mov 4(%esp), %edx mov 4(%esp), %edx
/* enable process' segment descriptors */ /* enable process' segment descriptors */
@ -906,7 +839,7 @@ _switch_address_space:
cmp %ecx, %eax cmp %ecx, %eax
je 0f je 0f
mov %eax, %cr3 mov %eax, %cr3
mov %edx, _ptproc mov %edx, _C_LABEL(ptproc)
0: 0:
ret ret
@ -915,11 +848,10 @@ _switch_address_space:
/*===========================================================================*/ /*===========================================================================*/
/* PUBLIC void poweroff(); */ /* PUBLIC void poweroff(); */
/* Jump to 16-bit poweroff code */ /* Jump to 16-bit poweroff code */
.globl _poweroff_jmp ENTRY(poweroff_jmp)
_poweroff_jmp:
cli cli
/* Make real mode descriptor */ /* Make real mode descriptor */
mov $(_gdt + SS_SELECTOR), %edi mov $(_C_LABEL(gdt) + SS_SELECTOR), %edi
mov $0x100, %eax mov $0x100, %eax
movw %ax, 2(%edi) movw %ax, 2(%edi)
shr $16, %eax shr $16, %eax

View file

@ -3,6 +3,7 @@
#include <minix/config.h> #include <minix/config.h>
#include <minix/const.h> #include <minix/const.h>
#include <machine/asm.h>
#include <machine/interrupt.h> #include <machine/interrupt.h>
#include "archconst.h" #include "archconst.h"
#include "kernel/const.h" #include "kernel/const.h"
@ -11,12 +12,9 @@
/* /*
* This file contains a number of 16-bit assembly code utility routines needed by the * This file contains a number of 16-bit assembly code utility routines needed by the
* kernel. They are: * kernel.
*/ */
.globl _poweroff16 /* enter real mode */
.globl _poweroff16_end
.text .text
.code16 .code16
@ -25,10 +23,10 @@
/*===========================================================================*/ /*===========================================================================*/
/* PUBLIC void poweroff16(); */ /* PUBLIC void poweroff16(); */
/* Power down system */ /* Power down system */
_poweroff16: ENTRY(poweroff16)
/* Assume eax is already set to required value of cr0*/ /* Assume eax is already set to required value of cr0*/
.byte 0x0F,0x22,0xC0 /* mov %cr0,%eax */ .byte 0x0F,0x22,0xC0 /* mov %cr0,%eax */
ljmp $0,$(BIOS_POWEROFF_ENTRY + real_mode - _poweroff16) ljmp $0,$(BIOS_POWEROFF_ENTRY + real_mode - _C_LABEL(poweroff16))
real_mode: real_mode:
mov $((BIOS_POWEROFF_ENTRY >> 4) + 0x200),%ax mov $((BIOS_POWEROFF_ENTRY >> 4) + 0x200),%ax
mov %ax, %ds mov %ax, %ds
@ -88,7 +86,7 @@ apm_err:
mov $0x07, %bx mov $0x07, %bx
mov $POWEROFF_MSG_LEN, %cx mov $POWEROFF_MSG_LEN, %cx
mov $0x0300, %dx mov $0x0300, %dx
mov $(poweroff_msg - _poweroff16), %bp mov $(poweroff_msg - _C_LABEL(poweroff16)), %bp
int $0x10 int $0x10
0: hlt 0: hlt
jmp 0b jmp 0b
@ -99,4 +97,4 @@ kb_wait:
jnz kb_wait jnz kb_wait
ret ret
/*mark the end for copy*/ /*mark the end for copy*/
_poweroff16_end: LABEL(poweroff16_end)

View file

@ -47,6 +47,7 @@ begbss:
#include <minix/config.h> #include <minix/config.h>
#include <minix/const.h> #include <minix/const.h>
#include <minix/com.h> #include <minix/com.h>
#include <machine/asm.h>
#include <machine/interrupt.h> #include <machine/interrupt.h>
#include "archconst.h" #include "archconst.h"
#include "kernel/const.h" #include "kernel/const.h"
@ -57,59 +58,11 @@ begbss:
/* Selected 386 tss offsets. */ /* Selected 386 tss offsets. */
#define TSS3_S_SP0 4 #define TSS3_S_SP0 4
/* IMPORT(copr_not_available_handler)
* Exported functions IMPORT(params_size)
* Note: in assembly language the .define statement applied to a function name IMPORT(params_offset)
* is loosely equivalent to a prototype in C code -- it makes it possible to IMPORT(mon_ds)
* link to an entity declared in the assembly code but does not create IMPORT(switch_to_user)
* the entity.
*/
.globl _restore_user_context
.globl _copr_not_available_handler
.globl _reload_cr3
.globl _divide_error
.globl _single_step_exception
.globl _nmi
.globl _breakpoint_exception
.globl _overflow
.globl _bounds_check
.globl _inval_opcode
.globl _copr_not_available
.globl _double_fault
.globl _copr_seg_overrun
.globl _inval_tss
.globl _segment_not_present
.globl _stack_exception
.globl _general_protection
.globl _page_fault
.globl _copr_error
.globl _alignment_check
.globl _machine_check
.globl _simd_exception
.globl _params_size
.globl _params_offset
.globl _mon_ds
.globl _switch_to_user
.globl _save_fpu
.globl _hwint00 /* handlers for hardware interrupts */
.globl _hwint01
.globl _hwint02
.globl _hwint03
.globl _hwint04
.globl _hwint05
.globl _hwint06
.globl _hwint07
.globl _hwint08
.globl _hwint09
.globl _hwint10
.globl _hwint11
.globl _hwint12
.globl _hwint13
.globl _hwint14
.globl _hwint15
/* Exported variables. */ /* Exported variables. */
.globl begbss .globl begbss
@ -178,16 +131,16 @@ kernel_init: /* after pre-init*/
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 _C_LABEL(mon_return)
noret: noret:
movl %esp, _mon_sp /* save stack pointer for later return */ movl %esp, _C_LABEL(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 _C_LABEL(gdt)+GDT_SELECTOR /* get the monitor gdtr */
movl _gdt+GDT_SELECTOR+2, %esi /* absolute address of GDT */ movl _C_LABEL(gdt)+GDT_SELECTOR+2, %esi /* absolute address of GDT */
mov $_gdt, %ebx /* address of kernel GDT */ mov $_C_LABEL(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
@ -195,28 +148,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 _C_LABEL(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 $_C_LABEL(gdt), %eax /* eax = vir2phys(gdt) */
movl %eax, _gdt+GDT_SELECTOR+2 /* set base of GDT */ movl %eax, _C_LABEL(gdt)+GDT_SELECTOR+2 /* set base of GDT */
lgdt _gdt+GDT_SELECTOR /* switch over to kernel GDT */ lgdt _C_LABEL(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, _C_LABEL(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 $_C_LABEL(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, _C_LABEL(params_size)
movl %ebx, _params_offset movl %ebx, _C_LABEL(params_offset)
movl $SS_SELECTOR, _mon_ds movl $SS_SELECTOR, _C_LABEL(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
@ -224,14 +177,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 _C_LABEL(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 _C_LABEL(gdt)+GDT_SELECTOR
lidt _gdt+IDT_SELECTOR lidt _C_LABEL(gdt)+IDT_SELECTOR
ljmp $CS_SELECTOR, $csinit ljmp $CS_SELECTOR, $csinit
csinit: csinit:
@ -245,7 +198,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 _C_LABEL(main) /* main() */
/*===========================================================================*/ /*===========================================================================*/
@ -255,7 +208,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 _C_LABEL(irq_handle) /* intr_handle(irq_handlers[irq]) */ ;\
add $4, %esp ; add $4, %esp ;
/*===========================================================================*/ /*===========================================================================*/
@ -269,16 +222,16 @@ csinit:
SAVE_PROCESS_CTX(0) ;\ SAVE_PROCESS_CTX(0) ;\
push %ebp ;\ push %ebp ;\
movl $0, %ebp /* for stack trace */ ;\ movl $0, %ebp /* for stack trace */ ;\
call _context_stop ;\ call _C_LABEL(context_stop) ;\
add $4, %esp ;\ add $4, %esp ;\
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 _C_LABEL(switch_to_user) ;\
\ \
0: \ 0: \
pusha ;\ pusha ;\
call _context_stop_idle ;\ call _C_LABEL(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 */ ;\
@ -287,43 +240,35 @@ csinit:
iret ; iret ;
/* 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 ENTRY(hwint00)
_hwint00:
/* Interrupt routine for irq 0 (the clock). */ /* Interrupt routine for irq 0 (the clock). */
hwint_master(0) hwint_master(0)
.balign 16 ENTRY(hwint01)
_hwint01:
/* Interrupt routine for irq 1 (keyboard) */ /* Interrupt routine for irq 1 (keyboard) */
hwint_master(1) hwint_master(1)
.balign 16 ENTRY(hwint02)
_hwint02:
/* Interrupt routine for irq 2 (cascade!) */ /* Interrupt routine for irq 2 (cascade!) */
hwint_master(2) hwint_master(2)
.balign 16 ENTRY(hwint03)
_hwint03:
/* Interrupt routine for irq 3 (second serial) */ /* Interrupt routine for irq 3 (second serial) */
hwint_master(3) hwint_master(3)
.balign 16 ENTRY(hwint04)
_hwint04:
/* Interrupt routine for irq 4 (first serial) */ /* Interrupt routine for irq 4 (first serial) */
hwint_master(4) hwint_master(4)
.balign 16 ENTRY(hwint05)
_hwint05:
/* Interrupt routine for irq 5 (XT winchester) */ /* Interrupt routine for irq 5 (XT winchester) */
hwint_master(5) hwint_master(5)
.balign 16 ENTRY(hwint06)
_hwint06:
/* Interrupt routine for irq 6 (floppy) */ /* Interrupt routine for irq 6 (floppy) */
hwint_master(6) hwint_master(6)
.balign 16 ENTRY(hwint07)
_hwint07:
/* Interrupt routine for irq 7 (printer) */ /* Interrupt routine for irq 7 (printer) */
hwint_master(7) hwint_master(7)
@ -337,17 +282,17 @@ _hwint07:
SAVE_PROCESS_CTX(0) ;\ SAVE_PROCESS_CTX(0) ;\
push %ebp ;\ push %ebp ;\
movl $0, %ebp /* for stack trace */ ;\ movl $0, %ebp /* for stack trace */ ;\
call _context_stop ;\ call _C_LABEL(context_stop) ;\
add $4, %esp ;\ add $4, %esp ;\
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 _C_LABEL(switch_to_user) ;\
\ \
0: \ 0: \
pusha ;\ pusha ;\
call _context_stop_idle ;\ call _C_LABEL(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 */ ;\
@ -357,52 +302,42 @@ _hwint07:
iret ; iret ;
/* 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 ENTRY(hwint08)
_hwint08:
/* Interrupt routine for irq 8 (realtime clock) */ /* Interrupt routine for irq 8 (realtime clock) */
hwint_slave(8) hwint_slave(8)
.balign 16 ENTRY(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 ENTRY(hwint10)
_hwint10:
/* Interrupt routine for irq 10 */ /* Interrupt routine for irq 10 */
hwint_slave(10) hwint_slave(10)
.balign 16 ENTRY(hwint11)
_hwint11:
/* Interrupt routine for irq 11 */ /* Interrupt routine for irq 11 */
hwint_slave(11) hwint_slave(11)
.balign 16 ENTRY(hwint12)
_hwint12:
/* Interrupt routine for irq 12 */ /* Interrupt routine for irq 12 */
hwint_slave(12) hwint_slave(12)
.balign 16 ENTRY(hwint13)
_hwint13:
/* Interrupt routine for irq 13 (FPU exception) */ /* Interrupt routine for irq 13 (FPU exception) */
hwint_slave(13) hwint_slave(13)
.balign 16 ENTRY(hwint14)
_hwint14:
/* Interrupt routine for irq 14 (AT winchester) */ /* Interrupt routine for irq 14 (AT winchester) */
hwint_slave(14) hwint_slave(14)
.balign 16 ENTRY(hwint15)
_hwint15:
/* Interrupt routine for irq 15 */ /* Interrupt routine for irq 15 */
hwint_slave(15) hwint_slave(15)
/* /*
* IPC is only from a process to kernel * IPC is only from a process to kernel
*/ */
.balign 16 ENTRY(ipc_entry)
.globl _ipc_entry
_ipc_entry:
SAVE_PROCESS_CTX(0) SAVE_PROCESS_CTX(0)
@ -422,25 +357,23 @@ _ipc_entry:
push %ebp push %ebp
/* for stack trace */ /* for stack trace */
movl $0, %ebp movl $0, %ebp
call _context_stop call _C_LABEL(context_stop)
add $4, %esp add $4, %esp
call _do_ipc call _C_LABEL(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 _C_LABEL(switch_to_user)
/* /*
* kernel call is only from a process to kernel * kernel call is only from a process to kernel
*/ */
.balign 16 ENTRY(kernel_call_entry)
.globl _kernel_call_entry
_kernel_call_entry:
SAVE_PROCESS_CTX(0) SAVE_PROCESS_CTX(0)
@ -458,15 +391,15 @@ _kernel_call_entry:
push %ebp push %ebp
/* for stack trace */ /* for stack trace */
movl $0, %ebp movl $0, %ebp
call _context_stop call _C_LABEL(context_stop)
add $4, %esp add $4, %esp
call _kernel_call call _C_LABEL(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 _C_LABEL(switch_to_user)
.balign 16 .balign 16
@ -490,7 +423,7 @@ exception_entry_from_user:
push %ebp push %ebp
/* for stack trace clear %ebp */ /* for stack trace clear %ebp */
movl $0, %ebp movl $0, %ebp
call _context_stop call _C_LABEL(context_stop)
add $4, %esp add $4, %esp
/* /*
@ -500,9 +433,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 _C_LABEL(exception_handler)
jmp _switch_to_user jmp _C_LABEL(switch_to_user)
exception_entry_nested: exception_entry_nested:
@ -511,7 +444,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 _C_LABEL(exception_handler)
add $8, %esp add $8, %esp
popa popa
@ -523,7 +456,7 @@ exception_entry_nested:
/*===========================================================================*/ /*===========================================================================*/
/* restart */ /* restart */
/*===========================================================================*/ /*===========================================================================*/
_restore_user_context: ENTRY(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 */
@ -558,13 +491,13 @@ _restore_user_context:
pushl $0 ;\ pushl $0 ;\
EXCEPTION_ERR_CODE(vector) EXCEPTION_ERR_CODE(vector)
_divide_error: LABEL(divide_error)
EXCEPTION_NO_ERR_CODE(DIVIDE_VECTOR) EXCEPTION_NO_ERR_CODE(DIVIDE_VECTOR)
_single_step_exception: LABEL(single_step_exception)
EXCEPTION_NO_ERR_CODE(DEBUG_VECTOR) EXCEPTION_NO_ERR_CODE(DEBUG_VECTOR)
_nmi: LABEL(nmi)
#ifndef CONFIG_WATCHDOG #ifndef CONFIG_WATCHDOG
EXCEPTION_NO_ERR_CODE(NMI_VECTOR) EXCEPTION_NO_ERR_CODE(NMI_VECTOR)
#else #else
@ -597,7 +530,7 @@ _nmi:
mov %si, %es mov %si, %es
push %esp push %esp
call _nmi_watchdog_handler call _C_LABEL(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 */
@ -610,71 +543,71 @@ _nmi:
iret iret
#endif #endif
_breakpoint_exception: LABEL(breakpoint_exception)
EXCEPTION_NO_ERR_CODE(BREAKPOINT_VECTOR) EXCEPTION_NO_ERR_CODE(BREAKPOINT_VECTOR)
_overflow: LABEL(overflow)
EXCEPTION_NO_ERR_CODE(OVERFLOW_VECTOR) EXCEPTION_NO_ERR_CODE(OVERFLOW_VECTOR)
_bounds_check: LABEL(bounds_check)
EXCEPTION_NO_ERR_CODE(BOUNDS_VECTOR) EXCEPTION_NO_ERR_CODE(BOUNDS_VECTOR)
_inval_opcode: LABEL(inval_opcode)
EXCEPTION_NO_ERR_CODE(INVAL_OP_VECTOR) EXCEPTION_NO_ERR_CODE(INVAL_OP_VECTOR)
_copr_not_available: LABEL(copr_not_available)
TEST_INT_IN_KERNEL(4, copr_not_available_in_kernel) TEST_INT_IN_KERNEL(4, copr_not_available_in_kernel)
cld /* set direction flag to a known value */ cld /* set direction flag to a known value */
SAVE_PROCESS_CTX(0) SAVE_PROCESS_CTX(0)
/* stop user process cycles */ /* stop user process cycles */
push %ebp push %ebp
mov $0, %ebp mov $0, %ebp
call _context_stop call _C_LABEL(context_stop)
jmp _copr_not_available_handler jmp _C_LABEL(copr_not_available_handler)
copr_not_available_in_kernel: copr_not_available_in_kernel:
pushl $0 pushl $0
pushl $COPROC_NOT_VECTOR pushl $COPROC_NOT_VECTOR
jmp exception_entry_nested jmp exception_entry_nested
_double_fault: LABEL(double_fault)
EXCEPTION_ERR_CODE(DOUBLE_FAULT_VECTOR) EXCEPTION_ERR_CODE(DOUBLE_FAULT_VECTOR)
_copr_seg_overrun: LABEL(copr_seg_overrun)
EXCEPTION_NO_ERR_CODE(COPROC_SEG_VECTOR) EXCEPTION_NO_ERR_CODE(COPROC_SEG_VECTOR)
_inval_tss: LABEL(inval_tss)
EXCEPTION_ERR_CODE(INVAL_TSS_VECTOR) EXCEPTION_ERR_CODE(INVAL_TSS_VECTOR)
_segment_not_present: LABEL(segment_not_present)
EXCEPTION_ERR_CODE(SEG_NOT_VECTOR) EXCEPTION_ERR_CODE(SEG_NOT_VECTOR)
_stack_exception: LABEL(stack_exception)
EXCEPTION_ERR_CODE(STACK_FAULT_VECTOR) EXCEPTION_ERR_CODE(STACK_FAULT_VECTOR)
_general_protection: LABEL(general_protection)
EXCEPTION_ERR_CODE(PROTECTION_VECTOR) EXCEPTION_ERR_CODE(PROTECTION_VECTOR)
_page_fault: LABEL(page_fault)
EXCEPTION_ERR_CODE(PAGE_FAULT_VECTOR) EXCEPTION_ERR_CODE(PAGE_FAULT_VECTOR)
_copr_error: LABEL(copr_error)
EXCEPTION_NO_ERR_CODE(COPROC_ERR_VECTOR) EXCEPTION_NO_ERR_CODE(COPROC_ERR_VECTOR)
_alignment_check: LABEL(alignment_check)
EXCEPTION_NO_ERR_CODE(ALIGNMENT_CHECK_VECTOR) EXCEPTION_NO_ERR_CODE(ALIGNMENT_CHECK_VECTOR)
_machine_check: LABEL(machine_check)
EXCEPTION_NO_ERR_CODE(MACHINE_CHECK_VECTOR) EXCEPTION_NO_ERR_CODE(MACHINE_CHECK_VECTOR)
_simd_exception: LABEL(simd_exception)
EXCEPTION_NO_ERR_CODE(SIMD_EXCEPTION_VECTOR) EXCEPTION_NO_ERR_CODE(SIMD_EXCEPTION_VECTOR)
/*===========================================================================*/ /*===========================================================================*/
/* reload_cr3 */ /* reload_cr3 */
/*===========================================================================*/ /*===========================================================================*/
/* PUBLIC void reload_cr3(void); */ /* PUBLIC void reload_cr3(void); */
_reload_cr3: ENTRY(reload_cr3)
push %ebp push %ebp
mov %esp, %ebp mov %esp, %ebp
mov %cr3, %eax mov %cr3, %eax
@ -696,7 +629,6 @@ _reload_cr3:
/* /*
* the kernel stack * the kernel stack
*/ */
.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 */ LABEL(k_boot_stktop) /* top of kernel stack */

View file

@ -2,6 +2,7 @@
#include <minix/config.h> #include <minix/config.h>
#include <minix/const.h> #include <minix/const.h>
#include <minix/com.h> #include <minix/com.h>
#include <machine/asm.h>
#include <machine/interrupt.h> #include <machine/interrupt.h>
#include "archconst.h" #include "archconst.h"
#include "kernel/const.h" #include "kernel/const.h"
@ -11,7 +12,7 @@
#define GDT_SET_ENTRY(selector, base, limit) \ #define GDT_SET_ENTRY(selector, base, limit) \
mov %ebp, %edi; \ mov %ebp, %edi; \
add $(_gdt + selector), %edi; \ add $(_C_LABEL(gdt) + selector), %edi; \
mov base, %eax; \ mov base, %eax; \
movw %ax, 2(%edi); \ movw %ax, 2(%edi); \
shr $16, %eax; \ shr $16, %eax; \
@ -26,10 +27,10 @@
andb $0xf0, 6(%edi); \ andb $0xf0, 6(%edi); \
or %ax, 6(%edi); \ or %ax, 6(%edi); \
.globl _pre_init IMPORT(pre_init)
.globl multiboot_init .extern kernel_init
.globl kernel_init
.globl multiboot_init
multiboot_init: multiboot_init:
/* Get size of kernel text */ /* Get size of kernel text */
mov MULTIBOOT_LOAD_ADDRESS + MULTIBOOT_KERNEL_a_text, %ecx mov MULTIBOOT_LOAD_ADDRESS + MULTIBOOT_KERNEL_a_text, %ecx
@ -44,7 +45,7 @@ multiboot_init:
/* Calculate and save kernel data base address */ /* Calculate and save kernel data base address */
mov $(MULTIBOOT_LOAD_ADDRESS + MULTIBOOT_ENTRY_OFFSET), %ebp mov $(MULTIBOOT_LOAD_ADDRESS + MULTIBOOT_ENTRY_OFFSET), %ebp
add %eax, %ebp add %eax, %ebp
mov %ebp, _kernel_data_addr(%ebp) mov %ebp, _C_LABEL(kernel_data_addr)(%ebp)
/* Init text seg */ /* Init text seg */
GDT_SET_ENTRY(CS_SELECTOR, \ GDT_SET_ENTRY(CS_SELECTOR, \
@ -68,10 +69,10 @@ multiboot_init:
mov $(GDT_SIZE*DESC_SIZE), %eax mov $(GDT_SIZE*DESC_SIZE), %eax
mov %ebp, %edi mov %ebp, %edi
add $(_gdt + GDT_SELECTOR), %edi add $(_C_LABEL(gdt) + GDT_SELECTOR), %edi
mov %ax, (%edi) mov %ax, (%edi)
mov %ebp, %eax mov %ebp, %eax
add $_gdt, %eax add $_C_LABEL(gdt), %eax
mov %eax, 2(%edi) mov %eax, 2(%edi)
lgdt (%edi) lgdt (%edi)
@ -86,14 +87,14 @@ reload_cs:
mov $(multiboot_stack + MULTIBOOT_STACK_SIZE), %esp mov $(multiboot_stack + MULTIBOOT_STACK_SIZE), %esp
push %ebx push %ebx
call _pre_init call _C_LABEL(pre_init)
add $4, %esp add $4, %esp
/* return to old boot code of kernel */ /* return to old boot code of kernel */
push %eax push %eax
push $MULTIBOOT_PARAM_BUF_SIZE push $MULTIBOOT_PARAM_BUF_SIZE
push $_multiboot_param_buf push $_C_LABEL(multiboot_param_buf)
push $0 push $0
mov $ES_SELECTOR, %eax mov $ES_SELECTOR, %eax
@ -102,16 +103,13 @@ reload_cs:
jmp kernel_init jmp kernel_init
.data .data
.globl _kernel_data_addr LABEL(kernel_data_addr)
_kernel_data_addr: .long 0
.long 0 LABEL(a_out_headers)
.globl _a_out_headers .space NR_BOOT_PROCS * 32 /* is A_MINHDR */
_a_out_headers:
.space NR_BOOT_PROCS * 32 /* is A_MINHDR */
.globl _multiboot_param_buf LABEL(multiboot_param_buf)
_multiboot_param_buf: .space MULTIBOOT_PARAM_BUF_SIZE
.space MULTIBOOT_PARAM_BUF_SIZE
multiboot_stack: multiboot_stack:
.space MULTIBOOT_STACK_SIZE + 4 .space MULTIBOOT_STACK_SIZE + 4

View file

@ -1,11 +1,9 @@
/* add64() - 64 bit addition Author: Kees J. Bot */ /* add64() - 64 bit addition Author: Kees J. Bot */
/* 7 Dec 1995 */ /* 7 Dec 1995 */
#include <minix/compiler.h> #include <minix/compiler.h>
#include <machine/asm.h>
.text ENTRY(add64)
.globl _add64
_add64:
/* u64_t add64(u64_t i, u64_t j); */ /* u64_t add64(u64_t i, u64_t j); */
movl 4(%esp), %eax movl 4(%esp), %eax
movl 8(%esp), %edx movl 8(%esp), %edx

View file

@ -1,13 +1,11 @@
/* add64u() - unsigned to 64 bit addition Author: Kees J. Bot */ /* add64u() - unsigned to 64 bit addition Author: Kees J. Bot */
/* 7 Dec 1995 */ /* 7 Dec 1995 */
#include <minix/compiler.h> #include <minix/compiler.h>
#include <machine/asm.h>
.text ENTRY(add64u)
.globl _add64u, _add64ul
_add64u:
/* u64_t add64u(u64_t i, unsigned j); */ /* u64_t add64u(u64_t i, unsigned j); */
_add64ul: ENTRY(add64ul)
/* u64_t add64ul(u64_t i, unsigned long j); */ /* u64_t add64ul(u64_t i, unsigned long j); */
movl 4(%esp), %eax movl 4(%esp), %eax
movl 8(%esp), %edx movl 8(%esp), %edx

View file

@ -1,11 +1,9 @@
/* bsr64() - 64 bit bit scan reverse Author: Erik van der Kouwe */ /* bsr64() - 64 bit bit scan reverse Author: Erik van der Kouwe */
/* 15 May 2010 */ /* 15 May 2010 */
#include <minix/compiler.h> #include <minix/compiler.h>
#include <machine/asm.h>
.text ENTRY(bsr64)
.globl _bsr64
_bsr64:
/* int bsr64(u64_t i); */ /* int bsr64(u64_t i); */
bsr 8(%esp), %eax /* check high-order DWORD */ bsr 8(%esp), %eax /* check high-order DWORD */
jnz 0f /* non-zero: return index+32 */ jnz 0f /* non-zero: return index+32 */

View file

@ -1,9 +1,8 @@
/* cmp64*() - 64 bit compare Author: Kees J. Bot */ /* cmp64*() - 64 bit compare Author: Kees J. Bot */
/* 7 Dec 1995 */ /* 7 Dec 1995 */
.text #include <machine/asm.h>
.globl _cmp64, _cmp64u, _cmp64ul
_cmp64: ENTRY(cmp64)
/* int cmp64(u64_t i, u64_t j); */ /* int cmp64(u64_t i, u64_t j); */
movl %esp, %ecx movl %esp, %ecx
0: 0:
@ -20,9 +19,9 @@ _cmp64:
adcl $0, %eax /* eax = (i > j) - (i < j) */ adcl $0, %eax /* eax = (i > j) - (i < j) */
ret ret
_cmp64u: ENTRY(cmp64u)
/* int cmp64u(u64_t i, unsigned j); */ /* int cmp64u(u64_t i, unsigned j); */
_cmp64ul: ENTRY(cmp64ul)
/* int cmp64ul(u64_t i, unsigned long j); */ /* int cmp64ul(u64_t i, unsigned long j); */
movl %esp, %ecx movl %esp, %ecx
push 16(%ecx) push 16(%ecx)

View file

@ -1,11 +1,10 @@
/* cv64u() - 64 bit converted to unsigned Author: Kees J. Bot */ /* cv64u() - 64 bit converted to unsigned Author: Kees J. Bot */
/* 7 Dec 1995 */ /* 7 Dec 1995 */
.text #include <machine/asm.h>
.globl _cv64u, _cv64ul
_cv64u: ENTRY(cv64u)
/* unsigned cv64u(u64_t i); */ /* unsigned cv64u(u64_t i); */
_cv64ul: ENTRY(cv64ul)
/* unsigned long cv64ul(u64_t i); */ /* unsigned long cv64ul(u64_t i); */
movl 4(%esp), %eax movl 4(%esp), %eax
cmpl $0, 8(%esp) /* return ULONG_MAX if really big */ cmpl $0, 8(%esp) /* return ULONG_MAX if really big */

View file

@ -1,13 +1,11 @@
/* cvu64() - unsigned converted to 64 bit Author: Kees J. Bot */ /* cvu64() - unsigned converted to 64 bit Author: Kees J. Bot */
/* 7 Dec 1995 */ /* 7 Dec 1995 */
#include <minix/compiler.h> #include <minix/compiler.h>
#include <machine/asm.h>
.text ENTRY(cvu64)
.globl _cvu64, _cvul64
_cvu64:
/* u64_t cvu64(unsigned i); */ /* u64_t cvu64(unsigned i); */
_cvul64: ENTRY(cvul64)
/* u64_t cvul64(unsigned long i); */ /* u64_t cvul64(unsigned long i); */
movl 4(%esp), %eax movl 4(%esp), %eax
movl 8(%esp), %edx movl 8(%esp), %edx

View file

@ -1,9 +1,8 @@
/* diff64() - 64 bit subtraction giving unsigned Author: Kees J. Bot */ /* diff64() - 64 bit subtraction giving unsigned Author: Kees J. Bot */
/* 7 Dec 1995 */ /* 7 Dec 1995 */
.text #include <machine/asm.h>
.globl _diff64
_diff64: ENTRY(diff64)
/* unsigned diff64(u64_t i, u64_t j); */ /* unsigned diff64(u64_t i, u64_t j); */
movl 4(%esp), %eax movl 4(%esp), %eax
subl 12(%esp), %eax subl 12(%esp), %eax

View file

@ -2,11 +2,9 @@
/* Author: Kees J. Bot */ /* Author: Kees J. Bot */
/* 7 Dec 1995 */ /* 7 Dec 1995 */
#include <minix/compiler.h> #include <minix/compiler.h>
#include <machine/asm.h>
.text ENTRY(div64u)
.globl _div64u, _div64u64, _rem64u
_div64u:
/* unsigned long div64u(u64_t i, unsigned j); */ /* unsigned long div64u(u64_t i, unsigned j); */
xorl %edx, %edx xorl %edx, %edx
movl 8(%esp), %eax /* i = (ih<<32) + il */ movl 8(%esp), %eax /* i = (ih<<32) + il */
@ -15,7 +13,7 @@ _div64u:
divl 12(%esp) /* i / j = (q<<32) + ((r<<32) + il) / j */ divl 12(%esp) /* i / j = (q<<32) + ((r<<32) + il) / j */
ret ret
_div64u64: ENTRY(div64u64)
/* u64_t div64u64(u64_t i, unsigned j); */ /* u64_t div64u64(u64_t i, unsigned j); */
xorl %edx, %edx xorl %edx, %edx
movl 12(%esp), %eax /* i = (ih<<32) + il */ movl 12(%esp), %eax /* i = (ih<<32) + il */
@ -28,10 +26,10 @@ _div64u64:
movl %ecx, %eax /* return pointer to result struct */ movl %ecx, %eax /* return pointer to result struct */
ret BYTES_TO_POP_ON_STRUCT_RETURN ret BYTES_TO_POP_ON_STRUCT_RETURN
_rem64u: ENTRY(rem64u)
/* unsigned rem64u(u64_t i, unsigned j); */ /* unsigned rem64u(u64_t i, unsigned j); */
pop %ecx pop %ecx
call _div64u call _C_LABEL(div64u)
movl %edx, %eax movl %edx, %eax
jmp *%ecx jmp *%ecx

View file

@ -1,15 +1,14 @@
/* ex64*() - extract low or high 32 bits of a 64 bit number */ /* ex64*() - extract low or high 32 bits of a 64 bit number */
/* Author: Kees J. Bot */ /* Author: Kees J. Bot */
/* 7 Dec 1995 */ /* 7 Dec 1995 */
.text #include <machine/asm.h>
.globl _ex64lo, _ex64hi
_ex64lo: ENTRY(ex64lo)
/* unsigned long ex64lo(u64_t i); */ /* unsigned long ex64lo(u64_t i); */
movl 4(%esp), %eax movl 4(%esp), %eax
ret ret
_ex64hi: ENTRY(ex64hi)
/* unsigned long ex64hi(u64_t i); */ /* unsigned long ex64hi(u64_t i); */
movl 8(%esp), %eax movl 8(%esp), %eax
ret ret

View file

@ -2,11 +2,9 @@
/* Author: Kees J. Bot */ /* Author: Kees J. Bot */
/* 7 Dec 1995 */ /* 7 Dec 1995 */
#include <minix/compiler.h> #include <minix/compiler.h>
#include <machine/asm.h>
.text ENTRY(make64)
.globl _make64
_make64:
/* u64_t make64(unsigned long lo, unsigned long hi); */ /* u64_t make64(unsigned long lo, unsigned long hi); */
movl 4(%esp), %eax movl 4(%esp), %eax
movl 8(%esp), %edx movl 8(%esp), %edx

View file

@ -2,11 +2,9 @@
/* Author: Kees J. Bot */ /* Author: Kees J. Bot */
/* 7 Dec 1995 */ /* 7 Dec 1995 */
#include <minix/compiler.h> #include <minix/compiler.h>
#include <machine/asm.h>
.text ENTRY(mul64u)
.globl _mul64u
_mul64u:
/* u64_t mul64u(unsigned long i, unsigned j); */ /* u64_t mul64u(unsigned long i, unsigned j); */
movl 4(%esp), %ecx movl 4(%esp), %ecx
movl 8(%esp), %eax movl 8(%esp), %eax

View file

@ -1,11 +1,9 @@
/* sub64() - 64 bit subtraction Author: Kees J. Bot */ /* sub64() - 64 bit subtraction Author: Kees J. Bot */
/* 7 Dec 1995 */ /* 7 Dec 1995 */
#include <minix/compiler.h> #include <minix/compiler.h>
#include <machine/asm.h>
.text ENTRY(sub64)
.globl _sub64
_sub64:
/* u64_t sub64(u64_t i, u64_t j); */ /* u64_t sub64(u64_t i, u64_t j); */
movl 4(%esp), %eax movl 4(%esp), %eax
movl 8(%esp), %edx movl 8(%esp), %edx

View file

@ -1,13 +1,11 @@
/* sub64() - unsigned from 64 bit subtraction Author: Kees J. Bot */ /* sub64() - unsigned from 64 bit subtraction Author: Kees J. Bot */
/* 7 Dec 1995 */ /* 7 Dec 1995 */
#include <minix/compiler.h> #include <minix/compiler.h>
#include <machine/asm.h>
.text ENTRY(sub64u)
.globl _sub64u, _sub64ul
_sub64u:
/* u64_t sub64u(u64_t i, unsigned j); */ /* u64_t sub64u(u64_t i, unsigned j); */
_sub64ul: ENTRY(sub64ul)
/* u64_t sub64ul(u64_t i, unsigned long j); */ /* u64_t sub64ul(u64_t i, unsigned long j); */
movl 4(%esp), %eax movl 4(%esp), %eax
movl 8(%esp), %edx movl 8(%esp), %edx

View file

@ -1,11 +1,9 @@
/* fpu_cw_get() - get FPU control word Author: Erik van der Kouwe */ /* fpu_cw_get() - get FPU control word Author: Erik van der Kouwe */
/* fpu_cw_set() - set FPU control word 9 Dec 2009 */ /* fpu_cw_set() - set FPU control word 9 Dec 2009 */
.text #include <machine/asm.h>
.globl _fpu_cw_get
.globl _fpu_cw_set
/* u16_t fpu_cw_get(void) */ /* u16_t fpu_cw_get(void) */
_fpu_cw_get: ENTRY(fpu_cw_get)
/* clear unused bits just to be sure */ /* clear unused bits just to be sure */
xor %eax, %eax xor %eax, %eax
push %eax push %eax
@ -14,7 +12,7 @@ _fpu_cw_get:
ret ret
/* void fpu_cw_set(u16_t fpu_cw) */ /* void fpu_cw_set(u16_t fpu_cw) */
_fpu_cw_set: ENTRY(fpu_cw_set)
/* load control word from parameter */ /* load control word from parameter */
fldcw 4(%esp) fldcw 4(%esp)
ret ret

View file

@ -1,11 +1,9 @@
/* fpu_rndint() - round integer Author: Erik van der Kouwe */ /* fpu_rndint() - round integer Author: Erik van der Kouwe */
/* 17 Dec 2009 */ /* 17 Dec 2009 */
.text #include <machine/asm.h>
.globl _fpu_rndint
.globl _fpu_remainder
/* void fpu_rndint(double *value) */ /* void fpu_rndint(double *value) */
_fpu_rndint: ENTRY(fpu_rndint)
/* move the value onto the floating point stack */ /* move the value onto the floating point stack */
mov 4(%esp), %eax mov 4(%esp), %eax
fldl (%eax) fldl (%eax)
@ -18,7 +16,7 @@ _fpu_rndint:
ret ret
/* void fpu_remainder(double *x, double y) */ /* void fpu_remainder(double *x, double y) */
_fpu_remainder: ENTRY(fpu_remainder)
/* move the values onto the floating point stack */ /* move the values onto the floating point stack */
fldl 8(%esp) fldl 8(%esp)
mov 4(%esp), %edx mov 4(%esp), %edx

View file

@ -1,36 +1,33 @@
/* fpu_compare() - compare doubles Author: Erik van der Kouwe */ /* fpu_compare() - compare doubles Author: Erik van der Kouwe */
/* fpu_sw_get() - get FPU status 17 Dec 2009 */ /* fpu_sw_get() - get FPU status 17 Dec 2009 */
/* fpu_xam() - examine double */ /* fpu_xam() - examine double */
.text #include <machine/asm.h>
.globl _fpu_compare
.globl _fpu_sw_get
.globl _fpu_xam
/* u16_t fpu_compare(double x, double y) */ /* u16_t fpu_compare(double x, double y) */
_fpu_compare: ENTRY(fpu_compare)
/* move the values onto the floating point stack */ /* move the values onto the floating point stack */
fldl 12(%esp) fldl 12(%esp)
fldl 4(%esp) fldl 4(%esp)
/* compare values and return status word */ /* compare values and return status word */
fcompp fcompp
jmp _fpu_sw_get jmp _C_LABEL(fpu_sw_get)
/* u16_t fpu_sw_get(void) */ /* u16_t fpu_sw_get(void) */
_fpu_sw_get: ENTRY(fpu_sw_get)
/* clear unused high-order word and get status word */ /* clear unused high-order word and get status word */
xor %eax, %eax xor %eax, %eax
.byte 0xdf, 0xe0 /* fnstsw ax */ .byte 0xdf, 0xe0 /* fnstsw ax */
ret ret
/* u16_t fpu_xam(double value) */ /* u16_t fpu_xam(double value) */
_fpu_xam: ENTRY(fpu_xam)
/* move the value onto the floating point stack */ /* move the value onto the floating point stack */
fldl 4(%esp) fldl 4(%esp)
/* examine value and get status word */ /* examine value and get status word */
fxam fxam
call _fpu_sw_get call _C_LABEL(fpu_sw_get)
/* pop the value */ /* pop the value */
fstp %st fstp %st

View file

@ -4,10 +4,9 @@
/* void _cpuid(u32_t *eax, u32_t *ebx, u32_t *ecx, u32_t *edx); */ /* void _cpuid(u32_t *eax, u32_t *ebx, u32_t *ecx, u32_t *edx); */
/* 0 for OK, nonzero for unsupported */ /* 0 for OK, nonzero for unsupported */
.globl __cpuid #include <machine/asm.h>
.text ENTRY(_cpuid)
__cpuid:
/* save work registers */ /* save work registers */
push %ebp push %ebp
push %ebx push %ebx

View file

@ -2,10 +2,9 @@
/* alloca() - allocate space on the stack Author: Kees J. Bot */ /* alloca() - allocate space on the stack Author: Kees J. Bot */
/* 2 Dec 1993 */ /* 2 Dec 1993 */
.text #include <machine/asm.h>
.balign 16
.globl _alloca ENTRY(alloca)
_alloca:
#if __ACK__ #if __ACK__
pop %ecx /* Return address */ pop %ecx /* Return address */
pop %eax /* Bytes to allocate */ pop %eax /* Bytes to allocate */

View file

@ -4,10 +4,9 @@
/* */ /* */
/* Created: Sep 7, 1992 by Philip Homburg */ /* Created: Sep 7, 1992 by Philip Homburg */
#include <machine/asm.h>
.text ENTRY(get_bp)
.globl _get_bp
_get_bp:
movl %ebp, %eax movl %ebp, %eax
ret ret

View file

@ -1,14 +1,10 @@
/* getprocessor() - determine processor type Author: Kees J. Bot */ /* getprocessor() - determine processor type Author: Kees J. Bot */
/* 26 Jan 1994 */ /* 26 Jan 1994 */
#include <machine/asm.h>
.text
/* int getprocessor(void); */ /* int getprocessor(void); */
/* Return 386, 486, 586, ... */ /* Return 386, 486, 586, ... */
ENTRY(getprocessor)
.globl _getprocessor
_getprocessor:
push %ebp push %ebp
movl %esp, %ebp movl %esp, %ebp
andl $0xFFFFFFFC, %esp /* Align stack to avoid AC fault */ andl $0xFFFFFFFC, %esp /* Align stack to avoid AC fault */

View file

@ -2,12 +2,9 @@
/* 9 May 1995 */ /* 9 May 1995 */
/* See RFC 1071, "Computing the Internet checksum" */ /* See RFC 1071, "Computing the Internet checksum" */
/* See also the C version of this code. */ /* See also the C version of this code. */
#include <machine/asm.h>
.text ENTRY(oneC_sum)
.globl _oneC_sum
.balign 16
_oneC_sum:
push %ebp push %ebp
movl %esp, %ebp movl %esp, %ebp
push %esi push %esi
@ -36,7 +33,7 @@ aligned:
adcl $0, %eax /* Add carry back in for one`s complement */ adcl $0, %eax /* Add carry back in for one`s complement */
jmp add6test jmp add6test
.balign 16 _ALIGN_TEXT
add6: add6:
addl (%esi), %eax /* Six times unrolled loop, see below */ addl (%esi), %eax /* Six times unrolled loop, see below */
adcl 4(%esi), %eax adcl 4(%esi), %eax
@ -52,7 +49,7 @@ add6test:
addl $24, %edi addl $24, %edi
jmp add1test jmp add1test
.balign 16 _ALIGN_TEXT
add1: add1:
addl (%esi), %eax /* while ((edi -= 4) >= 0) */ addl (%esi), %eax /* while ((edi -= 4) >= 0) */
adcl $0, %eax /* eax += *esi++; */ adcl $0, %eax /* eax += *esi++; */
@ -83,7 +80,7 @@ done:
#else #else
.data .data
#endif #endif
.balign 4 .balign 4
mask: mask:
.long 0x000000FF, 0x0000FFFF, 0x00FFFFFF .long 0x000000FF, 0x0000FFFF, 0x00FFFFFF

View file

@ -1,3 +1,4 @@
#include <machine/asm.h>
#ifdef __ACK__ #ifdef __ACK__
.text .text
@ -14,9 +15,11 @@ begdata:
begbss: begbss:
#endif #endif
.extern _getuctx
.extern _setuctx IMPORT(getuctx)
.extern _resumecontext IMPORT(setuctx)
IMPORT(resumecontext)
/* Offsets into ucontext_t structure. Keep in sync with <sys/ucontext.h>! */ /* Offsets into ucontext_t structure. Keep in sync with <sys/ucontext.h>! */
#define UC_FLAGS 0 #define UC_FLAGS 0
@ -55,16 +58,11 @@ begbss:
#define EFAULT 14 #define EFAULT 14
#define EINVAL 22 #define EINVAL 22
/* int getcontext(ucontext_t *ucp) /* int getcontext(ucontext_t *ucp)
* Initialise the structure pointed to by ucp to the current user context * Initialise the structure pointed to by ucp to the current user context
* of the calling thread. */ * of the calling thread. */
ENTRY(getcontext)
.text
.globl _getcontext
.balign 16
_getcontext:
/* In case a process does not use the FPU and is neither interested in /* In case a process does not use the FPU and is neither interested in
* saving its signal mask, then we can skip the context switch to * saving its signal mask, then we can skip the context switch to
* PM and kernel altogether and only save general-purpose registers. */ * PM and kernel altogether and only save general-purpose registers. */
@ -78,7 +76,7 @@ _getcontext:
/* Check null pointer */ /* Check null pointer */
cmp $0, %edx /* edx == NULL? */ cmp $0, %edx /* edx == NULL? */
jne 3f /* Not null, continue */ jne 3f /* Not null, continue */
movl $EFAULT, (_errno) movl $EFAULT, (_C_LABEL(errno))
xor %eax, %eax xor %eax, %eax
dec %eax /* return -1 */ dec %eax /* return -1 */
ret ret
@ -98,7 +96,7 @@ _getcontext:
0: 0:
push %ecx /* Save ecx */ push %ecx /* Save ecx */
push %edx push %edx
call _getuctx /* getuctx(ucp) */ call _C_LABEL(getuctx) /* getuctx(ucp) */
pop %edx /* clean up stack and restore edx */ pop %edx /* clean up stack and restore edx */
pop %ecx /* Restore ecx */ pop %ecx /* Restore ecx */
@ -131,12 +129,7 @@ _getcontext:
* program execution continues as if the corresponding call of getcontext() * program execution continues as if the corresponding call of getcontext()
* had just returned. If ucp was created with makecontext(), program * had just returned. If ucp was created with makecontext(), program
* execution continues with the function passed to makecontext(). */ * execution continues with the function passed to makecontext(). */
ENTRY(setcontext)
.text
.globl _setcontext
.balign 16
_setcontext:
/* In case a process does not use the FPU and is neither interested in /* In case a process does not use the FPU and is neither interested in
* restoring its signal mask, then we can skip the context switch to * restoring its signal mask, then we can skip the context switch to
* PM and kernel altogether and restore state here. */ * PM and kernel altogether and restore state here. */
@ -146,7 +139,7 @@ _setcontext:
/* Check null pointer */ /* Check null pointer */
cmp $0, %edx /* edx == NULL? */ cmp $0, %edx /* edx == NULL? */
jnz 3f /* Not null, continue */ jnz 3f /* Not null, continue */
movl $EFAULT, (_errno) movl $EFAULT, (_C_LABEL(errno))
xor %eax, %eax xor %eax, %eax
dec %eax /* return -1 */ dec %eax /* return -1 */
ret ret
@ -158,7 +151,7 @@ _setcontext:
pop %ebx /* restore ebx */ pop %ebx /* restore ebx */
cmp $MCF_MAGIC, %ecx /* is the magic value set (is context valid)?*/ cmp $MCF_MAGIC, %ecx /* is the magic value set (is context valid)?*/
jz 4f /* is set, proceed */ jz 4f /* is set, proceed */
movl $EINVAL, (_errno) /* not set, return error code */ movl $EINVAL, (_C_LABEL(errno)) /* not set, return error code */
xor %eax, %eax xor %eax, %eax
dec %eax /* return -1 */ dec %eax /* return -1 */
ret ret
@ -176,7 +169,7 @@ _setcontext:
0: push %ecx /* Save ecx */ 0: push %ecx /* Save ecx */
push %edx push %edx
call _setuctx /* setuctx(ucp) */ call _C_LABEL(setuctx) /* setuctx(ucp) */
pop %edx /* Clean up stack and restore edx */ pop %edx /* Clean up stack and restore edx */
pop %ecx /* Restore ecx */ pop %ecx /* Restore ecx */
@ -200,12 +193,7 @@ _setcontext:
* arguments to `func' from the stack. Finally, a call to resumecontext * arguments to `func' from the stack. Finally, a call to resumecontext
* will start the next context in the linked list (or exit the program if * will start the next context in the linked list (or exit the program if
* there is no context). */ * there is no context). */
ENTRY(ctx_start)
.text
.globl _ctx_start
.balign 16
_ctx_start:
/* 0(esp) -> func /* 0(esp) -> func
* 4(esp) -> arg1 * 4(esp) -> arg1
* ... * ...
@ -216,7 +204,7 @@ _ctx_start:
call *%eax /* func(arg1, ..., argn) */ call *%eax /* func(arg1, ..., argn) */
mov %esi, %esp /* Clean up stack */ mov %esi, %esp /* Clean up stack */
/* ucp is now at the top of the stack again */ /* ucp is now at the top of the stack again */
call _resumecontext /* resumecontext(ucp) */ call _C_LABEL(resumecontext) /* resumecontext(ucp) */
ret /* never reached */ ret /* never reached */

View file

@ -1,9 +1,9 @@
/* This routine is the low-level code for returning from signals. */ /* This routine is the low-level code for returning from signals. */
/* It calls __sigreturn, which is the normal "system call" routine. */ /* It calls _sigreturn, which is the normal "system call" routine. */
/* Both ___sigreturn and __sigreturn are needed. */ /* Both __sigreturn and _sigreturn are needed. */
.text #include <machine/asm.h>
.globl ___sigreturn
.extern __sigreturn IMPORT(_sigreturn)
___sigreturn: ENTRY(__sigreturn)
addl $16, %esp addl $16, %esp
jmp __sigreturn jmp _C_LABEL(_sigreturn)

View file

@ -1,6 +1,5 @@
#include <minix/ipcconst.h> #include <minix/ipcconst.h>
#include <machine/asm.h>
.globl __notify, __send, __senda, __sendnb, __receive, __sendrec, __do_kernel_call
IPCVEC = 33 /* ipc trap to kernel */ IPCVEC = 33 /* ipc trap to kernel */
KERVEC = 32 /* syscall trap to kernel */ KERVEC = 32 /* syscall trap to kernel */
@ -13,8 +12,7 @@
/* IPC assembly routines * */ /* IPC assembly routines * */
/**========================================================================* */ /**========================================================================* */
/* all message passing routines save ebx, but destroy eax and ecx. */ /* all message passing routines save ebx, but destroy eax and ecx. */
.text ENTRY(_send)
__send:
push %ebp push %ebp
movl %esp, %ebp movl %esp, %ebp
push %ebx push %ebx
@ -26,7 +24,7 @@ __send:
pop %ebp pop %ebp
ret ret
__receive: ENTRY(_receive)
push %ebp push %ebp
movl %esp, %ebp movl %esp, %ebp
push %ebx push %ebx
@ -40,7 +38,7 @@ __receive:
pop %ebp pop %ebp
ret ret
__sendrec: ENTRY(_sendrec)
push %ebp push %ebp
movl %esp, %ebp movl %esp, %ebp
push %ebx push %ebx
@ -52,7 +50,7 @@ __sendrec:
pop %ebp pop %ebp
ret ret
__notify: ENTRY(_notify)
push %ebp push %ebp
movl %esp, %ebp movl %esp, %ebp
push %ebx push %ebx
@ -63,7 +61,7 @@ __notify:
pop %ebp pop %ebp
ret ret
__sendnb: ENTRY(_sendnb)
push %ebp push %ebp
movl %esp, %ebp movl %esp, %ebp
push %ebx push %ebx
@ -75,7 +73,7 @@ __sendnb:
pop %ebp pop %ebp
ret ret
__do_kernel_call: ENTRY(_do_kernel_call)
/* pass the message pointer to kernel in the %eax register */ /* pass the message pointer to kernel in the %eax register */
movl 4(%esp), %eax movl 4(%esp), %eax
int $KERVEC int $KERVEC

View file

@ -1,15 +1,12 @@
#include <minix/ipcconst.h> #include <minix/ipcconst.h>
#include <machine/asm.h>
.globl __senda
SYSVEC = 33 SYSVEC = 33
MSGTAB = 8 /* message table */ MSGTAB = 8 /* message table */
TABCOUNT = 12 /* number of entries in message table */ TABCOUNT = 12 /* number of entries in message table */
.text ENTRY(_senda)
__senda:
push %ebp push %ebp
movl %esp, %ebp movl %esp, %ebp
push %ebx push %ebx

View file

@ -4,10 +4,9 @@
/* void *_memmove(void *s1, const void *s2, size_t n) */ /* void *_memmove(void *s1, const void *s2, size_t n) */
/* Copy a chunk of memory. Handle overlap. */ /* Copy a chunk of memory. Handle overlap. */
/* */ /* */
.text #include <machine/asm.h>
.globl __memmove, __memcpy
.balign 16 ENTRY(_memmove)
__memmove:
push %ebp push %ebp
movl %esp, %ebp movl %esp, %ebp
push %esi push %esi
@ -19,7 +18,7 @@ __memmove:
subl %esi, %eax subl %esi, %eax
cmpl %ecx, %eax cmpl %ecx, %eax
jb downwards /* if (s2 - s1) < n then copy downwards */ jb downwards /* if (s2 - s1) < n then copy downwards */
__memcpy: LABEL(_memcpy)
cld /* Clear direction bit: upwards */ cld /* Clear direction bit: upwards */
cmpl $16, %ecx cmpl $16, %ecx
jb upbyte /* Don't bother being smart with short arrays */ jb upbyte /* Don't bother being smart with short arrays */

View file

@ -4,10 +4,9 @@
/* char *_strncat(char *s1, const char *s2, size_t edx) */ /* char *_strncat(char *s1, const char *s2, size_t edx) */
/* Append string s2 to s1. */ /* Append string s2 to s1. */
/* */ /* */
.text #include <machine/asm.h>
.globl __strncat
.balign 16 ENTRY(_strncat)
__strncat:
push %ebp push %ebp
movl %esp, %ebp movl %esp, %ebp
push %esi push %esi

View file

@ -4,10 +4,9 @@
/* int strncmp(const char *s1, const char *s2, size_t ecx) */ /* int strncmp(const char *s1, const char *s2, size_t ecx) */
/* Compare two strings. */ /* Compare two strings. */
/* */ /* */
.text #include <machine/asm.h>
.globl __strncmp
.balign 16 ENTRY(_strncmp)
__strncmp:
push %ebp push %ebp
movl %esp, %ebp movl %esp, %ebp
push %esi push %esi

View file

@ -4,10 +4,9 @@
/* char *_strncpy(char *s1, const char *s2, size_t ecx) */ /* char *_strncpy(char *s1, const char *s2, size_t ecx) */
/* Copy string s2 to s1. */ /* Copy string s2 to s1. */
/* */ /* */
.text #include <machine/asm.h>
.globl __strncpy
.balign 16 ENTRY(_strncpy)
__strncpy:
movl 12(%ebp), %edi /* edi = string s2 */ movl 12(%ebp), %edi /* edi = string s2 */
xorb %al, %al /* Look for a zero byte */ xorb %al, %al /* Look for a zero byte */
movl %ecx, %edx /* Save maximum count */ movl %ecx, %edx /* Save maximum count */

View file

@ -4,10 +4,9 @@
/* size_t _strnlen(const char *s, size_t ecx) */ /* size_t _strnlen(const char *s, size_t ecx) */
/* Return the length of a string. */ /* Return the length of a string. */
/* */ /* */
.text #include <machine/asm.h>
.globl __strnlen
.balign 16 ENTRY(_strnlen)
__strnlen:
push %ebp push %ebp
movl %esp, %ebp movl %esp, %ebp
push %edi push %edi

View file

@ -7,16 +7,15 @@
/* (Alas it is not without some use, it reports the number of bytes */ /* (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.) */ /* after the bytes that are equal. So it can't be simply replaced.) */
/* */ /* */
.text #include <machine/asm.h>
.globl _bcmp
.balign 16 ENTRY(bcmp)
_bcmp:
push %ebp push %ebp
movl %esp, %ebp movl %esp, %ebp
push 16(%ebp) push 16(%ebp)
push 12(%ebp) push 12(%ebp)
push 8(%ebp) push 8(%ebp)
call _memcmp /* Let memcmp do the work */ call _C_LABEL(memcmp) /* Let memcmp do the work */
testl %eax, %eax testl %eax, %eax
je equal je equal
subl 8(%ebp), %edx /* Memcmp was nice enough to leave "esi" in edx */ subl 8(%ebp), %edx /* Memcmp was nice enough to leave "esi" in edx */

View file

@ -5,11 +5,10 @@
/* Copy a chunk of memory. Handle overlap. */ /* Copy a chunk of memory. Handle overlap. */
/* This is a BSD routine that escaped from the kernel. Don't use. */ /* This is a BSD routine that escaped from the kernel. Don't use. */
/* */ /* */
.text #include <machine/asm.h>
.globl _bcopy
.balign 16 ENTRY(bcopy)
_bcopy:
movl 4(%esp), %eax /* Exchange string arguments */ movl 4(%esp), %eax /* Exchange string arguments */
xchgl 8(%esp), %eax xchgl 8(%esp), %eax
movl %eax, 4(%esp) movl %eax, 4(%esp)
jmp __memmove /* Call the proper routine */ jmp _C_LABEL(_memmove) /* Call the proper routine */

View file

@ -5,15 +5,14 @@
/* Set a chunk of memory to zero. */ /* Set a chunk of memory to zero. */
/* This is a BSD routine that escaped from the kernel. Don't use. */ /* This is a BSD routine that escaped from the kernel. Don't use. */
/* */ /* */
.text #include <machine/asm.h>
.globl _bzero
.balign 16 ENTRY(bzero)
_bzero:
push %ebp push %ebp
movl %esp, %ebp movl %esp, %ebp
push 12(%ebp) /* Size */ push 12(%ebp) /* Size */
push $0 /* Zero */ push $0 /* Zero */
push 8(%ebp) /* String */ push 8(%ebp) /* String */
call _memset /* Call the proper routine */ call _C_LABEL(memset) /* Call the proper routine */
leave leave
ret ret

View file

@ -5,8 +5,7 @@
/* Look for a character in a string. Has suffered from a hostile */ /* Look for a character in a string. Has suffered from a hostile */
/* takeover by strchr(). */ /* takeover by strchr(). */
/* */ /* */
.text #include <machine/asm.h>
.globl _index
.balign 16 ENTRY(index)
_index: jmp _C_LABEL(strchr)
jmp _strchr

View file

@ -4,10 +4,9 @@
/* void *memchr(const void *s, int c, size_t n) */ /* void *memchr(const void *s, int c, size_t n) */
/* Look for a character in a chunk of memory. */ /* Look for a character in a chunk of memory. */
/* */ /* */
.text #include <machine/asm.h>
.globl _memchr
.balign 16 ENTRY(memchr)
_memchr:
push %ebp push %ebp
movl %esp, %ebp movl %esp, %ebp
push %edi push %edi

View file

@ -4,10 +4,9 @@
/* int memcmp(const void *s1, const void *s2, size_t n) */ /* int memcmp(const void *s1, const void *s2, size_t n) */
/* Compare two chunks of memory. */ /* Compare two chunks of memory. */
/* */ /* */
.text #include <machine/asm.h>
.globl _memcmp
.balign 16 ENTRY(memcmp)
_memcmp:
cld cld
push %ebp push %ebp
movl %esp, %ebp movl %esp, %ebp

View file

@ -8,10 +8,9 @@
/* negligible, but you are dealing with a programmer who believes that if */ /* negligible, but you are dealing with a programmer who believes that if */
/* anything can go wrong, it should go wrong. */ /* anything can go wrong, it should go wrong. */
/* */ /* */
.text #include <machine/asm.h>
.globl _memcpy
.balign 16 ENTRY(memcpy)
_memcpy:
push %ebp push %ebp
movl %esp, %ebp movl %esp, %ebp
push %esi push %esi
@ -20,4 +19,4 @@ _memcpy:
movl 12(%ebp), %esi /* String s2 */ movl 12(%ebp), %esi /* String s2 */
movl 16(%ebp), %ecx /* Length */ movl 16(%ebp), %ecx /* Length */
/* No overlap check here */ /* No overlap check here */
jmp __memcpy /* Call the part of __memmove that copies up */ jmp _C_LABEL(_memcpy) /* Call the part of __memmove that copies up */

View file

@ -4,8 +4,7 @@
/* void *memmove(void *s1, const void *s2, size_t n) */ /* void *memmove(void *s1, const void *s2, size_t n) */
/* Copy a chunk of memory. Handle overlap. */ /* Copy a chunk of memory. Handle overlap. */
/* */ /* */
.text #include <machine/asm.h>
.globl _memmove
.balign 16 ENTRY(memmove)
_memmove: jmp _C_LABEL(_memmove) /* Call common code */
jmp __memmove /* Call common code */

View file

@ -4,10 +4,9 @@
/* void *memset(void *s, int c, size_t n) */ /* void *memset(void *s, int c, size_t n) */
/* Set a chunk of memory to the same byte value. */ /* Set a chunk of memory to the same byte value. */
/* */ /* */
.text #include <machine/asm.h>
.globl _memset
.balign 16 ENTRY(memset)
_memset:
push %ebp push %ebp
movl %esp, %ebp movl %esp, %ebp
push %edi push %edi

View file

@ -5,8 +5,7 @@
/* Look for the last occurrence a character in a string. Has suffered */ /* Look for the last occurrence a character in a string. Has suffered */
/* from a hostile takeover by strrchr(). */ /* from a hostile takeover by strrchr(). */
/* */ /* */
.text #include <machine/asm.h>
.globl _rindex
.balign 16 ENTRY(rindex)
_rindex: jmp _C_LABEL(strrchr)
jmp _strrchr

View file

@ -4,9 +4,8 @@
/* char *strcat(char *s1, const char *s2) */ /* char *strcat(char *s1, const char *s2) */
/* Append string s2 to s1. */ /* Append string s2 to s1. */
/* */ /* */
.text #include <machine/asm.h>
.globl _strcat
.balign 16 ENTRY(strcat)
_strcat:
movl $-1, %edx /* Unlimited length */ movl $-1, %edx /* Unlimited length */
jmp __strncat /* Common code */ jmp _C_LABEL(_strncat) /* Common code */

View file

@ -4,10 +4,9 @@
/* char *strchr(const char *s, int c) */ /* char *strchr(const char *s, int c) */
/* Look for a character in a string. */ /* Look for a character in a string. */
/* */ /* */
.text #include <machine/asm.h>
.globl _strchr
.balign 16 ENTRY(strchr)
_strchr:
push %ebp push %ebp
movl %esp, %ebp movl %esp, %ebp
push %edi push %edi

View file

@ -4,9 +4,8 @@
/* int strcmp(const char *s1, const char *s2) */ /* int strcmp(const char *s1, const char *s2) */
/* Compare two strings. */ /* Compare two strings. */
/* */ /* */
.text #include <machine/asm.h>
.globl _strcmp
.balign 16 ENTRY(strcmp)
_strcmp:
movl $-1, %ecx /* Unlimited length */ movl $-1, %ecx /* Unlimited length */
jmp __strncmp /* Common code */ jmp _C_LABEL(_strncmp) /* Common code */

View file

@ -4,16 +4,15 @@
/* char *strcpy(char *s1, const char *s2) */ /* char *strcpy(char *s1, const char *s2) */
/* Copy string s2 to s1. */ /* Copy string s2 to s1. */
/* */ /* */
.text #include <machine/asm.h>
.globl _strcpy
.balign 16 ENTRY(strcpy)
_strcpy:
push %ebp push %ebp
movl %esp, %ebp movl %esp, %ebp
push %esi push %esi
push %edi push %edi
movl $-1, %ecx /* Unlimited length */ movl $-1, %ecx /* Unlimited length */
call __strncpy /* Common code */ call _C_LABEL(_strncpy) /* Common code */
movl 8(%ebp), %eax /* Return s1 */ movl 8(%ebp), %eax /* Return s1 */
pop %edi pop %edi
pop %esi pop %esi

View file

@ -4,9 +4,8 @@
/* size_t strlen(const char *s) */ /* size_t strlen(const char *s) */
/* Return the length of a string. */ /* Return the length of a string. */
/* */ /* */
.text #include <machine/asm.h>
.globl _strlen
.balign 16 ENTRY(strlen)
_strlen:
movl $-1, %ecx /* Unlimited length */ movl $-1, %ecx /* Unlimited length */
jmp __strnlen /* Common code */ jmp _C_LABEL(_strnlen) /* Common code */

View file

@ -4,9 +4,8 @@
/* size_t strncat(char *s1, const char *s2, size_t n) */ /* size_t strncat(char *s1, const char *s2, size_t n) */
/* Append string s2 to s1. */ /* Append string s2 to s1. */
/* */ /* */
.text #include <machine/asm.h>
.globl _strncat
.balign 16 ENTRY(strncat)
_strncat:
movl 12(%esp), %edx /* Maximum length */ movl 12(%esp), %edx /* Maximum length */
jmp __strncat /* Common code */ jmp _C_LABEL(_strncat) /* Common code */

View file

@ -4,9 +4,8 @@
/* int strncmp(const char *s1, const char *s2, size_t n) */ /* int strncmp(const char *s1, const char *s2, size_t n) */
/* Compare two strings. */ /* Compare two strings. */
/* */ /* */
.text #include <machine/asm.h>
.globl _strncmp
.balign 16 ENTRY(strncmp)
_strncmp:
movl 12(%esp), %ecx /* Maximum length */ movl 12(%esp), %ecx /* Maximum length */
jmp __strncmp /* Common code */ jmp _C_LABEL(_strncmp) /* Common code */

View file

@ -4,16 +4,15 @@
/* char *strncpy(char *s1, const char *s2, size_t n) */ /* char *strncpy(char *s1, const char *s2, size_t n) */
/* Copy string s2 to s1. */ /* Copy string s2 to s1. */
/* */ /* */
.text #include <machine/asm.h>
.globl _strncpy
.balign 16 ENTRY(strncpy)
_strncpy:
push %ebp push %ebp
movl %esp, %ebp movl %esp, %ebp
push %esi push %esi
push %edi push %edi
movl 16(%ebp), %ecx /* Maximum length */ movl 16(%ebp), %ecx /* Maximum length */
call __strncpy /* Common code */ call _C_LABEL(_strncpy) /* Common code */
movl %edx, %ecx /* Number of bytes not copied */ movl %edx, %ecx /* Number of bytes not copied */
rep stosb /* strncpy always copies n bytes by null padding */ rep stosb /* strncpy always copies n bytes by null padding */

View file

@ -4,9 +4,8 @@
/* size_t strnlen(const char *s, size_t n) */ /* size_t strnlen(const char *s, size_t n) */
/* Return the length of a string. */ /* Return the length of a string. */
/* */ /* */
.text #include <machine/asm.h>
.globl _strnlen
.balign 16 ENTRY(strnlen)
_strnlen:
movl 8(%esp), %ecx /* Maximum length */ movl 8(%esp), %ecx /* Maximum length */
jmp __strnlen /* Common code */ jmp _C_LABEL(_strnlen) /* Common code */

View file

@ -4,10 +4,9 @@
/* char *strrchr(const char *s, int c) */ /* char *strrchr(const char *s, int c) */
/* Look for the last occurrence a character in a string. */ /* Look for the last occurrence a character in a string. */
/* */ /* */
.text #include <machine/asm.h>
.globl _strrchr
.balign 16 ENTRY(strrchr)
_strrchr:
push %ebp push %ebp
movl %esp, %ebp movl %esp, %ebp
push %edi push %edi

View file

@ -1,10 +1,9 @@
/ __setjmp.gnu.s / __setjmp.gnu.s
/ /
/ Created: Oct 14, 1993 by Philip Homburg <philip@cs.vu.nl> / Created: Oct 14, 1993 by Philip Homburg <philip@cs.vu.nl>
#include <machine/asm.h>
.text ENTRY(__setjmp)
.globl ___setjmp
___setjmp:
movl 4(%esp), %eax /* jmp_buf */ movl 4(%esp), %eax /* jmp_buf */
movl %edx, 28(%eax) /* save edx */ movl %edx, 28(%eax) /* save edx */
movl 0(%esp), %edx movl 0(%esp), %edx
@ -22,7 +21,7 @@ ___setjmp:
jz 1f jz 1f
leal 4(%eax), %edx /* pointer to sigset_t */ leal 4(%eax), %edx /* pointer to sigset_t */
push %edx push %edx
call ___newsigset /* save mask */ call _C_LABEL(__newsigset) /* save mask */
addl $4, %esp addl $4, %esp
1: 1:
movl $0, %eax movl $0, %eax

View file

@ -1,16 +1,15 @@
/ longjmp.gnu.s / longjmp.gnu.s
/ /
/ Created: Oct 15, 1993 by Philip Homburg <philip@cs.vu.nl> / Created: Oct 15, 1993 by Philip Homburg <philip@cs.vu.nl>
#include <machine/asm.h>
.text ENTRY(longjmp)
.globl _longjmp
_longjmp:
movl 4(%esp), %eax /* jmp_buf */ movl 4(%esp), %eax /* jmp_buf */
cmpl $0, 0(%eax) /* save mask? */ cmpl $0, 0(%eax) /* save mask? */
je 1f je 1f
leal 4(%eax), %edx /* pointer to sigset_t */ leal 4(%eax), %edx /* pointer to sigset_t */
push %edx push %edx
call ___oldsigset /* restore mask */ call _C_LABEL(__oldsigset) /* restore mask */
addl $4, %esp addl $4, %esp
movl 4(%esp), %eax /* jmp_buf */ movl 4(%esp), %eax /* jmp_buf */
1: 1:

View file

@ -1,7 +1,6 @@
.text #include <machine/asm.h>
.extern ___exit
.globl __exit IMPORT(__exit)
.balign 2 ENTRY(_exit)
jmp _C_LABEL(__exit)
__exit:
jmp ___exit

View file

@ -1,7 +1,6 @@
.text #include <machine/asm.h>
.extern ___pm_findproc
.globl __pm_findproc IMPORT(__pm_findproc)
.balign 2 ENTRY(_pm_findproc)
jmp _C_LABEL(__pm_findproc)
__pm_findproc:
jmp ___pm_findproc

View file

@ -1,7 +1,6 @@
.text #include <machine/asm.h>
.extern __access
.globl _access IMPORT(_access)
.balign 2 ENTRY(access)
jmp _C_LABEL(_access)
_access:
jmp __access

View file

@ -1,7 +1,6 @@
.text #include <machine/asm.h>
.extern __adddma
.globl _adddma IMPORT(_adddma)
.balign 2 ENTRY(adddma)
jmp _C_LABEL(_adddma)
_adddma:
jmp __adddma

View file

@ -1,7 +1,6 @@
.text #include <machine/asm.h>
.extern __alarm
.globl _alarm IMPORT(_alarm)
.balign 2 ENTRY(alarm)
jmp _C_LABEL(_alarm)
_alarm:
jmp __alarm

View file

@ -1,7 +1,6 @@
.text #include <machine/asm.h>
.extern __brk
.globl _brk IMPORT(_brk)
.balign 2 ENTRY(brk)
jmp _C_LABEL(_brk)
_brk:
jmp __brk

View file

@ -1,7 +1,6 @@
.text #include <machine/asm.h>
.extern __cfgetispeed
.globl _cfgetispeed IMPORT(_cfgetispeed)
.balign 2 ENTRY(cfgetispeed)
jmp _C_LABEL(_cfgetispeed)
_cfgetispeed:
jmp __cfgetispeed

View file

@ -1,7 +1,6 @@
.text #include <machine/asm.h>
.extern __cfgetospeed
.globl _cfgetospeed IMPORT(_cfgetospeed)
.balign 2 ENTRY(cfgetospeed)
jmp _C_LABEL(_cfgetospeed)
_cfgetospeed:
jmp __cfgetospeed

View file

@ -1,7 +1,6 @@
.text #include <machine/asm.h>
.extern __cfsetispeed
.globl _cfsetispeed IMPORT(_cfsetispeed)
.balign 2 ENTRY(cfsetispeed)
jmp _C_LABEL(_cfsetispeed)
_cfsetispeed:
jmp __cfsetispeed

View file

@ -1,7 +1,6 @@
.text #include <machine/asm.h>
.extern __cfsetospeed
.globl _cfsetospeed IMPORT(_cfsetospeed)
.balign 2 ENTRY(cfsetospeed)
jmp _C_LABEL(_cfsetospeed)
_cfsetospeed:
jmp __cfsetospeed

View file

@ -1,11 +1,10 @@
.text #include <machine/asm.h>
.extern __chdir
.globl _chdir IMPORT(_chdir)
.extern __fchdir ENTRY(chdir)
.globl _fchdir jmp _C_LABEL(_chdir)
.balign 2
IMPORT(_fchdir)
ENTRY(fchdir)
jmp _C_LABEL(_fchdir)
_chdir:
jmp __chdir
_fchdir:
jmp __fchdir

View file

@ -1,7 +1,6 @@
.text #include <machine/asm.h>
.extern __chmod
.globl _chmod IMPORT(_chmod)
.balign 2 ENTRY(chmod)
jmp _C_LABEL(_chmod)
_chmod:
jmp __chmod

View file

@ -1,7 +1,6 @@
.text #include <machine/asm.h>
.extern __chown
.globl _chown IMPORT(_chown)
.balign 2 ENTRY(chown)
jmp _C_LABEL(_chown)
_chown:
jmp __chown

View file

@ -1,7 +1,6 @@
.text #include <machine/asm.h>
.extern __chroot
.globl _chroot IMPORT(_chroot)
.balign 2 ENTRY(chroot)
jmp _C_LABEL(_chroot)
_chroot:
jmp __chroot

View file

@ -1,7 +1,6 @@
.text #include <machine/asm.h>
.extern __close
.globl _close IMPORT(_close)
.balign 2 ENTRY(close)
jmp _C_LABEL(_close)
_close:
jmp __close

View file

@ -1,7 +1,6 @@
.text #include <machine/asm.h>
.extern __closedir
.globl _closedir IMPORT(_closedir)
.balign 2 ENTRY(closedir)
jmp _C_LABEL(_closedir)
_closedir:
jmp __closedir

View file

@ -1,7 +1,6 @@
.text #include <machine/asm.h>
.extern __cprofile
.globl _cprofile IMPORT(_cprofile)
.balign 2 ENTRY(cprofile)
jmp _C_LABEL(_cprofile)
_cprofile:
jmp __cprofile

View file

@ -1,7 +1,6 @@
.text #include <machine/asm.h>
.extern __creat
.globl _creat IMPORT(_creat)
.balign 2 ENTRY(creat)
jmp _C_LABEL(_creat)
_creat:
jmp __creat

View file

@ -1,7 +1,6 @@
.text #include <machine/asm.h>
.extern __deldma
.globl _deldma IMPORT(_deldma)
.balign 2 ENTRY(deldma)
jmp _C_LABEL(_deldma)
_deldma:
jmp __deldma

View file

@ -1,7 +1,6 @@
.text #include <machine/asm.h>
.extern __dup
.globl _dup IMPORT(_dup)
.balign 2 ENTRY(dup)
jmp _C_LABEL(_dup)
_dup:
jmp __dup

View file

@ -1,7 +1,6 @@
.text #include <machine/asm.h>
.extern __dup2
.globl _dup2 IMPORT(_dup2)
.balign 2 ENTRY(dup2)
jmp _C_LABEL(_dup2)
_dup2:
jmp __dup2

View file

@ -1,7 +1,6 @@
.text #include <machine/asm.h>
.extern __execl
.globl _execl IMPORT(_execl)
.balign 2 ENTRY(execl)
jmp _C_LABEL(_execl)
_execl:
jmp __execl

View file

@ -1,7 +1,6 @@
.text #include <machine/asm.h>
.extern __execle
.globl _execle IMPORT(_execle)
.balign 2 ENTRY(execle)
jmp _C_LABEL(_execle)
_execle:
jmp __execle

View file

@ -1,7 +1,6 @@
.text #include <machine/asm.h>
.extern __execlp
.globl _execlp IMPORT(_execlp)
.balign 2 ENTRY(execlp)
jmp _C_LABEL(_execlp)
_execlp:
jmp __execlp

View file

@ -1,7 +1,6 @@
.text #include <machine/asm.h>
.extern __execv
.globl _execv IMPORT(_execv)
.balign 2 ENTRY(execv)
jmp _C_LABEL(_execv)
_execv:
jmp __execv

View file

@ -1,7 +1,6 @@
.text #include <machine/asm.h>
.extern __execve
.globl _execve IMPORT(_execve)
.balign 2 ENTRY(execve)
jmp _C_LABEL(_execve)
_execve:
jmp __execve

View file

@ -1,7 +1,6 @@
.text #include <machine/asm.h>
.extern __execvp
.globl _execvp IMPORT(_execvp)
.balign 2 ENTRY(execvp)
jmp _C_LABEL(_execvp)
_execvp:
jmp __execvp

View file

@ -1,7 +1,6 @@
.text #include <machine/asm.h>
.extern __fchmod
.globl _fchmod IMPORT(_fchmod)
.balign 2 ENTRY(fchmod)
jmp _C_LABEL(_fchmod)
_fchmod:
jmp __fchmod

View file

@ -1,7 +1,6 @@
.text #include <machine/asm.h>
.extern __fchown
.globl _fchown IMPORT(_fchown)
.balign 2 ENTRY(fchown)
jmp _C_LABEL(_fchown)
_fchown:
jmp __fchown

View file

@ -1,7 +1,6 @@
.text #include <machine/asm.h>
.extern __fcntl
.globl _fcntl IMPORT(_fcntl)
.balign 2 ENTRY(fcntl)
jmp _C_LABEL(_fcntl)
_fcntl:
jmp __fcntl

View file

@ -1,7 +1,6 @@
.text #include <machine/asm.h>
.extern __fork
.globl _fork IMPORT(_fork)
.balign 2 ENTRY(fork)
jmp _C_LABEL(_fork)
_fork:
jmp __fork

View file

@ -1,7 +1,6 @@
.text #include <machine/asm.h>
.extern __fpathconf
.globl _fpathconf IMPORT(_fpathconf)
.balign 2 ENTRY(fpathconf)
jmp _C_LABEL(_fpathconf)
_fpathconf:
jmp __fpathconf

View file

@ -1,7 +1,6 @@
.text #include <machine/asm.h>
.extern __fstat
.globl _fstat IMPORT(_fstat)
.balign 2 ENTRY(fstat)
jmp _C_LABEL(_fstat)
_fstat:
jmp __fstat

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