mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2024-11-14 22:32:30 +01:00
Added MCOUNT_ENTER and MCOUNT_EXIT macros to profile.h
Removed inb function since it's more correctly in pio.h Copied write_eflags and read_eflags over from npx.c (Some changes to the macros suggested by Bruce were not made at this time since his suggestions probably apply to all the macros and these inlined/macro definitions need a lot of cleaning up at some point in the future.) Reviewed by: Bruce
This commit is contained in:
parent
691071ff1c
commit
8db02de884
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=2801
@ -30,7 +30,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: cpufunc.h,v 1.19 1994/08/23 13:41:37 paul Exp $
|
||||
* $Id: cpufunc.h,v 1.20 1994/09/02 04:12:16 davidg Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -70,26 +70,18 @@ enable_intr(void)
|
||||
__asm __volatile("sti");
|
||||
}
|
||||
|
||||
static inline u_char
|
||||
inb(u_int port)
|
||||
static inline u_long
|
||||
read_eflags()
|
||||
{
|
||||
u_char data;
|
||||
/*
|
||||
* We use %%dx and not %1 here because i/o is done at %dx and not at
|
||||
* %edx, while gcc-2.2.2 generates inferior code (movw instead of movl)
|
||||
* if we tell it to load (u_short) port.
|
||||
*/
|
||||
__asm __volatile("inb %%dx,%0" : "=a" (data) : "d" (port));
|
||||
return data;
|
||||
u_long ef;
|
||||
__asm __volatile("pushf; popl %0" : "=a" (ef));
|
||||
return(ef);
|
||||
}
|
||||
|
||||
static inline void
|
||||
outb(u_int port, u_char data)
|
||||
write_eflags(u_long ef)
|
||||
{
|
||||
u_char al;
|
||||
|
||||
al = data; /* help gcc-1.40's register allocator */
|
||||
__asm __volatile("outb %0,%%dx" : : "a" (al), "d" (port));
|
||||
__asm __volatile("pushl %0; popf" : : "a" ((u_long) ef));
|
||||
}
|
||||
|
||||
static inline void
|
||||
|
@ -31,7 +31,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)profile.h 8.1 (Berkeley) 6/11/93
|
||||
* $Id: profile.h,v 1.2 1994/08/02 07:38:56 davidg Exp $
|
||||
* $Id: profile.h,v 1.3 1994/08/21 04:55:29 paul Exp $
|
||||
*/
|
||||
|
||||
#ifndef _I386_MACHINE_PROFILE_H_
|
||||
@ -59,4 +59,7 @@ extern void mcount() asm("mcount"); void mcount() { \
|
||||
_mcount(frompcindex, selfpc); \
|
||||
}
|
||||
|
||||
#define MCOUNT_ENTER save_eflags = read_eflags(); disable_intr()
|
||||
#define MCOUNT_EXIT write_eflags(save_eflags)
|
||||
|
||||
#endif
|
||||
|
@ -30,7 +30,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: cpufunc.h,v 1.19 1994/08/23 13:41:37 paul Exp $
|
||||
* $Id: cpufunc.h,v 1.20 1994/09/02 04:12:16 davidg Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -70,26 +70,18 @@ enable_intr(void)
|
||||
__asm __volatile("sti");
|
||||
}
|
||||
|
||||
static inline u_char
|
||||
inb(u_int port)
|
||||
static inline u_long
|
||||
read_eflags()
|
||||
{
|
||||
u_char data;
|
||||
/*
|
||||
* We use %%dx and not %1 here because i/o is done at %dx and not at
|
||||
* %edx, while gcc-2.2.2 generates inferior code (movw instead of movl)
|
||||
* if we tell it to load (u_short) port.
|
||||
*/
|
||||
__asm __volatile("inb %%dx,%0" : "=a" (data) : "d" (port));
|
||||
return data;
|
||||
u_long ef;
|
||||
__asm __volatile("pushf; popl %0" : "=a" (ef));
|
||||
return(ef);
|
||||
}
|
||||
|
||||
static inline void
|
||||
outb(u_int port, u_char data)
|
||||
write_eflags(u_long ef)
|
||||
{
|
||||
u_char al;
|
||||
|
||||
al = data; /* help gcc-1.40's register allocator */
|
||||
__asm __volatile("outb %0,%%dx" : : "a" (al), "d" (port));
|
||||
__asm __volatile("pushl %0; popf" : : "a" ((u_long) ef));
|
||||
}
|
||||
|
||||
static inline void
|
||||
|
@ -31,7 +31,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)profile.h 8.1 (Berkeley) 6/11/93
|
||||
* $Id: profile.h,v 1.2 1994/08/02 07:38:56 davidg Exp $
|
||||
* $Id: profile.h,v 1.3 1994/08/21 04:55:29 paul Exp $
|
||||
*/
|
||||
|
||||
#ifndef _I386_MACHINE_PROFILE_H_
|
||||
@ -59,4 +59,7 @@ extern void mcount() asm("mcount"); void mcount() { \
|
||||
_mcount(frompcindex, selfpc); \
|
||||
}
|
||||
|
||||
#define MCOUNT_ENTER save_eflags = read_eflags(); disable_intr()
|
||||
#define MCOUNT_EXIT write_eflags(save_eflags)
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user