45 lines
1.3 KiB
C
45 lines
1.3 KiB
C
|
#include <linux/kernel.h>
|
||
|
#include <linux/errno.h>
|
||
|
#include <linux/list.h>
|
||
|
#include <linux/io.h>
|
||
|
#include <linux/of.h>
|
||
|
#include <linux/spinlock.h>
|
||
|
#include <linux/bitops.h>
|
||
|
#include <linux/slab.h>
|
||
|
#include <asm/fsl_gtm.h>
|
||
|
#include <linux/interrupt.h>
|
||
|
#include <linux/slab.h>
|
||
|
#include <linux/socket.h>
|
||
|
|
||
|
uint64_t get_basetimer(void)
|
||
|
{
|
||
|
uint32_t h = 0;
|
||
|
uint32_t l = 0;
|
||
|
uint32_t h1 = 0;
|
||
|
// unsigned long flags;
|
||
|
//asm volatile ("mfmsr %0":"=r"(flags));
|
||
|
//asm volatile ("mtmsr %0"::"r"(flags & ~MSR_EE):"memory");
|
||
|
asm volatile("loop:\n"
|
||
|
"mftbu %0 \n"
|
||
|
"mftb %1 \n"
|
||
|
"mftbu %2 \n"
|
||
|
"cmpw %0,%2\n"
|
||
|
"bne loop\n"
|
||
|
:"=r"(h), "=r"(l), "=r"(h1):);
|
||
|
//asm volatile ("mtmsr %0"::"r"(flags):"memory");
|
||
|
return (((uint64_t)h) << 32) | l;
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
void dump_msghdr(struct msghdr* msg)
|
||
|
{
|
||
|
printk(KERN_DEBUG "msghdr.msg_name: %p\n", msg->msg_name);
|
||
|
printk(KERN_DEBUG "msghdr.msg_namelen: %d\n", msg->msg_namelen);
|
||
|
printk(KERN_DEBUG "msghdr.msg_iov: %p\n", msg->msg_iov);
|
||
|
printk(KERN_DEBUG "msghdr.msg_iovlen: %d\n", msg->msg_iovlen);
|
||
|
printk(KERN_DEBUG "msghdr.msg_control: %p\n", msg->msg_control);
|
||
|
printk(KERN_DEBUG "msghdr.msg_controllen: %d\n", msg->msg_controllen);
|
||
|
printk(KERN_DEBUG "msghdr.msg_flags: 0x%x\n", msg->msg_flags);
|
||
|
}
|