Commit 1545181c authored by Brian Kocoloski's avatar Brian Kocoloski

update pisces legacy v3_console utility to be compatible with kitten's newer...

update pisces legacy v3_console utility to be compatible with kitten's newer ringbuffer implementation
parent 3081244f
......@@ -39,16 +39,16 @@ typedef enum { CONSOLE_CURS_SET = 1,
static inline void __atomic_set16(u16 * dst, u16 val)
static inline void __atomic_set32(u32 * dst, u32 val)
{
__asm__ __volatile__ ("" ::: "memory");
*dst = val;
__asm__ __volatile__ ("" ::: "memory");
}
static inline u16 __atomic_get16(u16 * src)
static inline u32 __atomic_get32(u32 * src)
{
u16 val = 0;
u32 val = 0;
__asm__ __volatile__ ("" ::: "memory");
val = *src;
......@@ -93,9 +93,10 @@ struct cons_msg {
struct cons_ring_buf {
u16 read_idx;
u16 write_idx;
u16 total_entries;
u32 entry_size;
u32 max_entries;
u32 read_idx;
u32 write_idx;
u16 kick_ipi_vec;
u16 kick_apic;
......@@ -121,8 +122,8 @@ cons_kick(int irq,
struct palacios_console * cons = arg;
struct cons_ring_buf * ring = cons->ring_buf;
u16 read_idx = __atomic_get16(&(ring->read_idx));
u16 write_idx = __atomic_get16(&(ring->write_idx));
u32 read_idx = __atomic_get32(&(ring->read_idx));
u32 write_idx = __atomic_get32(&(ring->write_idx));
if (read_idx != write_idx) {
......@@ -137,8 +138,8 @@ static int
cons_dequeue(struct cons_ring_buf * ring,
struct cons_msg * msg)
{
u16 read_idx = __atomic_get16(&(ring->read_idx));
u16 write_idx = __atomic_get16(&(ring->write_idx));
u32 read_idx = __atomic_get32(&(ring->read_idx));
u32 write_idx = __atomic_get32(&(ring->write_idx));
if (read_idx == write_idx) {
return -1;
......@@ -146,7 +147,7 @@ cons_dequeue(struct cons_ring_buf * ring,
memcpy(msg, &(ring->msgs[read_idx]), sizeof(struct cons_msg));
__asm__ __volatile__ ("":::"memory");
__atomic_set16(&(ring->read_idx), (read_idx + 1) % ring->total_entries);
__atomic_set32(&(ring->read_idx), (read_idx + 1) % ring->max_entries);
return 0;
......@@ -243,8 +244,8 @@ console_poll(struct file * filp,
poll_wait(filp, &(cons->intr_queue), poll_tb);
{
u16 read_idx = __atomic_get16(&(ring->read_idx));
u16 write_idx = __atomic_get16(&(ring->write_idx));
u32 read_idx = __atomic_get32(&(ring->read_idx));
u32 write_idx = __atomic_get32(&(ring->write_idx));
if (read_idx != write_idx) {
// DEBUG("Returning from POLL\n");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment