[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
hurd-l4/physmem ChangeLog output.c physmem.c ph...
From: |
Marcus Brinkmann |
Subject: |
hurd-l4/physmem ChangeLog output.c physmem.c ph... |
Date: |
Thu, 16 Oct 2003 09:26:47 -0400 |
CVSROOT: /cvsroot/hurd
Module name: hurd-l4
Branch:
Changes by: Marcus Brinkmann <address@hidden> 03/10/16 09:26:46
Modified files:
physmem : ChangeLog output.c physmem.c physmem.h
Log message:
2003-10-16 Marcus Brinkmann <address@hidden>
* output.c (shutdown): New function.
* physmem.c: Include <stdlib.h>.
(get_all_memory): Update to match new wortel interface.
(create_bootstrap_caps): New function.
(main): Call create_bootstrap_caps.
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/hurd/hurd-l4/physmem/ChangeLog.diff?tr1=1.5&tr2=1.6&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/hurd/hurd-l4/physmem/output.c.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/hurd/hurd-l4/physmem/physmem.c.diff?tr1=1.5&tr2=1.6&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/hurd/hurd-l4/physmem/physmem.h.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
Patches:
Index: hurd-l4/physmem/ChangeLog
diff -u hurd-l4/physmem/ChangeLog:1.5 hurd-l4/physmem/ChangeLog:1.6
--- hurd-l4/physmem/ChangeLog:1.5 Sun Oct 12 18:35:17 2003
+++ hurd-l4/physmem/ChangeLog Thu Oct 16 09:26:45 2003
@@ -1,3 +1,11 @@
+2003-10-16 Marcus Brinkmann <address@hidden>
+
+ * output.c (shutdown): New function.
+ * physmem.c: Include <stdlib.h>.
+ (get_all_memory): Update to match new wortel interface.
+ (create_bootstrap_caps): New function.
+ (main): Call create_bootstrap_caps.
+
2003-10-12 Marcus Brinkmann <address@hidden>
* config.m4: New file.
Index: hurd-l4/physmem/output.c
diff -u hurd-l4/physmem/output.c:1.3 hurd-l4/physmem/output.c:1.4
--- hurd-l4/physmem/output.c:1.3 Mon Sep 15 20:42:17 2003
+++ hurd-l4/physmem/output.c Thu Oct 16 09:26:45 2003
@@ -33,6 +33,29 @@
int output_debug;
+/* Send a shutdown request to the rootserver wortel. */
+void
+shutdown (void)
+{
+ l4_msg_t msg;
+
+ l4_msg_clear (&msg);
+ /* FIXME: Hard coded message label. */
+#define WORTEL_MSG_SHUTDOWN 2
+ l4_set_msg_label (&msg, WORTEL_MSG_SHUTDOWN);
+
+ /* FIXME: This should be our cap ID. */
+ l4_msg_append_word (&msg, 0);
+
+ /* This is some yet unspecified specifier. */
+ l4_msg_append_word (&msg, 0);
+
+ l4_msg_load (&msg);
+ /* FIXME: Hard coded thread ID. */
+ l4_send (l4_global_id (l4_thread_user_base () + 2, 1));
+}
+
+
/* Print the single character CHR on the output device. */
int
putchar (int chr)
Index: hurd-l4/physmem/physmem.c
diff -u hurd-l4/physmem/physmem.c:1.5 hurd-l4/physmem/physmem.c:1.6
--- hurd-l4/physmem/physmem.c:1.5 Fri Sep 19 14:48:59 2003
+++ hurd-l4/physmem/physmem.c Thu Oct 16 09:26:45 2003
@@ -23,48 +23,52 @@
#include <config.h>
#endif
+#include <stdlib.h>
+
#include "physmem.h"
#include "zalloc.h"
/* The program name. */
-char *program_name = "physmem";
+char program_name[] = "physmem";
+#define WORTEL_MSG_PUTCHAR 1
+#define WORTEL_MSG_PANIC 2
+#define WORTEL_MSG_GET_MEM 3
+#define WORTEL_MSG_GET_CAP_REQUEST 4
+#define WORTEL_MSG_GET_CAP_REPLY 5
+
void
get_all_memory (void)
{
l4_fpage_t fpage;
+ l4_accept (l4_map_grant_items (l4_complete_address_space));
+
do
{
l4_msg_t msg;
- l4_msg_tag_t msg_tag;
+ l4_msg_tag_t tag;
l4_grant_item_t grant_item;
- l4_accept (l4_map_grant_items (l4_complete_address_space));
l4_msg_clear (&msg);
- /* FIXME: 2 is WORTEL_MSG_GET_MEM. */
- l4_set_msg_label (&msg, 2);
- /* FIXME: cap_id */
+ l4_set_msg_label (&msg, WORTEL_MSG_GET_MEM);
+ /* FIXME: Use real cap_id. */
l4_msg_append_word (&msg, 0);
l4_msg_load (&msg);
/* FIXME: Hard coded wortel thread. */
- msg_tag = l4_call (l4_global_id (l4_thread_user_base () + 2, 1));
- if (l4_ipc_failed (msg_tag))
- {
- debug ("get_mem request failed during %s: %u",
- l4_error_code () & 1 ? "receive" : "send",
- (l4_error_code () >> 1) & 0x7);
- l4_sleep (l4_never);
- }
- if (l4_untyped_words (msg_tag) != 0
- || l4_typed_words (msg_tag) != 2)
- {
- debug ("Invalid format of wortel get_mem reply");
- l4_sleep (l4_never);
- }
- l4_msg_store (msg_tag, &msg);
+ tag = l4_call (l4_global_id (l4_thread_user_base () + 2, 1));
+ if (l4_ipc_failed (tag))
+ panic ("get_mem request failed during %s: %u",
+ l4_error_code () & 1 ? "receive" : "send",
+ (l4_error_code () >> 1) & 0x7);
+
+ if (l4_untyped_words (tag) != 0
+ || l4_typed_words (tag) != 2)
+ panic ("Invalid format of wortel get_mem reply");
+
+ l4_msg_store (tag, &msg);
l4_msg_get_grant_item (&msg, 0, &grant_item);
fpage = grant_item.send_fpage;
@@ -74,6 +78,97 @@
while (fpage.raw != l4_nilpage.raw);
}
+
+void
+create_bootstrap_caps (void)
+{
+ l4_accept (l4_map_grant_items (l4_complete_address_space));
+
+ while (1)
+ {
+ l4_msg_t msg;
+ l4_msg_tag_t tag;
+ unsigned int i;
+
+ l4_msg_clear (&msg);
+ l4_set_msg_label (&msg, WORTEL_MSG_GET_CAP_REQUEST);
+ /* FIXME: Use real cap_id. */
+ l4_msg_append_word (&msg, 0);
+ l4_msg_load (&msg);
+ /* FIXME: Hard coded wortel thread. */
+ tag = l4_call (l4_global_id (l4_thread_user_base () + 2, 1));
+
+ if (l4_ipc_failed (tag))
+ panic ("get cap request failed during %s: %u",
+ l4_error_code () & 1 ? "receive" : "send",
+ (l4_error_code () >> 1) & 0x7);
+
+ l4_msg_store (tag, &msg);
+
+ if (l4_untyped_words (tag) == 1)
+ {
+ /* This requests the master control capability. */
+ if (l4_typed_words (tag))
+ panic ("Invalid format of wortel get cap request reply "
+ "for master control");
+
+ /* FIXME: Create capability. */
+ l4_msg_clear (&msg);
+ l4_set_msg_label (&msg, WORTEL_MSG_GET_CAP_REPLY);
+ /* FIXME: Use our wortel cap here. */
+ l4_msg_append_word (&msg, 0);
+ /* FIXME: Use our control cap for this task here. */
+ l4_msg_append_word (&msg, 0xf00);
+ l4_msg_load (&msg);
+ /* FIXME: Hard coded thread ID. */
+ l4_send (l4_global_id (l4_thread_user_base () + 2, 1));
+
+ /* This is the last request made. */
+ return;
+ }
+ else if (l4_untyped_words (tag) != 3
+ || l4_typed_words (tag) == 0)
+ panic ("Invalid format of wortel get cap request reply");
+
+ debug ("Creating cap for 0x%x covering 0x%x to 0x%x:",
+ l4_msg_word (&msg, 0), l4_msg_word (&msg, 1),
+ l4_msg_word (&msg, 2));
+
+ for (i = 0; i < l4_typed_words (tag); i += 2)
+ {
+ l4_fpage_t fpage;
+ l4_grant_item_t grant_item;
+ l4_msg_get_grant_item (&msg, i, &grant_item);
+
+ fpage = grant_item.send_fpage;
+ if (l4_nilpage.raw == fpage.raw)
+ {
+ if (l4_typed_words (tag) == 2)
+ {
+ /* FIXME: Create control capability for this one
+ task. */
+ debug ("Can't create task control capability yet");
+ }
+ else
+ panic ("Invalid fpage in create bootstrap cap call");
+ }
+ debug ("0x%x ", fpage.raw);
+ }
+ debug ("\n");
+
+ l4_msg_clear (&msg);
+ l4_set_msg_label (&msg, WORTEL_MSG_GET_CAP_REPLY);
+
+ /* FIXME: Use our wortel cap here. */
+ l4_msg_append_word (&msg, 0);
+ /* FIXME: This must return the real capability ID. */
+ l4_msg_append_word (&msg, 0xa00);
+ l4_msg_load (&msg);
+ /* FIXME: Hard coded thread ID. */
+ l4_send (l4_global_id (l4_thread_user_base () + 2, 1));
+ }
+}
+
int
main (int argc, char *argv[])
@@ -84,7 +179,7 @@
get_all_memory ();
- zalloc_dump_zones (program_name);
+ create_bootstrap_caps ();
while (1)
l4_sleep (l4_never);
Index: hurd-l4/physmem/physmem.h
diff -u hurd-l4/physmem/physmem.h:1.1 hurd-l4/physmem/physmem.h:1.2
--- hurd-l4/physmem/physmem.h:1.1 Tue Sep 9 17:43:12 2003
+++ hurd-l4/physmem/physmem.h Thu Oct 16 09:26:45 2003
@@ -24,7 +24,7 @@
/* The program name. */
-extern char *program_name;
+extern char program_name[];
#define BUG_ADDRESS "<address@hidden>"
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- hurd-l4/physmem ChangeLog output.c physmem.c ph...,
Marcus Brinkmann <=