From 9c4fe7ba105c0430c90179fd1e93c3d439a8cbd5 Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Sat, 19 Feb 2011 21:16:54 -0500 Subject: xv6: formatting, cleanup, rev5 --- data.S | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 data.S (limited to 'data.S') diff --git a/data.S b/data.S new file mode 100644 index 0000000..47f05b3 --- /dev/null +++ b/data.S @@ -0,0 +1,7 @@ +# Define "data" symbol to mark beginning of data segment. +# Must be linked before any other data on ld command line. +.data +.globl data +data: + .word 1 + -- cgit v1.2.3 From cf4b1ad90bcaeeb0c8458098c87948f61d408f94 Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Sat, 19 Feb 2011 21:17:55 -0500 Subject: xv6: formatting, cleanup, rev5 (take 2) --- data.S | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) (limited to 'data.S') 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: -- cgit v1.2.3 From f70ef994dce8f6948edec8c534ae21742141dd50 Mon Sep 17 00:00:00 2001 From: Frans Kaashoek Date: Thu, 28 Apr 2011 08:01:36 -0400 Subject: Russ's fix for panic remap --- data.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'data.S') diff --git a/data.S b/data.S index c0eb55b..8b651b4 100644 --- a/data.S +++ b/data.S @@ -20,7 +20,7 @@ // or to write a linker script, but this is simplest. .data +.align 4096 .globl data data: .word 1 - -- cgit v1.2.3