1/* $NetBSD: db_dbgreg.S,v 1.6 2007/10/17 19:54:44 garbled Exp $ */ 2 3/* 4 * Mach Operating System 5 * Copyright (c) 1995 Carnegie Mellon University 6 * All Rights Reserved. 7 * 8 * Permission to use, copy, modify and distribute this software and its 9 * documentation is hereby granted, provided that both the copyright 10 * notice and this permission notice appear in all copies of the 11 * software, derivative works or modified versions, and any portions 12 * thereof, and that both notices appear in supporting documentation. 13 * 14 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" 15 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR 16 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. 17 * 18 * Carnegie Mellon requests users of this software to return to 19 * 20 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU 21 * School of Computer Science 22 * Carnegie Mellon University 23 * Pittsburgh PA 15213-3890 24 * 25 * any improvements or extensions that they make and grant Carnegie Mellon 26 * the rights to redistribute these changes. 27 */ 28 29/* LINTSTUB: Empty */ 30 31#include <i386/include/asm.h> 32__KERNEL_RCSID(0, "$NetBSD$"); 33 34#define S_ARG0 4(%esp) 35#define S_ARG1 8(%esp) 36#define S_ARG2 12(%esp) 37#define S_ARG3 16(%esp) 38 39#define B_ARG0 8(%ebp) 40#define B_ARG1 12(%ebp) 41#define B_ARG2 16(%ebp) 42#define B_ARG3 20(%ebp) 43 44ENTRY(dr6) 45 movl %db6, %eax 46 ret 47 48/* dr<i>(address, type, len, persistence) 49 * type: 50 * 00 execution (use len 00) 51 * 01 data write 52 * 11 data read/write 53 * len: 54 * 00 one byte 55 * 01 two bytes 56 * 11 four bytes 57 */ 58ENTRY(dr0) 59 movl S_ARG0, %eax 60 movl %eax,_C_LABEL(dr_addr) 61 movl %eax, %db0 62 movl $0, %ecx 63 jmp 0f 64ENTRY(dr1) 65 movl S_ARG0, %eax 66 movl %eax,_C_LABEL(dr_addr)+1*4 67 movl %eax, %db1 68 movl $2, %ecx 69 jmp 0f 70ENTRY(dr2) 71 movl S_ARG0, %eax 72 movl %eax,_C_LABEL(dr_addr)+2*4 73 movl %eax, %db2 74 movl $4, %ecx 75 jmp 0f 76 77ENTRY(dr3) 78 movl S_ARG0, %eax 79 movl %eax,_C_LABEL(dr_addr)+3*4 80 movl %eax, %db3 81 movl $6, %ecx 82 830: 84 pushl %ebp 85 movl %esp, %ebp 86 87 movl %db7, %edx 88 movl %edx,_C_LABEL(dr_addr)+4*4 89 andl dr_msk(,%ecx,2),%edx /* clear out new entry */ 90 movl %edx,_C_LABEL(dr_addr)+5*4 91 movzbl B_ARG3, %eax 92 andb $3, %al 93 shll %cl, %eax 94 orl %eax, %edx 95 96 shll $1, %ecx 97 98 movzbl B_ARG1, %eax 99 andb $3, %al 100 addb $0x10, %cl 101 shll %cl, %eax 102 orl %eax, %edx 103 104 movzbl B_ARG2, %eax 105 andb $3, %al 106 addb $0x2, %cl 107 shll %cl, %eax 108 orl %eax, %edx 109 110 movl %edx, %db7 111 movl %edx,_C_LABEL(dr_addr)+7*4 112 movl %edx, %eax 113 leave 114 ret 115 116 .data 117dr_msk: 118 .long ~0x000f0003 119 .long ~0x00f0000c 120 .long ~0x0f000030 121 /* XXX 122 * The following should be ~0xf00000c0 but that confuses gas 123 * when cross-compiling i386 from amd64. 124 */ 125 .long 0x0fffff3f 126_C_LABEL(dr_addr): 127 .long 0,0,0,0 128 .long 0,0,0,0 129 .text 130