summaryrefslogtreecommitdiff
path: root/data.S
diff options
context:
space:
mode:
authorRuss Cox <[email protected]>2011-02-19 21:17:55 -0500
committerRuss Cox <[email protected]>2011-02-19 21:17:55 -0500
commitcf4b1ad90bcaeeb0c8458098c87948f61d408f94 (patch)
treeb6385b1d72af5a3e634b94b318fb7e43644493af /data.S
parent9c4fe7ba105c0430c90179fd1e93c3d439a8cbd5 (diff)
downloadxv6-labs-cf4b1ad90bcaeeb0c8458098c87948f61d408f94.tar.gz
xv6-labs-cf4b1ad90bcaeeb0c8458098c87948f61d408f94.tar.bz2
xv6-labs-cf4b1ad90bcaeeb0c8458098c87948f61d408f94.zip
xv6: formatting, cleanup, rev5 (take 2)
Diffstat (limited to 'data.S')
-rw-r--r--data.S23
1 files changed, 21 insertions, 2 deletions
diff --git a/data.S b/data.S
index 47f05b3..c0eb55b 100644
--- a/data.S
+++ b/data.S
@@ -1,5 +1,24 @@
-# Define "data" symbol to mark beginning of data segment.
-# Must be linked before any other data on ld command line.
+// The kernel layout is:
+//
+// text
+// rodata
+// data
+// bss
+//
+// Conventionally, Unix linkers provide pseudo-symbols
+// etext, edata, and end, at the end of the text, data, and bss.
+// For the kernel mapping, we need the address at the beginning
+// of the data section, but that's not one of the conventional
+// symbols, because the convention started before there was a
+// read-only rodata section between text and data.
+//
+// To get the address of the data section, we define a symbol
+// named data and make sure this is the first object passed to
+// the linker, so that it will be the first symbol in the data section.
+//
+// Alternative approaches would be to parse our own ELF header
+// or to write a linker script, but this is simplest.
+
.data
.globl data
data: