FreeBSD/Linux Kernel Cross Reference
sys/i386/hardclock.s
1 /*
2 * Mach Operating System
3 * Copyright (c) 1993 Carnegie Mellon University
4 * All Rights Reserved.
5 *
6 * Permission to use, copy, modify and distribute this software and its
7 * documentation is hereby granted, provided that both the copyright
8 * notice and this permission notice appear in all copies of the
9 * software, derivative works or modified versions, and any portions
10 * thereof, and that both notices appear in supporting documentation.
11 *
12 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
13 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
14 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
15 *
16 * Carnegie Mellon requests users of this software to return to
17 *
18 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
19 * School of Computer Science
20 * Carnegie Mellon University
21 * Pittsburgh PA 15213-3890
22 *
23 * any improvements or extensions that they make and grant Carnegie Mellon
24 * the rights to redistribute these changes.
25 */
26 /*
27 * HISTORY
28 * $Log: hardclock.s,v $
29 * Revision 2.2 93/11/17 16:35:45 dbg
30 * Created.
31 * [93/02/10 dbg]
32 *
33 */
34
35 #include <platforms.h>
36
37 #include <i386/eflags.h>
38 #include <assym.s>
39
40 /*
41 * Assembler version of system clock interrupt
42 * routine.
43 *
44 * On stack:
45 * esp-> return address to interrupt dispatcher
46 * unit number (unneeded on return)
47 * [ PS2 only interrupt vector number ]
48 * saved SPL
49 * return address from interrupt dispatcher
50 * pointer to saved registers
51 */
52
53 #ifdef PS2
54 #define RET_OFFSET 16
55 #else /* not PS2 */
56 #define RET_OFFSET 12
57 #endif
58
59 .globl _hardclock
60 _hardclock:
61 movl RET_OFFSET(%esp),%eax /* get dispatcher return address */
62 cmpl $_return_to_iret,%eax /* from interrupt level? */
63 jne hardclock_system /* in kernel if so */
64 movl RET_OFFSET+4(%esp),%eax /* point to registers */
65 testl $(EFL_VM),I_EFL(%eax) /* in V86 mode? */
66 jnz hardclock_user /* in user if so */
67 testb $3,I_CS(%eax) /* protection level 3? */
68 jnz hardclock_user /* in user if so */
69
70 /* clock interrupt from system */
71
72 hardclock_system:
73 movl $0,4(%esp) /* set usermode = FALSE */
74 jmp _sys_clock_interrupt /* take system clock interrupt */
75
76 /* clock interrupt from user */
77
78 hardclock_user:
79 movl $1,4(%esp) /* set usermode = TRUE */
80 jmp _sys_clock_interrupt /* take system clock interrupt */
Cache object: 6619361b044622534db81653c905ee63
|