summaryrefslogtreecommitdiff
path: root/hurd/startup.h
blob: 98fe2099fba9c6874a6ffbf3ea20b4e9487b94b4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
/* startup.h - Interface for starting a new program.
   Copyright (C) 2004, 2007 Free Software Foundation, Inc.
   This file is part of the GNU Hurd.

   The GNU Hurd is free software; you can redistribute it and/or
   modify it under the terms of the GNU Lesser General Public
   License as published by the Free Software Foundation; either
   version 2.1 of the License, or (at your option) any later version.

   The GNU Hurd is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   Lesser General Public License for more details.

   You should have received a copy of the GNU Lesser General Public
   License along with the GNU C Library; if not, write to the Free
   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
   02111-1307 USA.  */

#ifndef _HURD_STARTUP_H
#define _HURD_STARTUP_H	1

#include <stdint.h>
#include <stddef.h>

#include <hurd/types.h>
#include <viengoos/addr.h>

#ifdef USE_L4
# include <l4/types.h>
#endif

/* The version of the startup data defined by this header file.  */
#define HURD_STARTUP_VERSION_MAJOR UINT16_C (0)
#define HURD_STARTUP_VERSION_MINOR UINT16_C (0)

/* Hurd object descriptors are used as a way to provide a map of its
   layout to a new task.  */
struct hurd_object_desc
{
  /* The object.  */
  vg_addr_t object;

  /* If the object is not a folio, then:  */

  /* The location of the storage.  (vg_addr_chop (STORAGE,
     VG_FOLIO_OBJECTS_LOG2) => the folio.)  */
  vg_addr_t storage;

  /* The type of the object (for convenience).  */
  unsigned char type;
};

/* A program's startup data.  When a program is started, the address
   is in the program's SP.  */
struct hurd_startup_data
{
  /* The version fields.  All versions with the same major version are
     compatible.  */
  unsigned short version_major;
  unsigned short version_minor;

  /* Startup flags.  */
  uintptr_t flags;

#ifdef USE_L4
  /* The UTCB area of this task.  */
  l4_fpage_t utcb_area;

  /* Thread id of Viengoos.  */
  l4_thread_id_t rm;
#endif

  /* The argument vector.  */
  char *argz;
  /* Absolute address in the data space.  */
  size_t argz_len;

  /* The environment vector.  */
  char *envz;
  /* Absolute address in the data space.  */
  size_t envz_len;

  /* Slot in which a capability designating the task's primary
     activity is stored.  */
  vg_addr_t activity;

  /* Slot in which a capability designating the task's first thread is
     stored.  */
  vg_addr_t thread;

  /* To allow a task to boot strap itself, it needs a couple of
     messengers (one to send and another to receive).  Here they
     are.  */
  vg_addr_t messengers[2];

  struct hurd_object_desc *descs;
  int desc_count;

  /* The program header.  */
  void *phdr;
  size_t phdr_len;
};


#endif	/* _HURD_STARTUP_H */