Permalink
Browse files

Tidy up a little.

  • Loading branch information...
1 parent 1d99c08 commit b4467bf1f6d0df71f0127cb56f8bc83699f77ef3 Steven Smith committed Jan 27, 2012
Showing with 38 additions and 42 deletions.
  1. +16 −10 xen/mini-os/arch/x86/mm.c
  2. +22 −12 xen/mini-os/console/xencons_ring.c
  3. +0 −14 xen/mini-os/kernel.c
  4. +0 −6 xen/mini-os/mm.c
View
@@ -199,6 +199,7 @@ static void build_pagetable(unsigned long *start_pfn, unsigned long *max_pfn)
unsigned long offset;
int count = 0;
int rc;
+ int expected_nodes[2];
pfn_to_map =
(start_info.nr_pt_frames - NOT_L1_FRAMES) * L1_PAGETABLE_ENTRIES;
@@ -256,6 +257,20 @@ static void build_pagetable(unsigned long *start_pfn, unsigned long *max_pfn)
pt_mfn = pte_to_mfn(page);
offset = l1_table_offset(start_address);
+ {
+ if (pfn_to_map == 0) {
+ printk("PFN 0 -> %lx\n", pfn_to_mfn(pfn_to_map));
+ expected_nodes[0] = pfn_to_mfn(pfn_to_map) >> 25;
+ } else if (pfn_to_map == 1) {
+ printk("PFN 1 -> %lx\n", pfn_to_mfn(pfn_to_map));
+ expected_nodes[1] = pfn_to_mfn(pfn_to_map) >> 25;
+ } else if (expected_nodes[pfn_to_map % 2] != (pfn_to_mfn(pfn_to_map) >> 25)) {
+ printk("PFN %lx -> MFN %lx\n",
+ pfn_to_map, pfn_to_mfn(pfn_to_map));
+ expected_nodes[pfn_to_map % 2] = pfn_to_mfn(pfn_to_map) >> 25;
+ }
+ }
+
mmu_updates[count].ptr =
((pgentry_t)pt_mfn << PAGE_SHIFT) + sizeof(pgentry_t) * offset;
mmu_updates[count].val =
@@ -275,6 +290,7 @@ static void build_pagetable(unsigned long *start_pfn, unsigned long *max_pfn)
start_address += PAGE_SIZE;
}
+ printk("Shared info MFN %lx\n", virt_to_mfn(HYPERVISOR_shared_info));
*start_pfn = pt_pfn;
}
@@ -923,13 +939,6 @@ void arch_init_mm(unsigned long* start_pfn_p, unsigned long* max_pfn_p)
{
unsigned long start_pfn, max_pfn;
- printk(" _text: %p(VA)\n", &_text);
- printk(" _etext: %p(VA)\n", &_etext);
- printk(" _erodata: %p(VA)\n", &_erodata);
- printk(" _edata: %p(VA)\n", &_edata);
- printk("stack start: %p(VA)\n", stack);
- printk(" _end: %p(VA)\n", &_end);
-
/* First page follows page table pages and 3 more pages (store page etc) */
start_pfn = PFN_UP(to_phys(start_info.pt_base)) +
start_info.nr_pt_frames + 3;
@@ -944,9 +953,6 @@ void arch_init_mm(unsigned long* start_pfn_p, unsigned long* max_pfn_p)
}
#endif
- printk(" start_pfn: %lx\n", start_pfn);
- printk(" max_pfn: %lx\n", max_pfn);
-
build_pagetable(&start_pfn, &max_pfn);
clear_bootstrap();
set_readonly(&_text, &_erodata);
@@ -28,7 +28,7 @@ static inline struct xencons_interface *xencons_interface(void)
return mfn_to_virt(start_info.console.domU.mfn);
}
-int xencons_ring_send_no_notify(struct consfront_dev *dev, const char *data, unsigned len)
+static int _xencons_ring_send(struct consfront_dev *dev, const char *data, unsigned len, int notify)
{
int sent = 0;
struct xencons_interface *intf;
@@ -44,26 +44,36 @@ int xencons_ring_send_no_notify(struct consfront_dev *dev, const char *data, uns
mb();
BUG_ON((prod - cons) > sizeof(intf->out));
- while ((sent < len) && ((prod - cons) < sizeof(intf->out)))
- intf->out[MASK_XENCONS_IDX(prod++, intf->out)] = data[sent++];
+ while (sent < len) {
+ while (prod - cons >= sizeof(intf->out)) {
+ wmb();
+ intf->out_prod = prod;
+ if (!notify)
+ return sent;
+ notify_daemon(dev);
+ cons = intf->out_cons;
+ mb();
+ }
+ intf->out[MASK_XENCONS_IDX(prod++, intf->out)] = data[sent++];
+ }
wmb();
intf->out_prod = prod;
-
+ if (notify)
+ notify_daemon(dev);
+
return sent;
}
int xencons_ring_send(struct consfront_dev *dev, const char *data, unsigned len)
{
- int sent;
-
- sent = xencons_ring_send_no_notify(dev, data, len);
- notify_daemon(dev);
-
- return sent;
-}
-
+ return _xencons_ring_send(dev, data, len, 1);
+}
+int xencons_ring_send_no_notify(struct consfront_dev *dev, const char *data, unsigned len)
+{
+ return _xencons_ring_send(dev, data, len, 0);
+}
static void handle_input(evtchn_port_t port, struct pt_regs *regs, void *data)
{
View
@@ -482,20 +482,6 @@ void start_kernel(start_info_t *si)
trap_init();
- /* print out some useful information */
- printk("Xen Minimal OS!\n");
- printk(" start_info: %p(VA)\n", si);
- printk(" nr_pages: 0x%lx\n", si->nr_pages);
- printk(" shared_inf: 0x%08lx(MA)\n", si->shared_info);
- printk(" pt_base: %p(VA)\n", (void *)si->pt_base);
- printk("nr_pt_frames: 0x%lx\n", si->nr_pt_frames);
- printk(" mfn_list: %p(VA)\n", (void *)si->mfn_list);
- printk(" mod_start: 0x%lx(VA)\n", si->mod_start);
- printk(" mod_len: %lu\n", si->mod_len);
- printk(" flags: 0x%x\n", (unsigned int)si->flags);
- printk(" cmd_line: %s\n",
- si->cmd_line ? (const char *)si->cmd_line : "NULL");
-
/* Set up events. */
init_events();
View
@@ -404,17 +404,11 @@ void init_mm(void)
unsigned long start_pfn, max_pfn;
- printk("MM: Init\n");
-
arch_init_mm(&start_pfn, &max_pfn);
/*
* now we can initialise the page allocator
*/
- printk("MM: Initialise page allocator for %lx(%lx)-%lx(%lx)\n",
- (u_long)to_virt(PFN_PHYS(start_pfn)), PFN_PHYS(start_pfn),
- (u_long)to_virt(PFN_PHYS(max_pfn)), PFN_PHYS(max_pfn));
init_page_allocator(PFN_PHYS(start_pfn), PFN_PHYS(max_pfn));
- printk("MM: done\n");
arch_init_p2m(max_pfn);

0 comments on commit b4467bf

Please sign in to comment.