2 * Kernel Debugger Architecture Independent Support Functions
4 * Copyright (C) 1999 Silicon Graphics, Inc.
5 * Copyright (C) Scott Lurndal (slurn@engr.sgi.com)
6 * Copyright (C) Scott Foehner (sfoehner@engr.sgi.com)
7 * Copyright (C) Srinivasa Thirumalachar (sprasad@engr.sgi.com)
9 * See the file LIA-COPYRIGHT for additional information.
11 * Written March 1999 by Scott Lurndal at Silicon Graphics, Inc.
14 * Richard Bass 1999/07/20
15 * Many bug fixes and enhancements.
18 * Scott Lurndal 1999/12/12
20 * Keith Owens 2000/05/23
24 #include <linux/string.h>
25 #include <linux/stddef.h>
26 #include <linux/kernel.h>
27 #include <linux/init.h>
28 #include <linux/ptrace.h>
30 #include <linux/sched.h>
31 #include <linux/kdb.h>
32 #include <linux/kdbprivate.h>
34 #include <asm/processor.h>
36 #include <asm/uaccess.h>
37 #include <asm/machdep.h>
39 extern const char *kdb_diemsg;
43 int valid_ppc64_kernel_address(unsigned long addr, unsigned long size);
44 extern int kdba_excprint(int argc, const char **argv, const char **envp, struct pt_regs *regs);
45 extern int kdba_super_regs(int argc, const char **argv, const char **envp, struct pt_regs *regs);
46 extern int kdba_dissect_msr(int argc, const char **argv, const char **envp, struct pt_regs *regs);
47 extern int kdba_halt(int argc, const char **argv, const char **envp, struct pt_regs *regs);
48 extern int kdba_dump_tce_table(int argc, const char **argv, const char **envp, struct pt_regs *regs);
49 extern int kdba_kernelversion(int argc, const char **argv, const char **envp, struct pt_regs *regs);
50 extern int kdba_dmesg(int argc, const char **argv, const char **envp, struct pt_regs *regs);
51 extern int kdba_dump_pci_info(int argc, const char **argv, const char **envp, struct pt_regs *regs);
52 unsigned long kdba_getword(unsigned long addr, size_t width);
56 * Architecture specific initialization.
59 kdb_register("commandname", # name of command user will use to invoke function
60 function_name, # name of function within the code
61 "function example usage", # sample usage
62 "function description", # brief description.
63 0 # if i hit enter again, will command repeat itself ?
64 Note: functions must take parameters as such:
65 functionname(int argc, const char **argv, const char **envp, struct pt_regs *regs)
72 kdb_register("excp", kdba_excprint, "excp", "print exception info", 0);
73 kdb_register("superreg", kdba_super_regs, "superreg", "display super_regs", 0);
74 kdb_register("msr", kdba_dissect_msr, "msr", "dissect msr", 0);
75 kdb_register("halt", kdba_halt, "halt", "halt machine", 0);
76 kdb_register("dump_tce_table", kdba_dump_tce_table, "dump_tce_table <addr> [full]", "dump the tce table located at <addr>", 0);
77 kdb_register("kernel", kdba_kernelversion, "version", "display running kernel version", 0);
78 kdb_register("version", kdba_kernelversion, "version", "display running kernel version", 0);
79 kdb_register("_dmesg", kdba_dmesg, "dmesg <lines>", "display lines from dmesg (log_buf) buffer", 0);
80 kdb_register("pci_info", kdba_dump_pci_info, "dump_pci_info", "dump pci device info", 0);
83 if (!ppc_md.udbg_getc_poll)
93 * This function analyzes a gcc-generated function prototype
94 * with or without frame pointers to determine the amount of
95 * automatic storage and register save storage is used on the
96 * stack of the target function. It only counts instructions
97 * that have been executed up to but excluding the current eip.
99 * code Start address of function code to analyze
100 * pc Current program counter within function
101 * sp Current stack pointer for function
102 * fp Current frame pointer for function, may not be valid
103 * ss Start of stack for current process.
104 * caller 1 if looking for data on the caller frame, 0 for callee.
106 * ar Activation record, all fields may be set. fp and oldfp
107 * are 0 if they cannot be extracted. return is 0 if the
108 * code cannot find a valid return address. args and arg0
109 * are 0 if the number of arguments cannot be safely
112 * 1 if prologue is valid, 0 otherwise. If pc is 0 treat it as a
113 * valid prologue to allow bt on wild branches.
120 kdba_prologue(const kdb_symtab_t *symtab, kdb_machreg_t pc, kdb_machreg_t sp,
121 kdb_machreg_t fp, kdb_machreg_t ss, int caller, kdb_ar_t *ar)
123 /* We don't currently use kdb's generic activation record scanning
124 * code to handle backtrace.
132 * kdba_getregcontents
134 * Return the contents of the register specified by the
135 * input string argument. Return an error if the string
136 * does not match a machine register.
138 * The following pseudo register names are supported:
139 * ®s - Prints address of exception frame
140 * kesp - Prints kernel stack pointer at time of fault
141 * cesp - Prints current kernel stack pointer, inside kdb
142 * ceflags - Prints current flags, inside kdb
143 * %<regname> - Uses the value of the registers at the
144 * last time the user process entered kernel
145 * mode, instead of the registers at the time
149 * regname Pointer to string naming register
150 * regs Pointer to structure containing registers.
152 * *contents Pointer to unsigned long to recieve register contents
155 * KDB_BADREG Invalid register name
159 * If kdb was entered via an interrupt from the kernel itself then
160 * ss and esp are *not* on the stack.
163 static struct kdbregs {
167 { "gpr0", offsetof(struct pt_regs, gpr[0]) },
168 { "gpr1", offsetof(struct pt_regs, gpr[1]) },
169 { "gpr2", offsetof(struct pt_regs, gpr[2]) },
170 { "gpr3", offsetof(struct pt_regs, gpr[3]) },
171 { "gpr4", offsetof(struct pt_regs, gpr[4]) },
172 { "gpr5", offsetof(struct pt_regs, gpr[5]) },
173 { "gpr6", offsetof(struct pt_regs, gpr[6]) },
174 { "gpr7", offsetof(struct pt_regs, gpr[7]) },
175 { "gpr8", offsetof(struct pt_regs, gpr[8]) },
176 { "gpr9", offsetof(struct pt_regs, gpr[9]) },
177 { "gpr10", offsetof(struct pt_regs, gpr[10]) },
178 { "gpr11", offsetof(struct pt_regs, gpr[11]) },
179 { "gpr12", offsetof(struct pt_regs, gpr[12]) },
180 { "gpr13", offsetof(struct pt_regs, gpr[13]) },
181 { "gpr14", offsetof(struct pt_regs, gpr[14]) },
182 { "gpr15", offsetof(struct pt_regs, gpr[15]) },
183 { "gpr16", offsetof(struct pt_regs, gpr[16]) },
184 { "gpr17", offsetof(struct pt_regs, gpr[17]) },
185 { "gpr18", offsetof(struct pt_regs, gpr[18]) },
186 { "gpr19", offsetof(struct pt_regs, gpr[19]) },
187 { "gpr20", offsetof(struct pt_regs, gpr[20]) },
188 { "gpr21", offsetof(struct pt_regs, gpr[21]) },
189 { "gpr22", offsetof(struct pt_regs, gpr[22]) },
190 { "gpr23", offsetof(struct pt_regs, gpr[23]) },
191 { "gpr24", offsetof(struct pt_regs, gpr[24]) },
192 { "gpr25", offsetof(struct pt_regs, gpr[25]) },
193 { "gpr26", offsetof(struct pt_regs, gpr[26]) },
194 { "gpr27", offsetof(struct pt_regs, gpr[27]) },
195 { "gpr28", offsetof(struct pt_regs, gpr[28]) },
196 { "gpr29", offsetof(struct pt_regs, gpr[29]) },
197 { "gpr30", offsetof(struct pt_regs, gpr[30]) },
198 { "gpr31", offsetof(struct pt_regs, gpr[31]) },
199 { "eip", offsetof(struct pt_regs, nip) },
200 { "msr", offsetof(struct pt_regs, msr) },
201 { "esp", offsetof(struct pt_regs, gpr[1]) },
202 { "orig_gpr3", offsetof(struct pt_regs, orig_gpr3) },
203 { "ctr", offsetof(struct pt_regs, ctr) },
204 { "link", offsetof(struct pt_regs, link) },
205 { "xer", offsetof(struct pt_regs, xer) },
206 { "ccr", offsetof(struct pt_regs, ccr) },
207 { "mq", offsetof(struct pt_regs, softe) /* mq */ },
208 { "trap", offsetof(struct pt_regs, trap) },
209 { "dar", offsetof(struct pt_regs, dar) },
210 { "dsisr", offsetof(struct pt_regs, dsisr) },
211 { "result", offsetof(struct pt_regs, result) },
214 static const int nkdbreglist = sizeof(kdbreglist) / sizeof(struct kdbregs);
220 asm("mr %0,1" : "=r" (x):);
225 kdba_getregcontents(const char *regname,
226 struct pt_regs *regs,
227 kdb_machreg_t *contents)
231 if (strcmp(regname, "®s") == 0) {
232 *contents = (unsigned long)regs;
236 if (strcmp(regname, "kesp") == 0) {
237 *contents = (unsigned long) current->thread.ksp;
241 if (strcmp(regname, "cesp") == 0) {
246 if (strcmp(regname, "ceflags") == 0) {
253 if (regname[0] == '%') {
254 /* User registers: %%e[a-c]x, etc */
256 regs = (struct pt_regs *)
257 (current->thread.ksp - sizeof(struct pt_regs));
260 for (i=0; i<nkdbreglist; i++) {
261 if (strnicmp(kdbreglist[i].reg_name,
263 strlen(regname)) == 0)
267 if ((i < nkdbreglist)
268 && (strlen(kdbreglist[i].reg_name) == strlen(regname))) {
269 *contents = *(unsigned long *)((unsigned long)regs +
270 kdbreglist[i].reg_offset);
278 * kdba_setregcontents
280 * Set the contents of the register specified by the
281 * input string argument. Return an error if the string
282 * does not match a machine register.
284 * Supports modification of user-mode registers via
288 * regname Pointer to string naming register
289 * regs Pointer to structure containing registers.
290 * contents Unsigned long containing new register contents
294 * KDB_BADREG Invalid register name
301 kdba_setregcontents(const char *regname,
302 struct pt_regs *regs,
303 unsigned long contents)
307 if (regname[0] == '%') {
309 regs = (struct pt_regs *)
310 (current->thread.ksp - sizeof(struct pt_regs));
313 for (i=0; i<nkdbreglist; i++) {
314 if (strnicmp(kdbreglist[i].reg_name,
316 strlen(regname)) == 0)
320 if ((i < nkdbreglist)
321 && (strlen(kdbreglist[i].reg_name) == strlen(regname))) {
322 *(unsigned long *)((unsigned long)regs
323 + kdbreglist[i].reg_offset) = contents;
333 * Dump the specified register set to the display.
336 * regs Pointer to structure containing registers.
337 * type Character string identifying register set to dump
338 * extra string further identifying register (optional)
345 * This function will dump the general register set if the type
346 * argument is NULL (struct pt_regs). The alternate register
347 * set types supported by this function:
350 * c Control registers
351 * u User registers at most recent entry to kernel
352 * Following not yet implemented:
353 * m Model Specific Registers (extra defines register #)
354 * r Memory Type Range Registers (extra defines register)
358 kdba_dumpregs(struct pt_regs *regs,
366 && (type[0] == 'u')) {
368 regs = (struct pt_regs *)
369 (current->thread.ksp - sizeof(struct pt_regs));
374 kdb_machreg_t contents;
376 for (i=0, rlp=kdbreglist; i<nkdbreglist; i++,rlp++) {
377 kdba_getregcontents(rlp->reg_name, regs, &contents);
378 kdb_printf("%-5s = 0x%p%c", rlp->reg_name, (void *)contents, (++count % 2) ? ' ' : '\n');
381 kdb_printf("®s = 0x%p\n", regs);
400 kdba_getpc(kdb_eframe_t ef)
406 kdba_setpc(kdb_eframe_t ef, kdb_machreg_t newpc)
408 /* for ppc64, newpc passed in is actually a function descriptor for kdb. */
409 ef->nip = kdba_getword(newpc+8, 8);
410 KDB_STATE_SET(IP_ADJUSTED);
417 * Do any architecture specific set up before entering the main kdb loop.
418 * The primary function of this routine is to make all processes look the
419 * same to kdb, kdb must be able to list a process without worrying if the
420 * process is running or blocked, so make all process look as though they
424 * reason The reason KDB was invoked
425 * error The hardware-defined error code
426 * error2 kdb's current reason code. Initially error but can change
427 * acording to kdb state.
428 * db_result Result from break or debug point.
429 * ef The exception frame at time of fault/breakpoint. If reason
430 * is KDB_REASON_SILENT then ef is NULL, otherwise it should
433 * 0 KDB was invoked for an event which it wasn't responsible
434 * 1 KDB handled the event for which it was invoked.
436 * Sets eip and esp in current->thread.
444 kdba_main_loop(kdb_reason_t reason, kdb_reason_t reason2, int error,
445 kdb_dbtrap_t db_result, kdb_eframe_t ef)
449 if (current->thread.regs == NULL)
452 asm volatile ("std 0,0(%0)\n\
483 std 31,248(%0)" : : "b" (®s));
484 /* Fetch the link reg for this stack frame.
485 NOTE: the prev kdb_printf fills in the lr. */
486 regs.nip = regs.link = ((unsigned long *)regs.gpr[1])[2];
487 regs.msr = get_msr();
488 regs.ctr = get_ctr();
489 regs.xer = get_xer();
492 current->thread.regs = ®s;
495 kdba_getregcontents("eip", ef, &(current->thread.regs->nip));
496 kdba_getregcontents("esp", ef, &(current->thread.regs->gpr[1]));
500 set_msr( msr & ~0x8000);
501 rv = kdb_main_loop(reason, reason2, error, db_result, ef);
507 kdba_disableint(kdb_intstate_t *state)
509 int *fp = (int *)state;
519 kdba_restoreint(kdb_intstate_t *state)
521 int flags = *(int *)state;
522 restore_flags(flags);
526 kdba_setsinglestep(struct pt_regs *regs)
532 kdba_clearsinglestep(struct pt_regs *regs)
535 regs->msr &= ~MSR_SE;
539 kdba_getcurrentframe(struct pt_regs *regs)
541 regs->gpr[1] = getsp();
542 /* this stack pointer becomes invalid after we return, so take another step back. */
543 regs->gpr[1] = kdba_getword(regs->gpr[1], 8);
547 #ifdef KDB_HAVE_LONGJMP
548 int kdba_setjmp(kdb_jmp_buf *buf)
551 "mflr 0; std 0,0(%0)\n\
554 mfcr 0; std 0,24(%0)\n\
575 KDB_STATE_SET(LONGJMP);
578 void kdba_longjmp(kdb_jmp_buf *buf, int val)
609 " : : "r" (buf), "r" (val));
616 * This function is called once on each CPU to enable machine
617 * check exception handling.
632 kdba_enable_mce(void)
639 * Enable last branch recording.
652 kdba_enable_lbr(void)
659 * disable last branch recording.
672 kdba_disable_lbr(void)
679 * Print last branch and last exception addresses
699 * Architecture specific function to access kernel virtual
712 /* if (access_ok(VERIFY_READ,__gu_addr,size)) \ */
714 extern inline void sync(void)
716 asm volatile("sync; isync");
719 extern void (*debugger_fault_handler)(struct pt_regs *);
720 extern void longjmp(u_int *, int);
722 static void handle_fault(struct pt_regs *);
724 static int fault_type;
728 kdba_getword(unsigned long addr, size_t width)
731 * This function checks the address for validity. Any address
732 * in the range PAGE_OFFSET to high_memory is legal, any address
733 * which maps to a vmalloc region is legal, and any address which
734 * is a user address, we use get_user() to verify validity.
737 if (!valid_ppc64_kernel_address(addr, width)) {
739 * Would appear to be an illegal kernel address;
740 * Print a message once, and don't print again until
741 * a legal address is used.
743 if (!KDB_STATE(SUPPRESS)) {
745 kdb_printf(" kdb: Possibly Bad kernel address 0x%lx \n",addr);
747 kdb_printf("kdb: ! \n");
749 KDB_STATE_SET(SUPPRESS);
756 * A good address. Reset error flag.
758 KDB_STATE_CLEAR(SUPPRESS);
764 lp = (unsigned long *)(addr);
770 ip = (unsigned int *)(addr);
774 { unsigned short *sp;
776 sp = (unsigned short *)(addr);
782 cp = (unsigned char *)(addr);
787 kdb_printf("kdbgetword: Bad width\n");
796 * Architecture specific function to access kernel virtual
810 kdba_putword(unsigned long addr, size_t size, unsigned long contents)
813 * This function checks the address for validity. Any address
814 * in the range PAGE_OFFSET to high_memory is legal, any address
815 * which maps to a vmalloc region is legal, and any address which
816 * is a user address, we use get_user() to verify validity.
819 if (addr < PAGE_OFFSET) {
829 lp = (unsigned long *) addr;
830 diag = put_user(contents, lp);
834 { unsigned short *sp;
836 sp = (unsigned short *) addr;
837 diag = put_user(contents, sp);
843 cp = (unsigned char *) addr;
844 diag = put_user(contents, cp);
848 kdb_printf("kdba_putword: Bad width\n");
853 if (!KDB_STATE(SUPPRESS)) {
854 kdb_printf("kdb: Bad user address 0x%lx\n", addr);
855 KDB_STATE_SET(SUPPRESS);
859 KDB_STATE_CLEAR(SUPPRESS);
864 if (addr > (unsigned long)high_memory) {
865 if (!kdb_vmlist_check(addr, addr+size)) {
867 * Would appear to be an illegal kernel address;
868 * Print a message once, and don't print again until
869 * a legal address is used.
871 if (!KDB_STATE(SUPPRESS)) {
872 kdb_printf("kdb: xx Bad kernel address 0x%lx\n", addr);
873 KDB_STATE_SET(SUPPRESS);
881 * A good address. Reset error flag.
883 KDB_STATE_CLEAR(SUPPRESS);
889 lp = (unsigned long *)(addr);
894 { unsigned short *sp;
896 sp = (unsigned short *)(addr);
897 *sp = (unsigned short) contents;
903 cp = (unsigned char *)(addr);
904 *cp = (unsigned char) contents;
909 kdb_printf("kdba_putword: Bad width\n");
916 * Callback function for kernel 'die' function.
919 * regs Register contents at time of trap
920 * error_code Trap-specific error code value
922 * vp Pointer to die message
924 * Returns 1 if fault handled by kdb.
931 kdba_callback_die(struct pt_regs *regs, int error_code, long trapno, void *vp)
934 * Save a pointer to the message provided to 'die()'.
936 kdb_diemsg = (char *)vp;
938 return kdb(KDB_REASON_OOPS, error_code, (kdb_eframe_t) regs);
944 * Callback function for kernel breakpoint trap.
947 * regs Register contents at time of trap
948 * error_code Trap-specific error code value
952 * Returns 1 if fault handled by kdb.
960 kdba_callback_bp(struct pt_regs *regs, int error_code, long trapno, void *vp)
965 kdb_printf("cb_bp: e_c = %d tn = %ld regs = 0x%p\n", error_code,
968 diag = kdb(KDB_REASON_BREAK, error_code, (kdb_eframe_t) regs);
971 kdb_printf("cb_bp: e_c = %d tn = %ld regs = 0x%p diag = %d\n", error_code,
977 * kdba_callback_debug
979 * Callback function for kernel debug register trap.
982 * regs Register contents at time of trap
983 * error_code Trap-specific error code value
987 * Returns 1 if fault handled by kdb.
995 kdba_callback_debug(struct pt_regs *regs, int error_code, long trapno, void *vp)
997 return kdb(KDB_REASON_DEBUG, error_code, (kdb_eframe_t) regs);
1006 * Architecture specific adjustment of instruction pointer before leaving
1010 * reason The reason KDB was invoked
1011 * error The hardware-defined error code
1012 * ef The exception frame at time of fault/breakpoint. If reason
1013 * is KDB_REASON_SILENT then ef is NULL, otherwise it should
1024 kdba_adjust_ip(kdb_reason_t reason, int error, kdb_eframe_t ef)
1032 * kdba_find_tb_table
1034 * Find the traceback table (defined by the ELF64 ABI) located at
1035 * the end of the function containing pc.
1038 * eip starting instruction addr. does not need to be at the start of the func.
1039 * tab table to populate if successful
1041 * non-zero if successful. unsuccessful means that a valid tb table was not found
1047 int kdba_find_tb_table(kdb_machreg_t eip, kdbtbtable_t *tab)
1049 kdb_machreg_t codeaddr = eip;
1050 kdb_machreg_t codeaddr_max;
1051 kdb_machreg_t tbtab_start;
1057 memset(tab, 0, sizeof(tab));
1059 if (eip < PAGE_OFFSET) { /* this is gonna fail for userspace, at least for now.. */
1063 /* Scan instructions starting at codeaddr for 128k max */
1064 for (codeaddr_max = codeaddr + 128*1024*4;
1065 codeaddr < codeaddr_max;
1067 instr = kdba_getword(codeaddr, 4);
1069 /* table should follow. */
1071 unsigned long flags;
1072 tbtab_start = codeaddr; /* save it to compute func start addr */
1074 flags = kdba_getword(codeaddr, 8);
1076 version = (flags >> 56) & 0xff;
1078 continue; /* No tb table here. */
1079 /* Now, like the version, some of the flags are values
1080 that are more conveniently extracted... */
1081 tab->fp_saved = (flags >> 24) & 0x3f;
1082 tab->gpr_saved = (flags >> 16) & 0x3f;
1083 tab->fixedparms = (flags >> 8) & 0xff;
1084 tab->floatparms = (flags >> 1) & 0x7f;
1086 num_parms = tab->fixedparms + tab->floatparms;
1088 unsigned int parminfo;
1091 return 1; /* incomplete */
1092 parminfo = kdba_getword(codeaddr, 4);
1093 /* decode parminfo...32 bits.
1094 A zero means fixed. A one means float and the
1095 following bit determines single (0) or double (1).
1097 for (parm = 0; parm < num_parms; parm++) {
1098 if (parminfo & 0x80000000) {
1100 if (parminfo & 0x80000000)
1101 tab->parminfo[parm] = KDBTBTAB_PARMDFLOAT;
1103 tab->parminfo[parm] = KDBTBTAB_PARMSFLOAT;
1105 tab->parminfo[parm] = KDBTBTAB_PARMFIXED;
1111 if (flags & KDBTBTAB_FLAGSHASTBOFF) {
1112 tab->tb_offset = kdba_getword(codeaddr, 4);
1113 if (tab->tb_offset > 0) {
1114 tab->funcstart = tbtab_start - tab->tb_offset;
1118 /* hand_mask appears to be always be omitted. */
1119 if (flags & KDBTBTAB_FLAGSHASCTL) {
1120 /* Assume this will never happen for C or asm */
1121 return 1; /* incomplete */
1123 if (flags & KDBTBTAB_FLAGSNAMEPRESENT) {
1125 short namlen = kdba_getword(codeaddr, 2);
1126 if (namlen >= sizeof(tab->name))
1127 namlen = sizeof(tab->name)-1;
1129 for (i = 0; i < namlen; i++) {
1130 tab->name[i] = kdba_getword(codeaddr++, 1);
1132 tab->name[namlen] = '\0';
1134 /* Fake up a symtab entry in case the caller finds it useful */
1135 tab->symtab.value = tab->symtab.sym_start = tab->funcstart;
1136 tab->symtab.sym_name = tab->name;
1137 tab->symtab.sym_end = tbtab_start;
1141 return 0; /* hit max...sorry. */
1146 kdba_putarea_size(unsigned long to_xxx, void *from, size_t size)
1149 kdb_printf(" ** this function calls copy_to_user... \n");
1150 kdb_printf(" kdba_putarea_size [0x%ul]\n",(unsigned int) to_xxx);
1151 c = *((volatile char *)from);
1152 c=*((volatile char *)from+size-1);
1153 return __copy_to_user((void *)to_xxx,from,size);
1161 * valid_ppc64_kernel_address() returns '1' if the address passed in is
1162 * within a valid range. Function returns 0 if address is outside valid ranges.
1167 KERNELBASE c000000000000000
1169 high_memory c0000000 20000000
1171 VMALLOC_START d000000000000000
1173 VMALLOC_END VMALLOC_START + VALID_EA_BITS
1175 IMALLOC_START e000000000000000
1177 IMALLOC_END IMALLOC_START + VALID_EA_BITS
1181 int valid_ppc64_kernel_address(unsigned long addr, unsigned long size)
1184 unsigned long end = (addr + size - 1);
1187 for (i = addr; i <= end; i = i ++ ) {
1188 if (((unsigned long)i < (unsigned long long)KERNELBASE ) ||
1189 (((unsigned long)i > (unsigned long long)high_memory) &&
1190 ((unsigned long)i < (unsigned long long)VMALLOC_START) ) ||
1191 (((unsigned long)i > (unsigned long long)VMALLOC_END) &&
1192 ((unsigned long)i < (unsigned long long)IMALLOC_START) ) ||
1193 ( (unsigned long)i > (unsigned long long)IMALLOC_END ) ) {
1202 kdba_getarea_size(void *to, unsigned long from_xxx, size_t size)
1204 int is_valid_kern_addr = valid_ppc64_kernel_address(from_xxx, size);
1207 *((volatile char *)to) = '\0';
1208 *((volatile char *)to + size - 1) = '\0';
1211 if (is_valid_kern_addr) {
1212 memcpy(to, (void *)from_xxx, size);
1214 /* user space address, just return. */
1224 * kdba_readarea_size, reads size-lump of memory into to* passed in, returns size.
1225 * Making it feel a bit more like mread.. when i'm clearer on kdba end, probally will
1226 * remove one of these.
1229 kdba_readarea_size(unsigned long from_xxx,void *to, size_t size)
1231 int is_valid_kern_addr = valid_ppc64_kernel_address(from_xxx, size);
1233 *((volatile char *)to) = '\0';
1234 *((volatile char *)to + size - 1) = '\0';
1236 if (is_valid_kern_addr) {
1237 memcpy(to, (void *)from_xxx, size);
1240 /* user-space, just return... */