summaryrefslogtreecommitdiffstats
path: root/sys/amd64
diff options
context:
space:
mode:
authorneel <neel@FreeBSD.org>2012-12-04 04:37:42 +0000
committerneel <neel@FreeBSD.org>2012-12-04 04:37:42 +0000
commitd8091074f2295a4be6817c9fe8802b9b0db9346d (patch)
tree6ef29583fd1f17922e7c5b7d49d2d96d8ff38ebb /sys/amd64
parentd45d8a8d668a9ee12073939bf775c404be8cf175 (diff)
parent6b76c5a1b878e8001537fb323cb0c88fca9dc2df (diff)
downloadFreeBSD-src-d8091074f2295a4be6817c9fe8802b9b0db9346d.zip
FreeBSD-src-d8091074f2295a4be6817c9fe8802b9b0db9346d.tar.gz
IFC @r243836
Diffstat (limited to 'sys/amd64')
-rw-r--r--sys/amd64/amd64/db_trace.c17
-rw-r--r--sys/amd64/pci/pci_cfgreg.c39
2 files changed, 31 insertions, 25 deletions
diff --git a/sys/amd64/amd64/db_trace.c b/sys/amd64/amd64/db_trace.c
index cba90f2..2c81f87 100644
--- a/sys/amd64/amd64/db_trace.c
+++ b/sys/amd64/amd64/db_trace.c
@@ -186,7 +186,8 @@ db_ss(struct db_variable *vp, db_expr_t *valuep, int op)
static void db_nextframe(struct amd64_frame **, db_addr_t *, struct thread *);
static int db_numargs(struct amd64_frame *);
-static void db_print_stack_entry(const char *, int, char **, long *, db_addr_t);
+static void db_print_stack_entry(const char *, int, char **, long *, db_addr_t,
+ void *);
static void decode_syscall(int, struct thread *);
static const char * watchtype_str(int type);
@@ -230,12 +231,13 @@ db_numargs(fp)
}
static void
-db_print_stack_entry(name, narg, argnp, argp, callpc)
+db_print_stack_entry(name, narg, argnp, argp, callpc, frame)
const char *name;
int narg;
char **argnp;
long *argp;
db_addr_t callpc;
+ void *frame;
{
db_printf("%s(", name);
#if 0
@@ -250,6 +252,8 @@ db_print_stack_entry(name, narg, argnp, argp, callpc)
#endif
db_printf(") at ");
db_printsym(callpc, DB_STGY_PROC);
+ if (frame != NULL)
+ db_printf("/frame 0x%lx", (register_t)frame);
db_printf("\n");
}
@@ -341,7 +345,7 @@ db_nextframe(struct amd64_frame **fp, db_addr_t *ip, struct thread *td)
return;
}
- db_print_stack_entry(name, 0, 0, 0, rip);
+ db_print_stack_entry(name, 0, 0, 0, rip, &(*fp)->f_frame);
/*
* Point to base of trapframe which is just above the
@@ -437,7 +441,8 @@ db_backtrace(struct thread *td, struct trapframe *tf,
* Don't try to walk back on a stack for a
* process that hasn't actually been run yet.
*/
- db_print_stack_entry(name, 0, 0, 0, pc);
+ db_print_stack_entry(name, 0, 0, 0, pc,
+ actframe);
break;
}
first = FALSE;
@@ -451,7 +456,7 @@ db_backtrace(struct thread *td, struct trapframe *tf,
narg = db_numargs(frame);
}
- db_print_stack_entry(name, narg, argnp, argp, pc);
+ db_print_stack_entry(name, narg, argnp, argp, pc, actframe);
if (actframe != frame) {
/* `frame' belongs to caller. */
@@ -465,7 +470,7 @@ db_backtrace(struct thread *td, struct trapframe *tf,
if (INKERNEL((long)pc) && !INKERNEL((long)frame)) {
sym = db_search_symbol(pc, DB_STGY_ANY, &offset);
db_symbol_values(sym, &name, NULL);
- db_print_stack_entry(name, 0, 0, 0, pc);
+ db_print_stack_entry(name, 0, 0, 0, pc, frame);
break;
}
if (!INKERNEL((long) frame)) {
diff --git a/sys/amd64/pci/pci_cfgreg.c b/sys/amd64/pci/pci_cfgreg.c
index 2714ecb..90d9087 100644
--- a/sys/amd64/pci/pci_cfgreg.c
+++ b/sys/amd64/pci/pci_cfgreg.c
@@ -295,6 +295,13 @@ pcie_cfgregopen(uint64_t base, uint8_t minbus, uint8_t maxbus)
return (1);
}
+#define PCIE_VADDR(base, reg, bus, slot, func) \
+ ((base) + \
+ ((((bus) & 0xff) << 20) | \
+ (((slot) & 0x1f) << 15) | \
+ (((func) & 0x7) << 12) | \
+ ((reg) & 0xfff)))
+
/*
* AMD BIOS And Kernel Developer's Guides for CPU families starting with 10h
* have a requirement that all accesses to the memory mapped PCI configuration
@@ -302,18 +309,12 @@ pcie_cfgregopen(uint64_t base, uint8_t minbus, uint8_t maxbus)
* Since other vendors do not currently have any contradicting requirements
* the AMD access pattern is applied universally.
*/
-#define PCIE_VADDR(base, reg, bus, slot, func) \
- ((base) + \
- ((((bus) & 0xff) << 20) | \
- (((slot) & 0x1f) << 15) | \
- (((func) & 0x7) << 12) | \
- ((reg) & 0xfff)))
static int
pciereg_cfgread(int bus, unsigned slot, unsigned func, unsigned reg,
unsigned bytes)
{
- volatile vm_offset_t va;
+ vm_offset_t va;
int data = -1;
if (bus < pcie_minbus || bus > pcie_maxbus || slot > PCI_SLOTMAX ||
@@ -324,16 +325,16 @@ pciereg_cfgread(int bus, unsigned slot, unsigned func, unsigned reg,
switch (bytes) {
case 4:
- __asm __volatile("mov %1, %%eax" : "=a" (data)
- : "m" (*(uint32_t *)va));
+ __asm("movl %1, %0" : "=a" (data)
+ : "m" (*(volatile uint32_t *)va));
break;
case 2:
- __asm __volatile("movzwl %1, %%eax" : "=a" (data)
- : "m" (*(uint16_t *)va));
+ __asm("movzwl %1, %0" : "=a" (data)
+ : "m" (*(volatile uint16_t *)va));
break;
case 1:
- __asm __volatile("movzbl %1, %%eax" : "=a" (data)
- : "m" (*(uint8_t *)va));
+ __asm("movzbl %1, %0" : "=a" (data)
+ : "m" (*(volatile uint8_t *)va));
break;
}
@@ -344,7 +345,7 @@ static void
pciereg_cfgwrite(int bus, unsigned slot, unsigned func, unsigned reg, int data,
unsigned bytes)
{
- volatile vm_offset_t va;
+ vm_offset_t va;
if (bus < pcie_minbus || bus > pcie_maxbus || slot > PCI_SLOTMAX ||
func > PCI_FUNCMAX || reg > PCIE_REGMAX)
@@ -354,16 +355,16 @@ pciereg_cfgwrite(int bus, unsigned slot, unsigned func, unsigned reg, int data,
switch (bytes) {
case 4:
- __asm __volatile("mov %%eax, %0" : "=m" (*(uint32_t *)va)
+ __asm("movl %1, %0" : "=m" (*(volatile uint32_t *)va)
: "a" (data));
break;
case 2:
- __asm __volatile("mov %%ax, %0" : "=m" (*(uint16_t *)va)
- : "a" (data));
+ __asm("movw %1, %0" : "=m" (*(volatile uint16_t *)va)
+ : "a" ((uint16_t)data));
break;
case 1:
- __asm __volatile("mov %%al, %0" : "=m" (*(uint8_t *)va)
- : "a" (data));
+ __asm("movb %1, %0" : "=m" (*(volatile uint8_t *)va)
+ : "a" ((uint8_t)data));
break;
}
}
OpenPOWER on IntegriCloud